Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy trying to enter order on past date

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

    Strategy trying to enter order on past date

    I probably don't understand how to use a strategy for realtime trading, but I expected that when I "Start" the strategy, it would begin it's analysis on the current bar. Today is 12/31/09 and it seems to want to start on 12/16/09. What do you think I may be doing wrong?

    #2
    Miker, strategies will need to load data before you started it because it needs to run back calculations and such to make sure the calculated position is correct. Also, many indicators need a certain number of bars to work right. With NinjaTrader 7, there is an option to define how many days of data to load, so you will be able to choose this value when NT7 is released.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick reply Austin. I understand the need for it to load historical data for the indicators, but it is entering a buy stop order above the high on the 12/16 bar, but complaining that it is below (presumably because the 12/31 bar price is indeed above the buy stop). What is the recommended approach to resolve this issue?

      Comment


        #4
        miker, what is the exact error you're seeing? Also, you can enable the order tracing tool by setting TraceOrders = true in the Initialize() section, which is very helpful when trying to debug order issues.

        Without knowing the exact details, I would say the best way to fix it is to set the stops even higher, or to just run it in real-time when you know the stops will be placed correctly.

        The 12/16 entry that was rejected was probably because the 12/17 bar (I assume you're using daily data here) was higher than the stop price, not the 12/31 bar.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Well, I don't even understand why it is starting on 12/16 in the first place!
          Where is the starting time set? Does it use the earliest date from any chart you happen to have open?

          I'm running the strategy with CL 02-10 on a 3minute chart. The buy stop (for a rbo entry) is set to 73.28 on the 3:42am bar. The high of that bar was 73.24! The next bar opened lower.

          I'll go back to Strategy Analyzer to see if I have the same problem there...
          Thanks.
          I've copied your email here, but in the future could you just reply on the thread you started? Thank you.

          In NT6.5, strategies load 15 days of data in the past. With NT7, you'll be able to specify how many days you want to load.

          Again, what is the error message you're seeing? Please review this post by Josh to help you figure out what is going on.
          AustinNinjaTrader Customer Service

          Comment


            #6
            Thanks again Austin. That explains why it starts on 12/16.
            As for the error message (from the trace file):
            Order='c12399f628de49e6884fe3757a7c52d3/Sim101' Name='Trade#1-Long' New State=Rejected Instrument='CL 02-10' Action=Buy Limit price=0 Stop price=74.65 Quantity=3 Type=Stop Filled=0 Fill price=0 Error=OrderRejected Native error='Buy stop or buy stop limit orders can't be placed below the market.'

            It was occurring using Strategy Analyzer as well, but then I noticed I had a bogus print statement, that may have been the cause, though it doesn't make sense to me why that would be related to the error I was getting, but after fixing the print statement, the problem no longer occurred.
            Before:
            if (Debug){if (entryOrder != null) {Print("ptOrder.OrderState: "+ptOrder.OrderState);}}
            After:
            if (Debug){if (ptOrder != null) {Print("ptOrder.OrderState: "+ptOrder.OrderState);}}

            Comment


              #7
              miker, don't believe this is related to the Print statement - you would need print out all order prices sent by the strategy and ensure you send them at valid prices for stop / stop limit orders.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Jon17, Today, 04:33 PM
              0 responses
              1 view
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              4 views
              0 likes
              Last Post Javierw.ok  
              Started by timmbbo, Today, 08:59 AM
              2 responses
              10 views
              0 likes
              Last Post bltdavid  
              Started by alifarahani, Today, 09:40 AM
              6 responses
              40 views
              0 likes
              Last Post alifarahani  
              Started by Waxavi, Today, 02:10 AM
              1 response
              19 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Working...
              X