Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleOnOrderUpdate - TD Ameritrade

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

    SampleOnOrderUpdate - TD Ameritrade

    Hello:

    How can the code for stopOrder and targetOrder in OnExecution(IExecution execution) be combined to reflect TD Ameritrade's requirement of both StopLoss and ProfitTarget being applied at the same time? There is no ExitLongStopLimit variable. Once this is figured out, I am sure that moving the StopLoss up to Postion.AvgPrice code when price is 1/2 or greater of ProfitTarget will also require some adjustment. I recognize that this is not required for other providers, and welcome help in this matter.

    Thanks.

    Tony

    #2
    Tony, I'm not sure I fully follow - looking throught the sample both the stop and target order are submitted at the same time once entryOrder reports as filled.

    If you work with the Set() methods, you would need to set WaitForOcoClosingBracket = true -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      SampleOnOrderUpdate - ExitLongStopLimit?

      Hi Bertrand:

      I asked this question because of my searching through the forums and trying to find problems with autotrading using TD Ameritrade. My gist of the main problem found was that a profit target and stop loss must be placed at the same time. In OnExecution(IExecution execution) part of SampleOnOrderUpdate, stopOrder and targetOrder appear to be submitted separately. If my premise is correct, shouldn't I use a variable to handle both? I am not using SetProfitTarget(), SetStopLoss(), or SetTrailStop(). I have successfully merged the code with my trading program and it works well within both charting and Strategy Analyzer. Thanks.

      Tony

      Comment


        #4
        tonyh, I believe this issue has been resolved. Are you actually running into errors or are you just assuming it won't work because it hasn't in the past?
        AustinNinjaTrader Customer Service

        Comment


          #5
          TD Ameritrade Issue Resolved?

          Hello Austin:

          If the error has been rectified, I must have missed it in the forums. I am about to purchase a live version, and just wish to have as many possible order entry issues addressed as possible. SampleOnOrderUpdate will be my primary way to buy and sell shares via TD Ameritrade. Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Barry Milan, Today, 10:35 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by WeyldFalcon, 12-10-2020, 06:48 PM
          14 responses
          1,428 views
          0 likes
          Last Post Handclap0241  
          Started by DJ888, Yesterday, 06:09 PM
          2 responses
          9 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          40 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Today, 08:51 AM
          2 responses
          16 views
          0 likes
          Last Post bill2023  
          Working...
          X