Download MetaTrader 5

How to access the close price of current candle after it is formed completely formed while using 1Min timeframe

To add comments, please log in or register
parashuram
15
parashuram  

I have written a simple expert adviser program with Simple Moving Average with period 8 (i.e., SMA(8)) and timeframe 1 Min.

Mqlrates mqrate, mqrate[0].close,mqrate[1].close is giving me the current and previous candle's open,high,low and close price values. But, when I try to access the current candle's close price, it is giving me the close price of the incomplete current candle (i.e., the intermediate close price value of current candle forming). I am getting correct open, high,low and close values for previous candles as they were completely formed. Can anyone suggest a way to access the close price after current candle formed completely.

Marco vd Heijden
Moderator
4821
Marco vd Heijden  

after it closed it will shift from zero to one.

So zero is always open... if it was not you could look into the future at what price it was going to close..

Your basically looking for a never existing value.

If you want the close price as soon as it becomes available you can compare the candles time and wait for it to change, once it changed you know there was a shift.

To add comments, please log in or register