ORB for previous day

Hello,

I've below code which pulls High and Low Value for particular time range for a current day.

Requesting forum members to help me in writing same code which pulls H and L for PREVIOUS DAY with time range same as below.

_SECTION_BEGIN("Time range High-Low");

tn = TimeNum();
// define start/end hours in TimeNum format
StartTime = 91500;
Endtime = 093000;
MendTime = 152000;

// 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 ) );

Such a thread already exists in the Forum and everything is discussed in detail.

There are more threads with variations of the same question.

kindly check this:

Thanks Travick. I had gone through the forum and checked many codes provided in an answer but all those were for current day while I was looking for solution was slight different.

Post up the code that you have tried so far.

Search again, and this time go through all the posts.
I have just now seen that post.

I'm surprised you can't find it when it already shows up within top 3 results. You need to read all the posts in that topic.

Below code is for current day. I don't know how to convert it so that it look for previous day.

_SECTION_BEGIN("Time range High-Low");

tn = TimeNum();
// define start/end hours in TimeNum format
StartTime = 91500;
Endtime = 093000;
MendTime = 152000;

// 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 ) );

So your attempted code is nothing, zilch?

Did you not see @travick suggested help?

Also, as @travick has already advised to you: see How to ask a good question.

1 Like