TOS left out the close of the day line...frustrating

R

rlohmeyer

New member
I am not a coder, but I dabble.....I have been dabbling with various code snippets for day trying to get code to plot a horizontal line off the PREVIOUS RTH session close that extends through the next RTH session and still be able to show overnight session. I have code, share by a friend, that does this nicely for the PRESENT RTH session open, see attached image and code.

If anyone can point me in the direction of how to modify this code to incude a PREVIOUS RTH session close line, it would be greatly appreciated.

# JimmyMack 2018
input aggregationPeriod = AggregationPeriod.DAY;
input showOnlyLastPeriod = yes;
def prevPrice = open(period = aggregationPeriod)[-1];
def price = open(period = aggregationPeriod);
plot DailyOpen = if showOnlyLastPeriod and !IsNaN(prevPrice) then Double.NaN else price;
DailyOpen.SetDefaultColor(GetColor(2));
DailyOpen.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

The image below shows the Yellow PRESENT RTH Session open line.
 
BenTen

BenTen

Administrative
Staff
VIP
I assume you want to plot the previous day's close? If so, try the snippet below.

Code:
input aggregationPeriod = AggregationPeriod.DAY;
plot ystdClose = close(period = aggregationPeriod)[1];

ystdClose.SetPaintingStrategy(PaintingStrategy.SQUARES);
ystdClose.SetDefaultColor(Color.Dark_Orange);
ystdClose.SetLineWeight(1);
 
Top