More control over training data sets

Sunday, May 1, 2022

 

Stock Trading

 

The Deep Signal Library has added two new methods to allow the trader more control over their training data sets. The DSTIsValidLongDataSet and DSTIsValidShortDataSet methods can be overriden by the trader to determine if they would like to add a particular data set to the training model. Each method will be called when creating a new machine learning model (ie: When running DSTCreateModelTest) and the Deep Signal Library has found either a data set for a long trade setup or a short trade setup based on their Bars To Target and Long Profit Target and Short Profit Targets values. There are two parameters that are passed. The first is the number of bars back from the current bar where a signal has occured for a long or short trade. The second parameter  determines whether they would like to use that data set.

As an example, if the user wanted to be sure a slow moving average was above a fast moving average for short trades and the opposite for long trades when training their machine learning model, they could add something similar to the following.

public override void DSTIsValidLongDataSet(int longSignalBarsBack, out bool isValid)
{
     isValid = false;

     // Only allow data sets to be trained where the SMA(20) is bigger than the SMA(10)
     if (SMA(20)[longSignalBarsBack] < SMA(10)[longSignalBarsBack])
          isValid = true;
}

public override void DSTIsValidShortDataSet(int shortSignalBarsBack, out bool isValid)
{
     isValid = false;

     // Only allow data sets to be trained where the SMA(20) is bigger than the SMA(10)
     if (SMA(20)[shortSignalBarsBack] > SMA(10)[shortSignalBarsBack])
          isValid = true;
}

 

This allows much more flexibility so you can choose which data the Deep Signal Library will use when training your machine learning model. 

Leave your comment