Strategy Optimization

<< <%SKIN-STRTRANS-SYNTOC%> >>

Navigation:  Video Tutorial >

Strategy Optimization

menu_video Watch the video here.

 

In this tutorial, I'm going to show you how to create "inputs" and how to optimize the breakout system we created in the previous video.

 

The first input should obviously be the time when pending orders are placed. Edit condition...

 

clip0292

 

and check the checkbox with the title "Add to inputs".

 

clip0293

 

Add new input...

 

clip0294

 

we will leave the suggested name...

 

clip0295

 

and it appears in the list of appropriate inputs.

 

clip0296

 

clip0297

 

The number 10 has been replaced by the input name in violet.

 

clip0298

 

Do the same with all other conditions that include the time of the day.

 

clip0299

 

clip0300

 

The input has already been created.

 

clip0301

 

clip0302

 

The next input we want to optimize is the Take Profit in Pips.

 

clip0303

 

Add to inputs...

 

clip0304

 

Add New Input...

 

clip0305

 

and replace the suggested name.

 

clip0306

 

clip0307

 

Click OK three times. The Take Profit value has been replaced by a variable name.

 

clip0308

 

The other conditions will be replaced quickly by clicking on the magic button.

 

clip0309

 

And the last input we want to optimize is the Trailing Stop.

 

clip0310

 

The number of bars determines how often the Stop Loss is moved. Add to inputs...

 

clip0311

 

Add new input...

 

clip0312

 

we will replace the suggested name with a more suitable one.

 

clip0313

 

clip0314

 

clip0315

 

And the same for short positions.

 

clip0316

 

Copy the source, replace the old source and compile it.

 

clip0317

 

clip0318

 

In the Strategy Tester, check Optimization.

 

clip0319

 

In Expert Properties, we will set up optimization. Uncheck Genetic algorithm (if checked). If you have more parameters, I recommend you use genetic optimization, because it will be much faster.

 

clip0320

 

In Inputs, we will choose some reasonable testing intervals.

 

The Time Hour will be tested with step 1 from 0 to 23.

The Take Profit in Pips will be tested with step 20 from 20 to 500.

The Stop Loss Interval will be tested with step 1 from 1 bar to 20 bars.

 

clip0321

 

Choose an optimization date interval of at least a few years...

 

clip0322

 

and start optimization. Depending on the number of parameters and intervals, optimization can take quite a while... from a few minutes up to millions of years.

 

clip0323

 

As seen in the optimization graph, the various profitable parameter sets are concentrated around the Time Hour value of 20 o'clock. It is the darkest area.

 

clip0324

 

I recommend you sort the optimization results by the drawdown percentage.

 

clip0325

 

We are looking for a system with a stable equity. For example, a good set-up might be 20 o'clock, 200 pips, moving Stop Loss every single bar (double-click on the row).

 

clip0326

 

clip0327

 

clip0328

 

These are the basics of system development, demonstrated on a simple system that can be improved. You can also experiment with different exit strategies, such as using the Average True Range indicator instead of the number of pips, and so on. This breakout system is also great for trading the news. It places two pending orders just before the news is released and catches the breakout on the long or short side.