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 wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          192 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,234 views
          0 likes
          Last Post xiinteractive  
          Working...
          X