protected void IndicatorCrossesAnotherIndicatorDownwardLogic(int firstBar, int prvs, double[] adIndValue, double[] adAnotherIndValue, ref IndicatorComp indCompLong, ref IndicatorComp indCompShort)
{
double sigma = Sigma();
for (int bar = firstBar; bar < Bars; bar++)
{
int currBar = bar - prvs;
int baseBar = currBar - 1;
while (Math.Abs(adIndValue[baseBar] - adAnotherIndValue[baseBar]) < sigma && baseBar > firstBar)
{ baseBar--; }
indCompLong.Value[bar] = adIndValue[currBar] < adAnotherIndValue[currBar] - sigma && adIndValue[baseBar] > adAnotherIndValue[baseBar] + sigma ? 1 : 0;
indCompShort.Value[bar] = adIndValue[currBar] > adAnotherIndValue[currBar] + sigma && adIndValue[baseBar] < adAnotherIndValue[baseBar] - sigma ? 1 : 0;
}
return;
}