Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Position in DOM/ChartTrader

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

    Strategy Position in DOM/ChartTrader

    Hi,

    I've got an automated strategy that uses Stops/Targets and moves to breakeven. Under certain conditions it also reverses.

    I originally tried ExitLong()/ExitShort() for the reversal, and then re-enter separately, but had some problems with the strategy shutting down due to reported Overfill (although they didn't show up in the executions/strategies tabs of the Control Center (CC).

    Next I tried to use the EnterLong()/EnterShort() and let NT handle the Close Position, and re-enter. This seemed pretty good, no strategy shutdowns or reported overfills. However, in going back over executions tab in CC, there were times that the position was reported as 4 contracts when it should have been only 2.

    Using TraceOrders = true; and throwing in some additional debugging code in OnOrderUpdate(), OnExecution(), OnPositionUpdate() etc., it seems the times there were 4 contracts were due to "in-flight" executions, generally after the stop had been moved to breakeven (closer to the market). It seems the NT "Close position" order was generated when a reversal was triggered, then the stop got hit (making the position flat), then the "Close position" order was executed (making position 2 in the opposite direction), and then the NT enter order is executed (making the position 4), with no overfill reported.

    I looked for a different solution and tried using the ExitLong()/ExitShort() method again, but also tracking the stop and target orders and waiting for them to reach a terminal state (filled, cancelled, rejected) before calling EnterLong()/EnterShort() for the reverse order.

    This seems to work well, no reported overfills (shutting down the strategy) and no positions larger than they should be are reported in the CC executions or strategies tabs.

    However, usually the strategy position and stop/target orders show up in the DOM, or a ChartTrader in another chart, set to the same symbol. In this case only some positions show up in DOM/ChartTrader, and other times only the stop/target show up and the DOM/ChartTrader, shows no current position. But the executions/strategies tabs in CC report the position accurately.

    Any Ideas?

    Ed

    #2
    Ed,

    Could you please clarify your issue?

    You mention that you are not seeing some orders show in the DOM or ChartTrader. Do you notice any patterns? How are you checking to exit your orders in OnOrderUpdate() and OnExecution()?

    Here is more information on how the managed approach approaches orders : http://www.ninjatrader.com/support/h...d_approach.htm

    I look forward to helping you resolve your issue.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi Adam,

      I'm not using the managed approach. To verify that the stop/targets are in a terminal state I use a List<IOrder> and catch/add the orders to the list in OnOrderUpdate() (similar to the SampleMonitorStopTarget.cs file). I then wait until those orders are either cancelled, filled or rejected, and MarketPosition == Flat, prior to submitting the order to enter in the reverse direction.

      The only pattern I see is that it seems to not show the new position in DOM/ChartTrader after the reversal sequence. Like I said, the CC Executions/Strategies tabs report the correct position, it's just not reflected in DOM/CT, only the stop and target orders.

      Ed

      Comment


        #4
        Ed,

        Do you possible have your strategy to post so that I may test on my end?
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Hi Adam,

          Sorry that would not be possible, but I will see if I can reproduce with some sample code, that I can post.

          An interesting development though. I was going to take some screen shots showing that the DOM and ChartTrader only showed the stop and target orders and not the position While the Strategies/Executions tab in CC showed a position. As I repositioned the DOM for the screen shot and scrolled the DOM display, the position suddenly appeared. However, the ChartTrader still showed no position (only the stop/target orders)...I turned the ChartTrader off and then back on, and the position appeared there as well. Strange indeed.

          I'll see if I can get some sample code to post for you, and will test a bit more to see if this recent development is reproducible.

          Ed

          Comment


            #6
            Ed,

            Yes, please do. It would help immensely if there are reproducible steps. It can help isolate the issue, and/or explain it.

            I look forward to helping you resolve your issue.
            Adam P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            657 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            373 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            579 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X