Stop looking at the current bar. One tick above you open, one tick below you close. What do you expect to happen?
I think I figured out what is happening. The buy is based on the MA(50)-CLOSE and the close trade is based on the MA(14)-CLOSE price. The bar that I open the trade, 3 minutes later the CLOSE price drops below the MA(10)-CLOSE and it executes the sell order.
So... How do I set it up to, once the BUY order has triggered, do not execute the SELL order for 2 or 3 bars?
if(Period()==PERIOD_D1) { // only buy here }
I'm working on creating an EA that purchases long when the price (close) crosses above the MA line and closes the trade when the price (close) crosses below the MA line.
My issue is that when I run the strategy tester, it is opening and closing the trade immediately.
I've used an online generator to create the EA, but can someone tell me what I need to add to not have it open and close at the same time?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm working on creating an EA that purchases long when the price (close) crosses above the MA line and closes the trade when the price (close) crosses below the MA line.
My issue is that when I run the strategy tester, it is opening and closing the trade immediately.
I've used an online generator to create the EA, but can someone tell me what I need to add to not have it open and close at the same time?