iLowest

 

Hi,

 I'm trying to create an EA that place a buy order when price is above the 50 days line.

 

Here's the 'if' condition:

if((iLowest(NULL,1,MODE_LOW,10,0) > iMA(NULL,PERIOD_M1,50,0,MODE_SMA,PRICE_CLOSE,0)))

 

However,

When I test out that if condition it placed an order at a bar higher then the bar I wanted.

I've attached an image to show you, the red arrow in the image shows the EA placed the buy order.

However, I wanted the EA to place the buy order at the bar as shown in the yellow arrow.  I painted in the red an yellow arrow to show you where I want the EA to place the buy order based on the 'if condition' I wrote above.

Your help is appreciated. 

Files:
iLowest.png  16 kb
 
just read the docu. about iLowest() and what does it return, a price or ...?
 

iLowest(): https://docs.mql4.com/series/ilowest

if(iLow(NULL, 1, iLowest(NULL,1,MODE_LOW,10,0)) > iMA(NULL,PERIOD_M1,50,0,MODE_SMA,PRICE_CLOSE,0)) {}
iLowest - MQL4 Documentation
  • docs.mql4.com
iLowest - MQL4 Documentation