Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Variable to Market order?

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

    Variable to Market order?

    Hi,

    Is it possible to assign to a variable the entry price executed by a market order (EnterLong)? I've tried:

    double value = EnterLong(1, "Entry");

    However I get an error with this...I simply want to "save" the price used for entry for later usage. Thank you.

    #2
    After you get filled save the value of Position.AvgPrice.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you.

      Comment


        #4
        Hi,

        For some reason this is returning a value of "0"...I don't understand why:

        EnterLong(1, "LO trace"); EnterPlace = Position.AvgPrice;

        Can somebody explain why my Print statements show the value for "EnterPlace" is always "0"?

        Comment


          #5
          You want to save the value after your order is filled not after you submit your order. So run a check as to when your order gets filled via either Position.MarketPosition or Position.Quantity. Then do the Position.AvgPrice saving.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by Josh View Post
            You want to save the value after your order is filled not after you submit your order. So run a check as to when your order gets filled via either Position.MarketPosition or Position.Quantity. Then do the Position.AvgPrice saving.
            EntryPrice in EasyLanguage.
            Position.MarketPosition changed or
            Position.Quantity changed
            EntryPrice = Position.AvgPrice

            Comment


              #7
              Huh? Not sure I follow what you are asking.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by Josh View Post
                Huh? Not sure I follow what you are asking.
                Sorry, Just a memo for myself.

                I was looking for a method to calculate the EntryPrice as with Tradestation.
                What you mentioned seems to work for me. that is all.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by sjsj2732, Yesterday, 04:31 AM
                0 responses
                33 views
                0 likes
                Last Post sjsj2732  
                Started by NullPointStrategies, 03-13-2026, 05:17 AM
                0 responses
                286 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                284 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                133 views
                1 like
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                91 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Working...
                X