Definition

DSTShortSignal is used to determine if there is a short trade signal from the machine learning model. It will be called on each bar update. Please note that both versions will use the ConfidenceScore in the prediction strategy in returning a true or false. If the ConfidenceScore is above the returned actualConfidenceScore the method will return true otherwise false.

 

Syntax

bool DSTShortSignal()

bool DSTShortSignal(ref float actualConfidenceScore)

 

Note: This method should be called within the OnBarUpdate() method. Please note the base.OnBarUpdate should be called before calling DSTShortSignal

 

Parameters

ref float

If this optional method is called, DSTShortSignal will return the confidence score (0.0-1.0) in the float that is passed by reference. 


Return value

bool

DSTShortSignal will return true if there is a signal to enter a sell short trade from the machine learning model, otherwise false

 

 

Examples

ns

Using the DSTShortSignal method


        protected override void OnBarUpdate()

        {

            // DST Library - The base OnBarUpdate needs to be called for updating the machine learning model data

            base.OnBarUpdate();            


            if (Position.MarketPosition == MarketPosition.Flat && BarsInProgress == 0)

            {

                if (DSTLongSignal())              

                    EnterLong(_Shares, "Long Entry");

                else if (DSTShortSignal())

                    EnterShort(_Shares, "Short Entry");                                   

            }

        }     

 


ns

Using the DSTShortSignal return value with Confidence Score


        protected override void OnBarUpdate()

        {

            // DST Library - The base OnBarUpdate needs to be called for updating the machine learning model data

            base.OnBarUpdate();            


            if (Position.MarketPosition == MarketPosition.Flat && BarsInProgress == 0)

            {

                  float confidenceScore = 0f;


                // In this case, DSTShortSignal will only return true if the confidenceScore that is returned is 

                // equal to or greater than the DSTMinLongConfidenceScore for long or DSTMinShortConfidenceScore for short trades

                if (DSTLongSignal(ref confidenceScore))

                {

                    EnterLong(_Shares, "Long Entry");

                    Print("Long confidence score = " + confidenceScore);                    

                }

                else if (DSTShortSignal(ref confidenceScore))

                {

                    EnterShort(_Shares, "Short Entry");

                    Print("Short confidence score = " + confidenceScore);                    

                }                         

             }

        }     



ns

Using the DSTShortSignal with Confidence Score Only


        protected override void OnBarUpdate()

        {

            // DST Library - The base OnBarUpdate needs to be called for updating the machine learning model data

            base.OnBarUpdate();            


            if (Position.MarketPosition == MarketPosition.Flat && BarsInProgress == 0)

            {

                  float confidenceScore = 0f;


                // In this case, the confidenceScore that is returned must be equal to or greater than 

                // the user set value of 0.4 in order to enter a long or short trade

                DSTLongSignal(ref confidenceScore);


                if (confidenceScore >= 0.4)

                {

                    EnterLong(_Shares, "Long Entry");

                    Print("Long confidence score = " + confidenceScore);                    

                }


                DSTShortSignal(ref confidenceScore)


                if (confidenceScore >= 0.4)

                {

                    EnterShort(_Shares, "Short Entry");

                    Print("Short confidence score = " + confidenceScore);                    

                }                         

             }

        }     



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.