Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding second contract to ATM strategy via NinjaScript

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

    Adding second contract to ATM strategy via NinjaScript

    I have written a NinjaScript strategy that uses ATM strategies to place trades. Currently, the script will place the trade via AtmStrategyCreate and will adjust the profit target and stop loss after those orders have been submitted. After the ATM strategy has been created I would like to have the script possibly add a second contract to the ATM Strategy. I cannot find any documentation on how I can do this.

    Do I use another AtmStrategyCreate with the same AtmStrategyId to submit the new order? Can you please give an example of the code I would use. Also, if the script makes trade for a second contract will the ATM strategy place the SL and PT at the prices based on the original ATM Strategy or will it place those orders at the adjusted levels.

    Thank-you

    #2
    Hello adaisguy,

    Thank you for your post.

    There is no supported way to programmatically scale in/add a second contract to an existing ATM strategy. As mentioned on the following help guide page, "Executions from ATM Strategies will not have an impact on the hosting NinjaScript strategy position and PnL - the NinjaScript strategy hands off the execution aspects to the ATM, thus no monitoring via the regular NinjaScript strategy methods will take place (also applies to strategy performance tracking)"



    This means that once an ATM strategy is created via NinjaScript, it is treated as a manually submitted order and does not get handled in the same way as automated orders from a NinjaScript strategy. You could work with the option of creating a new instance of an ATM strategy with AtmStrategyCreate, though this would not put the Stop Loss and Profit Target orders at the same prices as the first strategy.

    Although adding another contract to scale in is unsupported, it might be possible to utilize an AddOn script to be able to make changes to an ATM strategy position and orders. This approach starts to go outside of our scope of NinjaScript support, though that being said the following links could prove useful if you would like to explore looping through the orders in the Account.Orders collection and then submit and change orders from an AddOn:
    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.

      I've played around with both methods and think I will just add a second ATM Strategy with a limit order placed once the first ATM strategy is filled. I had hoped using the CreateOrder and Submit AddOns you suggested would have simply added to the active ATM on the chart (as if adding a contract using the ChartTrader), but that did not work. I also tried using CreatOrder with the StartAtmStrategy option but that just created an ATM which I couldn't update the SL and PT orders.

      Thank you again for your help.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Max238, Today, 01:28 AM
      2 responses
      26 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by Shansen, 08-30-2019, 10:18 PM
      25 responses
      949 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      8 responses
      41 views
      0 likes
      Last Post JonesJoker  
      Started by timko, Today, 06:45 AM
      0 responses
      5 views
      0 likes
      Last Post timko
      by timko
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      2 responses
      41 views
      0 likes
      Last Post poeds
      by poeds
       
      Working...
      X