AstroBoy
New member
Hey everyone! I'm trying to customize a Technical Indicator Study that plots the Previous Day's High, Previous Day's Close, and Present Day's Pre-Market High.
The study measures what I need it to do, but visually on the chart, how do I code the script so that the Previous Day's High Line and Previous Day's Close Line extends to the left to their respective candles?
The Pre-Market High Line is already on its respective candle, I just need the Day's High and Day's Close to do the same...Here's a visual example of what I am trying to accomplish:
And here is the script:
Transparency: This script is an aggregation of several other scripts from here and Reddit that I edited to measure the correct price levels I needed it to and be displayed to my preferences
The study measures what I need it to do, but visually on the chart, how do I code the script so that the Previous Day's High Line and Previous Day's Close Line extends to the left to their respective candles?
The Pre-Market High Line is already on its respective candle, I just need the Day's High and Day's Close to do the same...Here's a visual example of what I am trying to accomplish:

And here is the script:
Code:
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = yes;
def h = high;
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 OverNightHigh = if BarNumber() == HighestAll(ONhighBar)
then ONhigh
else OverNightHigh[1];
plot PrevDayHigh;
if showOnlyLastPeriod and !IsNaN(high(period = aggregationPeriod)[-1])
{
PrevDayHigh = Double.NaN;
}
else
{
PrevDayHigh = Highest(high(period = aggregationPeriod)[-displace], length);
}
plot PrevDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) { PrevDayClose = Double.NaN;
} else { PrevDayClose = Highest(close(period = aggregationPeriod)[-displace], length);
}
plot PreMarketHigh = if OverNightHigh > 0
then OverNightHigh
else Double.NaN;
Transparency: This script is an aggregation of several other scripts from here and Reddit that I edited to measure the correct price levels I needed it to and be displayed to my preferences
Last edited: