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

Addon button for boolean variable

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

    #16
    if I open 2 strategy on one chart (2 different accounts ) which one will be connected to the buttons of that instance and that chart ?and the truth is that a strategy usually has nothing to do with the indicators on that chart so how will the strategy know which buttons are associated to this strategy
    do you mean that I would have to select plot on chart ...for the button to work with the strategy ?
    Last edited by yBl123; 01-10-2024, 11:27 AM.

    Comment


      #17
      Hello,

      Each strategy added to the chart is accessing a separate instance of the indicator, so two strategies mean two separate indicator instances. As mentioned, each indicator instance has its own button.

      When you access an indicator in a strategy, it is not actually adding it to the chart for display. This is done via AddChartIndicator(). So if you have two strategies calling the indicator and adding it via AddChartIndicator() for display, the indicator is being added to the chart twice.



      Please let me know if you have any further questions.
      Gaby V.NinjaTrader Customer Service

      Comment


        #18
        Thanks for this clarification ,so to be able to press the button I would indeed need to select plot to chart(this is a option in strategy builder ) for the button to be on the chart , do you know what happens if I add this twice on the same chart will pressing that button which is really 2 buttons on top of each other work for both ?
        ok I just tried with indicator you showed me and i see it does not stack the buttons on top of each other ,so i guess this wont work
        Last edited by yBl123; 01-10-2024, 12:10 PM.

        Comment


          #19
          Hello,

          Please note you cannot add plots in the Strategy Builder.

          It's possible that the indicator buttons would be layered on top of eachother if you have more than one instance added to the chart, if the indicator does not have code to identify if there is already a button within the User Control Collection or use something like a StackPanel. So if you add the indicator twice on the same chart, multiple buttons would be added layered on top of each other and clicking on a button would only affect the one instance of the indicator added by the specific strategy it is tied to.

          Take a look at SampleWPFModifications which demonstrates implementing custom logic for adding buttons to new rows in the Chart Trader area without having them overlap.



          Please let us know if you have any further questions.
          Gaby V.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_Gaby View Post
            Hello,

            Please note you cannot add plots in the Strategy Builder.

            It's possible that the indicator buttons would be layered on top of eachother if you have more than one instance added to the chart, if the indicator does not have code to identify if there is already a button within the User Control Collection or use something like a StackPanel. So if you add the indicator twice on the same chart, multiple buttons would be added layered on top of each other and clicking on a button would only affect the one instance of the indicator added by the specific strategy it is tied to.

            Take a look at SampleWPFModifications which demonstrates implementing custom logic for adding buttons to new rows in the Chart Trader area without having them overlap.



            Please let us know if you have any further questions.
            is it possible with code to set up that if multiple buttons would be added layered on top of each other and clicking on the button would affect all buttons that are layered ?

            Comment


              #21
              Hello,

              No, that would not be possible.

              If you wanted to have the buttons be put side by side to eachother, you could do so using a StackPanel.

              The sample script linked in my previous post demonstrates using StackPanels.
              Gaby V.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rbeckmann05, Today, 06:48 PM
              0 responses
              4 views
              0 likes
              Last Post rbeckmann05  
              Started by rhyminkevin, Today, 04:58 PM
              4 responses
              52 views
              0 likes
              Last Post dp8282
              by dp8282
               
              Started by iceman2018, Today, 05:07 PM
              0 responses
              5 views
              0 likes
              Last Post iceman2018  
              Started by lightsun47, Today, 03:51 PM
              0 responses
              8 views
              0 likes
              Last Post lightsun47  
              Started by 00nevest, Today, 02:27 PM
              1 response
              14 views
              0 likes
              Last Post 00nevest  
              Working...
              X