Hi guys,
I have an annoying error that causes my EA to place multiple (sometimes as many as 100) trades and then close them straight away because the fast moving average that I use as a close signal has not yet caught up with the price and fallen below the buy signal. So essentially both conditions are true at the same time (enter buy / exit buy). This is what the chart looks like.
Its responding to an if statement that states if 5 bars close above the green line open a buy order and also another if statement that states if two bars close below the red line close the buy order. I'd like to avoid changing the positions of the MA lines, and also I'd like to avoid making the triggers any more or less sensitive. Can anybody suggest anything that I could do to prevent this?
That is not an issue of the average
That is an issue of the code managing orders
If you want to avoid the change of the current average value, the simplest is to :
- use open price for average
- use the average value on the first closed bar

- 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 guys,
I have an annoying error that causes my EA to place multiple (sometimes as many as 100) trades and then close them straight away because the fast moving average that I use as a close signal has not yet caught up with the price and fallen below the buy signal. So essentially both conditions are true at the same time (enter buy / exit buy). This is what the chart looks like.
Its responding to an if statement that states if 5 bars close above the green line open a buy order and also another if statement that states if two bars close below the red line close the buy order. I'd like to avoid changing the positions of the MA lines, and also I'd like to avoid making the triggers any more or less sensitive. Can anybody suggest anything that I could do to prevent this?