protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
// if(Times[0][0].Day < 15) return;
// if(Times[1][0].Day < 15) return;
Print("CurrentBars[0] " + CurrentBars[0]);
Print("CurrentBars[1] " + CurrentBars[1]);
if(CurrentBars[0] < 40) return;
if(CurrentBars[1] < 40) return;
Print("times 0 count " + Times[0].Count);
Print("times 1 count " + Times[1].Count);
Print("T10 " + Times[1][0] + " T00 " + Times[0][0]);
Print("T11 " + Times[1][1] + " T01 " + Times[0][1]); //fails
}
also in the configure section
else if (State == State.Configure)
{
AddDataSeries("TSLA",Data.BarsPeriodType.Minute, 5);
}
I bacame stuck because Times[0][0] prints as the time of the first bar on my chart, which means I am getting an error when I try to access index[1], since it is before the 1st bar on the chart.
I've tried several ways to block any execution on the 1st bar but it keeps doing it.
Though uncommenting the first 2 lines will definitely stop it, however that makes nothing print at all! even though my chart has day 15 & 16 visible! so something should be printing then at least.
also when I add this indicator to a chart and then go back into indicator settings, ninja complains about:
Indicator 'multiseries': Error on calling 'OnStateChange' method: 'AddDataSeries' cannot be called from this state.
but it's already in state configure where the guides and even the ninja wizard puts it.
*forgot to add that the error message says an error on bar 200+ so it's not actually failing on bar 1 at all. really baffling one. haven't been able to figure out how this is even happening.
*I managed to get it to print by setting the bars to load in the Ui to 400, rather than 5 days. 5 days should have no problem working so I don't understand.
there is a new problem though. the output prints
T10 08/04/2019 8:35:00 PM T00 11/04/2019 9:00:00 PM
T11 08/04/2019 7:56:00 PM T01 11/04/2019 8:57:00 PM
the values for the 1st data series are somehow 39 minutes apart even though the chart period is 5 minutes. set bars to load to 100 just to check it's not a data gap problem, still 39 minutes. very odd. why 39?
T10 12/04/2019 7:35:00 PM T00 15/04/2019 6:00:00 PM
T11 12/04/2019 6:36:00 PM T01 15/04/2019 5:45:00 PM
**I just noticed the times in the 2nd half of those strings still correspond to the first bar visible on my chart, so somehow it's still going back and doing stuff on bar 1. (by second half I mean comparing T00 & T01 in the outputs above)
another thing noticed is the time differences of the times in the 2nd half. first one has a 3min time difference, 2nd one 15min.
and I ran another test with UI setting bars to load 200, and now the gap is 7 minutes.
T10 11/04/2019 5:45:00 PM T00 15/04/2019 2:40:00 PM
T11 11/04/2019 5:16:00 PM T01 15/04/2019 2:33:00 PM
the first bar visible on my chart is 2:40PM. don't know how it accessed 2:33PM without failing.
the chart period is 2 minutes.. so I'd expect any time difference related to the main series to be 2 minutes.
Comment