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 CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    29 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    184 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    338 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    262 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X