Is Optimization Good In Trading? (How To Optimize Backtests Correctly) (Amibroker Code)

The original article can be found here.

How to optimize in Amibroker:

The example below is the RSI-example from the article.

SetOption(“initialEquity”,100000);
SetPositionSize(99.75*leverage,spsPercentOfEquity);
setOption(“MaxOpenPositions”,1);
setOption(“holdminbars”,1);
SetTradeDelays( 0, 0, 0, 0 );

oddis=Optimize(“#Days RSI”,2,2,5,1);
oddis1=Optimize(“Buy threshold”,15,10,35,5);
oddis2=Optimize(“Sell threshold”,85,65,90,5);

Buy= Cross(oddis1,RSI(oddis));
BuyPrice=Close;
Sell= Cross(RSI(oddis),oddis2);
SellPrice=Close;

 

Disclaimer: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.