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 kempotrader, Today, 08:56 AM
        0 responses
        6 views
        0 likes
        Last Post kempotrader  
        Started by kempotrader, Today, 08:54 AM
        0 responses
        4 views
        0 likes
        Last Post kempotrader  
        Started by mmenigma, Today, 08:54 AM
        0 responses
        2 views
        0 likes
        Last Post mmenigma  
        Started by halgo_boulder, Today, 08:44 AM
        0 responses
        1 view
        0 likes
        Last Post halgo_boulder  
        Started by drewski1980, Today, 08:24 AM
        0 responses
        3 views
        0 likes
        Last Post drewski1980  
        Working...
        X