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 jxs_xrj, 01-12-2020, 09:49 AM
        5 responses
        3,289 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        5 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        61 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        5 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        24 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X