Speed Up EA in Strategy Tester?

 

Hi, I wanted to ask if any one knows how to speed up an EA in the strategy tester. (a strategy tester for MQL4).

Thank You

 
A short and "smart" programmed EA and larger interval steps, to start with.
 

Thank you for your post!

1. Can you define "smart"?

2. Can you explain "larger interval steps"?

Thanks again!

 
If you have several computers you can install the same mt4 in all then say we have 3 computers and an EA that is to be tested for different stop loss values. We can let computer 1 strategy test stop loss values from 10 to 100, computer two values 100 to 200 and computer three values 200 to 300. Its like we are manually sharing the task between the three computers and this will have speeded up testing like three times.
 
VirtualReal:
A short and "smart" programmed EA and larger interval steps, to start with.
Sometimes the aspects you are reffering to cant be avoided when you want to find the most optimal settings.
 
WhooDoo22:

Thank you for your post!

1. Can you define "smart"?

2. Can you explain "larger interval steps"?

Thanks again!

1. Don't do things every tick when you only need to do them once per new bar, don't do things once per bar that you don't need to do at all.

2. If you use the Optimizer and want to test using a parameter with a range of 1 to 100 don't use steps of 1 use steps of 10 or 20

3. Get a faster CPU with more cores.

 

By far the most effective way I've found is to skip ticks. You have a tick filter in the start function that lets only every (eg) 4th tick pass trough to the rest of the start function. That will speed up the testing by 400%.

This is obviously at the expense of accuracy but far better than controlpoints which typically are only 8 'ticks'. At the end of the day you'll have to do some 'all ticks' tests to verify the results.

Also code smarter:

-some custom indicators are poorly coded and slow, they can often be speeded up a lot by reducing the number of bars they compute. If you're only interested in the last 50 bars then do not let'em process all history for every tick!

-dont calculate your lotsize for every tick. You only need the risk/lots just before entry, after the entry signals are confirmed.

- if your strategy involves only one open order at a time, then dont keep running entry indicators if you're already in the market, total wast of time.

-be very careful with string operations... they are VERY slow. Just doing a Comment() or Print() can cut the speed by several 100 percent ! I never test with these in the start function, I disable them during testing using IsTesting()

And pls make extensive use of custom functions, it'll make your life a lot easier!

I guess we've all seen the typical EA, where everything is stuffed into the Start function... and that function is nothing other than a horrible unmaintainable 'crows nest' of nested statements.

Just to give you an idea here is my latest that I'm working on right now. There are currently 22 custom functions in this program:

//---------- INIT FUNCTION ---------------------------------
void init()
   {
   GetMarketInfo();   
   return(0);
   }
//---------- END INIT FUNCTION ------------------------------
//---------- DEINIT FUNCTION --------------------------------
int deinit()
   {
   return (0);
   }
//---------- END DEINIT FUNCTION ----------------------------
//---------- START FUNCTION ---------------------------------
int start()
   {
   EnterOnSignal();//OK
   BreakEven();//Some errors
   CloseOnSignal();//OK!!
   return (0);
   }
//---------- END START FUNCTION -----------------------------
 
tonny:
If you have several computers you can install the same mt4 in all then say we have 3 computers and an EA that is to be tested for different stop loss values. We can let computer 1 strategy test stop loss values from 10 to 100, computer two values 100 to 200 and computer three values 200 to 300. Its like we are manually sharing the task between the three computers and this will have speeded up testing like three times.

Thank You!
 
tonny:
Sometimes the aspects you are reffering to cant be avoided when you want to find the most optimal settings.

Thank You!
 
RaptorUK:

1. Don't do things every tick when you only need to do them once per new bar, don't do things once per bar that you don't need to do at all.

2. If you use the Optimizer and want to test using a parameter with a range of 1 to 100 don't use steps of 1 use steps of 10 or 20

3. Get a faster CPU with more cores.


Thanks again RaptorUK!
 
DayTrader:

By far the most effective way I've found is to skip ticks. You have a tick filter in the start function that lets only every (eg) 4th tick pass trough to the rest of the start function. That will speed up the testing by 400%.

This is obviously at the expense of accuracy but far better than controlpoints which typically are only 8 'ticks'. At the end of the day you'll have to do some 'all ticks' tests to verify the results.

Also code smarter:

-some custom indicators are poorly coded and slow, they can often be speeded up a lot by reducing the number of bars they compute. If you're only interested in the last 50 bars then do not let'em process all history for every tick!

-dont calculate your lotsize for every tick. You only need the risk/lots just before entry, after the entry signals are confirmed.

- if your strategy involves only one open order at a time, then dont keep running entry indicators if you're already in the market, total wast of time.

-be very careful with string operations... they are VERY slow. Just doing a Comment() or Print() can cut the speed by several 100 percent ! I never test with these in the start function, I disable them during testing using IsTesting()

And pls make extensive use of custom functions, it'll make your life a lot easier!

I guess we've all seen the typical EA, where everything is stuffed into the Start function... and that function is nothing other than a horrible unmaintainable 'crows nest' of nested statements.

Just to give you an idea here is my latest that I'm working on right now. There are currently 22 custom functions in this program:

Wow! I agree with this statement 100%, "I guess we've all seen the typical EA, where everything is stuffed into the Start function... and that function is nothing other than a horrible unmaintainable 'crows nest' of nested statements." Very funny!" AND True! :) Props from RunnerUp^bitch3s^!

Thank You!

Reason: