Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 How to turn on/off OnRender from button click?

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

    NT8 How to turn on/off OnRender from button click?

    Hi there,

    I have placed a button on the main panel. (See attachment)
    I have an indicator that only plots via "OnRender". I wish to turn this indicator on and off visually via this button.

    I can't seem to find any samples to do this....... only how to make a button.

    Code:
    [INDENT]protected void btn_Click(object sender, RoutedEventArgs rea)
    {[INDENT]....... make ellipse visible or not visible
    [/INDENT]}
    
    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
    {[INDENT]........ draw the ellipse
    [/INDENT]}
    [/INDENT]
    Also, how do I make the button click result instantaneous without having to F5 the chart?

    Thank you,

    Sim22
    Attached Files
    Last edited by Sim22; 11-06-2015, 08:30 PM.

    #2
    Originally posted by Sim22 View Post
    I have placed a button on the main panel. (See attachment)
    I have an indicator that only plots via "OnRender". I wish to turn this indicator on and off visually via this button
    Use your button click event to turn on and off a bool, and then use that bool as a condition (in if statement) to draw in OnRender.

    Originally posted by Sim22 View Post
    Also, how do I make the button click result instantaneous without having to F5 the chart?
    I'm not sure why you would have to do that with this approach.. But search "refresh" in the help guide for reference..


    -=Edge=-
    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

    Comment


      #3
      Worked......

      Thank you Edge!

      Here is the concept for anyone following........

      Code:
       //assuming "IsVisible = true" when first initializing a chart
      
      protected void btn_Click(object sender, RoutedEventArgs rea)
      {   
            IsVisible = IsVisible == true ? false : true; // on-off switch
            ForceRefresh(); // refreshes the chart so you don't have to click on it.
      }
      
      protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
      {   
            if( Bars == null || ChartControl == null || Bars.Instrument == null  || !IsVisible)
             {
                   return; 
                   // does not draw OnRender if "IsVisible" = false;
              }
             //.............draw an ellipse
      }
      Find an attached basic indicator that turns an ema plot on/off. Both a regular plot and a OnRender drawing.
      Attached Files
      Last edited by Sim22; 11-07-2015, 09:45 PM. Reason: Added attachment

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      666 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      376 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      110 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X