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

Add a button to chart trader

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

    #16
    See attached.

    Summary: It is an addon indicator that shows how to add a button to the chart trader panel and implement a click event. In this example, it is used to add on to an existing position. So if you were 1 contact long, and you hit the "addon" button it will add 1 long to your position at the current price. And vice versa with a short. If you have no positions, it will not do anything. It will also default to the account you have selected in the chart trader panel.

    Install Instructions:
    Instructions

    1. Tools >> Import >> NinjaScript Add-On...
    2. Select the zip file you downloaded
    3. Create new chart and add the indicator MyAddonChartTrader
    4. Open Chart Trader panel and you should see the "Addon" button.

    Hope that gets you started so you can implement your own logic.
    Attached Files

    Comment


      #17
      thanks for this - and it does work.

      If I put text on the screen eg High[0].ToString() on your button click the value never changes and it bears no relation to HIgh[0]. I even closed the whole application and restarted and it came up with the same value so something is seriously wrong with this. Its frustrating to deal with.

      Code:
                  Draw.TextFixed(this, "infobox", High[0].ToString(), TextPosition.BottomLeft, Brushes.Green, new Gui.Tools.SimpleFont("Arial", 25), Brushes.Transparent, Brushes.Transparent, 100);
      edit - however my order is placed at the previous high which is what I want - but how comes the value in my text doesn't change??
      Last edited by Mindset; 08-01-2020, 02:34 AM.

      Comment


        #18
        Hello Mindset,

        I may suggest using TriggerCustomEvent when referencing price data from a timed event or a button click event.

        TriggerCustomEvent - https://ninjatrader.com/support/help...ustomevent.htm

        I may also suggest calling ForceRefresh(); after calling your Draw method from an event so NinjaTrader knows to refresh the chart with this change.

        ForceRefresh() - https://ninjatrader.com/support/help...rcerefresh.htm

        You may also see the examples below for further reference and inspiration.

        WPF Modification examples - https://ninjatrader.com/support/foru...considerations

        Example using TriggerCustomEvent - https://ninjatrader.com/support/help...to_output_.htm

        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #19
          Hello, I am very interested in your sample, but the download link is not working... says Invalid File Specified

          Could you please reupload it?


          Originally posted by bc24fl View Post
          See attached.

          Summary: It is an addon indicator that shows how to add a button to the chart trader panel and implement a click event. In this example, it is used to add on to an existing position. So if you were 1 contact long, and you hit the "addon" button it will add 1 long to your position at the current price. And vice versa with a short. If you have no positions, it will not do anything. It will also default to the account you have selected in the chart trader panel.

          Install Instructions:
          Instructions

          1. Tools >> Import >> NinjaScript Add-On...
          2. Select the zip file you downloaded
          3. Create new chart and add the indicator MyAddonChartTrader
          4. Open Chart Trader panel and you should see the "Addon" button.

          Hope that gets you started so you can implement your own logic.

          Comment


            #20
            Originally posted by NinjaTrader_Jim View Post
            Hello bc24fl,

            This isn't documented, but you could consider using ChartControl.OwnerChart.ChartTrader.Account for the Account, and it will reflect the account selected in ChartTrader.

            We look forward to assisting.
            Hi Jim,

            What about ChartControl.OwnerChart.ChartTrader.Instrument ? Or, there is a better option for Instrument ? And I suppose that we are using all these in an indicator.

            Omololu

            Comment


              #21
              Hello omololu,

              Accessing ChartControl.OwnerChart.ChartTrader is undocumented/unsupported, but if you test accessing ChartControl.OwnerChart.ChartTrader.Instrument, you may find it does what you are looking for.

              Print(ChartControl.OwnerChart.ChartTrader.Instrume nt.FullName);

              We look forward to assisting.
              JimNinjaTrader Customer Service

              Comment


                #22
                Hey NinjaTrader_ChelseaB , assuming that I bought a strategy that has buttons on chart trader, and this strategy needs manual button click each time market conditions are changing, but I want to automate this process, is there a way to build a strategy in which I say, if condition 1, 2, 3 are confirmed, go to "strategy I bought"​ and click "this button", if yes then how please, I heard that we should know button ID, then how to find it ? Thank you

                Comment


                  #23
                  Hi Mohammed, thanks for posting. The button ID can be found using the Inspect.exe tool. This comes with the Windows SDK. Its typically located in "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64"

                  Kind regards,
                  -ChrisL
                  Chris L.NinjaTrader Customer Service

                  Comment


                    #24
                    Hi NinjaTrader_ChrisL I don't find Windows Kits Folder

                    Comment


                      #25
                      Hello, thanks for the follow up. You need the Windows SDK installed:
                      https://developer.microsoft.com/en-u...s/windows-sdk/ (publicly available)

                      Please let me know if this does not resolve.
                      Chris L.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by judysamnt7, 03-13-2023, 09:11 AM
                      4 responses
                      59 views
                      0 likes
                      Last Post DynamicTest  
                      Started by ScottWalsh, Today, 06:52 PM
                      4 responses
                      36 views
                      0 likes
                      Last Post ScottWalsh  
                      Started by olisav57, Today, 07:39 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post olisav57  
                      Started by trilliantrader, Today, 03:01 PM
                      2 responses
                      22 views
                      0 likes
                      Last Post helpwanted  
                      Started by cre8able, Today, 07:24 PM
                      0 responses
                      10 views
                      0 likes
                      Last Post cre8able  
                      Working...
                      X