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 andrewtrades, Today, 04:57 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      3 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      6 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X