Hello fellow traders.
Recently found this super useful piece of code which I have incorporated into all my intraday charts. Its from this post:
https://usethinkscript.com/threads/premarket-after-market-for-thinkorswim.75/post-1323
I am wondering if there is there a way to make the H/L lines extend left across all historical data in the chart?
Any thoughts?
Rich (BB code):
# Archive Name: GlobeX or Overnight High / Low v.07.2017
# Archive Section: Support Resistance
# Suggested Tos Name: GlobeX_HighLow_v2017_Mobius
# Archive Date: 5.06.2018 May 6, 2018
# Archive Notes: This looks to be a second version
# GlobeX or Overnight High / Low
# Mobius
# V01.2012
# V07.2017 Replaced Time Brackets with GetTime() function which works better with Mobile
input PlotOverNightExtremes = yes;
def h = high;
def l = low;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def ONhigh = if GlobeX and !Globex[1]
then h
else if Globex and
h > ONhigh[1]
then h
else ONhigh[1];
def ONhighBar = if GlobeX and h == ONhigh
then Bar
else double.nan;
def ONlow = if GlobeX and !GlobeX[1]
then l
else if GlobeX and
l < ONlow[1]
then l
else ONlow[1];
def ONlowBar = if GlobeX and l == ONlow
then Bar
else double.nan;
def OverNightHigh = if BarNumber() == HighestAll(ONhighBar)
then ONhigh
else OverNightHigh[1];
def OverNightLow = if BarNumber() == HighestAll(ONlowBar)
then ONlow
else OverNightLow[1];
plot ONH = if OverNightHigh > 0
then OverNightHigh
else Double.NaN;
ONH.SetHiding(!PlotOverNightExtremes);
ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
ONH.SetDefaultColor(Color.BLUE);
ONH.HideBubble();
ONH.HideTitle();
plot ONL = if OverNightLow > 0
then OverNightLow
else Double.NaN;
ONL.SetHiding(!PlotOverNightExtremes);
ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
ONL.SetDefaultColor(Color.GRAY);
ONL.HideBubble();
ONL.HideTitle();
AddLabel(GlobeX, "GlobeX Range = " + AsDollars(ONH - ONL), color.white);
AddChartBubble(bar == ONhighBar and PlotOverNightExtremes, ONH, "ONH", Color.BLUE);
AddChartBubble(bar == ONlowBar and PlotOverNightExtremes, ONL, "ONL", Color.GRAY, 0);
Alert((close crosses above ONH) or (close crosses below ONL), "", Alert.Bar, Sound.Bell);
# End Code GlobeX or Overnight High / Low v.07.2017