Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

forward testing errors

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

    forward testing errors

    Hi,
    I have a strategy that when I backtest, it runs fine, however when I forward test it on SIM, I get errors (see attached) and the strategy gets cancelled.

    The following portion of the code is the "order part" of the code after certain criteria has been met:

    double bid2 = Swing(3).SwingHigh[0];
    if (usetarget1) entryOrderT1 = EnterLongStop(orderSize1, bid2 + 1 * TickSize, "LongTgt1");//EnterLong(1,"LongTgt1");

    What my intention is, is to go long just above the swing high once the criteria has been met, what could I change to avoid this error?

    Thanks,
    John
    Attached Files

    #2
    Yeah, you won't get that error backtesting.


    I found this, someone else had a similar problem:



    Someone else will probably have a better idea, as I haven't used this yet.

    Originally posted by John.2000 View Post
    Hi,
    I have a strategy that when I backtest, it runs fine, however when I forward test it on SIM, I get errors (see attached) and the strategy gets cancelled.

    The following portion of the code is the "order part" of the code after certain criteria has been met:

    double bid2 = Swing(3).SwingHigh[0];
    if (usetarget1) entryOrderT1 = EnterLongStop(orderSize1, bid2 + 1 * TickSize, "LongTgt1");//EnterLong(1,"LongTgt1");

    What my intention is, is to go long just above the swing high once the criteria has been met, what could I change to avoid this error?

    Thanks,
    John

    Comment


      #3
      Explains what a buy stop order is, how it works, and its benefits and limitations.


      only other suggestion I have is that bid2 isn't behaving in real time.

      use a print statement to the console to verify it's value and make sure you ARE above market value.

      Originally posted by John.2000 View Post
      Hi,
      I have a strategy that when I backtest, it runs fine, however when I forward test it on SIM, I get errors (see attached) and the strategy gets cancelled.

      The following portion of the code is the "order part" of the code after certain criteria has been met:

      double bid2 = Swing(3).SwingHigh[0];
      if (usetarget1) entryOrderT1 = EnterLongStop(orderSize1, bid2 + 1 * TickSize, "LongTgt1");//EnterLong(1,"LongTgt1");

      What my intention is, is to go long just above the swing high once the criteria has been met, what could I change to avoid this error?

      Thanks,
      John

      Comment


        #4
        Originally posted by sledge View Post
        http://www.solerinvestments.com/Onli...Stop-Order.htm

        only other suggestion I have is that bid2 isn't behaving in real time.

        use a print statement to the console to verify it's value and make sure you ARE above market value.
        Sledge,

        Thanks for both of your suggesstions. How would I use a Print Statement?

        John

        Comment


          #5
          Originally posted by John.2000 View Post
          Sledge,

          Thanks for both of your suggesstions. How would I use a Print Statement?

          John

          You have unlocked you code and are programming it correct?

          I hope this helps you.

          Turn on the output window :: Tools->Output Window

          Code:
          double bid2 = Swing(3).SwingHigh[0];
          
          Print ( "bid2="+bid2+"  bid2+1*TickSize=" + (bid2 + 1 * TickSize) );
          
          if (usetarget1) entryOrderT1 = EnterLongStop(orderSize1, bid2 + 1 * TickSize, "LongTgt1");//EnterLong(1,"LongTgt1");

          Comment


            #6
            John, please try sledge's print suggestion and see if the values are being calculated as you expect. Here is a link to a more detailed description of the debugging process, including Prints - http://www.ninjatrader.com/support/f...ead.php?t=3418.
            AustinNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            116 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            61 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            40 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            43 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            82 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X