Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Order not getting triggered

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

    Order not getting triggered

    Hi.

    I had buy signal in this morning but it was never triggered. I run strategy. End of the bar, buy at limit of closing(5Min). It has been working properly last few weeks and this was the first time it has happened. There was no Buy or error on LOG.

    When I disabled and able strategy, the trade pop up on chart but deviously did not get into a position.

    Where do you suggest me to check further?

    Thank you,
    kapa

    #2
    Hello kapa1,

    Thanks for your inquiry.

    Disabling and re-enabling a strategy will recalculate historical trades, and trades possible through historical data will be presented on the chart. The plot marker would be a historical trade after you re-enabled.

    Historical Data and Realtime data are fundamentally different. Since a single tick can modify strategy results, it is possible to see conditions become true historically that do not become true in realtime.

    Here are some resources that explain these discrepancies:

    Discrepancies between realtime and backtest (historical data) - https://ninjatrader.com/support/help...ime_vs_bac.htm

    Comparing real-time, historical, and replay performance - https://ninjatrader.com/support/foru...d.php?t=102504

    For more information as to why you did not receive a submission for your order, debugging steps must be taken to observe how the logic is processed for real time data. I recommend to use Market Replay Data to recreate the scenario, and to add prints to your code as well as enabling TraceOrders to watch the strategy logic process in the NinjaScript Output window.

    Here are some resources on debugging.

    Debugging - https://ninjatrader.com/support/foru...ead.php?t=3418

    TraceOrders - https://ninjatrader.com/support/foru...ead.php?t=3627

    Please let me know if I may be of further assistance.
    Last edited by NinjaTrader_Jim; 09-29-2017, 12:03 PM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Jim Thank you and have a great weekend. I will check out those link later today.

      kapa

      Comment


        #4
        Hi, Jim.

        Here is my concern.
        I do run strategy with strategy builder. Not with Ninja script. And it happened as I was watching the market. Simply put, 5min bar has been ended meeting requirements from signal and should have placed limit order to enter but never did. A few min later, I disable the strategy then turn back on, the trade appeared on the chart. So in this case, it was not due to discrepancies between realtime and backtest data. Any thoughts on what might have been the cause? And from late August, the system was spot on for getting in and out of trades.

        Thank you,
        Kapa.

        Comment


          #5
          chart

          and ninjatrader chart was doing this a couple of time. I tried re-download and fixing it but I found it like this in this morning.
          Attached Files

          Comment


            #6
            Hello kapa1,

            Thanks for your replies.

            The Strategy Builder creates NinjaScript code. If the order methods aren't firing, the logic must tell the tale. Debugging steps will still be your best route to analyze what is happening and to come up with a solution.

            You can create a separate condition set (without conditions) in the Strategy Builder that prints out the values for your order entry condition, and I would also advise to place a print beside the order entry method to clearly see it getting fired.

            When you disable and re-enable the strategy, historical data is processed and historical executions appear on your chart. (Historical means processed by historical data, not "past realtime orders.") We have not yet ruled out discrepancies between realtime and historical.

            Please take the aforementioned debugging steps to verify your strategy logic in this instance using Market Replay Data to mimic realtime data.

            As for the chart issue, it appears that an indicator you are plotting to the price panel is autoscaling the chart so you can always see the indicator plot, and it is then scrunching the chart bars so you can see the plot.

            Please let me know if I may be of further assistance.
            Last edited by NinjaTrader_Jim; 10-02-2017, 07:27 AM.
            JimNinjaTrader Customer Service

            Comment


              #7
              Thank you.

              I did debug my strategies a bit. It seems to be working fine for now. Thank you for your suggestion.

              Kapa.

              Comment


                #8
                it happened again.

                Today it happened again. Buy order was never triggered on strategy. The strategy I am running had both buy and sell as well as different time it needs to be in. I will create a separate strategy for them and try to see what happen.

                This strategy also have rule of not to trade on certain days(Like no long for Tuesdays and no short for Wednesdays). Do you think that might be the cause of the problem? A different strategy without day of the week restriction seems to be working flawlessly.

                Thanks,
                Kapa

                Comment


                  #9
                  Hello kapa1,

                  Without the full code and taking the necessary debugging steps to monitor the logic as it is executing, I could not provide further input on why the logic did not fire.

                  I've created a quick demonstration for adding debugging prints to a strategy in the Strategy Builder: https://www.screencast.com/t/rQBwlQKfwCAI\

                  After taking these steps and testing with Market Replay, do you see the conditions for your order logic becoming true and allowing the order submission?

                  If there is anything else I can do to assist, please let me know.
                  Last edited by NinjaTrader_Jim; 10-05-2017, 08:00 AM.
                  JimNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by guillembm, Yesterday, 11:25 AM
                  2 responses
                  9 views
                  0 likes
                  Last Post guillembm  
                  Started by junkone, 04-21-2024, 07:17 AM
                  9 responses
                  68 views
                  0 likes
                  Last Post jeronymite  
                  Started by trilliantrader, 04-18-2024, 08:16 AM
                  4 responses
                  18 views
                  0 likes
                  Last Post trilliantrader  
                  Started by mgco4you, Yesterday, 09:46 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by wzgy0920, Yesterday, 09:53 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post wzgy0920  
                  Working...
                  X