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 Perr0Grande, Today, 08:16 PM
            0 responses
            2 views
            0 likes
            Last Post Perr0Grande  
            Started by elderan, Today, 08:03 PM
            0 responses
            5 views
            0 likes
            Last Post elderan
            by elderan
             
            Started by algospoke, Today, 06:40 PM
            0 responses
            10 views
            0 likes
            Last Post algospoke  
            Started by maybeimnotrader, Today, 05:46 PM
            0 responses
            11 views
            0 likes
            Last Post maybeimnotrader  
            Started by quantismo, Today, 05:13 PM
            0 responses
            7 views
            0 likes
            Last Post quantismo  
            Working...
            X