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 ETFVoyageur, Today, 04:00 PM
        0 responses
        7 views
        0 likes
        Last Post ETFVoyageur  
        Started by AaronKTradingForum, Today, 03:44 PM
        1 response
        8 views
        0 likes
        Last Post AaronKTradingForum  
        Started by Felix Reichert, 04-26-2024, 02:12 PM
        11 responses
        77 views
        0 likes
        Last Post Felix Reichert  
        Started by junkone, 04-28-2024, 02:19 PM
        7 responses
        83 views
        1 like
        Last Post junkone
        by junkone
         
        Started by pechtri, 06-22-2023, 02:31 AM
        11 responses
        138 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Working...
        X