• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy - not working for all instruments

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

    strategy - not working for all instruments

    Hello,

    I have finished my strategies after a long work and with your support.
    Now it occurs that when I do enabling a strategy for EURUSD, GBPUSD and AUDUSD in the strategy tab the AUDUSD is unchecked from NT immediately. How can this be that a strategy can be enabled for 2 currencies and not for a 3rd one? I have not idea what might be the reason for this.

    Thanks
    Tony

    #2
    Hi Tony,

    Are there any error messages in log tab of the control center?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hello Ryan

      in the logtab there appears:

      "Error on calling OnExecution method for strategy.... Object reference not set to an instance of an object."

      In the strategy I have:
      protected override void OnExecution(IExecution execution)
      { if (execution.Order.OrderState == OrderState.Filled && (execution.Order.Name == "S1A" ))
      tradeCounter++;

      }

      Do I have to add something in the variables section (tradeCounter I have) or with Ordername?

      But why can I enable the same strategy for EURUSD but with AUDUSD the message appears?

      Thanks
      Tony
      Last edited by tonynt; 12-15-2011, 10:31 AM.

      Comment


        #4
        Each strategy instance is unique, so there are no assurances that if one instance works without errors then all instances work without errors. Each could produce a different sequence of events.

        Please see this link for checking null references, which can help with the type of error you are getting with your strategy:
        http://www.ninjatrader.com/support/f...ead.php?t=4226
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan,

          thank you for the link. Can you please shortly type in what there is to do so for

          protected override void OnExecution(IExecution execution)
          { if (execution.Order.OrderState == OrderState.Filled && (execution.Order.Name == "S1A" ))
          tradeCounter++;}

          I don´t understand as this is not in OnBarUpdate as in the sample.

          THANK YOU!


          Originally posted by NinjaTrader_RyanM View Post
          Each strategy instance is unique, so there are no assurances that if one instance works without errors then all instances work without errors. Each could produce a different sequence of events.

          Please see this link for checking null references, which can help with the type of error you are getting with your strategy:
          http://www.ninjatrader.com/support/f...ead.php?t=4226

          Comment


            #6
            Unfortunately we could not debug this for you. It could be anywhere you access an object that does not exist. The debugging tool to use for these cases is try catch. This sample can help:
            http://www.ninjatrader.com/support/f...ead.php?t=9825
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by VincentMicah, Today, 12:46 AM
            0 responses
            3 views
            0 likes
            Last Post VincentMicah  
            Started by WestonMicah, Today, 12:44 AM
            0 responses
            5 views
            0 likes
            Last Post WestonMicah  
            Started by Janfor, Yesterday, 10:19 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Brian F, Yesterday, 10:00 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Perceivedshift, Yesterday, 05:17 AM
            0 responses
            22 views
            0 likes
            Last Post Perceivedshift  
            Working...
            X