Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 gravdigaz6, Today, 11:40 PM
    0 responses
    6 views
    0 likes
    Last Post gravdigaz6  
    Started by MarianApalaghiei, Today, 10:49 PM
    3 responses
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by XXtrader, Today, 11:30 PM
    0 responses
    4 views
    0 likes
    Last Post XXtrader  
    Started by love2code2trade, Yesterday, 01:45 PM
    4 responses
    28 views
    0 likes
    Last Post love2code2trade  
    Started by funk10101, Today, 09:43 PM
    0 responses
    9 views
    0 likes
    Last Post funk10101  
    Working...
    X