Low and High

 

Hello! How can I get Low and High value between 15.00 and 17.00? I have tried something like this:

if (Hour()==Start) // extern int Start=15;

{

HighValue=High[iHighest(NULL,0,MODE_HIGH,8,1)]; // 8 M15 bars between 15.00-17.00

LowValue=Low[iLowest(NULL,0,MODE_LOW,8,1)]; // 8 M15 bars between 15.00-17.00

}


Anyone have an idea?

 

Doesn't your code work? Looks ok...

 
01005379:

Hello! How can I get Low and High value between 15.00 and 17.00? I have tried something like this:

if (Hour()==Start) // extern int Start=15;

{

HighValue=High[iHighest(NULL,0,MODE_HIGH,8,1)]; // 8 M15 bars between 15.00-17.00

LowValue=Low[iLowest(NULL,0,MODE_LOW,8,1)]; // 8 M15 bars between 15.00-17.00

}

Anyone have an idea?

It's been a long day, but... if Start = 15, then isn't this code going to get the high and low between 13.00 and 15.00, not 15.00 and 17.00? And, at 15.15, it's going to start looking at the 8 bars starting at 13.15, not 13.00. (All this assuming that you're running it on an M15 chart.)

 

Nope, I can't figure out which values it calculates, but absolutely not high and low between 15.00 and 17.00.

Is this OK: EA starts to look for high and low at 15.00 and then 8 bar forward?

Or I have to change Start=17, and then EA looks from 17.00 and back to 15.00 (8 bars)?

 
jjc:

It's been a long day, but... if Start = 15, then isn't this code going to get the high and low between 13.00 and 15.00, not 15.00 and 17.00? And, at 15.15, it's going to start looking at the 8 bars starting at 13.15, not 13.00.

you may be right, I'll have a look at this. Thanks for idea!

 

Oh... you were trying to look forward. The function is intended to look backward in time.

Chart = 15m timeframe

if (Hour()==Start) // extern int Start=17;
HighValue=High[iHighest(NULL,0,MODE_HIGH,8,1)]; // 8 M15 bars between 15.00-16:59:59

 
phy:

Oh... you were trying to look forward. The function is intended to look backward in time.

Chart = 15m timeframe

if (Hour()==Start) // extern int Start=17;
HighValue=High[iHighest(NULL,0,MODE_HIGH,8,1)]; // 8 M15 bars between 15.00-16:59:59

Thanks! Lets see if it works fine!

 
It still doesn't work! I try everythig, but with no success.
 

if (TimeHour(Time[i])==Start) // extern int Start=17;
HighValue=High[iHighest(NULL,0,MODE_HIGH,8,i)]; // 8 M15 bars between 15.00-16:59:59

 
phy:
if (TimeHour(Time[i])==Start) // extern int Start=17;
HighValue=High[iHighest(NULL,0,MODE_HIGH,8,1)]; // 8 M15 bars between 15.00-16:59:59

What about variable i?

 

Yes, just saw that.

Reading/fixing other people's code is always a challenge.

.

http://my.jetscreenshot.com/demo/20090824-27lq-148kb.jpg

.

Working example, same idea, different times

.

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start(){

int Start = 14;
double HighValue;
int HighTime;

for(int i = 0; i < Bars-1; i++){
  
   if(TimeHour(Time[i])==Start){ // extern int Start=14;
      HighValue=High[iHighest(NULL,0,MODE_HIGH,36,i)]; // 36 M5 bars between 11:00-13:59:59 
      HighTime = Time[iHighest(NULL,0,MODE_HIGH,36,i)];
      Comment(HighValue, "  ", TimeToStr(HighTime, TIME_DATE|TIME_MINUTES));
      break;
   }
}
return(0);
}
Reason: