the indicator put same result for all bars, I guess it doesn´t reset the variables, how to reset them ("calculo" and "std")?
publicclass IntradayIntensity : Indicator
{
#region Variables
privateint period = 21;
privatedouble calculo = 0;
private double std = 0;
#endregion
protectedoverridevoid Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "IntradayIntensity"));
Overlay = false;
BarsRequired = 21;
}
protectedoverridevoid OnBarUpdate()
{
int i = CurrentBar - 21;
if (i>=0)
{
for (int k = i; k < CurrentBar; k++)
{
if (High[k]-Low[k] != 0)
calculo = (((2*Close[k]-High[k]-Low[k])/(High[k]-Low[k]))*Volume[k]);
std = std + calculo;
}
Value.Set(std);
}
}
Comment