Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

making bars invisible and revert back to color

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

    making bars invisible and revert back to color

    Hi,

    I added a button to my chart via an indicator.

    What I want the button to do is:

    if bars are visible - make bars invisible (set barcolors and outline to transparent if there is no other way)

    if bars are invisible - make bars visible (go back to initial parameters as defined in chart properties)

    what whould be the easiest way to do so.

    as always thanks in advance and really appreciate help.

    regards

    #2
    Hello keepsimple,

    Thanks for opening the thread.

    This would be done easiest by saving/restoring the BarBrush the CandleOutlineBrush and replacing them with Brushes.Transparent. If you are doing this from a button, you will have to loop through all bars and modify BarBrushes and CandleOutlineBrushes.

    You will also need to trigger a custom event when changing BarBrushes or CandleOutlineBrushes outside of OnBarUpdate().

    Code:
    TriggerCustomEvent(o =>
    {
    	if(makeTransparent == true)
    	{
    		myCandleOutlineBrush = CandleOutlineBrush;
    		myBarBrush = BarBrush;
                    for(int i = 0; i < CurrentBar; i++)
    		{
    			CandleOutlineBrushes[i]   = Brushes.Transparent;
    			BarBrushes[i] = Brushes.Transparent;
    		}
    	}
    	else
    		for(int i = 0; i < CurrentBar; i++)
    		{
    			CandleOutlineBrushes[i]   = myCandleOutlineBrush;
    			BarBrushes[i] = myBarBrush;
    		}
    }, null);
    I have provided links to the our documentation on the items discussed.

    BarBrush - https://ninjatrader.com/support/help...s/barbrush.htm
    BarBrushes - https://ninjatrader.com/support/help...barbrushes.htm

    CandleOutlineBrush - https://ninjatrader.com/support/help...tlinebrush.htm
    CandleOutlineBrushes - https://ninjatrader.com/support/help...inebrushes.htm

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

    Please let me know if I can be of further help.
    Last edited by NinjaTrader_Jim; 11-01-2017, 10:51 AM.

    Comment


      #3
      Thanks very much,

      that should do. Wasnt sure about the need to loop, that primarily why I was asking.

      regards

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      627 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      359 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      562 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X