Announcement

Collapse
No announcement yet.

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 NullPointStrategies, Today, 05:17 AM
              0 responses
              52 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              130 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              70 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              43 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              47 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X