Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy doesn't execute

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

    Strategy doesn't execute

    I have ninja trader strategy which works for backtest but when added to sim-trading doesn't place orders.
    What I do is go to strategies tab, add new strategy, change paramters and start. But it doesn't place even if the conditions are met. Is there a step I am missing in order to deploy strategies?

    #2
    Hello morphtrade,

    Does the issue persist if you apply the strategy in a chart?


    Could it be the strategy uses 'Calculate on bar close' set to True?

    In addition, general debug information can be found at the following link.
    JasonNinjaTrader Customer Service

    Comment


      #3
      it shows all the trades when I apply it to chart. yes calc on bar close is set to true.

      Comment


        #4
        Does it make a difference if you set it to False? When set to True, the strategy will trigger orders at the close of a price bar, while set to False it will submit orders intra-bar.
        JasonNinjaTrader Customer Service

        Comment


          #5
          I can set it to false just for testing but in live if I calculate entry intrabar it might results into more trades and live results will deviate from testing.

          Comment


            #6
            Ok sounds good, you can find debug tips to debug your strategy at the link below as well.
            JasonNinjaTrader Customer Service

            Comment


              #7
              it's this line here which never return true for realtime bars but does work for historical bars.

              if (CrossAbove(EMA(smSeries, Period1), EMA(smSeries, Period2), 1))

              Comment


                #8
                Suggest you actually print values of your indicator and debug it by hand.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  so after debugging I found out that EMA(smSeries, Period1) and EMA(smSeries, Period2) gives different values when calculated on historical and realtime series. For realtime EMA's are much lower than what it should be. Is there a difference between how the EMA is calculated for historical bars than realtime? I changed tha Min bars to calculate to 100 but that didn't make any difference either.

                  Period1 is 2 and Period2 is 5.

                  Comment


                    #10
                    I have copied the values from output window for hist and realtime EMA's

                    79.0258361854625
                    78.9966120618208
                    78.9588706872736
                    78.9436235624245
                    78.9665411874748
                    79.010180395825
                    79.0540601319417
                    79.0593533773139
                    26.353117792438 <<<<<<<<<<<realtime bar
                    8.78437259747933 <<<<<<<realtime bar

                    Comment


                      #11
                      No difference. You need to check your realtime values stored in smSeries.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        I will debug that and find out. But I am trying to understand what's the difference between the way OnBarUpdate is executed for historical bars and realtime bars. This might help me in future as well.

                        Comment


                          #13
                          Difference depends on your CalculateOnBarClose setting. On Historical, all bars are processed once at the end with OHLC. In real-time, if the setting is set to false, bars are processed on every single incoming tick.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            calculateonbarclose is set to true even then there is difference between realtime and historical values. I print the values in realtime and then I realod strategy and same bars when processed as historical print different values(correct one).

                            Comment


                              #15
                              Which is why you need to debug every aspect of your custom DataSeries as you set values to it in real-time.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              2 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
                              18 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by Kaledus, Today, 01:29 PM
                              5 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X