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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          68 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          38 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          62 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X