I have again on issue with which I a struggling since few days without success.
Here is the code:
protected override void OnBarUpdate()
{
if(CurrentBar < Period) return;
Int CountsBars = 300;
Int Period = 15;
Int shift = CurrentBar - CountSBars;
while(shift >= 0)
{
Counter = shift;
for(Counter = shift; Counter <= shift+9; Counter++)
{
}
Shift++;
}
}
Whell afet compiling,, I wanted to print the output. After attaching the indicator to the chart, the platform just stopps to work or to move whatever.
What could be wrong in this code?
Yesterday, I replaced "Counter" by "Period" annd the output pupped out a mistake that I accessing a bar 15 outside of the range.
I have also seen that protected override void OnRender(ChartControl chartControl, ChartScale chartScale) doesnot require conditions such as "if(CurrentBar < Period) return;", in the forum I am also seen that on this function OnRender() could lag by one tick.
Why is it impossible to use the for loop in "void OnBarUpdate()" when Period exceed a certain value? I have realised that when I have:
for(Counter = 0; Counter <= Period-2; Counter++), I have a result. This time I want to use something+x and not something-x.
How to fix this problem? Is void OnBarUpdate() the ppropraite place to perform these operations?
Any help?
Thanks!
Comment