Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Failed to open position

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

    Failed to open position

    Why didn't my strategy open a position when the strategy analyzer did? What's wrong? The strategy was working previously.

    Secondly, could you please confirm if the EntriesPerDirection variable will be re-initiated after each session as I was having some problems with it where I have to disable/enable the strategy to refresh the variable.

    #2
    Hello,

    The variable does not refresh each session, it only refreshes when you exit a position. This is independant on the session, unless you are using ExitOnClose = True.

    As far as any question on why a strategy did not place an order. If you add TraceOrders = True in the Initialize Method you will be able to trace the orders to see what is happening.


    Let me know if I can be of further assistance.

    Comment


      #3
      Hi Brett,

      Yes, I'm using ExitOnClose. So do I need to manually refresh the EntriesPerDirection variable?

      Comment


        #4
        Hello,

        It will refresh for you automatically once the position is closed.

        Let me know if I can be of further assistance.

        Comment


          #5
          Hi Brett,

          Last night, I had the complete opposite problem. NT7 opened a position when the strategy analyzer did not. Please explain what might have caused this...

          Comment


            #6
            Which order types and fill algorithms are you working with? Was the condition leading to the order evaluated correctly and to your expectations judging from the code you used?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Bertrand View Post
              Which order types and fill algorithms are you working with? Was the condition leading to the order evaluated correctly and to your expectations judging from the code you used?
              I'm using Market Order with Default Fill.
              Regarding the condition, I believed that it was evaluated wrongly as I explicitly coded that MACD had to be below 0 to open a short position. However, it was definitely above 0 yesterday and it opened a short position when the strategy analyzer didn't.

              Comment


                #8
                Hello,

                There are some key differences to know about the differences between backtesting and running a strategy live:




                Let me know if I can be of further assistance.

                Comment


                  #9
                  Hi Brett,
                  I understand that there would be discrepancies in performances. But the difference should not be that the Strategy analyzer did not open a position but a position was opened in realtime, especially when the same set of data was used? I was running the backtest during live trading to confirm the issue.

                  Comment


                    #10
                    Hello,

                    This is absolutly the difference. By definition a difference in performance means that trades may or may not be made at the same time depending on how your strategy is coded.

                    Many factors are involved here that are described in the document I linked.

                    Also, there is no way to run a strategy analyzer test live, It always runs historical with historical data loaded up until that point.

                    Let me know if I can be of further assistance.

                    Comment


                      #11
                      Hi Brett,
                      What I meant by testing live was, while the trade is happening in realtime, i fired up the Strategy Analyzer and ran it against the datafeed that was coming in and stored as historical data.

                      In any case, would I be able to configure my strategy to run against historical data instead?

                      Comment


                        #12
                        Hello rogueTrader,

                        This is possible upon using the Market Replay connection. It will allow you to replay historical data and run your strategy in real-time.

                        Please be aware that Market Replay data is different than historical data and is not the same. You can obtain Market Replay data by downloading it or recording real-time data. More information can be found at the link below.
                        JasonNinjaTrader Customer Service

                        Comment


                          #13
                          I would like to ask what should I do or configure to ensure that the simulated account actually mirrors as close as possible to the backtested results.

                          Please advice

                          Comment


                            #14
                            Hello,

                            Backtest results and simulation results will be different as I have attached the link to this in a previous thread.

                            The only way to get the to match is as close as possible is by coding the strategy to run Calculate On Bar Close = True when running live and running in the backtester. This will get the closest results you can achieve between the two.

                            Let me know if I can be of further assistance.

                            Comment


                              #15
                              Hi Brett,
                              I think I've discovered the reason for the discrepancy. It is likely due to my multi-time frame strategy. It seems like it matters which data series the OnBarUpdate triggers first. I've coded it such that the secondary bars get updated first.

                              Anyway, my enabled strategy in the Strategies tab failed to open a position now when my Strategy Analyzer shows that a position is opened. Can you advise what might be the problem?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Taddypole, 04-26-2024, 02:47 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Eduardo  
                              Started by futtrader, 04-21-2024, 01:50 AM
                              6 responses
                              58 views
                              0 likes
                              Last Post futtrader  
                              Started by sgordet, Today, 11:48 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post sgordet
                              by sgordet
                               
                              Started by Trader146, Today, 11:41 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post Trader146  
                              Started by jpapa, 04-23-2024, 07:22 AM
                              2 responses
                              19 views
                              0 likes
                              Last Post rene69851  
                              Working...
                              X