Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Monitoring Entry Prices Individually

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

    Monitoring Entry Prices Individually

    Code:
     
    protected override void OnOrderUpdate(IOrder order){
     
    if (buy1entry != null && buy1entry == order){ 
    Print( Time[0] + " - buy1entry is Working at "+Buy_1EntryPrice); // Print Working
    if (order.OrderState == OrderState.Filled){
    Position1 = MarketPosition.Long; // Position1 is Long
    Print( Time[0] + " - buy1entry is Filled at [COLOR=red]"+Position.AvgPrice[/COLOR]); // Print Filled
    }
    I am using this code to monitor a working limit order entry and it's fill to make sure they are the same.

    Code:
     
    if (buy2entry != null && buy2entry == order){ 
    Print( Time[0] + " - buy2entry is Working at "+Buy_2EntryPrice); // Print Working
    if (order.OrderState == OrderState.Filled){
    Position2 = MarketPosition.Long; // Position2 is Long
    Print( Time[0] + " - buy2entry is Filled at [COLOR=red]"+What goes here[/COLOR]?); // Print Filled
    }
    But if I have a second position I need some code other than +Position.AvgPrice because I don't want the average of the 2 entries, I need the price of the second fill only. Any help would be appreciated. Thanks
    Last edited by kenb2004; 07-29-2012, 04:26 PM.

    #2
    kenb,

    You can track individual IOrder objects. For example :

    IOrder MyOrder = EnterShort();
    Print(MyOrder.ToString());

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Adam

      Isn't there a "+something" that will give me an actual price instead of a string()?

      Comment


        #4
        Hello,

        myOrder.AvgFillPrice would give you a double value representing that orders fill price, rather than the overall position avg fill price.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Thanks

          I'll try that.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          60 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          39 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          20 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          22 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          51 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X