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 Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                574 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                332 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
                553 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