Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems with TD Ameritrade

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

    #16
    So I circumvented this problem by tapping the 'Change Pending" status on the Order.
    1. I subscribe to Order Update Event.
    2. Upon Order Update , I check with the Status is "Change Pending" , if so
    - I get all the Orders with the same oco as this order in this Account, store the changed value of the oco-leg being modified and the current value of the other oco-leg into a variable and cancel them both.
    - then I get the current position and create new oco bracket with the stored values and same quantity as position

    This seem to be working. However I have one question
    - I see that first time when ATM strategy triggers modification of orders , above logic gets executed and the new OCO bracket created

    Question is whether my original ATM Strategy is still running , will it trigger its second modification to trigger the Order Update Event on new OCO leg(s)

    Comment


      #17
      Hello vivekniwas,

      If you cancel an ATM strategy order, the ATM strategy will be disabled and the position will remain open. The same can be said about programmatically cancelling the ATM strategy orders.

      Attempting to intercept the modifications to ATM strategy orders and maintaining the functionality of the ATM strategy may be a very difficult way to approach this. Another way forward to consider would be to create a NinjaScript strategy that adds buttons for manual order submission, and possibly reads mouse coordinates on the chart to submit orders at specified price levels. The strategy can then parse an ATM strategy XML file and then have the strategy perform those actions, ensuring the orders are always cancelled and replaced.

      Theoretically, you could move forward with your approach and program functionality to parse the ATM strategy and re-implement the ATM strategy's behaviors, but you may find that easier from a NinjaScript strategy.

      I replied to a thread recently where another client was asking about how they can add manual order submissions to a NinjaScript strategy this can help to give further direction as well.

      https://ninjatrader.com/support/foru...16#post1104416

      A NinjaScript strategy that adds buttons can be found here - https://ninjatraderecosystem.com/use...bar-buttons-2/

      The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

      Intercepting the orders in OnOrderUpdate goes pretty far into unsupported territory, so we won't be answering any more questions in that direction. You may continue in that direction if you like, but consider the information given "Use at your own risk."

      Have a good weekend!
      JimNinjaTrader Customer Service

      Comment


        #18
        Hi, I am using NT8 latest version and I getting a few errors when testing my strategy. I use TDA and also have Kinteck connection for Market Data/Tick Data.
        Error 1: My entry orders are not executing/triggering, even when my strategy conditions are met. I am not sure why this is happening.
        Error 2. So I changed the symbol in the chart control and my entry order executed and filled however I got an error "Condition Orders are not permitted for accounts in this segment". Note: my StopLoss order was placed in TDA however my Profit Target order was not. I have contacted TDA for this error and they will turn off the advanced features which prevent OCO orders via API.

        When I back test my strategy it works fine and shows entry,, stop loss, and profit target.

        Any help or suggestions for Error 1. will be greatly appreciated.

        Thanks,

        Comment


          #19
          Hello bjunaid,

          If the strategy is green and is not taking trades, this would point to a logical issue with the strategy, or you are hitting an internal rule preventing that submission.

          Ultimately, debugging steps should be taken to observe the strategy logic as it is executing.

          In order to better understand how the code is executing, I recommend adding debugging prints to your strategy. By adding prints for the values used to evaluate your conditions, outside of those conditions, you can observe if logic is becoming true and allowing your order submission methods to fire.

          I.E.

          Code:
          Print("Close: " + Close[0] + " Open: " + Open[0]);
          if (Close[0] > Open[0])
          {
              ...
          }
          The above print will tell you what the Close and Open values are and can tell you why the condition below has/has not become true.

          If you are seeing your order submission logic being reached, but it is not executing, there may be an issue where the strategy is hitting an internal rule that is not allowing you to re-enter. TraceOrders can be enabled in the strategy (set in State.SetDefaults or in the Strategy Builder under Default Properties) so it prints its order feedback, and you may also observe the log tab of the Control Center for additional hints.

          Some items to check when you are taking debugging steps:
          1. Are your conditions allowing your order submission methods to be reached?
          2. Is the strategy currently in a position that is preventing it from submitting another entry order?
          3. Do you see any errors in the log tab of the Control Center or does Trace Orders give you any feedback?
          I've included some tips for debugging below. The Playback Connection can be used to replay data and test your strategy as if it were running realtime.

          Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm
          TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm
          Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk
          Playback Connection - https://ninjatrader.com/support/help...connection.htm
          Debugging Demo - https://drive.google.com/file/d/1rOz...w?usp=drivesdk

          We look forward to assisting.
          JimNinjaTrader Customer Service

          Comment


            #20
            Just wanted to let people know that I'm able to get NT working with TDA. I used Managed orders, with local OCO enabled. I can move stops successfully also.

            You can see my setup in action here: https://www.youtube.com/watch?v=Z3UzhS5_Uzg&t=172s

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            7 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            13 views
            0 likes
            Last Post bltdavid  
            Working...
            X