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
The expert advisor I wrote is very slow in backtesting. Therefore, I attempted to rewrite it to only look at the recent closed bar, unless one of the preconditions for trading was close to being met, in which case it would calculate every tick, as before.
Unfortunately, now the two versions produce different results. Usually the first version enters a trade slightly before the second version, though sometimes the second version enters a trade slightly sooner. This is a huge problem mostly because it means I am misunderstanding how my code runs!
Here is the main function in both versions, abbreviated to only show the important stuff:
Here is the Ontick function in the first version:
Here is the second version, which triggers calculating every tick long before either version would enter a trade:
Please help me understand. The trades should be exactly the same, but they aren't. Thank you for your time.