I have read the documentation of exposing values of an indicator. I have no problem writing an indicator that exposes a value that is associated with the bar e.g. Close[0]
Here, I am trying to expose the values of a line drawn on a Sender indicator on one chart, so it can be read by a Receiver indicator on another chart.
I draw a horizontal line, obtain its tag and enter this tag into the Sender's code:
public class SampleSender : Indicator
{
private double exposedVariable;
HorizontalLine HL;
protected override void OnStateChange()
{
if(State == State.SetDefaults)
{
Name = "SampleSender";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
}
}
protected override void OnBarUpdate()
{
foreach (DrawingTool draw in DrawObjects.ToList())
{
if (draw.Tag == "@Horizontal Line 3963")
{
HL = draw as DrawingTools.HorizontalLine;
exposedVariable = HL.StartAnchor.Price;
}
}
Print("Sender :" + exposedVariable);
}
public double ExposedVariable
{
get { Update(); return exposedVariable; }
}
My Receiver code is simply:
protected override void OnBarUpdate()
{
Print("Receiver :" + SampleSender().ExposedVariable);
}​
I am not able to read the Sender's line value from the Receiver.
Would appreciate your assistance on how to do achieve this.

Comment