eg , If I need to plot the difference between 6E and 6B percent change in intraday basis.
If anybody can point out the error here?
#region Variables
private string hedgeInstrument = @"";
private int hedgeInstrumentPeriod = 3;
#endregion
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.PaleTurquoise ), PlotStyle.Line, "NetChangePair"));
Overlay = false;
if (hedgeInstrument!= "")
{
Add(hedgeInstrument,PeriodType.Minute,hedgeInstrum entPeriod);
}
}
protected override void OnBarUpdate()
{
if(BarsInProgress==0)
{
double nt1 = ((Closes[0][0]-CurrentDayOHL(BarsArray[0]).CurrentOpen[0])/CurrentDayOHL(BarsArray[0]).CurrentOpen[0])*100;
double nt2 = ((Closes[1][0]-CurrentDayOHL(BarsArray[1]).CurrentOpen[0])/CurrentDayOHL(BarsArray[1]).CurrentOpen[0])*100;
double difference = nt1-nt2;
NetChangePair.Set(difference);
}
}
Comment