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 futtrader, 04-21-2024, 01:50 AM
          4 responses
          41 views
          0 likes
          Last Post futtrader  
          Started by Option Whisperer, Today, 09:55 AM
          1 response
          11 views
          0 likes
          Last Post bltdavid  
          Started by port119, Today, 02:43 PM
          0 responses
          3 views
          0 likes
          Last Post port119
          by port119
           
          Started by Philippe56140, Today, 02:35 PM
          0 responses
          4 views
          0 likes
          Last Post Philippe56140  
          Started by 00nevest, Today, 02:27 PM
          0 responses
          2 views
          0 likes
          Last Post 00nevest  
          Working...
          X