Definition

Adds an additional instrument to the strategy's machine learning model. Either the close or open value for each bar will be added to the model depending on the Use Close or Open selection. Please see the Training Parameters section in Creating a Machine Learning Model.


Please note, the primary instrument will be defined in the Strategy Analyzer window under the Data Series group using the Instrument parameter. This method will add an additional instrument beyond the first.


The method is needed both in creating a new model and using an existing model to predict long or short signals. Please note if you add an instrument for the create model strategy, you will also need to add the same instrument in the predict model strategy. The instrument added will use the same bar period and market data type (open, high, low, close) as the primary instrument used in the strategy.

 

Note:  The AddDSTInstrument method has two overrides. The min and max parameters are optional and are used when normalizing the data before creating a new machine learning model. Normalizing the data is the process of setting all of the data values to values between 0 and 1 before feeding the data set to the machine learning model. By default these values will be set to 0 for the minimum and double the maximum value found in the training data set if min and max is not used. 


The min and max can be modified if you feel that the maximum value may be more than double the maximum value from the training set. As an example, if you trained the model based on the Close value for an instrument from 2000-2005 the maximum for the Close was $118.00 then we will use $236.00 for the default maximum. If we are running the strategy live we still normalize the data before sending the values to the model. If the current Close is 300, then when we normalize the data, the normalized value will always be 1 since it is more than the expected maximum of $236 and the model may not perform as expected.


The AddDSTInstrument with min and max is only available when creating a new machine learning model and for strategies that are derived from DSTCreateModelBase

 

Syntax

AddDSTInstrument(string instrumentTickerSymbol)
AddDSTInstrument(string instrumentTickerSymbol, double min, double max)

 

Warning: This method should ONLY be called within the OnStateChange() method during State.Configure

 

Parameters

instrumentTickerSymbol

string value representing the ticker symbol of the instrument, for example "AAPL".

min

double value representing the minimum value for the series found before training the machine learning model. By default this value is set to 0 when creating the machine learning model.

max

double value representing the maximum value for the series when training the machine learning model. By default, this value is set to double the value found in the data set before training the model. As an example, if we created a machine learning model for the instrument AAPL for the time period of 1/1/10 through 1/1/15 and the highest value we found for this time period was $200.00 then we'll use $400.00 for the default maximum value. If we are running live and the current Close values for AAPL were above $400 then we would need to retrain the model using a higher maximum value for the model to give correct predictable long or short signals.



 

 

Examples

ns

Adding indicator data to a machine learning model


protected override void OnStateChange()
{   

  // Please do not change, the DST Library will need to call OnStateChange

  base.OnStateChange();   


  if (State == State.Configure)
  {
    // AddDSTInstrument adds any instrument series that you want to use in training a machine learning model

    AddDSTInstrument("AAPL");
  }
}



 

ns

Adding indicator data to machine learning model with min and max parameters


protected override void OnStateChange()
{
  // Please do not change, the DST Library will need to call OnStateChange

  base.OnStateChange();   


  if (State == State.Configure)
  {
    // AddDSTInstrument adds any instrument series that you want to use in training a machine learning model

    // The example below will set the min value to 0 and max value will be set to 1,000

    AddDSTInstrument("AAPL", 0, 1000);
  }
}
 
 

 

 







Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.