I coded a really simple indicator plotting Open / High / Low / Close as a line overlaying the price chart...
- I'm working on a longterm chart SP 500 ES-Contract 1970 - 2011 showing yearly candlesticks.
- When I try adding my indicator the data of the indicaotr (= OHLC of each bar) is shown correctly in the databox but is only drawn on the chart beginning with 1990 = 20 bars after start
- On a monthly or daily chart the same problem occurs -> for the first 20 bars no Line is drawn but shown in databox correctly, afterwards everything alright
As the calculation logic doesn't require any lookback-period I don't understand why it doesn't work. Thinking of a bug I already updated to Version 7.0.1000.6 but didn't help. Despereately I also tried changing values Infinite/256Barslookback and also calculate bar on close true/false. Nothing helps...
here is the code how the values are assigned to the 4 Plots
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.SeaGreen), PlotStyle.Line, "OpenLine"));
Add(new Plot(Color.FromKnownColor(KnownColor.Orchid), PlotStyle.Line, "HighLine"));
Add(new Plot(Color.FromKnownColor(KnownColor.DodgerBlue), PlotStyle.Line, "LowLine"));
Add(new Plot(Color.FromKnownColor(KnownColor.Firebrick), PlotStyle.Line, "CloseLine"));
Overlay = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
OpenLine.Set(Open[0]);
HighLine.Set(High[0]);
LowLine.Set(Low[0]);
CloseLine.Set(Close[0]);
}
Comment