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

New Feature Request : AtmOrder of StartAtmStrategy

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

    New Feature Request : AtmOrder of StartAtmStrategy

    When we execute an order from an Addon and then assign an ATM to it, we only get the order id (entryOrder );
    entryOrder = accountSelector.SelectedAccount.CreateOrder(....
    but not the atm order id ;
    AtmOrder = NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(...
    ( or at least it is not documented that StartAtmStrategy has a result )

    Would it be possible to add that option so we can use all the ATM Strategy Methods to monitor that trade ?


    Thank You !
    pmaglio
    NinjaTrader Ecosystem Vendor - The Indicator Store

    #2
    Hello pmaglio, and thank you for your question. This is something that is currently possible through NinjaScript, and it would therefore be best if the community developed a strategy that worked this way. The best way to implement a strategy like this, would be to have your add-on pass a message to an active NinjaScript strategy, and let the strategy manage its own ATM logic. Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      yes, this is the way it is working now ; the user must add a strategy that executes that part of the logic, adding complexity degree to the user.
      The main question would be, why not doing everything from a strategy instead from an addon or indicator
      There are several reasons ;
      1) If the user presses close on Chart Trader to close a position all strategies are disabled, so everything calculated inside that strategy is lost. I think there is already a request of new feature to allow re enable a strategy from an addon, so this could be fixed in the future.
      2) It is easy to save all indicators and chart settings with a template, so a setup can be easily shared between users or copied to other charts.
      3) Strategies instead, have their own templates and still not clear if they are stored on the workspace or somewhere else, so not easy to share a setup or copy to another workspace

      By the Way, on Ninja 7 it was possible to load and enable a strategy from an indicator and then execute atm orders through it. It was also possible to detect if that strategy was disabled to enable it again.
      This is the way my main product "Markers Plus" works (https://goo.gl/3oL4QT).
      ...Still looking the way to make it work on Ninja 8
      Last edited by pmaglio; 01-30-2017, 09:54 AM.
      pmaglio
      NinjaTrader Ecosystem Vendor - The Indicator Store

      Comment


        #4
        I understand your concerns. What you are discussing would best be accomplished through writing a wrapper you can call from an add-on, which will in turn let you call static methods from your add-on object to synchronize a NinjaScript ATM strategy to orders you place through the add-on.
        Last edited by NinjaTrader_JessicaP; 01-31-2017, 09:55 AM.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          I am following up on our conversation. It turns out I am mistaken. There is a missing technology that would make this possible without first creating a strategy instance in a chart or strategy tab. Therefore, I have requested the following feature from the product management team :
          This user would like the ability to manage ATM strategies directly from an add-on
          Please let us know if there are any other ways we can help.
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            Any news ?
            pmaglio
            NinjaTrader Ecosystem Vendor - The Indicator Store

            Comment


              #7
              Since I was unable to find this feature request in our tracking system, I have revised this request and have resubmitted it. The revised request is as follows :
              This user would like a blocking overload for StartAtmStrategy which returns a list of order IDs controlled by the started ATM strategy
              I will follow up when we have more information to report.
              Last edited by NinjaTrader_JessicaP; 07-10-2017, 10:23 AM.
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                Hello pmaglio,

                This feature is being reviewed by the product management team and has been assigned the following unique tracking ID


                SFT-2513


                Please let us know if there is any other way we can help.
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  Jessica
                  Would this include the ability to Grab the order ID's and Created ATMstrategy ID from a manually
                  started ATM order on the Dom so it could be managed by a Script communicating thru the addon?
                  Currently I can detect a manually created ATM position in an account thru an addon but Communicating with with the addon and changing Orders from another script thru static methods and vars is proving to be difficult.

                  Thanks
                  Jerry

                  Comment


                    #10
                    Thanks for your interest JerryWar. The use case I was covering is a little different from yours. The add on I suggested would only help with ATM strategies started and controlled by NinjaScript. If you would instead like to access foreign (to the script) strategies from a script you will need to use the Account object to loop through all orders attached to the account, then filter out any that match your ATM strategy template. I will prepare a reference code sample for this use case. This reference sample will not be adequate for the first use case, as this information would be unavailable to hooks like OnOrderUpdate. However in your case the orders in question are past this.
                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #11
                      Jessica,
                      Thanks I would appreciate any samples to validate what I have already done.( Filter thru accounts)
                      I have gotten to the point where I can pick up the execution and position and hopefully by the EOD I am issuing Account.Change() orders. I was only able to get this far by following some old forum posts, I think you did along with help from Chelsea. My Interest in the members post was that ultimately I would rather be Using ATMstrategy methods to manage an existing manual order. I know this can be done by adding buttons with a script but then in order to use all the order types I want I have to in essence replicate the Dom, What is the sense in that. For now the account lookup method will suffice as long as I get the Account.Change() to work. Once I get the stop and exits working with my indicator I can focus on working on Automated entries with a strategy along with the stop/exit code.

                      Comment


                        #12
                        Attached is a code sample that should do something like what you are describing. Code samples we provide are for educational purposes, and are not intended for live trading, and are not guaranteed to accomplish any user goal or to be maintained.
                        Attached Files
                        Last edited by NinjaTrader_JessicaP; 07-18-2017, 11:53 AM.
                        Jessica P.NinjaTrader Customer Service

                        Comment


                          #13
                          Jessica, Just to make sure I understand this code. It is run as a strategy but does not generate any orders. What it does is on startup ( state==dataloaded) it looks for an ATM order and picks up on it.

                          I took notice that the Account was defined as static. I have two questions

                          1) if I wanted to interface from another script to this strategy and access the ATM Methods would I need to do that thru public static vars or methods that both the Strategy and my indicator could see ? What I want to do is change the stops from my indicator initially.

                          2) It detects the order in State ==State.Dataloaded which happens when the strategy starts So I would need to generate the same process again if the order was not sitting there already. Is this correct ?

                          Thanks
                          Jerry

                          Comment


                            #14
                            Thank you for your questions JerryWar. You are correct as to how this strategy works.

                            As mentioned, this was intended for educational purposes, not direct use. This code was added to State.DataLoaded simply so it would run exactly once, rather than repeating every bar. I would recommend moving this code to a logic appropriate place inside OnBarUpdate and using it there.

                            The code used to create the account is "boilerplate" code, or in other words, code I could easily copy / paste between different scripts that need to reference an account. This was the reason this object was made static. While you can certainly reference this member from other scripts, doing so is your responsibility. So you fully understand why this was made static, there is a design paradigm called "test driven development", and one test for portable code (which this needed to be in order for me to use it in many code examples) is that the object you are creating does not reference any local members. Using the static keyword accomplishes this without fully writing out any tests.
                            Jessica P.NinjaTrader Customer Service

                            Comment


                              #15
                              The problem I am fighting with is the OrderID. In order to use the methods in those print statements you need the orderID. I was able to get the OrderID generated in the Print Statements but If I use that it rejects it as invalid.
                              Could you add some could to your example to show getting the proper orderID from an exisiting order and then using it with order.GetOwnerStrategy().AtmStrategyClose . Or is this the problem the original poster was pointing to ?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by chartchart, 05-19-2021, 04:14 PM
                              3 responses
                              577 views
                              1 like
                              Last Post NinjaTrader_Gaby  
                              Started by bsbisme, Yesterday, 02:08 PM
                              1 response
                              15 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by prdecast, Today, 06:07 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post prdecast  
                              Started by i019945nj, 12-14-2023, 06:41 AM
                              3 responses
                              60 views
                              0 likes
                              Last Post i019945nj  
                              Started by TraderBCL, Today, 04:38 AM
                              2 responses
                              18 views
                              0 likes
                              Last Post TraderBCL  
                              Working...
                              X