Definition

Call this method in your inherited class from DSTCreateModelBase in OnBarUpdate to add a Pre Signal Window (data window) for long trade data to the machine learning model training data. The signalBarsAgo parameter defines how many bars back the signal bar occurred. The signal bar is the first bar before before the price of the instrument hits a profit target defined by Bars To Target and Ticks Up to Target or Ticks Down to Target. The data window that gets used for training a machine learning model is defined by a number of bars before the signal bar. The total bars for the data window is set by the parameter value Pre Signal Window Size.


The DSTAddLongDataWindow will add a data set for long trades that are expected to reach their profit target. To add data sets for long trades that fail to reach their profit target, please use the DSTAddFailedLongDataWindow method. Both data sets for reaching a profit target and failing to reach a profit target will need to be added in order to successfully train a model. 


The following chart shows the Pre-Signal Window, Signal Bar and Ticks Up to Target window. In this case, the Pre-Signal Window size was set at 10 bars which is used to train our model. The Ticks Up to Target was set at 20 ticks (5 points for ES) but when CreateCustomDataWindows is set to true, the Deep Signal Library will ignore the Ticks Up to Target or Ticks Down to Target and use the signalBarsAgo parameter to determine the data window used for training.



Chart Showing Data Windows


 

Note:  The DSTAddLongDataWindow method is an advanced method used to control adding data for training a machine learning model. The CreateCustomDataWindows parameter needs to be set to true in order to use the DSTAddLongDataWindow. Please see the Model Parameters page to learn more about the CreateCustomDataWindows parameter.

 

Syntax

DSTAddLongDataWindow(int signalBarsAgo)

 

Warning: This is an advanced method and will override the default Deep Signal Library method of training a machine learning library.

 

Parameters

signalBarsAgo

An int used to pass the number of bars back that the signal bar had occurred. The data window used to train the model will be determined by this parameter.


 

 

Examples

ns

Example of only allowing training for short data sets in which a slow moving SMA crosses above a fast moving SMA at the signal bar for a short trade and long data sets in which the slow moving SMA crosses below the fast SMA.


protected override void OnBarUpdate()

{

      // Please do not change, the DST Library will need to call OnBarUpdate. Add any additional code below this line.

      base.OnBarUpdate();


       if (CrossAbove(SMA(slowSMA), SMA(fastSMA), 1))                                

               DSTAddShortDataWindow(0);                                

       else if (CrossBelow(SMA(slowSMA), SMA(fastSMA), 1))

               DSTAddLongDataWindow(0);                                

       else

      {

               DSTAddFailedLongDataWindow(0);

               DSTAddFailedShortDataWindow(0);

       }

}



 

 









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.