Post by jb on Nov 15, 2015 14:43:39 GMT
Tring to post a new message but for some reasons does not go thought. Please see below. Useful if we could open a new tread.
I have used two approaches in the preparation of the code snippets below.
Code Set1 to Set20 are unique. All the codes below Set20 use the same structure:
option="NAME OF THE SET OPTION";
Set=Param(Option,0,0,100,1); SetOption( Option,Set);
testing them before sharing in amibroker forum.
Have I made any huge mistake?
I have used two approaches in the preparation of the code snippets below.
Code Set1 to Set20 are unique. All the codes below Set20 use the same structure:
option="NAME OF THE SET OPTION";
Set=Param(Option,0,0,100,1); SetOption( Option,Set);
testing them before sharing in amibroker forum.
Have I made any huge mistake?
Set1 = ParamToggle( "NoDefaultColumns", "FALSE|TRUE", 0 ); // if set to True - exploration does not have default Ticker and Date/Time columns
SetOption( "NoDefaultColumns", Set1 ) ;
Set2 = Param( "InitialEquity", 10000, 0, 1000000, 1 );
SetOption( "InitialEquity", Set2 ) ;
Set3 = ParamToggle( "AllowSameBarExit" , "FALSE|TRUE", 0 );
SetOption( "AllowSameBarExit", Set3 ) ;
Set4 = ParamToggle( "ActivateStopsImmediately" , "FALSE|TRUE", 0 );
SetOption( "ActivateStopsImmediately", Set4 ) ;
Set5 = ParamToggle( "AllowPositionShrinking" , "FALSE|TRUE", 0 );
SetOption( "AllowPositionShrinking", Set5 ) ;
Set6 = ParamToggle( "FuturesMode" , "FALSE|TRUE", 0 );
SetOption( "FuturesMode" , Set6 ) ;
Set7 = ParamToggle( "InterestRate" , "FALSE|TRUE", 0 );
SetOption( "InterestRate" , Set7 ) ;
Set8 = Param( "MaxOpenPositions", 10, 0, 1000, 1 ); // maximum number of simlutaneously open positions (trades) in portfolio backtest/optimization
SetOption( "MaxOpenPositions", Set8 ) ;
Set9 = ParamToggle( "WorstRankHeld" , "FALSE|TRUE", 0 ); // the worst rank of symbol to be held in rotational trading mode (see EnableRotationalTrading for more details)
SetOption( "WorstRankHeld" , Set9 ) ;
Set10 = Param( "MinShares", 1, 0, 1000, 1 ); // the minimum number of shares required to open the position in the backtester/optimizer. If you don't have enough funds to purchase that many, trade will NOT be entered
SetOption( "MinShares", Set10 ) ;
Set11 = Param( "MinPosValue", 1, 0, 1000000, 1 ); // (4.70.3 and above) the minimum dollar amount required to open the position in the backtester/optimizer. If you don't have enough funds trade will NOT be entered
SetOption( "MinPosValue", Set11 ) ;
Set12 = "0-commission table,1-percent of trade,2-$ per trade,3-$ per share/contract";
CommModetog = ParamList( "Report Mode:", Set12, Defaultval = 2 );
for( n = 0; ( Mode = StrExtract( Set12, n ) ) != ""; n++ ) {
if( Mode == CommModetog )
break;
}
SetOption( "CommissionMode", n );
Set13 = Param( "CommissionAmount", 0, 0, 1000, 0.1 ); // amount of commission in modes 1..3
SetOption( "CommissionAmount", Set13 ) ;
Set14 = Param( "AccountMargin", 100, 0, 100, 0.1 ); // account margin requirement (as in settings), 100 = no margin
SetOption( "AccountMargin", Set14 ) ;
Set15 = ParamToggle( "PriceBoundChecking", "FALSE|TRUE", 0 ); // if set to False - disables checking and adjusting buyprice/sellprice/coverprice/shortprice arrays to current symbol High-Low range.
SetOption( "PriceBoundChecking" , Set15 ) ;
Set16 = ParamToggle( "ReverseSignalForcesExit", "FALSE|TRUE", 1 ); // reverse entry signal forces exit of existing trade (default = True )
SetOption( "ReverseSignalForcesExit" , Set16 ) ;
Set17 = ParamToggle( "UsePrevBarEquityForPosSizing", "FALSE|TRUE", 0 ); // Affects how percent of current equity position sizing is performed. False (default value) means: use current (intraday) equity to perform position sizing, True means: use previous bar closing equity to perform position sizing
SetOption( "UsePrevBarEquityForPosSizing" , Set17 ) ;
Set18 = "0 - trade list,1 - detailed log,2 - summary,3 - no output (custom only)";
ReportModetog = ParamList( "PortfolioReportMode:", Set18, Defaultval = 2 );
for( n = 0; ( Mode = StrExtract( Set18, n ) ) != ""; n++ ) {
if( Mode == ReportModetog )
break;
}
SetOption( "PortfolioReportMode", n );
Set19 = ParamToggle( "UseCustomBacktestProc", "FALSE|TRUE", 1 ); // True/False - allows to turn on/off custom backtest procedure (default = True )
SetOption( "UseCustomBacktestProc" , Set19 ) ;
Set20 = ParamToggle( "EveryBarNullCheck", "FALSE|TRUE", 1 ); // allows to turn on checking for Nulls in arithmetic operations on every bar in the array(by default it is OFF - i.e. AmiBroker checks for nulls that appear in the beginning of the arrayand in the end of the array and once non-null value is detected it assumes no further holes (nulls) in the middle). Turning "EveryBarNullCheck" to True allows to extend these checks to each and every barwhich is the way 4.74.x and earlier versions worked. Note however that turning it on gives huge performance penalty (arithmetic operations are performed even 4x slower when this option is ON, so don't use it unless you really have to).
SetOption( "EveryBarNullCheck" , Set20 ) ;
option = "HoldMinBars"; // Number - if set to value > 0 - it disables exit during user-specified number of bars even if signals/stops are generated during that period
Set = Param( Option, 0, 0, 100, 1 );
SetOption( Option, Set );
option = "EarlyExitBars"; // Number if set to value > 0 - causes that special early exit (redemption) fee is charged if trade is exited during this period
Set = Param( option, 0, 0, 100, 1 );
SetOption( option , Set ) ;
option = "EarlyExitFee"; // Number if set to value > 0 - causes that special early exit (redemption) fee is charged if trade is exited during this period
Set = Param( option, 0, 0, 100, 0.01 );
SetOption( option, Set ) ;
option = "HoldMinDays"; // HoldMinDays - Number - if set to value > 0 - it disables exit during user-specified number of CALENDAR DAYS (not bars) even if signals/stops are generated during that period
Set = Param( option, 0, 0, 100, 0.01 );
SetOption( option, Set ) ;
option = "EarlyExitDays"; // Number if set to value > 0 - causes that special early exit (redemption) fee is charged if trade is exited during the period specified in calendar days (not bars).
Set = Param( option, 0, 0, 100, 0.01 );
SetOption( option, Set ) ;
option = "DisableRuinStop"; // it set to TRUE built-in ruin stop is disabled
Set = ParamToggle( option, "FALSE|TRUE", 0 );
SetOption( option , Set ) ;
option = "PortfolioReportMode"; //allows to suppress/force generation of backtest report. Allowable values: 0, 1, or 2
Set = "0 - suppress generation of report,1 - force generation of full report,2 - only one-line report is generated";
ReportMode = ParamList( option, Set, Defaultval = 2 );
for( n = 0; ( Mode = StrExtract( Set, n ) ) != ""; n++ )
{
if( Mode == ReportMode )
break;
}
SetOption( option, n );
option = "SeparateLongShortRank"; // True/False
Set = ParamToggle( option, "FALSE|TRUE", 0 );
SetOption( option , Set ) ;
option = "MaxOpenLong"; // limits the number of LONG positions that can be open simultaneously. ZERO (default) means NO LIMIT.
Set = Param( option, 0, 0, 100, 1 );
SetOption( option, Set ) ;
option = "MaxOpenShort"; // limits the number of SHORT positions that can be open simultaneously ZERO (default) means NO LIMIT.
Set = Param( option, 0, 0, 100, 1 );
SetOption( option, Set ) ;
option = "RefreshWhenCompleted"; // when set to TRUE, it will perform View->Refresh All after Automatic-Analysis operation (scan/exploration/backtest/optimize) is completed.
Set = ParamToggle( option, "FALSE|TRUE", 0 );
SetOption( option , Set ) ;
option = "RequireDeclarations"; // when set to TRUE the AFL engine will always require variable declarations (using local/global) on formula-by-formula basis
Set = ParamToggle( option, "FALSE|TRUE", 0 );
SetOption( option , Set ) ;
option = "ExtraColumnsLocation"; //allows the user to change the location of custom columns added during backtest/optimization. "extra" columns mean: //a) any custom metrics added using custom backtester //b) any optimization parameters defined using
Set = Param( option, 0, 0, 100, 1 );
SetOption( option, Set ) ;