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 funk10101, Today, 11:35 AM
        0 responses
        0 views
        0 likes
        Last Post funk10101  
        Started by samish18, Today, 11:26 AM
        0 responses
        1 view
        0 likes
        Last Post samish18  
        Started by Trader146, 03-29-2024, 01:22 PM
        2 responses
        14 views
        0 likes
        Last Post Trader146  
        Started by tsantospinto, 04-12-2024, 07:04 PM
        7 responses
        127 views
        0 likes
        Last Post aligator  
        Started by futtrader, 04-21-2024, 01:50 AM
        5 responses
        56 views
        0 likes
        Last Post NinjaTrader_Eduardo  
        Working...
        X