In this tutorial we want to optimize the below script. The script has been explained here: Backtesting Tutorial.

BUY = CLOSE < 10;
SELL = CLOSE > 15;

To use the optimizer for the above script, we need to insert the Optimize function:

Optimize( LABEL, DEFAULT_VALUE, MIN_VALUE, MAX_VALUE, STEP)

  • LABEL is used for the output in the optimizer report.
  • DEFAULT_VALUE this value is used when the backtest button is used instead of the optimize button.
  • MIN_VALUE the optimizer starts with this value
  • MAX_VALUE this is the maximum value..
  • STEP this value is used for increasing values from MIN_VALUE to MAX_VALU

 

buy = close < Optimize("BuyValue", 10, 1, 50, 5);
sell = close > Optimize("SellValue", 15, 2, 50, 5);

Replace the script and start the optimizer.

© Copyright Erich Behmen 2009 - 2012. All Rights Reserved