datetime time_H1=iTime(_Symbol,PERIOD_H1,bar_number); datetime time_H4=iTime(_Symbol,PERIOD_H4,bar_number);
Marco vd Heijden:
its showing date. What I am suppose to do is I want to check if
H1 HA Last Candle Close value > H1 Last Candle EMA
&&
H4 HA Last Candle Close value > H4 Last Candle EMA
than open a pending trade.
- This logic is fine Say suppose right now H1 current active candle is 10am candle but in H4 current active candle is 8am in that candle I am getting data of 10am which is fine.
- When in H1 I access last candle value it will give me value of 9am candle which is also fine Now when in H4 I will try to access value of last candle I will get data of 4am candle. Now the problem begin If i will compare 9am candle values with 4am candle values now you can think what disaster my EA can create in this situation.
kumaillakhani:
Hello,
What logic should I use for getting H1 & H4 value of same time?
This was your question, so i answered that.
You can compare datetimes but in this case there is no use to that.
Unless you understand this:
datetime time_H1=iTime(_Symbol,PERIOD_H1,bar_number); datetime time_H4=iTime(_Symbol,PERIOD_H4,bar_number);
And then
if(time_H1 == time_H4) { Print("Same Candle Time"); }
for a close use
double close=iClose(_Symbol,PERIOD_H4,bar_number);

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
From above code when I am accessing previous candle on H1 it is give me values of 10:00 am candle but in H4 it is giving me values of 4:00 am candle. According to code its right but logically it should give me same time value.
What logic should I use for getting H1 & H4 value of same time?