Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position.MarketPosition

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

    Position.MarketPosition

    compiler accepts
    if (Position.MarketPosition != MarketPosition.Flat)
    but not
    if (Position.MarketPosition == "Long")
    even though
    Print("Position = "+Position.MarketPosition );
    prints "Long"

    1. is there a method which returns direction of position?

    2. is there a method which returns the number of lots in the position?

    3. does OnPositionUpdate not update when a stop is hit?
    Last edited by ATI user; 03-09-2010, 04:33 PM.

    #2
    MarketPosition is an enumeration. When you write Print("Position = "+Position.MarketPosition ); then its ToString() method is implicitly called which converts MarketPosition.Long to the string "Long". What you want to do is: if(Position.MarketPosition == MarketPosition.Long)

    Comment


      #3
      2. Position.Quantity

      3. When a stop is hit and filled OnPositionUpdate will update. This is only relevant for NinjaScript positions.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by ATI user View Post
        1. is there a method which returns direction of position?
        That should be Position.MarketPosition.

        Originally posted by ATI user View Post
        2. is there a method which returns the number of lots in the position?
        I think there is something like Position.Quantity or something like that.

        Originally posted by ATI user View Post
        3. does OnPositionUpdate not update when a stop is hit?
        It should once the order is filled.

        Comment


          #5
          thanks Josh and Terenyi

          I have been using atmStrategyCreate code for the last 3 years...more flexible....however can only be tested in MarketReplay

          Josh... does StrategyAnalyzer still not run atmStrategies?

          re "3. When a stop is hit and filled OnPositionUpdate will update. This is only relevant for NinjaScript positions. "...in SA I am testing new ninjascript which uses the standard Order Methods...and it does not seem to be updating on stop hits...

          Comment


            #6
            ATI User,

            It updates only when positions change. You likely have too many filters in your code for its printing.

            Any time you see Positon.Quantity change or Position.MarketPosition change it means it has already finished OnPositionUpdate().

            No, you cannot backtest ATM strategies.
            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
            591 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            342 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
            555 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X