Download MetaTrader 5

Please help to describe close price 5 minute ago in mt4

To add comments, please log in or register
huylucdao
9
huylucdao  
Hello everybody.
I am trying to code a EA:
x = close current - close at 5 minute ago.
x>30pips ->buy
x stoploss=30pips, takeprofit=80pips, trailing stop = 30pips.
Time frame 4 hour.

The problem: how to describe close price at 5 minutes ago in mt4 ?

The close price at 5 minutes ago will change value with time.

Anyone help me ? Thank you so much.
Simon Gniadkowski
Moderator
18056
Simon Gniadkowski  
Huylucdao:
Hello everybody.
I am trying to code a EA:
x = close current - close at 5 minute ago.
x>30pips ->buy
x stoploss=30pips, takeprofit=80pips, trailing stop = 30pips.
Time frame 4 hour.

The problem: how to describe close price at 5 minutes ago in mt4 ?

The close price at 5 minutes ago will change value with time.

Anyone help me ? Thank you so much.

There is no "close price" 5 minutes ago . . . close price applies to a bar and discrete packets of time, not x minutes ago. You can get the close of a M1 bar 5 bars ago . . .

iClose(NULL, PERIOD_M1, 5)
huylucdao
9
huylucdao  
Thank RaptorUK so much :)
RaptorUK:

There is no "close price" 5 minutes ago . . . close price applies to a bar and discrete packets of time, not x minutes ago. You can get the close of a M1 bar 5 bars ago . . .


To add comments, please log in or register