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

How to change Atm strategy details

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

    How to change Atm strategy details

    lets say, i submit ATM strategy (from chart trader). Template had several ProfitTarget and Stoploss enabled (i.e. 30 ticks)

    How it is possible through ninjascript, if there happens my predefined condition, i want to only change profitTarget to 50 ticks (or even cancel that).
    I couldnt find the needed methods to modify the attached parts of AtmStrategy... how to do that (i.e. using https://ninjatrader.com/support/help...entryorder.htm or https://ninjatrader.com/support/help...entryorder.htm , i am not sure).

    Any help appreciated.

    (p.s. also when order-events I get the ATM id (i.e. 123055295) and while order is open, I put that id into sample strategy manually and attach to chart, I always get :
    'GetAtmStrategyUnrealizedProfitLoss' method error: ATM strategy ID '123055295' does not exist . however, that ATM strategy order still open. So, how can i get the ID's reliably?)
    Last edited by ttodua; 05-29-2020, 02:16 PM.

    #2
    Hello ttodua,

    For a manually submitted ATM there is no suggested way to do that, the ATM is going to be in control of its targets.

    An Addon could do what you are asking because it could gather the instance of the ATMStrategy object when it submits it, the same would apply to a Strategy which submits ATM orders as you would have its ID to use the methods you linked.

    If the ATM was submitted with NinjaScript instead of chart trader you could use the appropriate ATM method to change the targets.

    An alternative option here would be to not attach an ATM strategy to your entry, an addon could apply targets by observing the executions and then you would have the instance of the order to manipulate from the addon. That could reside in an Indicator if you need bar data to do some calculation or use other indicator values.



    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse. nice to hear from you.
      here is code I have (there is two classes in once script -addon and strategy) : https://pastebin.com/raw/uRT4Y757

      it is quite demonstrational.
      what it does:
      - when submiting order from Chart-Trader, with atm (say 100 ticks STOP and PROFIT Target), and clicking i.e. "BUY" in output window somewhere i spot the "AtmStrategy id= xxxxxxx".

      then you can attach the "XYZ_sample" strategy on chart, and in it's input name "atm-id" input that copied ID (from output window).
      Then it should show the "unrealized Profit/Loss", however it says atm doesnt exist.

      hope code is self explanatory.

      Comment


        #4
        actually, my goal is that user submits ATM strategy from chart trader, and then my script (either addon & strategy combination) should monitor for specific condition to happen (i.e. 50$ profit accumulated) and if so, my script should be able to do:
        - cancel or change the Stop or Profit of that ATM
        - close/exit that ATM order at all.

        i think it is doable, but how - i was unable to find out (and i dont know NT internals)

        Comment


          #5
          Hello ttodua,

          The ATM's from the chart trader or other tools are not going to be able to be modified as you don't have the instance to the ATM or its ID. We have no samples of using the ATM's in that way or trying to catch a manually submitted ATM. You can instead use either the strategy approach or ATM approach where you have the strategy or addon submit the ATM order. That way you have an ID or the instance to make other changes later.

          As noted you can instead avoid using the ATM strategies from the chart trader and just submit an entry. Your addon can catch the entry orders fill and then your addon could apply targets or make OCO type orders/do changes to the targets.



          Please let me know if I may be of further assistance.



          JesseNinjaTrader Customer Service

          Comment


            #6
            oh, that's bad news NT is so pwoerful, and there should be some way (theoretically there is, but only for them who is perfect in internals of NT) to achieve what I described... :/ could be there feature vote? i know it doesnt have any meaning, but for the sake of anything, lets submit my request.. might happen if in 5 years will be implemented.

            Comment


              #7
              Originally posted by ttodua View Post
              Thanks Jesse. nice to hear from you.
              here is code I have (there is two classes in once script -addon and strategy) : https://pastebin.com/raw/uRT4Y757

              it is quite demonstrational.
              what it does:
              - when submiting order from Chart-Trader, with atm (say 100 ticks STOP and PROFIT Target), and clicking i.e. "BUY" in output window somewhere i spot the "AtmStrategy id= xxxxxxx".

              then you can attach the "XYZ_sample" strategy on chart, and in it's input name "atm-id" input that copied ID (from output window).
              Then it should show the "unrealized Profit/Loss", however it says atm doesnt exist.

              hope code is self explanatory.
              ttodua Hey there ttodua! I have been trying to make this work for a long time now, LOL. I see you have a sample you posted and I think it would help a lot, but the link is broken. Do you think you could repost it please? Thank you kindly

              Comment


                #8
                I have been trying to change the stop loss of a manually submitted ATM strategy order using Ninjascript. I have been told, there is no direct approach. So, I was thinking what if I use the Add-on Framework Window script provided in the NT Help Guide. When the user clicks on "Buy Mkt", it initiates a NinjaScript, which creates the ATM strategy. This way I will have the IDs, so I can do whatever I want. But the problem is, how will the user set the settings of the NinjaScript strategy? Will it take the default settings template set by the user?

                Please let me know if this can be done, or if there's any other approach.

                Comment


                  #9
                  Hello fawzanalim,

                  There is not a way for the user to set the ATM strategy settings through NinjaScript, the ATM template is used to control the strategies settings. If you want to work with ATM's targets I would suggest to use a Strategy and have that strategy add custom buttons. You could then submit ATM's using the custom buttons and use the strategies ATM methods to change the targets as needed.




                  I look forward to being of further assistance.

                  The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by RubenCazorla, Today, 09:07 AM
                  2 responses
                  13 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by i019945nj, 12-14-2023, 06:41 AM
                  7 responses
                  82 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by timmbbo, 07-05-2023, 10:21 PM
                  4 responses
                  158 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by tkaboris, Today, 08:01 AM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by Lumbeezl, 01-11-2022, 06:50 PM
                  31 responses
                  820 views
                  1 like
                  Last Post NinjaTrader_Adrian  
                  Working...
                  X