public class myPositionInfo : Indicator
{
private readonly StringFormat far = new StringFormat {Alignment = StringAlignment.Far};
private readonly Font font1 = new Font("Arial", 9, FontStyle.Bold);
private readonly StringFormat near = new StringFormat {Alignment = StringAlignment.Near};
private readonly Pen pen = new Pen(Color.Black);
private readonly Brush redbrush = new SolidBrush(Color.FromArgb(250, Color.Red));
[Browsable(false)] public double OpenPl { get; set;}
protected override void Initialize() { Overlay = true; }
protected override void OnBarUpdate() {}
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
if (ChartControl == null) return;
graphics.FillRectangle(graybrush, 5, bounds.Height - 67, 210, 47);
graphics.DrawRectangle(pen, 5, bounds.Height - 67, 210, 47);
graphics.DrawString("Tracked P&L :"+OpenPl, font1, redbrush, 135f, bounds.Height - 35, far);
}
}
However, I am unable to call (thus add it on chart) from another primary indicator, using this:
OnStartup:
myPositionInfo xyz = new myPositionInfo();
Add(xyz); //<--- gives error
How to do that?

Comment