plot line only on current day


Category:
0
0

Hi Pete,

I am trying to plot a line from the pre-market open price but I only want it to display on the current day.
this code works but displays on previous days.  Can you help?

#Pre-Market open

def day = GetDay();

def PMfirstBar = day != day[1];

def PMOpen = if PMfirstBar then open else PMOpen[1];

plot PMO = PMOpen;

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 21, 2019 6:37 pm
108 views
0
Private answer

This should do it. (I have not tested it)

def day = GetDay();
def PMfirstBar = day != day[1];
def PMOpen = if PMfirstBar then open else PMOpen[1];
def currentDay = GetLastDay() == GetDay() and GetLastYear() == GetYear();
plot PMO = if currentDay then PMOpen else Double.NaN;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 27, 2019 12:22 pm
0

Thanks Pete, really appreciate it!

( at February 28, 2019 3:33 pm)