Hi,
I've made some changes.
It works now.
SteveBrown:
I need help getting my first Expert Advisor to work in Strategy Tester. The attached debugEA.mq4 is a short, simplified version which fails in the same manner. This version waits for a new hourly candle and the SMA8 crossing SMA24 to open and close trades. The problem is that when I run it in Strategy Tester, it opens the first trade at the appropriate time, but it does not close the trade nor open any new trades at subsequent MA crossovers. What am I doing wrong? I will be grateful to anyone who can find the problem and correct it.
I need help getting my first Expert Advisor to work in Strategy Tester. The attached debugEA.mq4 is a short, simplified version which fails in the same manner. This version waits for a new hourly candle and the SMA8 crossing SMA24 to open and close trades. The problem is that when I run it in Strategy Tester, it opens the first trade at the appropriate time, but it does not close the trade nor open any new trades at subsequent MA crossovers. What am I doing wrong? I will be grateful to anyone who can find the problem and correct it.
Files:
debugea_v1.mq4
3 kb
Thanks, igorad. God bless you.
Incorporating igorad's changes, I revised the EA in order to implement the basic MA crossover strategy accurately. Although it is a losing trading strategy, this EA may serve as a good "bare bones" template on which to build Expert Advisors.
Files:
debugea_v3.mq4
2 kb
This EA also works fine with 5M timeframes as well
Probably also would work with any other timeframes, too.

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
I need help getting my first Expert Advisor to work in Strategy Tester. The attached debugEA.mq4 is a short, simplified version which fails in the same manner. This version waits for a new hourly candle and the SMA8 crossing SMA24 to open and close trades. The problem is that when I run it in Strategy Tester, it opens the first trade at the appropriate time, but it does not close the trade nor open any new trades at subsequent MA crossovers. What am I doing wrong? I will be grateful to anyone who can find the problem and correct it.