Definition

Sets custom feature data to be used in a strategy's machine learning model. This is needed both in creating a new model and using an existing model to predict long or short signals. This method needs to be called in OnBarUpdate and needs to be set every bar.

 

 

Syntax

DSTSetCustomData(string name, double val, int barsAgo = 0)

 

Warning: This method should be called within the OnBarUpdate() method 

 

Parameters

name

string value representing the name of the indicator data series such as "Volume". Please use the same name

when creating a model as when you predict a model. When selecting a Prediction strategy, the Deep Signal Library will look for strategies with the same number of parameter and the same name to find matching create/predict strategies when populating the Strategy Data Folder in Settings.

val

An double value representing the value for the feature.


barsAgo

An int value representing the number of bars back from the current bar to set the val. The default barsAgo is 0, which corresponds to the current bar.


 

 

Examples

ns

Adding custom feature data to a machine learning model


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();

                       

DSTSetCustomData("Slow SMA", SMA(slowSMA)[0]);

DSTSetCustomData("Fast SMA", SMA(fastSMA)[0]);

DSTSetCustomData("Volume", Volume[0]);                        

}


 

ns

Adding custom feature data for one bar back from current bar


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();

                       

   // This example shows how to set custom data for the previous bar

DSTSetCustomData("Slow SMA", SMA(slowSMA)[0], 1);

DSTSetCustomData("Fast SMA", SMA(fastSMA)[0], 1);

DSTSetCustomData("Volume", Volume[0], 1);                        

}


 











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.