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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          118 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          166 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          85 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          130 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          88 views
          0 likes
          Last Post PaulMohn  
          Working...
          X