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

Toggle candlesticks visibility on button click

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

    Toggle candlesticks visibility on button click

    For a strategy, how can we code to toggle the visibility of candlesticks on a button click? A sample code would be helpful. Thanks.

    #2
    Hello singjay,

    Setting the BarBrush and CandleOutlineBrush to transparent would hide the candles. You would need to loop through all of the bars on the chart.

    Below is a link to a User App Share script that hides the chart bars.
    NYSE Advancing Issues/Declining Issues Uses historical tick data to calculate the ^ADV index minus the ^DECL index to give a simulation of the ^ADD index. Requires a data feed that supports indexes and provides data for the ^ADV (NYSE Advancing Issues) and ^DECL (NYSE Declining Issues). Update June 16th, 2020 – Corrected stroke attributes to […]


    As well as a link to an example with button clicks.
    I need some guidance. I need to create a script that has 3 plots that are public and they plot either a 1 or 0. But I need to create another indicator that has 3 chart buttons that sets these variables. The first indicator needs to get those values from the second indicator depending on the button clicks. Because of using

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the code example. It helped but the last current candle is still showing. How to hide that one as well? See screenshot.
      Attached Files

      Comment


        #4
        Hello singjay,

        Calculate.OnPriceChange / .OnEachTick.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks this helped. Btw, the strategy was not hiding all the candles. It was hiding only subsequent candles after the button click, not historical bars. I've to put this part separately in a custom indicator for now. If it works from a strategy please provide a quick sample code, it would help. Thanks.

          Comment


            #6
            Hello singjay,

            To loop through all bars and set the brush to transparent.

            Code:
            for (index = 0; index < CurrentBar; index++)
            {
            BarBrushes[index] = Brushes.Transparent;
            }
            If this is called from a button click or any non-data-driven method, be sure to call TriggerCustomEvent first as demonstrated in the example script I have provided.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I'll try this one out. Thanks much!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by burtoninlondon, Today, 12:38 AM
              0 responses
              10 views
              0 likes
              Last Post burtoninlondon  
              Started by AaronKoRn, Yesterday, 09:49 PM
              0 responses
              14 views
              0 likes
              Last Post AaronKoRn  
              Started by carnitron, Yesterday, 08:42 PM
              0 responses
              11 views
              0 likes
              Last Post carnitron  
              Started by strategist007, Yesterday, 07:51 PM
              0 responses
              14 views
              0 likes
              Last Post strategist007  
              Started by StockTrader88, 03-06-2021, 08:58 AM
              44 responses
              3,983 views
              3 likes
              Last Post jhudas88  
              Working...
              X