Plotting text in indicator panel - NinjaTrader Programming | futures io social day trading
futures io futures trading


Plotting text in indicator panel
Updated: Views / Replies:5,074 / 2
Created: by ibiscmllc Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Plotting text in indicator panel

  #1 (permalink)
Elite Member
Parkland, FL, USA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Kinetick, Amp Futures
Favorite Futures: ES, 6E
 
ibiscmllc's Avatar
 
Posts: 17 since Aug 2010
Thanks: 0 given, 6 received

Plotting text in indicator panel

I would like to draw a descriptive label for each row of dots in my indicator panel. It is not an issue drawing the text to the right of the plot using DrawText but there is apparently no parameter to draw it to the left of the row (so that the label is always visible even if I scroll the price chart to the left). I was told that this may require an overriding of the Plot method. Any good example out there or some sample code that could help me out?
Thanks!
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Orlando, Florida
 
Futures Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Favorite Futures: ES
 
Posts: 56 since Aug 2010
Thanks: 3 given, 66 received


Here's an example of overriding the plot method. If you want to plot the text on the left, you will probably want to increase the left margin by using:

ChartControl.MarginLeft = 20;

 
Code
                            
// 
// Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
// NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
//

#region Using declarations
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    
/// <summary>
    /// This is a sample for an indicator which with custom plotting.
    /// </summary>
    
[Description("This is a sample for an indicator using custom plotting.")]
    public class 
CustomPlotSample Indicator
    
{
        
#region Variables
        // Wizard generated variables
        // User defined variables (add any user defined variables below)
        
private StringFormat            stringFormat    = new StringFormat();
        private    
SolidBrush                textBrush        = new SolidBrush(Color.Black);
        private    
System.Drawing.Font        textFont        = new Font("Arial"10);
        
#endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        
protected override void Initialize()
        {
            
ChartOnly            true;
        }

        
/// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        
protected override void OnBarUpdate()
        {
        }

        
#region Miscellaneous
        /// <summary>
        /// Overload this method to handle the termination of an indicator. Use this method to dispose of any resources vs overloading the Dispose() method.
        /// </summary>
        
protected override void OnTermination()
        {
            
textBrush.Dispose();
            
stringFormat.Dispose();
        }

        
/// <summary>
        /// Called when the indicator is plotted.
        /// </summary>
        /// <param name="graphics">Graphics context</param>
        /// <param name="bounds">Paintable chart region</param>
        /// <param name="min">Min indicator value plotted</param>
        /// <param name="max">Max indicator value plotted</param>
        
public override void Plot(Graphics graphicsRectangle boundsdouble mindouble max)
        {
            
// Default plotting in base class. Uncomment if indicators holds at least one plot.
            // base.Plot(graphics, bounds, min, max);

            // fill the complete paintable region
            // note: although the rectangle is greater and even would start plotting at the left upper corner of the chart, 
            // it's clipped to the paintable region
            // the qualification 'InHitTest' is used to exclude the drawn rectangle from the mouse selection action
            
SolidBrush tmpBrush = new SolidBrush(Color.LightGray);
            if (!
InHitTest)
                
graphics.FillRectangle(tmpBrush, new Rectangle (0020002000));
            
tmpBrush.Dispose();

            
// plot a green line from the upper left to the lower right corner
            // all painting needs to go by bounds X/Y offset
            
Pen tmpPen = new Pen(Color.Green);
            
graphics.DrawLine(tmpPenbounds.Xbounds.Ybounds.bounds.Widthbounds.bounds.Height);

            
// plot a green line from the lower left to the upper right corner and apply 
            // apply AnitAlias to make the line look nicer
            // don't forget to reset after plotting -> smoothing has some performance impact
            
SmoothingMode oldSmoothingMode graphics.SmoothingMode;        // save current smoothing mode
            
graphics.SmoothingMode SmoothingMode.AntiAlias;                // apply smoothing mode
            
graphics.DrawLine(new Pen(Color.Green), bounds.Xbounds.bounds.Heightbounds.bounds.Widthbounds.Y);
            
graphics.SmoothingMode oldSmoothingMode;                        // restore smoothing mode
            
tmpPen.Dispose();

            
// plot text in the upper left corner at position 10/10
            
stringFormat.Alignment    StringAlignment.Near;                    // text is docked to the left
            
textBrush.Color            Color.Blue;                            // set text color
            
graphics.DrawString("Upper left corner"textFonttextBrushbounds.10bounds.10stringFormat);
            
            
// paint text at the lower left corner right to the bottom on background with an outline
            // 1) plot background rectangle
            
tmpBrush = new SolidBrush(Color.Red);
            
graphics.FillRectangle(tmpBrushbounds.10bounds.bounds.Height 2014019);
            
tmpBrush.Dispose();
            
// 2) plot outline
            
tmpPen = new Pen(Color.Black);
            
graphics.DrawRectangle(tmpPenbounds.10bounds.bounds.Height 2014019);
            
tmpPen.Dispose();
            
// 3) plot text
            
graphics.DrawString("Lower left corner"textFonttextBrushbounds.10bounds.bounds.Height 20stringFormat);
        }

        
#endregion

        #region Properties
        #endregion
    
}


Reply With Quote
The following 9 users say Thank You to MooreTech for this post:

Reply



futures io > > > > > Plotting text in indicator panel

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Williams Acc Dist indicator not plotting buzzsaw NinjaTrader Programming 6 March 16th, 2016 06:37 AM
Arrows not plotting on price panel kendallw4 NinjaTrader Programming 2 June 28th, 2011 03:44 PM
Put/Call Ration indicator or plotting capability. hector24 NinjaTrader 4 March 12th, 2011 11:56 PM
NT7 - indicator plotting priorities .. or so ;) max-td NinjaTrader 3 February 11th, 2011 04:24 AM
PLotting GOM Indicator eone NinjaTrader 1 October 7th, 2010 08:16 PM


All times are GMT -4. The time now is 09:55 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-12 in 0.09 seconds with 19 queries on phoenix via your IP 54.221.93.187