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:
        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:
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kevinenergy, 02-17-2023, 12:42 PM
            115 responses
            2,699 views
            1 like
            Last Post kevinenergy  
            Started by prdecast, Today, 06:07 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Christopher_R, Today, 12:29 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by chartchart, 05-19-2021, 04:14 PM
            3 responses
            577 views
            1 like
            Last Post NinjaTrader_Gaby  
            Started by bsbisme, Yesterday, 02:08 PM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X