Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MarketDataType

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

    MarketDataType

    Is there a way to determine whether the value from MarketDataType.Last represents a long position or short position?

    #2
    Hello pman777,
    Thanks for your post.

    MarketDataType would not have any concept of a position. You can use the PositionAccount object to check for the account position or the Position object to check the strategies position. If you wanted to check for a long or short position you would use the MarketPosition property for those objects.

    For example, to check if the strategy is in a long position you would do something similar to the following snippet:
    Code:
    if(Position.MarketPosition == MarketPosition.Long)


    Josh G.NinjaTrader Customer Service

    Comment


      #3
      thanks Josh, for context, I'm not looking to analyze my position or strategy ... i'm evaluating past large lot trades via OnMarketData and was hoping to also determine what type of position those trades were.

      Comment


        #4
        pman777,

        You would just need to check and see if the Last price was greater/lesser than the Ask/Bid. You can see an example of this in the BuySellPressure and BuySellVolume default indicators.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          thanks Josh!

          Comment

          Latest Posts

          Collapse

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