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

Multiple Exit Orders OCA

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

    Multiple Exit Orders OCA

    Is it possible to send multiple Exit Limit Orders which OCA

    what i am trying to do is the following example:


    If i have a long position where the last traded price triggers an exit condition
    the last traded price is for example is 50
    and the bid is now 49.95 and the offer is now 50.03
    i would like to send ExitLongLimit orders @ 50.03,50.02,..thru to........49.96 & 49.95
    All OCA

    if (close[0] <= 50)

    {


    }

    #2
    Hello fiddy,

    Thank you for your post.

    Using OCA (referred to as to as OCO in NinjaTrader) would require the Unmanaged Order Approach. You can find information on the Unmanaged Order Approach at the following link: http://ninjatrader.com/support/helpG...d_approach.htm

    Alternatively you could wait until one of the price levels is hit and then submit an ExitLong(). For example:
    Code:
    if (Close[0] == 50.03 || Close[0] == 49.95)
    ExitLong();

    Comment


      #3
      are you able to provide example of how orders are done OCO using unmanaged approach?

      Comment


        #4
        Hello fiddy,

        A basic example would be the following:
        Code:
                protected override void Initialize()
                {
        			Unmanaged = true;
                }
        
                protected override void OnBarUpdate()
                {
        			if (Close[0] > Open[0]) //basic condition
        			{
        				SubmitOrder(0, OrderAction.Buy, OrderType.Stop, 1, 0, Close[0] + 2*TickSize, "MyOCO: " + CurrentBar, "Buy");
        				SubmitOrder(0, OrderAction.Sell, OrderType.Stop, 1, 0, Close[0] - 2*TickSize, "MyOCO: " + CurrentBar, "Sell");
        			}
                }

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mintos, 04-02-2024, 08:22 PM
        5 responses
        30 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Felix Reichert, 04-26-2024, 02:12 PM
        10 responses
        69 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by PaulMohn, 04-24-2024, 03:49 AM
        4 responses
        36 views
        0 likes
        Last Post PaulMohn  
        Started by lightsun47, Today, 11:37 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by vitaly_p, Yesterday, 05:09 PM
        4 responses
        36 views
        0 likes
        Last Post vitaly_p  
        Working...
        X