this is my code can you see any problems:
#region Variables
// Wizard generated variables
private int roclength = 50; // Default setting for MyInput0
private int actroclength = 50;
private double sum = 0;
private double sum2 = 0;
private double avg = 0;
private double avg2 = 0;
private double num = 0;
private double dom = 0;
private double dom2 = 0;
private double dom3 = 0;
private double dom4 = 0;
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add("NQ 12-17", PeriodType.Minute, 1);
Add("ES 12-17", PeriodType.Minute, 1);
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired || CurrentBars[2] <= BarsRequired || CurrentBars[3] <= BarsRequired)
return;
/*if (CurrentBar < 2)
{
return;
}*/
double[] roc = new double[roclength];
double[] roc2 = new double[roclength];
double[] corr = new double[roclength];
double[] corr2 = new double[roclength];
for(int i = roclength; i > 0; i--)
{
roc[i] = ROC(BarsArray[1],actroclength)[i];
roc2[i] = ROC(BarsArray[2], actroclength)[i];
}
for(int j = roclength; j > 0; j--)
{
sum += roc[j];
sum2 += roc2[j];
}
avg = sum/roclength;
avg2 = sum2/roclength;
Plot0.Set(avg);
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}
[Description("")]
[GridCategory("Parameters")]
public int Roclength
{
get { return roclength; }
set { roclength = Math.Max(1, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int Actroclength
{
get { return actroclength; }
set { actroclength = Math.Max(1, value); }
}
#endregion
Comment