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

Custom button to execute ATM Strategy and order quantity from chart trader

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

    Custom button to execute ATM Strategy and order quantity from chart trader

    Do you have any exiting sample script which executes ATM strategy selected and quantity from the chart trader when you press that button? if not, can you please point me to the right direction? thanks in advance.

    #2
    Hello asmmbillah,

    Thank you for the post.

    Are you trying to configure the ATM in some way before submitting it with the custom button? Generally with the chart trader atm selection you would just use the existing chart trader buttons to submit that order.

    There is an addon example which submits ATM orders however that uses its own custom ATM selector. You could also take a look at the addon StartAtmStrategy method https://ninjatrader.com/support/help...tmstrategy.htm

    You can get the atm from the chart trader similar to this and create an order: https://ninjatrader.com/support/foru...775#post752775

    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 08-04-2020, 08:05 AM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      thanks for your reply. It was helpful. But What I was looking for is, I am adding a button on charttrader grid, when I click on that custom button, it will enter entry order (which I am coding in the script), but it will start the atm strategy which ever is showing now. if none is showin it will not start any atm. I just need to grab the strategy atm showing selected only. Please note, I have multiple atm strategy already set, but I want that button to execute only the one I have selected before pressing the button. I hope, that clarifies.

      Comment


        #4
        Hello asmmbillah,

        You should be able to use the second link I posted for that purpose to find the selected ATM strategy. There is a sample in that post.

        Please let me know if I may be of additional assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          sorry, I am a bit confused with that. Are you talking about this post in this link? https://ninjatrader.com/support/foru...m-an-indicator

          Comment


            #6
            Hello asmmbillah,

            No i had not provided that link, if you look in post number 2 in this thread there are two links, the second link goes to this page: https://ninjatrader.com/support/foru...not-a-strategy

            In that thread there is a sample of getting the selected ATM strategy from the chart trader.

            JesseNinjaTrader Customer Service

            Comment


              #7
              Thanks for clarifying. There are two attched sample, one is MenuContent.cs by NinjaTrader_JessicaP, another is ChartTraderGetSelectedAccount Zip file attched by you. or there is a code provided,
              NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrateg ySelector selector = chartTrader.FindFirst("ChartTraderControlATMStrate gySelector") as NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrateg ySelector; NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(selector.SelectedAtmStrategy, entryOrder); which one you are referring to? Thanks in advance

              Comment


                #8
                Hello asmmbillah,

                It is post number 7 in that thread.

                JesseNinjaTrader Customer Service

                Comment


                  #9
                  thanks very much

                  Comment


                    #10
                    That was very helpful. From the below, does entryOrder has to be an unmanaged order or can it be a EnterLong(), can you please explain:
                    NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrate gy(selector.SelectedAtmStrategy, entryOrder);

                    Comment


                      #11
                      Hello asmmbillah,

                      You cannot use Strategy based methods with the addon methods. You would need to see the first link I provided in post number 2, that shows using StartAtmStrategy and also Account.CreateOrder.


                      Please let me know if I may be of additional assistance.
                      JesseNinjaTrader Customer Service

                      Comment


                        #12
                        Thanks for your suggestion,
                        Last edited by asmmbillah; 08-06-2020, 03:57 PM.

                        Comment


                          #13
                          Hello asmmbillah,

                          I don't see the problem from the given syntax, have you tried to use Prints at this point to make sure everything is correct with your variables and that the logic is getting called?

                          I see one print being used, was that printed?


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

                          JesseNinjaTrader Customer Service

                          Comment


                            #14
                            No, it does not even print.

                            Comment


                              #15
                              Hello asmmbillah,

                              If your print did not happen at all that would indicate that code did not get called. I would suggest to simplify what you are testing to make sure the logic gets called up to that point. You can also add other prints into your other areas where you call that code to see why it did not happen.

                              For what you are trying to execute it may be easier to add a specific condition and use a specific chart for testing, what I mean is to use a 10 second chart so a bar elapses quickly and then a simple condition like the following:

                              Code:
                              if(State == State.Realtime)
                              {
                                 //execute your code
                              }
                              If you only want this to execute one time you can add a variable to stop it once it was executed.

                              Code:
                              if(State == State.Realtime && myVariable == false)
                              {
                                 //execute your code
                                 myVaraible = true; 
                              }

                              That sets up a simple condition for testing which does not require an amount of bars or anything else other than a bar elapsing in realtime.




                              Please let me know if I may be of additional assistance.
                              JesseNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GussJ, 03-04-2020, 03:11 PM
                              11 responses
                              3,227 views
                              0 likes
                              Last Post xiinteractive  
                              Started by andrewtrades, Today, 04:57 PM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              440 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post FAQtrader  
                              Working...
                              X