Download MetaTrader 5

Highest open and lowest open

To add comments, please log in or register
Jeff
27
Jeff 2014.02.27 16:35 

Hi,

I am not a coder but have been trying to learn over time, so please bear with me (and be gentle, lol). I have an EA that trades off the highest high and lowest low over a period of Monday H1 bars. I want to test this EA on open prices only (not every tick), but am having trouble modifying the code to work on open prices. Here is the code that finds the highest high and lowest low, which I follow. This has to be fairly common, but is there a similar function that finds the highest open and lowest open? I looked around and am guessing not, that I need to make an array first? Any help is appreciated. Thanks!

Jeff

 MonHigh =  iHigh( strSymbol, PERIOD_H1, iHighest( strSymbol, PERIOD_H1, MODE_HIGH, EndOfZoneDetermingHour,0 ) );
     if (MonHigh > HighMondayZone)HighMondayZone = MonHigh;
     MonLow =  iLow( strSymbol, PERIOD_H1, iLowest( strSymbol, PERIOD_H1, MODE_LOW, EndOfZoneDetermingHour, 0 ) );
     if (MonLow < LowMondayZone)LowMondayZone = MonLow;


Alain Verleyen
Moderator
31137
Alain Verleyen 2014.02.27 18:21  
Jeff7102:

Hi,

I am not a coder but have been trying to learn over time, so please bear with me (and be gentle, lol). I have an EA that trades off the highest high and lowest low over a period of Monday H1 bars. I want to test this EA on open prices only (not every tick), but am having trouble modifying the code to work on open prices. Here is the code that finds the highest high and lowest low, which I follow. This has to be fairly common, but is there a similar function that finds the highest open and lowest open? I looked around and am guessing not, that I need to make an array first? Any help is appreciated. Thanks!

Jeff


Try this :

MonHigh=iOpen(strSymbol,PERIOD_H1,iHighest(strSymbol,PERIOD_H1,MODE_OPEN,EndOfZoneDetermingHour,0));
if(MonHigh>HighMondayZone)HighMondayZone=MonHigh;
MonLow=iOpen(strSymbol,PERIOD_H1,iLowest(strSymbol,PERIOD_H1,MODE_OPEN,EndOfZoneDetermingHour,0));
if(MonLow<LowMondayZone)LowMondayZone=MonLow;
Jeff
27
Jeff 2014.02.27 19:31  
Thank you! I will try that out. Such a simple fix.
To add comments, please log in or register