Best practices to improve EA speed (Backtesting)
-
Hi everyone
Im climbing my learning curve in fxdreema, and at this point I feel that I need some information that you could help a lot.
I tried to make my EAs as simple as possible, but as you know there are many ways to achieve the same result in fxdreema. So, I would like to post here some example to understant by users experience wich options are lighter for BAcktesting and EA performance.
Here we go:
First example: Which one is faster?

which one is faster?

Another situations:
The number of buy/sell group os ordens makes EA slow? Cause I have an EA with 32 groups and is is really slow. Ans another one with 4 groups is fast.
That all for now
Thank you in advance
-
@trdjb3 Your first picture: I assume there similar but the bool flag may use less code so maybe quicker, every tick the blocks run so the flag may only have 1 line NAME==true/false.
Your second picture probably the one with the close block, the other has to turn on another block which then runs another another 2.
As a general rule the fewer blocks the quicker, every block adds lines to the code, the more lines the slower.
If you back test on control points you cannot rely on results but for testing before a final run you'll save lots of time. -
@trdjb3
Friend, let's go to some points that helped me a lot to improve the speed of the EA (Backtesting).- Know exactly where to place each block.
Block (once per bar) - Place them exactly above conditions/rules that need to wait for candles to close, if your strategy is scalp/short trade - fast and you don't aim to make long gains then this block might not be ideal . This block speeds up the backtest speed when it is not necessary for the EA to watch (every tick) and thus saves a lot of time.
Block ( For each position) or ( For each closed position) - When you are carrying out an order count (profits and losses), performing sums etc... then you do not need this count to be executed every tick, but you need the After each trade or each closed trade this is executed, for this always use these blocks, I noticed that both in ONTICK and ONTRADE they save backtesting time.
Block ( Check Flag (true-false) When using these blocks, check the need to have a block before them or not so that when this previous block is really needed, then it checks this final block true-false. I noticed that this ends improving the performance of not having to check every tick if the condition is true or false.
I have cited just a few of the many examples that I could cite here, but in general I would like to inform you that the ideal thing is that you plan your project thoroughly knowing that when all the blocks are IN ORDER, and each one in its DUE place the chances of your backtest not getting slow will be higher, I see that many projects made in FXDREEMA sometimes need a review in this regard.
The more you use the more you learn, practice makes perfect. - Know exactly where to place each block.
-
Thank you for your words, all that you said make sense.
I have digged inside my project and tested blocks performance. I Foud 5 blocks that make my EA 40% slower: this are they
https://fxdreema.com/shared/oqhwxKIBc
unfortunately i think that nothing can be changed to make this blocks faster. How can I check day profit faster then the block made for this purpose?
either, how chek open positions equity faster then use bucket of positions?
-
@trdjb3 said in Best practices to improve EA speed (Backtesting):
Como posso verificar o lucro do dia mais rápido do que o bloco feito para esse fim?
ou, como verificar o patrimônio das posições abertas mais rapidamente do que usar o balde de posições?How can I check the day's profit faster than the block made for this purpose?
The answer is in:
What is the need for you to have to watch the day's profit at every tick of the market?
Wouldn't it be more interesting to know this after each trade is closed?or, how to check equity of open positions faster than using position bucket?
I give the same answer to this question.
You just need to know the balance of open positions "if there was any open position", so put an "if position" block above.