Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

A-Z Index | Category Index |

SETOPTION
- sets options in automatic analysis settings

Trading system toolbox
(AFL 2.3)


SYNTAX SetOption( field, value )
RETURNS NOTHING
FUNCTION Sets various options in automatic analysis settings. Affects also Equity() function results.

field - is a string that defines the option to change. There are following options available:

  • "NoDefaultColumns" - if set to True - exploration does not have default Ticker and Date/Time columns
  • "InitialEquity"
  • "AllowSameBarExit"
  • "ActivateStopsImmediately"
  • "AllowPositionShrinking"
  • "FuturesMode"
  • "InterestRate"
  • "MaxOpenPositions" - maximum number of simlutaneously open positions (trades) in portfolio backtest/optimization
  • "WorstRankHeld" - the worst rank of symbol to be held in rotational trading mode (see EnableRotationalTrading for more details)
  • "MinShares" - 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
  • "MinPosValue" - (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
  • "PriceBoundChecking" - if set to False - disables checking and adjusting buyprice/sellprice/coverprice/shortprice arrays to current symbol High-Low range.
  • CommissionMode -
    0 - use portfolio manager commission table
    1 - percent of trade
    2 - $ per trade
    3 - $ per share/contract
  • CommissionAmount - amount of commission in modes 1..3
  • AccountMargin (in old versios it was 'MarginRequirement') - account margin requirement (as in settings), 100 = no margin
  • ReverseSignalForcesExit - reverse entry signal forces exit of existing trade (default = True )
  • UsePrevBarEquityForPosSizing - 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
  • PortfolioReportMode - sets backtester report mode:
    0 - trade list
    1 - detailed log
    2 - summary
    3 - no output (custom only)
  • UseCustomBacktestProc - True/False - allows to turn on/off custom backtest procedure
  • EveryBarNullCheck - 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).
  • 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
  • EarlyExitBars - Number if set to value > 0 - causes that special early exit (redemption) fee is charged if trade is exited during this period
  • EarlyExitFee - defines the % (percent) value of early exit fee
  • 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
  • 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).
  • DisableRuinStop - it set to TRUE built-in ruin stop is disabled
  • Generate report - allows to suppress/force generation of backtest report. Allowable values: 0, 1, or 2
    By default backtest reports are generated ONLY for portfolio backtests and for individual backtests if individual reporting is turned on in the settings. Reports are disabled for optimization.
    Now with the SetOption() function you can either supress report generation for backtests or enable report generation during certain optimization steps, all from code level.
    SetOption("GenerateReport", 0 ); // suppress generation of report
    SetOption("GenerateReport", 1 ); // force generation of full report
    SetOption("GenerateReport", 2 ); // only one-line report is generated (in results.rlst file) viewable as single line in Report Explorer

WARNING: If you change the option on *per-symbol* basis the composite results (%profit for example) will be DISTORTED since calculations assume that OPTIONS are constant for all symbols in one backtest run. 'HoldMinBars', 'EarlyExit..." options are exception from this rule (i.e. can be safely set on per-symbol basis)

EXAMPLE SetOption("InitialEquity", 5000 );
SetOption("AllowPositionShrinking", True );
SetOption("MaxOpenPositions", 5 );
PositionSize = -100/5;
SEE ALSO EnableRotationalTrading() function , EQUITY() function

References:

The SetOption function is used in the following formulas in AFL on-line library:


Add your comment:

(please do not ask questions here, if you have a question please send it to support e-mail address)

Your name:
Your e-mail:
Comment:
 

About | Privacy | Terms of Use | Contact information
Copyright © 2003 AMIBROKER.COM