Forex_Strategy_Builder.Indicator.BarOpensBelowIndicatorAfterOpeningAboveLogic C# (CSharp) Method

BarOpensBelowIndicatorAfterOpeningAboveLogic() protected method

Returns signals for the logic rule "The bar opens below the Indicator after opening above it"
protected BarOpensBelowIndicatorAfterOpeningAboveLogic ( int firstBar, int prvs, double adIndValue, IndicatorComp &indCompLong, IndicatorComp &indCompShort ) : void
firstBar int
prvs int
adIndValue double
indCompLong IndicatorComp
indCompShort IndicatorComp
return void
        protected void BarOpensBelowIndicatorAfterOpeningAboveLogic(int firstBar, int prvs, double[] adIndValue, ref IndicatorComp indCompLong, ref IndicatorComp indCompShort)
        {
            double sigma = Sigma();

            for (int bar = firstBar; bar < Bars; bar++)
            {
                int baseBar = bar - 1;
                while (Math.Abs(Open[baseBar] - adIndValue[baseBar - prvs]) < sigma && baseBar > firstBar)
                { baseBar--; }

                indCompLong.Value[bar]  = Open[bar] < adIndValue[bar - prvs] - sigma && Open[baseBar] > adIndValue[baseBar - prvs] + sigma ? 1 : 0;
                indCompShort.Value[bar] = Open[bar] > adIndValue[bar - prvs] + sigma && Open[baseBar] < adIndValue[baseBar - prvs] - sigma ? 1 : 0;
            }

            return;
        }