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

Order Handling

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

    Order Handling

    Hello,

    I recently ran into a bad situation with my live strategy. My strategy had placed an order, the stop loss and profit target were set (using the code below), and then my internet connection was interrupted causing my strategy to remain disabled while in a live position. There are several parts to this issue that I need addressed.
    • The most important thing I need to nail down is how to send proper OCO orders to my broker (Forex.com/City Index):
    In this documentation, it states that "OCO (One Cancels Other) functionality is simulated on your local PC". However, I do not want OCO orders to be simulated locally, I want these handled by my broker so that in the event my connection is lost, strategy disabled, power outage, etc -- I can rest assured that my position is protected. This is also how I place my discretionary trades. I don't mind using unmanaged orders...as long as the goal is achieved.
    • If for some reason it is not possible to send my OCO order to my broker and it absolutely must be simulated locally on my PC, then can you please explain why this is the case?
    • What is the best way to prevent this situation from happening again (aside from having a UPS, 100% up-time connection, surge protection, etc)? There wouldn't be a need to have extra (expensive) hardware if the OCO was sent to the broker.

    Code:
     
    if (entrySignal == true)
    {
        EnterShort(size);
        SetStopLoss(CalculationMode.Pips, stop);
        SetProfitTarget(CalculationMode.Pips, target);
    }

    #2
    Hello jflaggs,

    That depends on if Local OCO Simulation is being used for the account connection.

    Sometimes this is available with a setting in the connection settings (like with CQG/Continuum), where others are Native OCO only (like with Rithmic).

    Who are you connected to?

    Below is a link to a forum post on internet loss.


    Also, you should call Set methods before calling the entry order.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB,

      Thanks for the reply. I am connected to Forex.com/City Index as my broker and data provider.

      From your previous answer in the linked thread:
      If Native OCO is used (meaning OCO IDs are submitted to the exchange with the order) the exchange will perform OCO and cancel any opposing paired orders with an order that is filled or cancelled.
      It sounds like I want to use the native OCO method so that the exchange performs my OCO rather than having NT8 logically simulate my OCO using the SetStop/Limit methods. If this is correct, what method call should I use to send a native OCO order to my broker??

      Comment


        #4
        Hello jflaggs,

        Unfortunately, with the Forex.com connection type OCO is local simulated and this cannot be changed.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        3 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        7 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X