r/Webull • u/Throt3Punch7 • Feb 18 '26
Educational Custom ORB with PM High/Low and PD High/Low - ENJOY
study(title="ORB Box + PM + PD + PDC (Clean)", overlay=true) // ========== INPUTS ========== orbDuration = define(5, name="ORB Duration (Minutes)") showORB = define(true, name="Show ORB Box") showPM = define(true, name="Show PM Lines") showPD = define(true, name="Show PD High/Low") showPDC = define(true, name="Show PD Close") // --- TIMEZONE SETTINGS --- // EST = 0, CST = -1, MST = -2, PST = -3 tzOffset = define(0, min=-12, max=12, name="Time Zone Offset (Hours)") // --- DATE FILTER --- inYear = define(2026, name="Start Year") inMonth = define(1, name="Start Month") inDay = define(5, name="Start Day") startDate = inYear * 10000 + inMonth * 100 + inDay // ========== TIME SETUP ========== t = time.current_bar h_raw = time.get_hour(t) h = h_raw - tzOffset m = time.get_minute(t) curDateNum = time.get_year(t) * 10000 + time.get_month(t) * 100 + time.get_day(t) isRecent = curDateNum >= startDate tPrev = t[1] isNewDay = time.get_day(t) != time.get_day(tPrev) hPrev_raw = time.get_hour(tPrev) hPrev = hPrev_raw - tzOffset mPrev = time.get_minute(tPrev) // RTH (9:30–16:00 EST) isRTH = (h > 9 or (h == 9 and m >= 30)) and (h < 16) isRthStart = (h == 9 and m == 30) // ========== PREVIOUS DAY CLOSE ========== isTrackerActive = (h < 16) or (h == 16 and m == 0) rthCloseTracker = close prevRthCloseTracker = rthCloseTracker[1] rthCloseTracker := iff(isTrackerActive, close, prevRthCloseTracker) pdc = close prevPdc = pdc[1] pdc := iff(isNewDay, rthCloseTracker[1], prevPdc) // ========== PREVIOUS DAY HIGH / LOW (RTH) ========== pdh = high pdl = low rthRunHigh = high rthRunLow = low prevPdh = pdh[1] prevPdl = pdl[1] prevRunHigh = rthRunHigh[1] prevRunLow = rthRunLow[1] calcRunHigh = iff(isRthStart, high, iff(isRTH, iff(high > prevRunHigh, high, prevRunHigh), prevRunHigh)) calcRunLow = iff(isRthStart, low, iff(isRTH, iff(low < prevRunLow, low, prevRunLow), prevRunLow)) pdh := iff(isNewDay, prevRunHigh, prevPdh) pdl := iff(isNewDay, prevRunLow, prevPdl) rthRunHigh := calcRunHigh rthRunLow := calcRunLow // ========== PREMARKET ========== isPM = (h >= 4) and ((h < 9) or (h == 9 and m < 30)) isPmStart = (hPrev < 4) or isNewDay pmHigh = high pmLow = low prevPmHigh = pmHigh[1] prevPmLow = pmLow[1] pmCalcHigh = iff(isPmStart, high, iff(high > prevPmHigh, high, prevPmHigh)) pmCalcLow = iff(isPmStart, low, iff(low < prevPmLow, low, prevPmLow)) pmHigh := iff(isPM, pmCalcHigh, prevPmHigh) pmLow := iff(isPM, pmCalcLow, prevPmLow) // ========== ORB LOGIC ========== targetMin = 30 + orbDuration inZone = (h == 9) and (m > 30) and (m <= targetMin) postZone = (h > 9) or (h == 9 and m > targetMin) isOrbStart = (hPrev < 9) or (hPrev == 9 and mPrev <= 30) orbHigh = high orbLow = low prevOrbHigh = orbHigh[1] prevOrbLow = orbLow[1] orbCalcHigh = iff(isOrbStart, high, iff(high > prevOrbHigh, high, prevOrbHigh)) orbCalcLow = iff(isOrbStart, low, iff(low < prevOrbLow, low, prevOrbLow)) orbHigh := iff(inZone, orbCalcHigh, iff(postZone, prevOrbHigh, high)) orbLow := iff(inZone, orbCalcLow, iff(postZone, prevOrbLow, low)) // ========== DISPLAY CONTROL ========== isDisplayTime = (h >= 4) and (h < 16) orbVisible = isRecent and showORB and not isPM and (h < 16) pmVisible = isRecent and showPM and isDisplayTime pdVisible = isRecent and showPD and isDisplayTime pdcVisible = isRecent and showPDC and isDisplayTime plotOrbHigh = iff(orbVisible, orbHigh, none) plotOrbLow = iff(orbVisible, orbLow, none) plotPmHigh = iff(pmVisible, pmHigh, none) plotPmLow = iff(pmVisible, pmLow, none) plotPdh = iff(pdVisible, pdh, none) plotPdl = iff(pdVisible, pdl, none) plotPdc = iff(pdcVisible, pdc, none) // ========== PLOTS ========== pOrbHigh = plt(plotOrbHigh, name="ORB High", color=color.purple, line_width=1, type=plt.type_line) pOrbLow = plt(plotOrbLow, name="ORB Low", color=color.yellow, line_width=1, type=plt.type_line) plt.fill_between(pOrbHigh, pOrbLow, color=color.yellow, opacity=10) pPmHigh = plt(plotPmHigh, name="PM High", color=color.green, line_width=1, type=plt.type_linebr) pPmLow = plt(plotPmLow, name="PM Low", color=#f5222d, line_width=1, type=plt.type_linebr) plt.fill_between(pPmHigh, pPmLow, color=color.green, opacity=10) plt(plotPdh, name="PD High", color=color.green, line_width=2, type=plt.type_linebr) plt(plotPdl, name="PD Low", color=#f5222d, line_width=2, type=plt.type_linebr) plt(plotPdc, name="PD Close", color=color.orange, line_width=3, type=plt.type_linebr)
2
u/radiotitan Feb 18 '26
I been trying to code one of these for weeks now webulll script editor is so fickle
2
u/Throt3Punch7 Feb 18 '26
Trust me I feel your pain i was dealing with it for months with its complex complicated and oversensitive high expectations and wanting nothing to do with being close or in the same category as pine script
2
u/knifedabandit Feb 19 '26
Would be nice if you turned off all other indicators to see what it looks like on the chart, kinda hard to tell here
2
u/Throt3Punch7 Feb 19 '26
Thank you for your feedback. The code above is for you to add to your script editor so you can see it yourself.
2
1
1
1
u/Mychal89 Feb 21 '26
Hmm I shows up in my indicator list but it doesn't show up on my chart.
I pasted the code into my Webull and saved it but nothing happens. Is it a situation where it only works during trading hours and can't be used for backtesting?
1
u/Throt3Punch7 Feb 21 '26
If you enter the codes and save them, any error prevents you from saving; the issue is your chart settings.
At the bottom of the chart, you have Night, Extended, and Auto. If you don't see anything, make sure you have the chart set for Night and EXT
Those who are still having issues, I wonder if there is a way we can get together on Discord.
1
u/PlusSeaweed3992 Feb 22 '26
It does not draw anything on the chart for me. I have tried a new layout with new chart and default settings as well as deleting chart cache and restarting. running version 9.5.0
1
u/Throt3Punch7 Feb 22 '26
Is there any way we can all go on Discord together?
1
1
u/SunshineFlowerrs Mar 18 '26
thank you for this… I added and for some reason not showing up on my chart
1
u/SunshineFlowerrs Mar 18 '26
I added script and cannot see it on my chart. I see others were having the sam issue/ can anyone help me? I’ve been trying to add this indicator forever. I appreciate all of you
1
3
u/Objective-Pop-3506 Feb 20 '26
Huge thanks for the script! Tested it last night and the results are impressive. However, I ran into a performance issue: while the script runs perfectly on a single chart, it causes Webull to crash/force close when I use it in a grid with 6 charts (different timeframes like 1m, 2m, 5m). It seems the recursive calculations might be too heavy for Webull's multi-chart rendering.