I am new to C# coding and still learning it on-the-fly. Please help with this multi-DataSeries question: How can I duplicate the calculations below for an additional DataSeries?
Background: I'd like to send buy/sell orders when the RSqueeze indicators on both DataSeries cross the respective zero line.
1st. I add a DataSeries to the code, but not to the chart. For example: 500-tick NQ to the 100-tick NQ chart.
2nd. I add the code below to calculate the RSqueeze values for the 100-tick chart
3rd. I add the same set of code to calculate the RSqueeze values for the 500-tick DataSeries. I know I need to use a second set of variables and "Closes[1] and CurrentBars[1]" for that price data. But where I got stuck are in two places: "Input" and "new DataSeries(this)", which I could not find an explanation that I could understand on these two items.
Thank you in advance,
Raymond
The code below is part of the RSqueeze Indicator, see thread:
Actual code:
#region Variables
private DataSeries myValue2;
public double SqueezeValue = 0 ;
#endregion
protected override void Initialize()
{
Overlay = true;
CalculateOnBarClose = true;
myValue2 = new DataSeries(this);
}
protected override void OnBarUpdate()
{
double avtrrg = ATR(20)[0];
double sd = StdDev(Close, 20)[0];
double bbsInd = (1.5 * avtrrg) != 0 ? 2 * sd / (1.5 * avtrrg) : 1;
myValue2.Set(Input[0] - (((DonchianChannel(Input, 20).Mean.Get(CurrentBar)) + (EMA(Input, 20)[0])) / 2));
SqueezeValue = LinReg(myValue2, 20)[0];
}
Comment