Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy handing off to ATM successfully but ATM settings ignored.

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

    Strategy handing off to ATM successfully but ATM settings ignored.

    Hi there...

    I have a strategy that is entering the market using an ATM... which it seems to be doing OK... however, the ATM stop and trail settings are either being ignored or mis-calculated.

    In the attached images, you can see the strategy has entered the market long. Although the markers are not appearing properly (something to do with replay and strategies), the entry is on the very last candle pictured.

    In image 00: you can see it is using the correct strategy as indicated by the lightning bolt symbol showing ATM in use

    in image 01: you can see the initial stop settings for the ATM

    in image 02: you can see the trail settings for the ATM

    For some reason, the trailing stop is being set only about 8 ticks away instead of the 30 specified.

    When I use the ATM in the live market and manually place a trade, this ATM works as expected.

    Previously when I've been back testing a strategy on market replay and using ATM hand off, it has worked.

    For some reason it is handing off to ATM but ignoring the ATM settings in market replay. (I have not tested in live market yet)

    Any help with this?

    Thanks.

    Note: here is the call to initiate the ATM
    AtmStrategyCreate(
    OrderAction.Buy
    , OrderType.Market
    , 0
    , 0
    , TimeInForce.Day
    , orderId
    , useATMName
    , atmStrategyId
    , (atmCallbackErrorCode, atmCallBackId) =>
    {
    //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
    if (atmCallbackErrorCode == ErrorCode.NoError
    && atmCallBackId == atmStrategyId)
    {isAtmStrategyCreated = true;}
    else
    {Print("ATM ERROR MSG: " + atmCallbackErrorCode.ToString());}
    }
    );​
    Attached Files
    Last edited by halgo_boulder; 04-20-2024, 08:55 AM.

    #2
    Hello halgo_boulder,

    Thanks for your post.

    Are you able to reproduce the behavior when testing the SampleATMStrategy script that comes with NinjaTrader?

    I have created a copy of the SampleATMStrategy script called "ATMTest" and created an ATM Strategy Template using the same settings as the template in your screenshot.

    When testing this on my end, I see the ATM Strategy stop loss and trailing stop logic behaving as expected.

    See this demonstration video: https://brandonh-ninjatrader.tinytak...OV8yMzEzMTcxOA

    Attached is a copy of the strategy used to test this and the ATM Strategy Template used for the test.

    You could import the attached Strategy and ATM Strategy Template by going to Tools > Import > NinjaScript AddOn.​
    Attached Files
    Last edited by NinjaTrader_BrandonH; 04-21-2024, 06:13 PM.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hi Brandon,

      Thank you for testing this and providing a test script.

      I ended up re-writing the ATM hand off using your test script and it seems to work now.

      Not sure what was wrong with it previously.

      Thank you.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Felix Reichert, 04-26-2024, 02:12 PM
      10 responses
      68 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by PaulMohn, 04-24-2024, 03:49 AM
      4 responses
      36 views
      0 likes
      Last Post PaulMohn  
      Started by lightsun47, Today, 11:37 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by vitaly_p, Yesterday, 05:09 PM
      4 responses
      35 views
      0 likes
      Last Post vitaly_p  
      Started by bortz, 11-06-2023, 08:04 AM
      50 responses
      1,773 views
      0 likes
      Last Post carnitron  
      Working...
      X