This function is used to enable or disable a test simulation and it must be called in the Before Simulation script.

 

By default Trading Blox sets this property to TRUE so that test being run will use the software's ability to automatically reserve enough data with each of the instrument files to allow period bar lengths to perform calculations without causing an error.

 

When set to FALSE, Auto-Priming will not reserve any priming records.  This means that blox scripting must determine when there is enough data available to process calculations without the look back reach of some calculation reaching back past the first available record in a series.

 

Priming of calculated indicators in the Indicator section of the Trading Blox Editor need to reference look back values to prevent testing errors:  

Click to Enlarge; Click to Reduce.

New Parameter Lookback Disabling Option

When a Parameter's "Used for Lookback" option is enabled, Trading Blox will reserve records for priming so the calculated indicator in the Indicator section doesn't cause an error. When more than one parameter enables its "Use for Lookback" option, the sum of the look backs is the amount of instrument records that are reserved.  This delay can be seen in the charting display by looking at the bar number where the indicators first appear on the chart.

 

Syntax:

test.SetAutoPriming( TrueFalse )

 

Parameter:

Description:

TrueFalse

By default Auto Priming for parameters is set to TRUE.  It can be disabled for special handling when their is no chance that an indicator or calculation will be used when there is insufficient bars available to all the range of the calculation to perform without error.

 

Returns:

Function doesn't return a value.  It just enables or prevents the automatic reservation of look back data bars.

 

Example:

'  BEFORE SIMULATION SCRIPT SECTION

'  Disable Auto Priming

test.SetAutoPriming( FALSE )

 

Example:

Roundtable Forum Question (link):

 

In my actual code I want a 250 bar lookback on the daily data. I solved my problem by setting the Years of Priming Data to 25 (fortunately I had that much monthly data going back) which allowed scripts like Entry Orders and Update Indicators to be run on the monthly bars from the test.startDate forward.

 
CODE: 

'  Disable Auto-Priming  
test.SetAutoPriming(false)

 


This will start running the entry orders script on bar one regardless of lookback parameters or indicators. So when using this, check the instrument.bar before accessing any indicators (they might not be ready) or lookbacks. In the case of monthly data based indicators, I sometimes create flexible function based indicators like this:

 

CODE: 

' Compute an SMA of the close, using as much data as available, up to 250
sma = AVERAGE( instrument.close, min(instrument.bar, 250) )

 

Links:

 

See Also:

Miscellaneous Functions

 


Edit Time: 9/21/2020 3:56:48 PM


Topic ID#: 532

 

 

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