• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    Patrick H.NinjaTrader Customer Service

    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 ksarin, Today, 12:39 PM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by ttodua, Today, 12:03 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by tomtr27, Today, 11:35 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Uregon, Today, 07:30 AM
        2 responses
        13 views
        0 likes
        Last Post bltdavid  
        Started by Induna, 02-20-2020, 05:38 AM
        4 responses
        26 views
        0 likes
        Last Post NinjaTrader_Kate  
        Working...
        X