Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

No suitable method found to override.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    No suitable method found to override.

    Hi,

    I am attempting to write some code to monitor my data feed connection.

    NT7 gives me the "No suitable method found to override" error because I use the following code :

    protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)

    In which section of the script do I need to put the code as per the following help article?



    Thanks.

    mp

    #2
    Hello,

    Thanks for the note.

    This would want to be placed under OnBarUpdate().

    OnBarUpdate()
    {

    //Do your OnBarUpdate stuff here.

    }

    OnConnectionLoss()
    {

    //Do your connection loss stuff here.

    }

    Comment


      #3
      Sorry, this is not working. I still get the error if I paste the code from the example found in the Help section (url provided in my original comment).

      In the "Variables" section I put:

      private ConnectionStatus dataFeed = ConnectionStatus.Connected;

      Then under the protected override void OnBarUpdate() section I pasted:

      protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
      {
      dataFeed = priceStatus;
      }


      mp

      Comment


        #4
        Hi,

        Its a method and I would try it before OnBarUpdate().

        Comment


          #5
          Hello,

          Please post full code if your still having issue or send it to support at ninjatrader dot com ATTN: Brett. You still dont have your placement quite right.

          I look forward to assisting you further.

          Comment


            #6
            // This namespace holds all indicators and is required. Do not change it.
            namespace NinjaTrader.Indicator
            {
            [Description("Enter the description of your new custom indicator here")]
            public class AlertConnectionLost : Indicator
            {
            #region Variables

            private ConnectionStatus dataFeed = ConnectionStatus.Connected;

            #endregion

            protected override void Initialize()
            {
            Overlay = true;
            }

            protected override void OnBarUpdate()
            {
            // Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
            }

            protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
            {

            priceDataFeed = priceStatus;
            orderDataFeed = orderStatus;

            if (priceDataFeed == ConnectionStatus.ConnectionLost)
            {
            Print("Connection Lost");
            }
            }

            Comment


              #7
              Hello,

              This looks good. Whats the error?

              I look forward to assisting you further.

              Comment


                #8
                A picture is worth a thousand words. This is a snapshot of the scripting windows and the related error message.

                Thanks for your persistence with this issue.

                mp
                Attached Files

                Comment


                  #9
                  MP, please try working with that method override in a strategy and not an indicator, then it should compile as expected.

                  Thanks,
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Ah! That's why. Many thanks!

                    mp

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by helpwanted, Today, 03:06 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post helpwanted  
                    Started by Brevo, Today, 01:45 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post Brevo
                    by Brevo
                     
                    Started by aussugardefender, Today, 01:07 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post aussugardefender  
                    Started by pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    242 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    9 responses
                    384 views
                    1 like
                    Last Post Gavini
                    by Gavini
                     
                    Working...
                    X