Download MetaTrader 5
To add comments, please log in or register
Subscribe to signals right in MetaTrader. It is easy!
Siddhant Batra
16
Siddhant Batra 2010.05.27 08:44 

Hi,

I'm an amateur MQL4 programmer, so this question may sound very foolish to you, but I had to ask this, as I need the answer.


I'm coding an EA based on Daily time frame, and I know that Close[i] returns the closing price of the specified bar of that chart ("Daily" in this case).


But I also need the closing price values, of H4 time frame bars for my strategy, how can I do it, when I'm working on Daily charts?


Please help. I have come here to become "less foolish".


Thanks,

Siddhant Batra

cameo
464
cameo 2010.05.27 09:40  

Hi,

call iClose(Symbol(),PERIOD_H4,shift); You can call this from any TF. Use iBarshift on the Time[i] you're interested in. And insert it as shift on iClose.

H4 opens on 00:00:00, 04:00:00, 08:00:00, ..., 20:00:00 ~ closes at 03:59:59, 07:59:59, ....., 23:59:59 <-- to describe the range, but as you know, bar may closes a little late depending on tick arrival.

Helmut
410
Helmut 2010.05.27 13:50  
cameofx:

Hi,

call iClose(Symbol(),PERIOD_H4,shift); You can call this from any TF. Use iBarshift on the Time[i] you're interested in. And insert it as shift on iClose.

H4 opens on 00:00:00, 04:00:00, 08:00:00, ..., 20:00:00 ~ closes at 03:59:59, 07:59:59, ....., 23:59:59 <-- to describe the range, but as you know, bar may closes a little late depending on tick arrival.

The generosity of this forum never ceases to amaze me. In two simple lines, cameofx has given us priceless information. Thank you, cameofx.
cameo
464
cameo 2010.05.27 14:35  
You're welcome engcomp. Nice to hear some appreciation :)
Siddhant Batra
16
Siddhant Batra 2010.05.29 14:36  

Thanks a lot camoefx,


As a temporary remedy, I used iMA(Symbol(), PERIOD_H4, 1, 0, MODE_SMA, PRICE_CLOSE, 1); that is, a 1 day simple moving average of the H4 period.


But, obviously, yours is the right and logical approach and would follow that only.


Thanks a lot!

Regards,
Siddhant Batra

santoso
3
santoso 2015.02.04 17:55  

cameofx:

Hi,

call iClose(Symbol(),PERIOD_H4,shift); You can call this from any TF. Use iBarshift on the Time[i] you're interested in. And insert it as shift on iClose.

H4 opens on 00:00:00, 04:00:00, 08:00:00, ..., 20:00:00 ~ closes at 03:59:59, 07:59:59, ....., 23:59:59 <-- to describe the range, but as you know, bar may closes a little late depending on tick arrival.

i don't get it, how to get close price of higher/lower time frame in specific timeframe ?

at timeframe M5, i want to make indicator that count bollinger and closing price of higher timeframe M15 or M30

i try these but isn't working  closePrice15 = iClose(NULL,15,0);

                                         closePrice15 = iClose(NULL,15,iBarShift(NULL,15,Time[i]));

                                         upperBand15 = iBands(NULL,15,20,2,0,PRICE_CLOSE,MODE_UPPER,i);

                                         lowerBand15 = iBands(NULL,15,20,2,0,PRICE_CLOSE,MODE_LOWER,i);

example or code please.....


gadget
100
gadget 2015.02.06 10:20  
santosos, you should pass a different period to the indicators....
/
To add comments, please log in or register