This function will remove instrument from the portfolio.  It removes access to the instrument by changing the state of the symbol's inPortfolio property.  When an instrument's symbol is included in the loaded portfolio, the instrument.inPortfolio property has a value of TRUE.  When an instrument portfolio, and the instrument.inPortfolio property is FALSE, Trading Blox Builder will not use the symbol.  

 

This Function is an Instrument Data Function.  It should be run in the Set Parameters script section defore the data is loaded, and the system's indicators perform the system's indicator calculations.  The Set Parameters script section was implemented so the memory needed for each symbol is needed, and the time it takes to load the data.  By changing the access state of a symbol to False, the time to load, and calculate indicators isn't used and the memory required isn't needed.

 

Previously, this function was executed in the BEFORE TEST script so the time saving and the memory used is wasted because .  When it is used in that script section the instrument's data will be loaded and the system's indicator calculations will run because the instrument's inPortfolio property is TRUE until the DisableTrading function changes the property to FALSE.

 

The instrument.inPortfolio property value can be changed by using the instrument.DisableTrading(index).  Changing the state of the instrument.inPortfolio property is best done in the Set Parameters script section.  The Set Parameters script section executes ahead of the Before Test script section where the instruments in the portfolio are loaded and used in the calculation of indicators.

 

When an instrument in the portfolio is removed from being accessible by using the Set Parameters script section, the data won't consume any time to load it, and it won't need any memory space to hold any calculated indicators.

 

can change the instrument's is changed by the instrument.DisableTrading function, it instrument.inPortfolio value will change from a 1 = (TRUE) to a 0 =(FALSE).  

 

These script section, Exit Orders,  Entry Orders,  Update Indicators, won't execute for an instruments  when its instrument.inPortfolio property  is FALSE.

 

This function does not remove a symbol's character text from the portfolio's save list of symbols, those will always be in place until changed using the Portfolio Manager.   This function's ability allows the trader to load a large list of instrument symbols and provides a method for removing all the symbols the user  decides remove from the symbols from being accessed and traded by the system.  When the symbols are removed, the processing of the above script section will not execute.  By removing the listed scripts from running during a test, the time save will enable Trading Blox Builder to run faster.  For example, when a portfolio of 10,000 stock symbols listed, but the system test only wants to allow 700 of those symbols be used the system test, removing .

 

Syntax:

 

where none of the instruments will have context.  In the example line below, the MktSymbol is a BPV Instrument Type variable.  When the LoadSymbol loads a symbol, all the normal properties and function in an instrument object are assigned to the MktSymbol BPV Type Instrument.


'  Example of how to use this function when it is

'  it is not used in the Set Parameters script section.
MktSymbol.DisableTrading( index )

 

'  When this function is used in a custom script section

'  that is called from the Set Parameters script, the

'  custom function will provide the instruments in the

'  custom script section to with automatic context.  

'  The calling script function script.InstrumentLoop will

'  automatically cause the instruments to loop through

'  Assigned portfolio list of symbols.

instrument.DisableTrading

'  Will not need the index parameter to change its
'  instrument.inPortfolio property state from True
'  to False.  See example in script.InstrumentLoop

 

Parameter:

Description:

index

The symbols location in the portfolio is the row-location of the symbol to remove.  See the examples below to how it works.

 

Index parameter is not needed and not allowed after the symbol has been loaded by the LoadSymbol function.  When a symbol is loaded, the DisableTrading function will be applied to the MktSymbol (BPV=Instrument)instrument assigned by the LoadSymbol function.

 

Example:

'  ==============================================================
'  Portfolio Instrument Disabling
'  BEFORE TEST SCRIPT - START
'  ==============================================================
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  Variables:
'     MktSymbol = a BPV Instrument Object Type
'     iIndex   = BPV Integer
'     iEnabled  = BPV Integer
'     MktSymbol.inPortfolio = instrument.inPortfolio property
'     sHeader = Column Title Header
'  --------------------------------------------------------------
'  Column Title Header
sHeader = "Index," _
        + "Symbol," _
        + "PriorityIndex," _
        + "InPortfolio"
'  Clear Enabled Symbol Counter
iEnabled = 0
'  Disable The Number of Instrument Symbols in the Portfolio
PRINT "Total Instruments: ", system.totalInstruments
'  Send Column Titles
PRINT sHeader
 
'  Load Each Portfolio Instrument into the Mkt Instrument Object
'  and disable every other instrument in this test to show the
'  current i.inPortfolio value, and the i.inPortfolio value
For iIndex = 1 TO system.totalInstruments   STEP + 1
  '  Load symbol in row 'iIndex' location
  MktSymbol.LoadSymbol(iIndex)
 
  ' Display the symbol, symbol's priorityIndex, and the
  ' the status of whether the index will be used by the
  '  system, or it is removed from being available.
  PRINT iIndex, _
        MktSymbol.symbol, _
        MktSymbol.priorityIndex, _
        MktSymbol.inPortfolio
 
  '  Count Any Symbol that is Enabled for System Testing
  If MktSymbol.inPortfolio = TRUE THEN iEnabled = iEnabled + 1
 
  '  When status value shows instrument.inPortfolio
  '  value is 1, that indicate the instrument will be
  '  Available to the system.
  '
  '  When an instrument is available, the DisableTrading
  '  Function will execute and change the the
  '  instrument.inPortfolio value to zero.
  '
  '  NOTE: When a LoadSymbol is assigned to the Mkt Object,
  '        DisableTrading function won't use the value
  If iIndex % 2 = 1 THEN MktSymbol.DisableTrading
Next
 
'  Show the original the Number of Enabled Symbols
PRINT "Enabled Symbols:","", iEnabled
'  --------------------------------------------------------------
'  Clear Enabled Symbol Counter
iEnabled = 0
 
'  Show the current count of all the instruments in the portfolio
PRINT
PRINT "Total Instruments: ", system.totalInstruments
 
'  Send Column Titles
PRINT sHeader
 
' Loop through each symbol in the portfolio again
For iIndex = 1 TO system.totalInstruments
 
  ' Assign each instrument symbol to the
  ' MktSymbol Object
  MktSymbol.LoadSymbol(iIndex)
 
  '  Count Any Symbol that is Enabled for System Testing
  If MktSymbol.inPortfolio = TRUE THEN iEnabled = iEnabled + 1
 
  ' Show the inPortfolio Status of the portfolio's
  ' symbols again
  PRINT iIndex, _
        MktSymbol.symbol, _
        MktSymbol.priorityIndex, _
        MktSymbol.inPortfolio
Next '  iIndex
 
'  Show the original the Number of Enabled Symbols
PRINT "Enabled Symbols:","", iEnabled
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  ==============================================================
'  Portfolio Instrument Disabling
'  BEFORE TEST SCRIPT - END
'  ==============================================================

Returns:

 

Click to Enlarge; Click to Reduce

Example Portfolio Before Symbols Disabled

   

Click to Enlarge; Click to Reduce

Example Portfolio After Symbols Disabled

 

Links:

LoadSymbol, instrument.priorityIndex, instrument.inPortfolio, system.totalInstruments

See Also:

Instrument Data Function, Portfolio Manager

 


Edit Time: 9/7/2020 3:54:25 PM


Topic ID#: 86

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software