1. The missing entries must be filtered by other logic conditions (MACD)
2. The "Wrong" entry is a special case where the entry price jumps from above the bar to below it. In that case the program executes entry at bar open. There is a bloc of code, which covers such cases.
for (int iBar = 2; iBar < Bars; iBar++)
{
// Covers the cases when the price can pass through the band without a signal
double dValueUp = adUpBand[iBar - iPrvs]; // Current value
double dValueUp1 = adUpBand[iBar - iPrvs - 1]; // Previous value
double dTempValUp = dValueUp;
if ((dValueUp1 > High[iBar - 1] && dValueUp < Low[iBar]) || // It jumps below the current bar
(dValueUp1 < Low[iBar - 1] && dValueUp > High[iBar]) || // It jumps above the current bar
(Close[iBar - 1] < dValueUp && dValueUp < Open[iBar]) || // Positive gap
(Close[iBar - 1] > dValueUp && dValueUp > Open[iBar])) // Negative gap
dTempValUp = Open[iBar];
double dValueDown = adDnBand[iBar - iPrvs]; // Current value
double dValueDown1 = adDnBand[iBar - iPrvs - 1]; // Previous value
double dTempValDown = dValueDown;
if ((dValueDown1 > High[iBar - 1] && dValueDown < Low[iBar]) || // It jumps below the current bar
(dValueDown1 < Low[iBar - 1] && dValueDown > High[iBar]) || // It jumps above the current bar
(Close[iBar - 1] < dValueDown && dValueDown < Open[iBar]) || // Positive gap
(Close[iBar - 1] > dValueDown && dValueDown > Open[iBar])) // Negative gap
dTempValDown = Open[iBar];
if (IndParam.ListParam[0].Text == "Enter long at the Upper Band" ||
IndParam.ListParam[0].Text == "Exit long at the Upper Band")
{
Component[3].Value[iBar] = dTempValUp;
Component[4].Value[iBar] = dTempValDown;
}
else
{
Component[3].Value[iBar] = dTempValDown;
Component[4].Value[iBar] = dTempValUp;
}
}
In this exactly case the entry price for the previous bar was above the bar. For the bar you marked, the entry price is below it. So BB was passed through the market price and to prevent a "missing" entry the program executes entry at first available price - "Bar Open" price.
That behaviour is same for all the indicators plotted on the main price chart as Moving Average, Bollinger Bands, Envelopes...
Indicators are same in both programs - Forex Strategy Builder and Forex Strategy Trader.