Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Plot Method within a Strategy

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

    Using Plot Method within a Strategy

    This question is directed towards programmers since this likely outside of what is supported.

    Does anyone know of a way to use the

    public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)

    inside of a strategy?

    Many Thanks

    #2
    Originally posted by boreland View Post
    This question is directed towards programmers since this likely outside of what is supported.

    Does anyone know of a way to use the

    public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)

    inside of a strategy?

    Many Thanks
    You cannot...

    Comment


      #3
      Could one possibly create an indicator to do the plotting callable from within a strategy?

      Comment


        #4
        Originally posted by boreland View Post
        Could one possibly create an indicator to do the plotting callable from within a strategy?
        When running a strategy on a chart you may find the need to plot values onto a chart. If these values are internal strategy calculations that are difficult to migrate to an indicator, you can use the following technique to achieve a plot. NinjaTrader 8 With NinjaTrader 8 we introduced strategy plots which provide the ability

        Comment


          #5
          Originally posted by roonius View Post
          You cannot...
          Not entirely true.

          We can add Paint event handler to any control and it will draw over the control:


          PHP Code:
          private void chart_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
          {
          if( !bCanTrade )
          {
          // Create a local version of the graphics object for the PictureBox.
          Graphics g = e.Graphics;
          SolidBrush textBrushBackground = new SolidBrush(Color.FromArgb(50,80,80,80)); //background 
          RectangleF rect = g.VisibleClipBounds;
          g.FillRectangle(textBrushBackground, rect);
          textBrushBackground.Dispose();
          }
          } 
          
          and to add event we do something like this:

          PHP Code:
          if( ChartControl != null )
          {
          Control ctrlChart = ChartControl.Controls["pnlChart"]; 
          if( ctrlChart != null )
          {
          ctrlChart.Paint += new PaintEventHandler(chart_Paint);
          } 
          
          Don't forget to remove this event later :

          ctrlChart.Paint -= new PaintEventHandler(chart_Paint);


          The code above for example, make all chart looking disabled-like ( grayed transparent color )

          But guys: make sure you know what you are doing as it really can break something.

          P.S. I am talking about strategy scrip of course, not indicator.


          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          574 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X