"No Trade" Block condition issue resulting zero divide when "first" added to the Metatrader.
-
I've identified a potential issue related to the "No Trade" block that seems to cause a divide by zero error under specific conditions:
Steps to Reproduce:
Prerequisite: Ensure auto trading is enabled.-
Launch MetaTrader and add a symbol that is not part of the default startup list.
-
Copy the EA into the MetaTrader Experts folder.
-
Attach the EA to the newly added symbol.
-
Once the condition in the EA is triggered, the divide by zero error may occur.
Workaround:
I resolved the issue by removing the "No Trade" block and replacing it with the "Check Trade Count" block, which prevented the error.EA link: https://fxdreema.com/shared/Nbvs0Q39
-
-
Really weird. Both blocks work normally on my projects without haveing to substitute them.
-
@l-andorrà
Agree. Probably not related to fxdreema.It is likely that the chart do not have enough histoical data during the first startup, that make any EA or indicator fail in calculation
-
I agree. If you replace the "No Trade" block with the "Check Trades Count" block, the trade would execute without any errors. I haven't tested this yet, but I’m wondering—what if, after adding the symbol, you immediately load the history data? Maybe then the trade would execute properly even with the "No Trade" block. Also, when you get the error using the "No Trade" block, re-attaching the EA to the same chart usually clears it. So the error typically only happens on the initial startup.
-
@lvang1126 Is the error happening on different brokers and data histories? Maybe the issue is on a specific broker data only.
-
The brokers I tested that were affected by this issue include BlackBullMarket-Demo, FXPig-Demo, and Alpari-ECN Demo. These were all free demo accounts I was able to create. I'm sure there are many others, but these are the ones I've tested so far.
-
Then the problem is apparently on the code itself. I guess some of the fxDreema blocks were corrupt. I know this can be annoying but the best way to check it out is building the whole project from scratch again (no copying any block from the original one). Then try the new version normally to confirm the issue still persists or not.