Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MarketPosition.Flat with long or short position open

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

    MarketPosition.Flat with long or short position open

    Hi! My Strategy uses "Position.MarketPosition == MarketPosition.Flat" to check the position status as a primary means of activating or deactivating different stages in its progression. Unfortunately, after the Strategy opens a position (either long or short) it inaccurately returns "MarketPosition.Flat", which somewhat disrupts the rest of its job. Interestingly, it didn't (and doesn't still - just checked) do this when I was testing it in a Playback connection; but it does it without fail in both Simulation and Live modes.

    Any ideas?

    #2
    Hello Borogove,

    Are you waiting for at least 1 OnBarUpdate event before printing the position? If you are printing that right after submitting the order then that would be the reason, you have to wait at least 1 OnBarUpdate event for the position to change, it won't change immediately after submitting an order.

    Comment


      #3
      Ah! Thank you very much! You are absolutely right! I guess this means something else about my code is bollucksed up, but at least I'm not haring off in the wrong direction any more!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      80 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X