Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss initialized but not sent to ameritrade

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

    Stop Loss initialized but not sent to ameritrade

    I have a custom strategy running on NT8(64) Trading US Stocks. Please Help

    It had a parameter box to put in my own stop loss in Dollar value such as 50 = $50 stop loss. Also a time limit to sell the stock which ever hits first.

    On demo and simulation is works just fine, but in live trading connected to tdameritrade the stop loss order seems to be generated on ninja and not being sent to ameritrade.

    The stop is generated as an oco order.

    There is no pending or open order on the ameritrade side.

    Attached are screen shots showing the order initialized on ninja but not really sent. So stop losses are going right past the number I put in. Entering orders are working and time limit sell is working so there's no problem with the connection to ameritrade.

    here is some of the code for the stop loss.

    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    trailstop=false;
    TimeInForce = TimeInForce.Day;

    IsInstantiatedOnEachOptimizationIteration = true;
    Offset = 10;
    stoploss=true;


    }
    else if (State == State.Configure)
    {




    SetStopLoss("",CalculationMode.Currency, StopLoss,false);


    if ( trailstop==false && stoploss ==false &&BarsSinceEntryExecution() >= MinutestoClose )
    {ExitShort(quantity);}

    // Set 4
    if (trailstop==false && stoploss ==false && BarsSinceEntryExecution() >=MinutestoClose )
    {ExitLong(quantity);}
    Attached Files

    #2
    Hello usstocks,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    The Order State Initialized would indicate the order was not sent to the connected brokerage technology. You can find out more on the Order States at the following link: https://ninjatrader.com/support/help...efinitions.htm

    Please send me your log and trace files so that I may look into what occurred. You can do this by going to the Control Center-> Help-> Mail to Platform Support. Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

    Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

    I look forward to assisting you further.

    Comment


      #3
      I tried my script on interactive broker and it works, fine. does this mean ameritrade has a problem with accepting the stop loss order? could it be something with the quotes? enteries and exits with ameritrade work.

      Comment


        #4
        Hello usstocks,

        Thank you for your patience.

        The issue is a limitation with TD Ameritrade and the way that NinjaTrader submits Stop losses.

        TD Ameritrade has a limitation where all orders in an OCO grouping must be received at the same time and does not allow for orders placed at different times to use the same OCO ID.

        Because of this, TD Ameritrade will not accept an order that uses an OCO ID if no other orders are submitted with the same OCO ID. (There can't be a single order placed with that OCO ID. If an OCO ID is used, there has to be a grouping)

        The issue is that NinjaTrader places Stop Losses submitted manually or with SetStopLoss() with an OCO ID.

        To prevent the issue, in the script use Exit orders instead of SetStopLoss() or alternatively, also use a profit target (which would be grouped with the OCO ID and allow for the orders to be accepted).

        Please let me know if this does not resolve your inquiry.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rocketman7, Today, 02:12 AM
        5 responses
        23 views
        0 likes
        Last Post rocketman7  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        7 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by samish18, 04-17-2024, 08:57 AM
        17 responses
        66 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by briansaul, Today, 05:31 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PaulMohn, Today, 03:49 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X