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 argusthome, Yesterday, 10:06 AM
      0 responses
      20 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      18 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      14 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      9 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      40 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X