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:

    Hi, I'd like to create a strategy where a stop limit order is placed after a condition is met, then cancel this order X bars later if not filled. If it is filled, I'd like to trail the stop based upon the previous bar's close. For example, on a long trade, after the condition is met, I'd like an order placed below the market. After X bars and not filled, cancel the order. If the order is filled, I'd like the stop to be set on the low of the previous bar, then trail up on the close with …


    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 Felix Reichert, Today, 02:12 PM
            0 responses
            1 view
            0 likes
            Last Post Felix Reichert  
            Started by Tim-c, Today, 02:10 PM
            0 responses
            1 view
            0 likes
            Last Post Tim-c
            by Tim-c
             
            Started by cre8able, Today, 01:16 PM
            2 responses
            9 views
            0 likes
            Last Post cre8able  
            Started by chbruno, 04-24-2024, 04:10 PM
            3 responses
            48 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by samish18, Today, 01:01 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Working...
            X