EA not closing out trades on MA crossover
-
Hi all,
For my EA I'm trying to implement a rule where my trades are closed when the price crosses my moving average. As you can see below the trade is only closed the candle after the crossover:

These are my settings:

The strange this is that sometimes it does work like here FE:

Perhaps important to mention is that I have a condition where my EA only runs once per day with these settings:

I have also tried this option but then it doesn't close my trades at all.

This is an overview of how my EA is strucutred, perhaps my problem is in the structure?

Thanks for all the help you gave me already!
Cheers!
-
@caesarcrypto Use a pass block and make the close seperate.
-
@trader-philipps Sorry for my noob questions but what is a pass block or how does it look like?
-
It is the first option under the "More..." Tab (listed on the left)
-
@caesarcrypto Simply remove these links from close condition, it's an error because you already have two time filter condition above, it means that the closure of trade is affected by these filters

-
@ambrogio Yes but I only want to close out the trades when the condition is met during the timestamp set in the filter above.
Because price can drop below and bounce back above the MA during the day but I dont want the trades to be closed then. Only when price is still below the MA just before the close of the candle.
If I remove those links wont they be closed out immediately on the cross below the MA?
Thanks already for all the help!
-
@caesarcrypto Change "once a day" block with "hours filter" block and let me know (without remove the links)
-
@ambrogio When I tried the hours filter it gave me the same results but then I realised I was using the backtester on visual mode at the settings "control point" instead of every tick because that takes way too long.
So I tried with visual mode off and with setting "every tick" and now it closes on the right candle.
I still find that odd because on the control points settings it jumps 20 minutes every time and my hours settings are 23:30 - 23:59. So I would think that when it jumps from 23:20 to 23:40 it should close the trade at 23:40 because at that time the price is below the MA... But it doesn't and I also noticed that on this mode it doesn't pick up on certain trades that it should be entering.
So the problem of the trades not losing is solved but now I wonder, is there no way to be able to analyse your trades on chart without the slow "every tick" option in visual mode?
Thanks!
-
A remark also said to split out the closing of the trades from the rest. So here below the left setup is better than the right one?

-
@caesarcrypto said in EA not closing out trades on MA crossover:
@ambrogio When I tried the hours filter it gave me the same results but then I realised I was using the backtester on visual mode at the settings "control point" instead of every tick because that takes way too long.
So I tried with visual mode off and with setting "every tick" and now it closes on the right candle.
I still find that odd because on the control points settings it jumps 20 minutes every time and my hours settings are 23:30 - 23:59. So I would think that when it jumps from 23:20 to 23:40 it should close the trade at 23:40 because at that time the price is below the MA... But it doesn't and I also noticed that on this mode it doesn't pick up on certain trades that it should be entering.
So the problem of the trades not losing is solved but now I wonder, is there no way to be able to analyse your trades on chart without the slow "every tick" option in visual mode?
Thanks!
No, there is not. Indeed, it is always very useful to make the visual backtest on each tick, and your case is demonstrated
-
Could you please share the last vesrion? Screenshots don't allow any potential bug within the blocks.
-
@l-andorrà hi, it's solved by using the tester on every tick feature

-
@l-andorrà If you still want to check, this is the link: https://fxdreema.com/shared/UD2eAPmue
Perhaps you see other mistakes or inefficiencies that I made
-
Interesting project. Nothing wrong as far as I can see. Tell us if you become a millionaire soon!
