i am trying to find "open price at 9:50AM, close price at 13:30PM and High and Low price between 9:50AM & 13:30PM" on analysis window

#1
Hello everyone, i am trying to find "open price at 9:50AM, close price at 13:30PM and High and Low price between 9:50AM & 13:30PM" on analysis window, but i am not able to do this, Please Help.
This is my code:-
tn = TimeNum();

//define start/end hours in TimeNum format
StartTime = 95000;
Endtime = 133000;

//these conditions are true when TimeNum of the bar equals startime/endtime
StartBar = tn == StartTime;
EndBar = tn == Endtime;

//on the end bar we read the value of highest high or lowest low since the start bar
myH = ValueWhen( EndBar, HighestSince( StartBar, High ) );
myL = ValueWhen( EndBar, LowestSince( StartBar, Low ) );

//display price and high / low on chart

//Plot( myH, "myH", colorGreen, styleThick );
//Plot( myL, "myL", colorGreen, styleThick );

//reading oprn price at 9:50AM & Close price at 13:30PM
open950_am = ValueWhen( TimeNum() == 93500, Open,1);
close1330_pm = ValueWhen( TimeNum() == 133000, Close,1);

//display oprn price at 9:50AM & Close price at 13:30PM on chart

//Plot(open950_am, "open_9:50", colorGreen, styleLine);
//Plot(close1330_pm, "close_13:30", colorRed, styleLine);

AddColumn(open950_am,"open_9:50",1.2);
AddColumn(close1330_pm,"close_13:30",1.2);
AddColumn(myH,"myH",1.2);
AddColumn(myL,"myL",1.2);

I am only getting following Heading not any value
1627812351243.png
 

Romeo1998

Well-Known Member
#2
Hello everyone, i am trying to find "open price at 9:50AM, close price at 13:30PM and High and Low price between 9:50AM & 13:30PM" on analysis window, but i am not able to do this, Please Help.
This is my code:-
tn = TimeNum();

//define start/end hours in TimeNum format
StartTime = 95000;
Endtime = 133000;

//these conditions are true when TimeNum of the bar equals startime/endtime
StartBar = tn == StartTime;
EndBar = tn == Endtime;

//on the end bar we read the value of highest high or lowest low since the start bar
myH = ValueWhen( EndBar, HighestSince( StartBar, High ) );
myL = ValueWhen( EndBar, LowestSince( StartBar, Low ) );

//display price and high / low on chart

//Plot( myH, "myH", colorGreen, styleThick );
//Plot( myL, "myL", colorGreen, styleThick );

//reading oprn price at 9:50AM & Close price at 13:30PM
open950_am = ValueWhen( TimeNum() == 93500, Open,1);
close1330_pm = ValueWhen( TimeNum() == 133000, Close,1);

//display oprn price at 9:50AM & Close price at 13:30PM on chart

//Plot(open950_am, "open_9:50", colorGreen, styleLine);
//Plot(close1330_pm, "close_13:30", colorRed, styleLine);

AddColumn(open950_am,"open_9:50",1.2);
AddColumn(close1330_pm,"close_13:30",1.2);
AddColumn(myH,"myH",1.2);
AddColumn(myL,"myL",1.2);

I am only getting following Heading not any value
View attachment 46601
there is no filter, hence no result... :)
add this 1 line before addcolumns...
Filter = tn == endtime + 1000;
good luck :)
 

Similar threads