Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Limit Order Bug?

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

    Stop Limit Order Bug?

    Very simple trailing stop strategy and NT keeps canceling the orders. Here is the visual evidence



    and now on the tick by tick scale....



    The order log....




    And the relevant ultrasimple strategy code.....


    protected override void Initialize()
    {

    CalculateOnBarClose = true;
    ExitOnClose = false;
    TraceOrders = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (DefaultInput[0] > ChandelierSAR(5, 4).Chandelier[0])
    {
    EnterShortStopLimit(DefaultQuantity, ChandelierSAR(5, 4).Chandelier[0], ChandelierSAR(5, 4).Chandelier[0], "");
    DrawDot("My dot" + CurrentBar, false, 0, ChandelierSAR(5, 4).Chandelier[0], Color.Blue);
    }

    // Condition set 2
    if (DefaultInput[0] < ChandelierSAR(5, 4).Chandelier[0])
    {
    ExitShortStopLimit(ChandelierSAR(5, 4).Chandelier[0], ChandelierSAR(5, 4).Chandelier[0], "", "");
    DrawDot("My dot" + CurrentBar, false, 0, ChandelierSAR(5, 4).Chandelier[0], Color.Blue);
    }
    Print(CurrentBar + " " + Time[0] + " " + ChandelierSAR(5, 4).Chandelier[0]);
    }

    #2
    RDPoS, please post the TraceOrders output you get for this scenario - the order likely expired before standing a chance to be triggered and filled (you resubmit it only if your condition is 'true' for the exit, this is not the case anymore on the bar breaching it this level).

    Comment


      #3
      I know I copied and pasted it in there, but somehow I must have deleted it from the last post when I tried to resize it. I just search the log files and can't find it either now. Any ideas on where I can find it in a file somewhere? The output window refreshed when I had to restart because the connection kept showing lost even though data was coming in. Where might I find it?

      Comment


        #4
        It would unfortunately not be stored, if you rerun your strategy with the output window open it should be containing the needed info again, as the strategy is backtested and traceOrder information is collected.

        Comment


          #5
          I have yet to encounter an instance where the past orders didn't go through when I force a reload of the script, but all the new ones seem to miss. I will wait and post it the next time it happens.
          Attached Files

          Comment


            #6
            I'm not sure I fully follow what you mean - if you work in WaitUntilFlat, the strategy would wait until the historical strategy position is flattened before taking any live trades. Yes, if you see any issues, the TraceOrders would be more helpful than the log.

            Comment


              #7
              After a lengthy discussion with the broker it seems as though that the time stamp on their server and the CME exchange server is not the same as the time stamp on my local machine.

              Is there a way to sync the times so that they give the correct picture. The Δt is ranging from 15 to 30 seconds thus throwing everything off.

              That discrepancy is likely the root of the problem. I know over a year ago I suggested a setting to allow your NT platform sync with the exchange time. That would be a huge benefit to us trying to go through orders with the broker and are fighting for every tick of profit if we are comparing apples to apples on time stamps.

              Did anything come of this?

              Comment


                #8
                You can sync your PC clock with the Windows clock syncing features. if you want something automated there are a plethora of clock syncing apps you can find freely through Google. I know many NT customers use one called Dimension 4.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                599 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                344 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                558 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                557 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X