Hey there, I'm hoping to adjust the below study so it plots the high and low from midnight onward, starting fresh each day.
Today when I ran the study it pulled the high from yesterday's overnight session.
Thanks for the help, cheers.
input show_lines = yes;
input show_bubbles = yes;
input aggregationPeriod = AggregationPeriod.WEEK;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = yes;
plot DailyHigh;
plot DailyLow;
def DH = if IsNaN(close(period = aggregationPeriod)[-1])
then DH[1]
else Highest(high(period = aggregationPeriod)[-displace], length);
def DL = if IsNaN(close(period = aggregationPeriod)[-1])
then DL[1]
else Lowest(low(period = aggregationPeriod)[-displace], length);
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyHigh = Double.NaN;
DailyLow = Double.NaN;
} else {
DailyHigh = DH ;
DailyLow = DL ;
}
DailyHigh.SetDefaultColor(GetColor(4));
DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyHigh.SetHiding(!show_lines);
DailyLow.SetDefaultColor(GetColor(4));
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetHiding(!show_lines);
def bn = BarNumber();
input bubble_displace = 3;
def mid=DH-DL;
plot middy = DL+(mid/2);
#AddChartBubble(show_bubbles and bn == HighestAll(bn - bubble_displace), DailyHigh, DailyHigh, Color.GREEN);
#AddChartBubble(show_bubbles and bn == HighestAll(bn - bubble_displace), DailyLow, DailyLow, Color.RED);
#AddChartBubble(show_bubbles and bn == HighestAll(bn - bubble_displace), middy, middy, Createcolor(25,175,195));
#Zones
#def cone= 3752.75;
#def ctwo = 3739.75;
#addcloud(cone,ctwo,createcolor(25,155,185), createcolor(25,55,185));
Today when I ran the study it pulled the high from yesterday's overnight session.
Thanks for the help, cheers.
input show_lines = yes;
input show_bubbles = yes;
input aggregationPeriod = AggregationPeriod.WEEK;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = yes;
plot DailyHigh;
plot DailyLow;
def DH = if IsNaN(close(period = aggregationPeriod)[-1])
then DH[1]
else Highest(high(period = aggregationPeriod)[-displace], length);
def DL = if IsNaN(close(period = aggregationPeriod)[-1])
then DL[1]
else Lowest(low(period = aggregationPeriod)[-displace], length);
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyHigh = Double.NaN;
DailyLow = Double.NaN;
} else {
DailyHigh = DH ;
DailyLow = DL ;
}
DailyHigh.SetDefaultColor(GetColor(4));
DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyHigh.SetHiding(!show_lines);
DailyLow.SetDefaultColor(GetColor(4));
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetHiding(!show_lines);
def bn = BarNumber();
input bubble_displace = 3;
def mid=DH-DL;
plot middy = DL+(mid/2);
#AddChartBubble(show_bubbles and bn == HighestAll(bn - bubble_displace), DailyHigh, DailyHigh, Color.GREEN);
#AddChartBubble(show_bubbles and bn == HighestAll(bn - bubble_displace), DailyLow, DailyLow, Color.RED);
#AddChartBubble(show_bubbles and bn == HighestAll(bn - bubble_displace), middy, middy, Createcolor(25,175,195));
#Zones
#def cone= 3752.75;
#def ctwo = 3739.75;
#addcloud(cone,ctwo,createcolor(25,155,185), createcolor(25,55,185));