iMA for the last frame candle

[Deleted]  

Hi,

I am a new user for mql4 so I would like to know an information.

I'm creating a EA, and I would like to open a position at open price of a new candle only if the close price of the last close candle (of the frame that I use) is higher of the iMA of that candle....

So, if the program are executing on tick of the new candle (it is the open prize of the candle), how can I calculate the iMA of the last close candle?

If I have this istrction: iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);

The PRICE_CLOSE is the close price of the last complete candle or is the close price of the last tick of the current candle???

thanks in advance

 
Use the Close[0] for the last candle close price. That works for me.
[Deleted]  
jirimac wrote >>
Use the Close[0] for the last candle close price. That works for me.

Yes, I know, but I need of the close price of the second last candle, so I can use Open[1], but the problem is: How ca I calcolate the

 
ok, i see, just use the offset in the indicator. Its the last number: iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,1);