Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Questions regarding starting ATM strategy from NinjaScript and quantity entry issue

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

    Questions regarding starting ATM strategy from NinjaScript and quantity entry issue

    Good morning. Two questions: 1) Is there a video tutorial about how to link ATM strategy from another strategy?2) I have generated a strategy without stop and without profit target. This is how it is executed and gets me into the market correctly. Once inside, for example Long, I introduce a Sell Stop as stop loss and a Sell Limit as profit target, both without any ATM strategy. That way I can manually manage the strategy. If it reaches the profit target, it is executed correctly, and I remove the other sell order that I had entered as stop loss. On the contrary, if the operation is stop, I manually remove the sell order I had set as profit target. Until then, everything is correct. But when the strategy executes the next trade, it enters TWO contracts instead of ONE. And the next time THREE and the next time FOUR, and so on. Why does this happen? How is it solved? Thank you.


    Translated with www.DeepL.com/Translator (free version)

    #2
    Welcome to the forums tradesouth!

    I have moved this post to a new thread as the thread you replied to was getting close to being a year old and you have some new questions that constitute a new thread. Please be sure to open new threads with new inquires so it can help to make the forum more browse-able for others to spot a thread that is related to issues or questions that they may be facing.

    More information on using the forum can be found here - https://ninjatrader.com/support/forum/help

    1) Is there a video tutorial about how to link ATM strategy from another strategy?
    We do not have videos for initiating ATM strategies from NinjaScript strategies. However, we have a working SampleAtmStrategy example that can be opened and reviewed in the NinjaScript Editor. It is important to note that ATM strategies are initiated and are separate strategies from the NinjaScript strategy. The NinjaScript strategy uses the ATM strategy methods to start/peek/poke the ATM strategy. (Strategy properties like the Position object won't show positions taken from the ATM strategy and the NinjaScript strategy's Strategy Performance report cannot be used to report the ATM strategies trades.)

    ATM strategies also must be initiated with realtime data and cannot be backtested in the Strategy Analyzer. You could use the Playback Connection to test these strategies against realtime data, however.

    Using ATM Strategies — https://ninjatrader.com/support/help...strategies.htm

    ATM Strategy Methods — https://ninjatrader.com/support/help...gy_methods.htm

    Playback — https://ninjatrader.com/support/help...connection.htm

    2) I have generated a strategy without stop and without profit target. This is how it is executed and gets me into the market correctly. Once inside, for example Long, I introduce a Sell Stop as stop loss and a Sell Limit as profit target, both without any ATM strategy. That way I can manually manage the strategy. If it reaches the profit target, it is executed correctly, and I remove the other sell order that I had entered as stop loss. On the contrary, if the operation is stop, I manually remove the sell order I had set as profit target. Until then, everything is correct. But when the strategy executes the next trade, it enters TWO contracts instead of ONE. And the next time THREE and the next time FOUR, and so on. Why does this happen? How is it solved? Thank you.
    This could be encountered if Exit and Enter methods are called at the same time, or if your strategy is submitting a different quantity for each entry. I would recommend checking these, and if you are still hitting the issue, I suggest then to do the following:

    1. Use the Playback Connection to be able to reproduce the issue in a consistent manner
    2. Add debugging prints before each order submission to observe a) Quantity submitted with each order b) when each order method gets called

    You can then review the output and see which order methods have opened each position and the quantity used with each order submission. This will help to identify if additional order methods are being fired, or if your logic is submitting orders with increasing quantity.

    Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

    Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk

    We look forward to assisting.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    48 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    66 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X