Draw auto line on pre market open price


Category:
0
0

Hello can you help me with the Script that draw line at 7 AM pre market open price.

I did saw this

def newDay = GetDay() <> GetDay()[1];
def start = newDay or SecondsTillTime(400) == 0;
rec premarketOpen = if start then open else premarketOpen[1];
plot po = premarketOpen;

 

But the issue is it draw line an all previous day is it possible that the line is only visible for current day only.

 

Thanks

Marked as spam
Posted by S S (Questions: 12, Answers: 5)
Asked on October 11, 2019 5:00 pm
241 views
0
it didn't work out. Actually all I want is the line draw at 7 AM when the premarket open and only for current day not for the previous days. Please can you help. Thanks
(S S at October 12, 2019 8:21 am)
0
Yes, it does work. I have updated my answer to show how to apply that filter to your code.
(Pete Hahn at October 12, 2019 9:28 am)
0
Private answer

Add a filter to your conditions:

def okToPlot = GetDay() == GetLastDay();

Edit: Based on feedback from the author of the post I see that I need to apply this additional filter to their original code so they understand how to make this work.

def newDay = GetDay() <> GetDay()[1];
def start = newDay or SecondsTillTime(400) == 0;
def okToPlot = GetDay() == GetLastDay();
rec premarketOpen = if okToPlot and start then open else premarketOpen[1];
plot po = premarketOpen;

Marked as spam
Posted by Pete Hahn (Questions: 37, Answers: 4153)
Answered on October 11, 2019 6:49 pm