I have a simple indicator I want to put on the chart but can't.
It seems so simple I don't understand what is going on. What I want to do is take the ATR 15 period and multiply that by 1.6. When I am trying to multiple I get no value in the indicator windown.
Here is my code :
protectedoverridevoid Initialize()
{
Add(new Plot(Color.Green, "emdtATRX"));
}
protectedoverridevoid OnBarUpdate()
{
if (CurrentBar == 0)
Value.Set(High[0] - Low[0]);
else
{
double trueRange = High[0] - Low[0];
trueRange = Math.Max(Math.Abs(Low[0] - Close[1]), Math.Max(trueRange, Math.Abs(High[0] - Close[1])));
Value.Set((((Math.Min(CurrentBar + 1, Period) - 1 ) * Value[1] + trueRange) / Math.Min(CurrentBar + 1, Period)) * Multiplier);
}
}
Obviously multiplier is a variable set to 1.6 and Multiplier a Property
What could be wrong ?
Thanks
Comment