Is there a benchmark on the running time for tester or optimization? What are the things to note in writing efficient EA?
Dont do everything every tick if you can avoid it
Some things only need checking once per bar
If there is a heavy function that checks for entry, do the simple checks first, eg
if (TimeToTrade()==true) // Check this first if (OpenOrderCount() < MaxOrders) // Then check this { iTrade = MonsterEntryFunction() // Only engage this when you need to if (iTrade == OP_BUY) { // So buy order here } if (iTrade == OP_SELL) { // So sell order here } }
Avoid long lines of && && && conditions
Dont put indicator code in an EA, etc, etc
FWIW
-BB-
And no there isnt any benchmark that is possible - you just have to be ruthlessly objective when reviewing your code
It is a very useful exercise, because if in live trading you have many EA's or many copies of one EA but on many pairs, you really do want to minimize CPU overhead
Also look at not overloading the orders channel, eg by only moving trailing stops every 2 full pips etc
-BB-
....
Dont put indicator code in an EA, etc, etc
...Just wanted to add, some custom indicators are badly coded and really slow down a backtest. In those instances, I would recommend re building the indicator or building efficient code into your EA. You can tell the bad indicators when you attach them to the chart when testing in visual mode. If you see a difference in the speed, then worth looking at the indicator more closely.
V
- 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 all, what is your running time for your EA in both testing and optimization mode?
I need to know if my EA is running too slow. My machine is a Intel Quad-core 6GB RAM.
Currently, for both modes, it takes around 45mins for M1 (timeframe) for start: 2010-Jan to end: 2010-June
What are the things to note in writing efficient EA?