Amibroker Backtest Settings Template

#1
here is the all the amibroker backtest settings. Some settings can not be set using AFL.

// Initialize the trading parameters

//EnableRotationalTrading();

BuyPrice = SellPrice = ShortPrice = CoverPrice = Open;

SetTradeDelays( 1, 1, 1, 1 );

//SetFormulaName( "TEST" );

SetOption( "InitialEquity", 1000 );
SetOption( "MinShares", 0.0001 );
SetOption( "MinPosValue", 0 );
SetOption( "FuturesMode", False );
SetOption( "AllowPositionShrinking", True );
SetOption( "ActivateStopsImmediately", False );
SetOption( "ReverseSignalForcesExit", True );
SetOption( "AllowSameBarExit", True );
SetOption( "CommissionMode", 2 );
SetOption( "CommissionAmount", 0 );
SetOption( "InterestRate", 0 );
SetOption( "MarginRequirement", 100 );
SetOption( "PortfolioReportMode", 0 );
SetOption( "MaxOpenPositions", 1 );
SetOption( "WorstRankHeld", 1 ); // Not in settings
SetOption( "PriceBoundChecking", False ); // Not in settings
SetOption( "UsePrevBarEquityForPosSizing", True );
SetOption( "UseCustomBacktestProc", False );
SetOption( "DisableRuinStop", False ); // Not in settings
SetOption( "EveryBarNullCheck", False ); // Not in settings
SetOption( "HoldMinBars", 0 ); // Not in settings
SetOption( "HoldMinDays", 0 ); // Not in settings
SetOption( "EarlyExitBars", 0 ); // Not in settings
SetOption( "EarlyExitDays", 0 ); // Not in settings
SetOption( "EarlyExitFee", 0 ); // Not in settings
SetOption( "SeparateLongShortRank", False ); // Not in settings
SetOption( "MaxOpenLong", 0 ); // Not in settings
SetOption( "MaxOpenShort", 0 ); // Not in settings

MaxPos = 100 * 100 / GetOption("MarginRequirement");
PositionSize = -MaxPos / GetOption("MaxOpenPositions");

RoundLotSize = 0; // 0 for Funds, 100 for Stocks
TickSize = 0; // 0 for no min. size
MarginDeposit = 0;
PointValue = 1; // For futures

ExitAtTradePrice = 0;
ExitAtStop = 1;
ExitNextBar = 2;
ReEntryDelay = 0;

ApplyStop( stopTypeLoss, stopModeDisable, 0, ExitAtTradePrice, ReEntryDelay );
ApplyStop( stopTypeProfit, stopModeDisable, 0, ExitAtTradePrice, ReEntryDelay );
ApplyStop( stopTypeTrailing, stopModeDisable, 0, ExitAtTradePrice, ReEntryDelay );
ApplyStop( stopTypeNBar, stopModeDisable, 0, ExitAtTradePrice, ReEntryDelay );

// THE FOLLOWING CANNOT BE SET PROGRAMMATICALLY AND SHOULD BE CHECKED

// Pad and align
// Reference symbol
// Risk-free rate Sharpe
// Risk-free rate UPI
// Add artificial future bar
// Limit trade size %
// Disable trade size limit
// Walk forward mode and data parameters
// Optimization target

Credit: This is a SetOption template by Bruce Robinson and it can be found at amibrokeru.com (Amibroker University).
 

Similar threads