Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1081

 
Foxonn:
Hello, can you advise how to find Low point and Hight point, let's say from 08:00 am to 15:00 pm broker time on M5 timeframe?
iBarShift(), iLowest(), iHighest().
 
evillive:
massiv[1]
How about in the loop, massiv[i+1] givesan array out of range

 
Pokrov:
How about in the loop, massiv[i+1] gives an array out of range

loop this way, it's hard to tell.
 
evillive:
cycle here, it's so hard to tell.
int i,limit;
   limit=rates_total-prev_calculated;
if(prev_calculated<1) limit=rates_total-1;
for(i=limit; i>0; i--)
   
{
internal_channelUp[i]= iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,internal_channel,i));
internal_channelDn[i]= iLow(NULL,0,iLowest(NULL,0,MODE_LOW,internal_channel,i));
}
Need data from the last bar
 
Pokrov:
Need data from the last bar
int i,limit;
   limit=rates_total-prev_calculated-1;
if(prev_calculated<1) limit=rates_total-1;
for(i=limit; i>0; i--)
   
{
internal_channelUp[i]= iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,internal_channel,i+1));
internal_channelDn[i]= iLow(NULL,0,iLowest(NULL,0,MODE_LOW,internal_channel,i+1));
}
 
evillive:
Did NOT see one in the conditions, sorry, I'll check everything now.
 
evillive:
iBarShift(), iLowest(), iHighest().
Can you explain in more detail how to link all this together and set the time range of high and low points? (if you can live example code)
P.s: I will start studying mql, please be patient =)
 
evillive:
All works, thank you very much!
 
Foxonn:
Can I have more details on how to tie it all together and set the time range for finding the high and low points ? (if possible live example code)
P.s: I will start to learn mql, please be patient =)

You can read a lot of interesting information by these keywords in the help, you just need to press F1 in the example code on the required word.

Approximately, the code for embedding into the indicator will look like this:

input datetime timestart=D'2016.08.10 08:00'; //время поиска, от
input datetime timeend=D'2016.08.10 15:00';  //и до

int shiftstart=0,shiftend=0,diff=0; 
double hi=0,lo=0;

int OnCalculate()
{
/////
shiftstart=iBarShift(_Symbol,PERIOD_M5,timestart);                                 //выясняем индекс бара с временем старта поиска
shiftend=iBarShift(_Symbol,PERIOD_M5,timeend);                                     //выясняем индекс бара с временем финиша поиска 
diff=shiftstart-shiftend;                                                      //вычисляем кол-во баров для поиска экстремумов
lo=iLow(_Symbol,PERIOD_M5,iLowest(_Symbol,PERIOD_M5,MODE_LOW,diff,shiftend));  //выясняем минимум 
hi=iHigh(_Symbol,PERIOD_M5,iHighest(_Symbol,PERIOD_M5,MODE_HIGH,diff,shiftend)); //и максимум
//////
}
 
evillive:

You can read a lot of interesting information by these keywords in the help, you just need to press F1 in the example code on the required word.

Approximately the code for embedding into the indicator will look like this


Thank you very much for your help.
Reason: