Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

question about Order Pending commands

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

    question about Order Pending commands

    I would like to make a delineation in my program between when an order is pending and when it is not. I know how to do this if there is an existing position , (e.g. if (Position.MarketPosition == MarketPosition.Short )) but I don't know how to do it when a limit order has been placed but is as yet unfilled.


    My current order code is as follows:


    entryOrder = EnterShortLimit(0,true,DefaultQuantity,(2*dResMax+ Close[0])/3, "FakeOutSell");
    SetProfitTarget("FakeOutSell",CalculationMode.Pric e,dLastMax);
    SetStopLoss("FakeOutSell",CalculationMode.Price, 10*ATR(20)[0]+dResMax,false);



    Essentially what I would like to write is "If, while a limit sell order is pending, the price drops below a certain level, then cancel the limit sell order"


    My guess at the code

    if ( entryOrder.State = entryOrder.ShortLimit)

    does not work!

    Thank you in advance.

    As a corollary, I could still use some clarity when it is better to use an iorder such as entry.Order versus just a simple LimitSell order such as
    EnterShortLimit(0,true,DefaultQuantity,Close[0], "WickShort");

    #2
    Hello Tradertrader,

    You will have to work with IOrder objects and check the state of your orders.



    The advantage of using Iorder is a higher level of control with the trade-off of increased complexity to manage.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X