Backtesting Template for Testing Future Scripts in Amibroker

For a Non Programmers it is really challenging to understand how to backtest future scripts in Amibroker. To solve this issue i had created a simple backtesting template where most of your backtesting settings are eliminated and its quite easier to understand too.

Backtesting Template

1)Download Backtesting Template for Amibroker
2)Unzip to local folder and copy backtest.afl to c:/program files/amibroker/formulas/include folder
3)Now add #include <backtest.afl> at the beginning of your trading system afl.
4)Goto New Analysis->Select your trading system to be backtested for futures mode and select the script to be backtested.
4)Goto Backtester Settings and Select the Positions – Long/Short and Select the required Periodicity as shown below and Press the Backtest Button.

Backtesting Template Explained

In this case we taken nifty futures as an example with an Initial Capital of 2 Lakhs and the goal is to trade a trading system with fixed shares 100 shares i.e 2 lots of Nifty every time. Rs100 of fixed Brokerage cost(Brokerage+Slippage+Transaction Cost) included in every leg of transaction.

SetTradeDelays – SetTradeDelays allows you to control trade delay. For example if your trade occurs at the end of the candle and if you want to execute your Buy/Sell/Long/Short orders then you can settradedelays(1,1,1,1) and generally settradedelays(0,0,0,0) represents no delay in execution.

Setpositionsize – This function defines how many number of shares you want to trade every time. Can be varied according to your trading style.

InitialEquity – Represents the Initial Capital Required for Backtesting Future data. And it can be varied according to your trading style and capital requirement to be backtested.

RoundLotSize – Roundlotsize is where you have to define your lot size and in case of nifty it is 50. You have to vary it according to the instrument you are willing to backtest.

CommissionMode – You can set the commissionmode depends upon how your broker charges you. Set it according to your type of broker or brokerage plan you adopted. Shown the values to be setted for different style of brokerage commissions.

About Rajandran

Rajandran is a Full time trader and founder of Marketcalls & Co-Founder of Traderscafe, trades mostly using discretionary Trading Concepts like Market Profile, Trading sentimental analysis, building timing models, algorithmic trading models. Instructs professional traders, full time traders & aspiring full time traders. Rajandran attended college in the Chennai where he earned a BE in Electronics and Communications. Rajandran has a broad understanding of trading softwares like Amibroker, Ninjatrader, Esignal, Metastock, Motivewave, Market Analyst(Optuma),Metatrader,Tradingivew,Python and understands individual needs of traders and investors utilizing a wide range of methodologies.

Data and information is provided for informational purposes only, and is not intended for trading purposes. Neither marketcalls.in website nor any of its promoters shall be liable for any errors or delays in the content, or for any actions taken in reliance thereon.