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

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Working...
    X