Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error message when using SetProfitTarget in Initialize

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

    Error message when using SetProfitTarget in Initialize

    Hi,

    When I add the line:

    SetProfitTarget(CalculationMode.Percent,TargetBP/10000.0);

    to the Initialize() metthod I get the following:

    3/31/2009 11:35:03 AM Default Error on running backtest: Object reference not set to an instance of an object.

    The backtest runs ok with the profit target not set. I'm using the following to get in:
    if(pullback == 0.0) {
    EnterLong();
    }
    else {
    EnterLongLimit((
    10000-pullback)/10000*Close[0]);
    }

    and the equivalent for getting short....

    Thx,

    John


    #2
    Hi John, please disconnect from your connections and go to Tools > Options > Misc and Repair your DB. Then reconnect and retry the strategy.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Didn't work....

      Bertrand,

      I did the procedure and am still getting the problem....!

      Help!!

      John

      Comment


        #4
        Hi John, then I would suggest moving your calculation in the SetProfitTarget (TargetBP/10000.0) out of the Initialize(), do this then in the OnBarUpdate.

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Still the same error....

          Originally posted by NinjaTrader_Bertrand View Post
          Hi John, then I would suggest moving your calculation in the SetProfitTarget (TargetBP/10000.0) out of the Initialize(), do this then in the OnBarUpdate.

          http://www.ninjatrader-support.com/H...fitTarget.html

          Bertrand,

          I moved the SetProfitTarget to OnBarUpdate and took the calculation out of the function call (made it a double that I set in Initialize)...unfortunately I get the same error.

          *sigh*

          Comment


            #6
            Sorry John, please contact me then with your trace and log files at support at ninjatrader dot com Attn Bertrand and I will review them closely. Thanks!
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Mail is on the way....

              Bertrand,

              I've sent you an e-mail as requested....

              Thank you,

              John

              Comment


                #8
                Thanks John, can you please resend it, it did unfortunately not reach me as of yet.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  resent....

                  Bertrand I sent to [email protected]....

                  John

                  Comment


                    #10
                    John,

                    Have you tried with SampleMACrossOver strategy? Do you get the error when you run that strategy in a backtest?

                    In your custom strategy are you using IOrders?
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by BarzTrading, Today, 07:25 AM
                    2 responses
                    23 views
                    1 like
                    Last Post BarzTrading  
                    Started by devatechnologies, 04-14-2024, 02:58 PM
                    3 responses
                    20 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by tkaboris, Today, 08:01 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post tkaboris  
                    Started by EB Worx, 04-04-2023, 02:34 AM
                    7 responses
                    163 views
                    0 likes
                    Last Post VFI26
                    by VFI26
                     
                    Started by Mizzouman1, Today, 07:35 AM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X