if(currentOpen != iOpen("GBPJPY",PERIOD_D1,0)) { // currentOpen = iOpen("GBPJPY",PERIOD_H1,0); }
Why are you checking against the daily chart and then setting the value according to the H1 chart?
that doesn't make sense.
if(iClose("GBPJPY",PERIOD_H1,0) > iOpen("GBPJPY",PERIOD_H1,0))
If you happen to catch the first tick of a bar, Open will equal the Close. In the strategy tester, you will definitely catch the first tick.
That period_d1 was a mistake, forgot to change it when I changed the strategy from daily to hourly time chart, whoops. It didn't work before that anyways.
But disregarding that, if you call iClose on a bar that hasn't closed yet, does it return the current value, or does it just not work?
I see now what I need to change though, I need to shift back one bar when I'm using the if statements that make the orders. Thank you!
Awesome, thank you for the resources.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I am very new to this, and I am learning mql4 so I can backtest some of my strategies with the MT4 strategy tester.
I have a very simple strategy that buys in the direction of the last candle printed as soon as a new candle prints.
My EA doesn't seem to work correctly. The results don't make sense for what the strategy is supposed to do. I must have coded it wrong.
Are there any beginner mistakes that you might be able to point out for me?
Thank you in advance for any advice you can give!