Firstly I have to apologize for my bad english.
I have a problem with rewrite script from NT7 to NT8. I need a short horizontal line like that on a picture.
error code: CS0103
protected override void OnBarUpdate()
{
barsBack = 5; // THERE IS PROBLEM
Color smaLineColor = Color.Orange;
if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
{
if (CurrentBar == 0)
Value[0] = Input[0];
else
{
double last = Value[1] * Math.Min(CurrentBar, Period);
if (CurrentBar >= Period)
Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
else
Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
}
if(CurrentBar > barsBack)
Draw.Line("HorizontalSMA", 0, Value[0], barsBack ,Value[0], smaLineColor);
}
else
{
if (IsFirstTickOfBar)
priorSum = sum;
sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
}
}
If you have any ideas, I would be grateful for help.

Comment