Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Checking that Position is Flat

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

    Checking that Position is Flat

    I have a strategy that calls an ATM Strategy. The ATM Strategy starts with 4 contracts and scalps 3 at 4 ticks, then lets the last one run with a trail stop. In the strategy code I need to ensure that the last contract has closed before setting up another trade (order). I'm using this:
    if( GetAtmStrategyMarketPosition(ATMOrder) == MarketPosition.Flat) {
    // ATM is done - can allow a new order
    Print("Order Complete");
    }

    Instead, "Order Complete", prints out after the first 3 contracts are scalped. Am I using the correct approach here?

    Thanks.

    #2
    How are you determining that it has not closed the 4th already as well? What does GetAtmStrategyPositionQuantity() say?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh:

      I will add that check. Here's how I determined there was an issue: I had the DOM running and the Output Window visible concurrently. I saw the ATM strategy begin, the order fill and the first target hit. So, I was left with a contract that was being trailed. That last contract took enough time that I could look at Output Window and see the "Output Complete" print, before the
      trailing stop hit it much later.

      Having said all that, I'll add the check you suggest and see what results.

      Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X