Wow! This looks amazing @SleepyZHere are 4 days hi/lo extended to the right edge using the script function.
To create more days back then use the logic of the 4
Wow! This looks amazing @SleepyZHere are 4 days hi/lo extended to the right edge using the script function.
To create more days back then use the logic of the 4
Can't thank you enough @SleepyZAlthough the ExtHrs Low worked on the other days using the volumeprofile method, it did not for Sun/Monday. So the following workaround seems to fix that. I used the volumeprofile so that you could see the developing horizontal line throughout the premarket. Most other methods seem to plot the horizontal line after the close of the ccurrent premarket period.
As far as extending the lines from the previous day into the next day cannot be done with the above code. It is one continuous line changing at the start of rthr session. To do your request would be writting another code.
Can't thank you enough @SleepyZ
This is brilliant. It's visually stunning and very practical. Tracking overnight levels is key for my trading.
Will open up a new thread, but want to be able to plot just the OVN POC next. Running VP from 18:00 to 9:29 and just plot that POC into the rth session. Not sure if that's doable but will search before posting.
Thanks!!!
Code:#Premarket_HL_Futures_ExtendedHrs_HL_POC_using_ProfileHL input showrthopen_plot = yes; input start = 1800; input end = 0929; input rthstart = 0930; input rthend = 1615; input bubblemover = 0; input showPriorbubbles = yes; input showLastbubbles = yes; input extendlines = yes; def sec1 = SecondsFromTime(start); def sec2 = SecondsFromTime(end); def isTime1 = (sec1 >= 0 and sec1[1] <= 0) or (sec1 < sec1[1] and sec1 > 0); def isTime2 = (sec2 > 0 and sec2[1] <= 0) or (sec2 < sec2[1] and sec2 > 0) ; def aftermarket = CompoundValue(1, if isTime1[1] == 0 and isTime1 == 1 then 1 else if isTime2 then 0 else aftermarket[1], 0); def bars = 100000; def bn = BarNumber(); def na = Double.NaN; def period = bn - 1; def count = CompoundValue(1, if aftermarket and period != period[1] then (count[1] + period - period[1]) % bars else count[1], 0); def cond = count < count[1] + period - period[1]; profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = no, "numberOfProfiles" = bars, "pricePerRow" = PricePerRow.TICKSIZE , "value area percent" = 0); #ExtHigh def hProfile = if aftermarket and IsNaN(vol.GetHighest()) then hProfile[1] else if period != period[1] then vol.GetHighest() else hProfile[1]; def ProfileHigh = if extendlines and !aftermarket then ProfileHigh[1] else if aftermarket then hProfile else na; #ExtLow def extlowtoday = if IsNaN(close) then extlowtoday[1] else if cond[1] == 1 and cond == 0 then low else if cond == 0 and GetTime() < RegularTradingStart(GetYYYYMMDD()) then Min(low, extlowtoday[1]) else extlowtoday[1]; #Monday workaround def ymd = getyyyymmDD(); def ct1 = if !IsNaN(close) and ymd != ymd[1] then ct1[1] + 11 else ct1[1]; def cond1 = HighestAll(ct1) - ct1; def mondaylow = if getdayofweek(getyyyyMMDD())==1 and sec1==0 then low else if cond == 0 and GetTime() < RegularTradingStart(GetYYYYMMDD()) then Min(low, extlowtoday[1]) else mondaylow[1]; def lProfile = if cond[1] == 1 and cond then low else if period != period[1] then vol.GetLowest() else lProfile[1]; def ProfileLow = if getdayofweek(getyyyyMMDD())==1 then mondaylow else if getdayofweek(getyyyyMMDD())>1 and extendlines and !aftermarket then ProfileLow[1] else if aftermarket then lProfile else na; #Colors DefineGlobalColor("H", Color.ORANGE); DefineGlobalColor("L", Color.ORANGE); DefineGlobalColor("O", Color.WHITE); DefineGlobalColor("P", Color.magenta); plot hrange = ProfileHigh; plot lrange = ProfileLow; def ropen = if showrthopen_plot and SecondsFromTime(rthstart) == 0 then open else ropen[1]; plot orange = ropen; hrange.AssignValueColor(GlobalColor("H")); lrange.AssignValueColor(GlobalColor("L")); orange.AssignValueColor(GlobalColor("O")); #Premarket POC def pPOC = if aftermarket and IsNaN(vol.GetHighest()) then pPOC[1] else if period != period[1] then vol.GetpointOfControl() else pPOC[1]; def exPOC = if extendlines and !aftermarket then exPOC[1] else if aftermarket then pPOC else na; plot POC = exPOC; POC.assignvalueColor(globalColor("P")); #Bubbles - Prior Days AddChartBubble(showPriorbubbles and hrange[bubblemover] != (hrange[bubblemover + 1]), hrange[bubblemover + 1], "EH", hrange.TakeValueColor()); AddChartBubble(showPriorbubbles and hrange[bubblemover] != (hrange[bubblemover + 1]), lrange[bubblemover + 1], "EL", lrange.TakeValueColor()); AddChartBubble(showPriorbubbles and hrange[bubblemover] != (hrange[bubblemover + 1]), orange[bubblemover + 1], "RO", orange.TakeValueColor()); AddChartBubble(showPriorbubbles and hrange[bubblemover] != (hrange[bubblemover + 1]), POC[bubblemover + 1], "EP", POC.TakeValueColor()); #Bubbles - Last Plot AddChartBubble(showLastbubbles and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]), hrange[bubblemover + 1], "ETH", hrange.TakeValueColor()); AddChartBubble(showLastbubbles and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]), lrange[bubblemover + 1], "ETL", lrange.TakeValueColor()); AddChartBubble(showLastbubbles and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]), orange[bubblemover + 1], "RTO", orange.TakeValueColor()); AddChartBubble(showLastbubbles and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]), POC[bubblemover + 1], "ETP", POC.TakeValueColor()); #
This looks amazing!!Since I already was using the volumeprofile indicator for the HL, I added exthrs POC to the last version
The image shows the exthrs POC extended into rthrs as well as the TOS volumeprofile indicator, highlighting the POC from it for the whole day.
Looks incredible @SleepyZThis looks amazing!!
To be clear, does this update include the fix you implemented here https://usethinkscript.com/threads/previous-day-high-low-close-for-thinkorswim.3494/post-141016 ?
I just tried adding it but am not seeing the profile. Wil keep tinkering with it, but this would be amazing....
The profile in the image was the TOS VolumeProfile indicator to confirm that what the code produced for the POC was not the TOS indicator POC. If someone wants the TOS indicator, they could just added it.Looks incredible @SleepyZ
I'm ok with the profile not being visible, but someone else might want to see it. And i'm guessing you'd want to know why it's not displaying. But thanks for bringing this to life!
H
View attachment 21736
I get it now. I re-read the message. even better. Thanks a million!!!!The profile in the image was the TOS VolumeProfile indicator to confirm that what the code produced for the POC was not the TOS indicator POC. If someone wants the TOS indicator, they could just added it.
Although the ExtHrs Low worked on the other days using the volumeprofile method, it did not for Sun/Monday. So the following workaround seems to fix that. I used the volumeprofile so that you could see the developing horizontal line throughout the premarket. Most other methods seem to plot the horizontal line after the close of the ccurrent premarket period.
As far as extending the lines from the previous day into the next day cannot be done with the above code. It is one continuous line changing at the start of rthr session. To do your request would be writting another code.
Code:#Premarket_HL_Futures_ExtendedHrs_using_ProfileHL_ETH_v1 input showrthopen_plot = yes; input start = 1800; input end = 0929; input rthstart = 0930; input rthend = 1615; input bubblemover = 0; input showPriorbubbles = yes; input showLastbubbles = yes; input extendlines = yes; def sec1 = SecondsFromTime(start); def sec2 = SecondsFromTime(end); def isTime1 = (sec1 >= 0 and sec1[1] <= 0) or (sec1 < sec1[1] and sec1 > 0); def isTime2 = (sec2 > 0 and sec2[1] <= 0) or (sec2 < sec2[1] and sec2 > 0) ; def aftermarket = CompoundValue(1, if isTime1[1] == 0 and isTime1 == 1 then 1 else if isTime2 then 0 else aftermarket[1], 0); def bars = 100000; def bn = BarNumber(); def na = Double.NaN; def period = bn - 1; def count = CompoundValue(1, if aftermarket and period != period[1] then (count[1] + period - period[1]) % bars else count[1], 0); def cond = count < count[1] + period - period[1]; profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = no, "numberOfProfiles" = bars, "pricePerRow" = PricePerRow.TICKSIZE , "value area percent" = 0); #ExtGigh def hProfile = if aftermarket and IsNaN(vol.GetHighest()) then hProfile[1] else if period != period[1] then vol.GetHighest() else hProfile[1]; def ProfileHigh = if bn == 1 then double.nan else if extendlines and !aftermarket then ProfileHigh[1] else if aftermarket then hProfile else na; #ExtLow def ymd = getyyyYMMDD(); def lProfile = if isnan(close) then lprofile[1] else if ymd!=ymd[1] then low else if aftermarket then min(low, lprofile[1]) else lProfile[1]; def ProfileLow = if bn == 1 then double.nan else if extendlines and !aftermarket then ProfileLow[1] else if aftermarket then lProfile else na; #Colors DefineGlobalColor("H", Color.ORANGE); DefineGlobalColor("L", Color.ORANGE); DefineGlobalColor("O", Color.WHITE); plot hrange = ProfileHigh; plot lrange = ProfileLow; def ropen = if bn == 1 then double.nan else if showrthopen_plot and SecondsFromTime(rthstart) == 0 then open else ropen[1]; plot orange = ropen; hrange.AssignValueColor(GlobalColor("H")); lrange.AssignValueColor(GlobalColor("L")); orange.AssignValueColor(GlobalColor("O")); #Bubbles - Prior Days AddChartBubble(showPriorbubbles and hrange[bubblemover] != (hrange[bubblemover + 1]), hrange[bubblemover + 1], "EH", hrange.TakeValueColor()); AddChartBubble(showPriorbubbles and hrange[bubblemover] != (hrange[bubblemover + 1]), lrange[bubblemover + 1], "EL", lrange.TakeValueColor()); AddChartBubble(showPriorbubbles and showrthopen_plot and hrange[bubblemover] != (hrange[bubblemover + 1]), orange[bubblemover + 1], "RO", orange.TakeValueColor()); #Bubbles - Last Plot AddChartBubble(showLastbubbles and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]), hrange[bubblemover + 1], "ETH", hrange.TakeValueColor()); AddChartBubble(showLastbubbles and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]), lrange[bubblemover + 1], "ETL", lrange.TakeValueColor()); AddChartBubble(showLastbubbles and showrthopen_plot and IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]), orange[bubblemover + 1], "RTO", orange.TakeValueColor()); #
This is awesome @SleepyZ I will test and confirm!!I had some time to test the code for extended hours and the volumeprofile method I used does not seem to be reliable for exthrs low. The exthrs high seems fine.
So I have rewritten the exthrs low to be more of a developiing plot of the low, which is then extended dueing regular trading hours from the exthrs low at 0929.
I have replaced the last code in post "190" with this code.
This is awesome @SleepyZ I will test and confirm!!
Looks great, but sure wish the "RO" bubbles wouldn't be visible when I select to not show the rthopen.
see screenshot. I think you had previously mentioned there is a glitch with bubbles. unfortunate.
View attachment 21807
On a related note - here is a classic example of why I like using that OVN time range and having it displayed throughout the RTH session. Tested the OVN hi twice. Excellent study man!
View attachment 21808
This may interest you.@hboogie
Code:#Premarket_HL_Futures_ExtendedHrs_using_thisday_RThrsOpen input showrthopen_plot = yes; input extend = no; input showpriorbubbles = yes; input bubblemover = 0; def na = Double.NaN; script pre { input daysback = 0; def na = Double.NaN; def bn = BarNumber(); def ymd = GetYYYYMMDD(); def capture = !IsNaN(close) and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); plot thisDay = HighestAll(dayCount) - dayCount ; def phigh = if bn == 1 then na else if thisDay[1] == daysback + 1 and thisDay == daysback then high else if thisDay == daysback and GetTime() < RegularTradingStart(GetYYYYMMDD()) then Max(high, phigh[1]) else na; def plow = if thisDay != thisDay[1] and thisDay == daysback then low else if thisDay == daysback and GetTime() < RegularTradingStart(GetYYYYMMDD()) then Min(low, plow[1]) else na; def ropen = if bn == 1 then na else if thisDay == daysback and SecondsFromTime(0930) == 0 then open else if thisDay == daysback and GetTime() < RegularTradingEnd(GetYYYYMMDD()) then ropen[1] else na; plot po = if thisDay > daysback then na else HighestAll(ropen); plot ph = if thisDay > daysback then na else HighestAll(phigh); plot pl = if thisDay > daysback then na else LowestAll(plow);# } plot preh0 = if !extend and pre(0) < 0 then na else pre(0).ph; plot preh1 = if !extend and pre(1) < 1 then na else pre(1).ph; plot preh2 = if !extend and pre(2) < 2 then na else pre(2).ph; plot preh3 = if !extend and pre(3) < 3 then na else pre(3).ph; plot preh4 = if !extend and pre(4) < 4 then na else pre(4).ph; plot preh5 = if !extend and pre(5) < 5 then na else pre(5).ph; plot prel0 = if !extend and pre(0) < 0 then na else pre(0).pl; plot prel1 = if !extend and pre(1) < 1 then na else pre(1).pl; plot prel2 = if !extend and pre(2) < 2 then na else pre(2).pl; plot prel3 = if !extend and pre(3) < 3 then na else pre(3).pl; plot prel4 = if !extend and pre(4) < 4 then na else pre(4).pl; plot prel5 = if !extend and pre(5) < 5 then na else pre(5).pl; plot preo0 = if showrthopen_plot then if !extend and pre(0) < 0 then na else pre(0).po else na; plot preo1 = if showrthopen_plot then if !extend and pre(1) < 1 then na else pre(1).po else na; plot preo2 = if showrthopen_plot then if !extend and pre(2) < 2 then na else pre(2).po else na; plot preo3 = if showrthopen_plot then if !extend and pre(3) < 3 then na else pre(3).po else na; plot preo4 = if showrthopen_plot then if !extend and pre(4) < 4 then na else pre(4).po else na; plot preo5 = if showrthopen_plot then if !extend and pre(5) < 5 then na else pre(5).po else na; #Colors DefineGlobalColor("H", Color.ORANGE); DefineGlobalColor("L", Color.ORANGE); DefineGlobalColor("O", Color.WHITE); preh0.AssignValueColor(GlobalColor("H")); preh1.AssignValueColor(GlobalColor("H")); preh2.AssignValueColor(GlobalColor("H")); preh3.AssignValueColor(GlobalColor("H")); preh4.AssignValueColor(GlobalColor("H")); preh5.AssignValueColor(GlobalColor("H")); prel0.AssignValueColor(GlobalColor("L")); prel1.AssignValueColor(GlobalColor("L")); prel2.AssignValueColor(GlobalColor("L")); prel3.AssignValueColor(GlobalColor("L")); prel4.AssignValueColor(GlobalColor("L")); prel5.AssignValueColor(GlobalColor("L")); preo0.AssignValueColor(GlobalColor("O")); preo1.AssignValueColor(GlobalColor("O")); preo2.AssignValueColor(GlobalColor("O")); preo3.AssignValueColor(GlobalColor("O")); preo4.AssignValueColor(GlobalColor("O")); preo5.AssignValueColor(GlobalColor("O")); def b = bubblemover; AddChartBubble(showpriorbubbles and !extend and IsNaN(preh1[b]) and !IsNaN(preh1[b + 1]), preh1[b + 1], "H1", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh2[b]) and !IsNaN(preh2[b + 1]), preh2[b + 1], "H2", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh3[b]) and !IsNaN(preh3[b + 1]), preh3[b + 1], "H3", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh4[b]) and !IsNaN(preh4[b + 1]), preh4[b + 1], "H4", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh5[b]) and !IsNaN(preh5[b + 1]), preh5[b + 1], "H5", GlobalColor("H")); AddChartBubble(showpriorbubbles and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh0[b + 1], "TH", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh1[b + 1], "H1", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh2[b + 1], "H2", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh3[b + 1], "H3", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh4[b + 1], "H4", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh5[b + 1], "H5", GlobalColor("H") ); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel1[b]) and !IsNaN(prel1[b + 1]), prel1[b + 1], "L1", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel2[b]) and !IsNaN(prel2[b + 1]), prel2[b + 1], "L2", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel3[b]) and !IsNaN(prel3[b + 1]), prel3[b + 1], "L3", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel4[b]) and !IsNaN(prel4[b + 1]), prel4[b + 1], "L4", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel5[b]) and !IsNaN(prel5[b + 1]), prel5[b + 1], "L5", GlobalColor("L")); AddChartBubble(showpriorbubbles and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel0[b + 1], "TL", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel1[b + 1], "L1", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel2[b + 1], "L2", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel3[b + 1], "L3", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel4[b + 1], "L4", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel5[b + 1], "L5", GlobalColor("L") ); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo1[b]) and !IsNaN(preo1[b + 1]), preo1[b + 1], "O1", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo2[b]) and !IsNaN(preo2[b + 1]), preo2[b + 1], "O2", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo3[b]) and !IsNaN(preo3[b + 1]), preo3[b + 1], "O3", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo4[b]) and !IsNaN(preo4[b + 1]), preo4[b + 1], "O4", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo5[b]) and !IsNaN(preo5[b + 1]), preo5[b + 1], "O5", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo0[b + 1], "TO", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo1[b + 1], "O1", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo2[b + 1], "O2", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo3[b + 1], "O3", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo4[b + 1], "O4", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo5[b + 1], "O5", GlobalColor("O") ); #
Hey @SleepyZThanks for the kind words. Glad it helps you.
This should now work how you requested. Replaced new code in posts #190 and #209
Hey @SleepyZ
I'm using this version in my production chart. Wondering what's different with this version vs the version I'm using here https://usethinkscript.com/threads/previous-day-high-low-close-for-thinkorswim.3494/post-141068 (post 203) I'm guessing it's just coded in a way to use VP and to correctly adjust the levels as they occur?
Only wondering if possible to include the OVN POC in this version and the rth open as coded. It's brilliant where it prints a dotted RTH open, but doesn't trail.
Thanks!
Code:#Premarket_HL_Futures_ExtendedHrs_using_thisday_RThrsOpen_PremarketPOC input showrthopen_plot = yes; input extend = no; input showpriorbubbles = yes; input bubblemover = 0; def na = Double.NaN; script pre { input daysback = 0; def na = Double.NaN; def bn = BarNumber(); def ymd = GetYYYYMMDD(); def capture = !IsNaN(close) and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); plot thisDay = HighestAll(dayCount) - dayCount ; def phigh = if bn == 1 then na else if thisDay[1] == daysback + 1 and thisDay == daysback then high else if thisDay == daysback and GetTime() < RegularTradingStart(GetYYYYMMDD()) then Max(high, phigh[1]) else na; def plow = if thisDay != thisDay[1] and thisDay == daysback then low else if thisDay == daysback and GetTime() < RegularTradingStart(GetYYYYMMDD()) then Min(low, plow[1]) else na; def ropen = if bn == 1 then na else if thisDay == daysback and SecondsFromTime(0930) == 0 then open else if thisDay == daysback and GetTime() < RegularTradingEnd(GetYYYYMMDD()) then ropen[1] else na; plot po = if thisDay > daysback then na else HighestAll(ropen); plot ph = if thisDay > daysback then na else HighestAll(phigh); plot pl = if thisDay > daysback then na else LowestAll(plow);# #Premarket POC input start = 1800; input end = 0929; input extendlines = yes; def sec1 = SecondsFromTime(start); def sec2 = SecondsFromTime(end); def isTime1 = (sec1 >= 0 and sec1[1] <= 0) or (sec1 < sec1[1] and sec1 > 0); def isTime2 = (sec2 > 0 and sec2[1] <= 0) or (sec2 < sec2[1] and sec2 > 0) ; def aftermarket = CompoundValue(1, if isTime1[1] == 0 and isTime1 == 1 then 1 else if isTime2 then 0 else aftermarket[1], 0); def bars = 100000; def period = bn - 1; def count = CompoundValue(1, if aftermarket and period != period[1] then (count[1] + period - period[1]) % bars else count[1], 0); def cond = count < count[1] + period - period[1]; profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = no, "numberOfProfiles" = bars, "pricePerRow" = PricePerRow.TICKSIZE , "value area percent" = 0); #Premarket POC def pPOC = if aftermarket and IsNaN(vol.GetHighest()) then pPOC[1] else if period != period[1] then vol.GetpointOfControl() else pPOC[1]; def exPOC = if thisDay != thisDay[1] and thisDay == daysback then if extendlines and !aftermarket then exPOC[1] else if aftermarket then pPOC else expoc[1] else na; plot POC = if thisDay > daysback then na else highestall(exPOC); } plot preh0 = if !extend and pre(0) < 0 then na else pre(0).ph; plot preh1 = if !extend and pre(1) < 1 then na else pre(1).ph; plot preh2 = if !extend and pre(2) < 2 then na else pre(2).ph; plot preh3 = if !extend and pre(3) < 3 then na else pre(3).ph; plot preh4 = if !extend and pre(4) < 4 then na else pre(4).ph; plot preh5 = if !extend and pre(5) < 5 then na else pre(5).ph; plot prel0 = if !extend and pre(0) < 0 then na else pre(0).pl; plot prel1 = if !extend and pre(1) < 1 then na else pre(1).pl; plot prel2 = if !extend and pre(2) < 2 then na else pre(2).pl; plot prel3 = if !extend and pre(3) < 3 then na else pre(3).pl; plot prel4 = if !extend and pre(4) < 4 then na else pre(4).pl; plot prel5 = if !extend and pre(5) < 5 then na else pre(5).pl; plot preo0 = if showrthopen_plot then if !extend and pre(0) < 0 then na else pre(0).po else na; plot preo1 = if showrthopen_plot then if !extend and pre(1) < 1 then na else pre(1).po else na; plot preo2 = if showrthopen_plot then if !extend and pre(2) < 2 then na else pre(2).po else na; plot preo3 = if showrthopen_plot then if !extend and pre(3) < 3 then na else pre(3).po else na; plot preo4 = if showrthopen_plot then if !extend and pre(4) < 4 then na else pre(4).po else na; plot preo5 = if showrthopen_plot then if !extend and pre(5) < 5 then na else pre(5).po else na; plot prep0 = if !extend and pre(0) < 0 then na else pre(0).poc; plot prep1 = if !extend and pre(1) < 1 then na else pre(1).poc; plot prep2 = if !extend and pre(2) < 2 then na else pre(2).poc; plot prep3 = if !extend and pre(3) < 3 then na else pre(3).poc; plot prep4 = if !extend and pre(4) < 4 then na else pre(4).poc; plot prep5 = if !extend and pre(5) < 5 then na else pre(6).poc; #Colors DefineGlobalColor("H", Color.ORANGE); DefineGlobalColor("L", Color.ORANGE); DefineGlobalColor("O", Color.WHITE); defineGlobalColor("P", color.magenta); preh0.AssignValueColor(GlobalColor("H")); preh1.AssignValueColor(GlobalColor("H")); preh2.AssignValueColor(GlobalColor("H")); preh3.AssignValueColor(GlobalColor("H")); preh4.AssignValueColor(GlobalColor("H")); preh5.AssignValueColor(GlobalColor("H")); prel0.AssignValueColor(GlobalColor("L")); prel1.AssignValueColor(GlobalColor("L")); prel2.AssignValueColor(GlobalColor("L")); prel3.AssignValueColor(GlobalColor("L")); prel4.AssignValueColor(GlobalColor("L")); prel5.AssignValueColor(GlobalColor("L")); preo0.AssignValueColor(GlobalColor("O")); preo1.AssignValueColor(GlobalColor("O")); preo2.AssignValueColor(GlobalColor("O")); preo3.AssignValueColor(GlobalColor("O")); preo4.AssignValueColor(GlobalColor("O")); preo5.AssignValueColor(GlobalColor("O")); prep0.AssignValueColor(GlobalColor("P")); prep1.AssignValueColor(GlobalColor("P")); prep2.AssignValueColor(GlobalColor("P")); prep3.AssignValueColor(GlobalColor("P")); prep4.AssignValueColor(GlobalColor("P")); prep5.AssignValueColor(GlobalColor("P")); #Bubbles #High def b = bubblemover; AddChartBubble(showpriorbubbles and !extend and IsNaN(preh1[b]) and !IsNaN(preh1[b + 1]), preh1[b + 1], "H1", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh2[b]) and !IsNaN(preh2[b + 1]), preh2[b + 1], "H2", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh3[b]) and !IsNaN(preh3[b + 1]), preh3[b + 1], "H3", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh4[b]) and !IsNaN(preh4[b + 1]), preh4[b + 1], "H4", GlobalColor("H")); AddChartBubble(showpriorbubbles and !extend and IsNaN(preh5[b]) and !IsNaN(preh5[b + 1]), preh5[b + 1], "H5", GlobalColor("H")); AddChartBubble(showpriorbubbles and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh0[b + 1], "TH", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh1[b + 1], "H1", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh2[b + 1], "H2", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh3[b + 1], "H3", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh4[b + 1], "H4", GlobalColor("H") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preh5[b + 1], "H5", GlobalColor("H") ); #Low AddChartBubble(showpriorbubbles and !extend and IsNaN(prel1[b]) and !IsNaN(prel1[b + 1]), prel1[b + 1], "L1", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel2[b]) and !IsNaN(prel2[b + 1]), prel2[b + 1], "L2", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel3[b]) and !IsNaN(prel3[b + 1]), prel3[b + 1], "L3", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel4[b]) and !IsNaN(prel4[b + 1]), prel4[b + 1], "L4", GlobalColor("L")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prel5[b]) and !IsNaN(prel5[b + 1]), prel5[b + 1], "L5", GlobalColor("L")); AddChartBubble(showpriorbubbles and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel0[b + 1], "TL", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel1[b + 1], "L1", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel2[b + 1], "L2", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel3[b + 1], "L3", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel4[b + 1], "L4", GlobalColor("L") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prel5[b + 1], "L5", GlobalColor("L") ); #RTHrs Open AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo1[b]) and !IsNaN(preo1[b + 1]), preo1[b + 1], "O1", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo2[b]) and !IsNaN(preo2[b + 1]), preo2[b + 1], "O2", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo3[b]) and !IsNaN(preo3[b + 1]), preo3[b + 1], "O3", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo4[b]) and !IsNaN(preo4[b + 1]), preo4[b + 1], "O4", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and !extend and IsNaN(preo5[b]) and !IsNaN(preo5[b + 1]), preo5[b + 1], "O5", GlobalColor("O")); AddChartBubble(showpriorbubbles and showrthopen_plot and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo0[b + 1], "TO", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo1[b + 1], "O1", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo2[b + 1], "O2", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo3[b + 1], "O3", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo4[b + 1], "O4", GlobalColor("O") ); AddChartBubble(showpriorbubbles and showrthopen_plot and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), preo5[b + 1], "O5", GlobalColor("O") ); #POC AddChartBubble(showpriorbubbles and !extend and IsNaN(prep1[b]) and !IsNaN(prep1[b + 1]), prep1[b + 1], "P1", GlobalColor("P")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prep2[b]) and !IsNaN(prep2[b + 1]), prep2[b + 1], "P2", GlobalColor("P")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prep3[b]) and !IsNaN(prep3[b + 1]), prep3[b + 1], "P3", GlobalColor("P")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prep4[b]) and !IsNaN(prep4[b + 1]), prep4[b + 1], "P4", GlobalColor("P")); AddChartBubble(showpriorbubbles and !extend and IsNaN(prep5[b]) and !IsNaN(prep5[b + 1]), prep5[b + 1], "P5", GlobalColor("P")); AddChartBubble(showpriorbubbles and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prep0[b + 1], "TP", GlobalColor("P") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prep1[b + 1], "P1", GlobalColor("P") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prep2[b + 1], "P2", GlobalColor("P") ); AddChartBubble(showpRiorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prep3[b + 1], "P3", GlobalColor("P") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prep4[b + 1], "P4", GlobalColor("P") ); AddChartBubble(showpriorbubbles and extend and IsNaN(close[b]) and !IsNaN(close[bubblemover + 1]), prep5[b + 1], "P5", GlobalColor("P") ); #
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.