Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Orders Never Get Filled in Replay

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

    Orders Never Get Filled in Replay

    Hi All,

    I am testing a strategy, and notice that no matter what I do, I cannot get the orders to fill. Currently, I am just using Market Replay to test how the strategy enters and exits. I have a simple strategy that uses EnterLong and EnterShort. I'm assuming that this should enter as a market order, which is what I want. But every time I replay the strategy, I get the order pending notification and the order tab shows the order as "working". But no matter how long I wait, the orders never get filled.

    What am i doing wrong? I have added the Historical == true option in the code to ensure my strategy is flat, and the strategy shows as green. I have the the Wait Until Flat option selected along with Sync Account position = false. I have changed the fill options but nothing seems to work. I have not tested it with a live simulation so I don't know how it responds in that environment yet.

    Looking for some advice,

    Thanks,

    Lee

    #2
    Hello Lee,

    Thank you for your note.

    If you turn off the historical, do they fill in a backtest from the Strategy Analyzer?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi Cal,

      Thank you for the response!

      So I turned off the historical, and ran a backtest in the strategy analyzer. I am getting results and it shows executions and trades, but I don't see anything that actually shows the status... I'm probably just looking in the wrong place but all i see is entry and exits, but nothing with a "Filled" label. I have the fill type set to default.

      Lee

      Comment


        #4
        Hello Lee,

        Thanks for your reply.

        With the historical turned off you saw executions in the strategy analyzer. If you now run in Market Replay do you also see executions?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          I've only tried running it over a couple days in Market Replay with Historical turned off where I know a signal should be triggered. It will trigger a buy/sell signal and the status will say "Working" within the Orders tab of the control center, but it never turns to filled. And then it seems that if I do anything it then cancels the order...

          Lee

          Comment


            #6
            Hello Lee,

            Thanks for your reply.

            Please post your strategy for review or if you prefer privacy please send it to PlatformSupport[at]Ninjatrader[dot]com, atten Paul in the subject line and a copy of this thread/link for reference.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Is there anything in the output window? Messages?

              Your charts have data and are playing properly?

              Comment


                #8
                The charts seem to be playing correctly, although I seem to have problems with replay at times. Its not always consistent with regards to working... The replay data is downloaded from the ninjatrader replay link, while the rest of the data is historical that I have saved (so I guess I am combining historical data with replay data). But the signal occurs during the replay data and the strategy appears to be working correctly with this setup. I have looked at the output window during the replay and I do see where it shows the buy initiated within the output window. But it never makes it to a "filled" status within the Control Center. Everything seems to work as anticipated, just not getting the filled status...

                Lee

                Comment


                  #9
                  I have attached my simple strategy as requested. I tired running it again, and I get the "Order Pending" audio alert and the order shows "Working" in the Control Center Orders. But it never changes to "Filled". Also, I don't know if it is the Historical option, but I get the audio alert and the order shows up in the Control Center but I don't get a visual up/down arrow on the screen during replay even thought it is in my code. I thought when I ran it with the Historical turned off (shows strategy history), I was getting visual cues as well. So, I have a few things going on that I don't understand. My experience with the replay is not so good as its performance seems spotty to me. But this is probably because I don't know what I'm doing...

                  Hoping for some insight,

                  Regards,

                  Lee
                  Attached Files

                  Comment


                    #10
                    Hello Lee,

                    Thanks for attaching the strategy.

                    Regarding the arrows, the issue is that you are drawing them at the 0 (zero) price level. To have them display near price please try something like:

                    DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0] - 4 * TickSize, Color.Lime); // Draw the arrow 4 ticks below price.

                    For the down arrow you could use High[0] + 4 * TickSize to place it 4 ticks above the high.

                    In the strategy you are using moving average with period of 70, 1800 and 3900. This means that you would need to have data with at least 3900+ bars. So that I can better understand what you are doing, what instrument(s) and period type are you using?

                    I look forward to your reply.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi Paul,

                      Thanks for the info. I'm still learning this strategy stuff as its very new to me.

                      I am currently using a 5min period on SPY and the SP500. I have the necessary historical data for the moving average periods I am using, but not Replay data that goes back that far. Can this be the problem? It still gives me the signal, but never changes to a "Filled" status.

                      I will try implementing your input on the DrawArrows. Is tick size the only option or is there something else (like 1 min bars)?

                      Thanks again,

                      Lee

                      Comment


                        #12
                        Hello Lee,

                        Thanks for your reply.

                        Regarding the arrows, you can use any valid Y axis value, even the zero was working if you looked at that level! Other possibilities are the values of the moving average when they cross.

                        In reviewing the code, in this section below, the use of the {} was causing the 2nd, 3rd and 4th to be set false on each on bar update, only the first condition was being effected by the true condition of the if statement.

                        Code:
                        if (Time[0].DayOfWeek != Time[1].DayOfWeek) // new day, reset bool flag
                        {longEntryMadeToday = false;}
                        {longExitMadeToday = false;}
                        {shortEntryMadeToday = false;}
                        {shortExitMadeToday = false;}
                        I believe the below is what you are looking for, where the true condition of the if statement will cause the various bools to be false.
                        Code:
                        if (Time[0].DayOfWeek != Time[1].DayOfWeek) // new day, reset bool flag
                           	{
                        	     longEntryMadeToday = false;
                        	     longExitMadeToday = false;
                        	     shortEntryMadeToday = false;
                        	     shortExitMadeToday = false;
                        	  }
                        I recommend that you try your strategy on the strategy analyzer using the historical data. Here is a link to the help guide on strategy analyzer: http://www.ninjatrader.com/support/h...y_analyzer.htm

                        Here is a link to the Ninjatrader automated strategy development, set to the time where they use the strategy analyzer:
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by lee612801 View Post
                          Hi Paul,

                          Thanks for the info. I'm still learning this strategy stuff as its very new to me.

                          I am currently using a 5min period on SPY and the SP500. I have the necessary historical data for the moving average periods I am using, but not Replay data that goes back that far. Can this be the problem? It still gives me the signal, but never changes to a "Filled" status.

                          I will try implementing your input on the DrawArrows. Is tick size the only option or is there something else (like 1 min bars)?

                          Thanks again,

                          Lee
                          Is your sp500 an index? Is there volume for it? I'm not sure market replay can trade an index such the sp500, hence why your orders end up in limbo.

                          Spy should work,since that is actually tradeable.

                          Comment


                            #14
                            Paul,

                            Thank you very much for the input. I will try this once I get home today.

                            Thanks again,

                            Lee

                            Comment


                              #15
                              Sledge,

                              Good point. I've been looking at the SP500. I will try again after making the corrections Paul suggested using SPY and see what happens. I would like to see the ordered get filled to ensure it is working properly.

                              Thanks,

                              Lee

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Irukandji, Today, 04:58 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post Irukandji  
                              Started by fitspressoburnfat, Today, 04:25 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post fitspressoburnfat  
                              Started by Skifree, Today, 03:41 AM
                              1 response
                              4 views
                              0 likes
                              Last Post Skifree
                              by Skifree
                               
                              Started by usazencort, Today, 01:16 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post usazencort  
                              Started by kaywai, 09-01-2023, 08:44 PM
                              5 responses
                              604 views
                              0 likes
                              Last Post NinjaTrader_Jason  
                              Working...
                              X