the high and low of the last 3 bars from yesterday

 

I would like to display the high and low of the last 3 bars from yesterday on the current day.

Example

Today is Tuesday. I use a Chart h1 and on this chart I want to display the high and low of the last 3 bars from Monday. On Wednesday the high and low of the last 3 bars from Tuesday and so on. (On Monday the high and low of the last 3 bars from the past Friday)

Like this example 'Previous Day High-Low' but the high and low should only referrer to the last 3 bars oft the day before.

Perhaps someone could help to modify the code.

I just work on a H1 chart

Best regard

Luis

 
double HighValue=High[iHighest(NULL,PERIOD_D1,MODE_HIGH,3,1)];
double LowValue=Low[iLowest(NULL,PERIOD_D1,MODE_LOW,3,1)];
 

520fx wrote >>

double HighValue=High[iHighest(NULL,PERIOD_D1,MODE_HIGH,3,1)];
double LowValue=Low[iLowest(NULL,PERIOD_D1,MODE_LOW,3,1)];


Ignore me if I'm being dim, but are you sure this is right? The call to iHighest looks as though it will evaluate the high of the last three complete days, not the last three hours of yesterday (which seems to be what Lorenzol wants). After that, the index returned by iHighest seems to be used to access the current timeframe data (i.e. H1) rather than D1 data. As far as I can see, if the high of the last 3 days was the day before yesterday, then this code will return the high of the penultimate hour yesterday.

 
double GetData(int KCnt)//KCnt means which day's last 3 bars u want to caculate on.
{
int KStartCnt=iBarShift(NULL,PERIOD_H1,iTime(NULL,PERIOD_D1,KCnt-1),false);
double HighValue=High[iHighest(NULL,PERIOD_H1,MODE_HIGH,3,KStartCnt)];
return(HighValue);
}

I sorry to misunderstand this.

I just rewrite a function for your reference.

 
520fx wrote >>

I sorry to misunderstand this.

I just rewrite a function for your reference.

Thank you . I´m a newbie and i don`t understand the KCnt in the first line. Ist this a funktion? I didn`t see where KCnt ist defined.

In the Second Line you use (NULL,PERIOD_D1,KCnt-1) In this line KCnt is used the first time but it isn`t defined

before.

I ask me how to use your Code to get it plot on the Chart. So each day show the high and the low of the last 3 Bars from the previous day

Perhaps you could give me a example for my first indikator.