blubbb wrote:continue makes the loop continue i.e. beginning the next cycle omitting the rest of the lines. So in fact you make your alert pop up only when bar 2 is NOT > 20 pips.
My suggestion (some lines further up rewritten, based on the current version in my thread):
Code: Select all
if (MinFactorWicking > 0) for(int i = 0; i < MaxBars; i++) {
double b2 = MathAbs(iClose(NULL, p, i+2) - iOpen(NULL, p, i+2));
if (b2 < 20 * Point) continue;
double b1 = MathAbs(iClose(NULL, p, i+1) - iOpen(NULL, p, i+1));
if (b1 < b2 * MinFactorWicking) continue;
double z = (iClose(NULL, p, i+1) + iOpen(NULL, p, i+1)) / 2;
Ok, Let me give it a try. Does this look right to you?
-------------------------------------
void Check(int p, datetime& t) {
if (iTime(NULL, p, 0) == t) return(0);
if (MinFactorWicking > 0) for(int i = 0; i < MaxBars; i++) {
double b2 = MathAbs(iClose(NULL, p, i+2) - iOpen(NULL, p, i+2));
if (b2 < 20 * Point) continue;
double b1 = MathAbs(iClose(NULL, p, i+1) - iOpen(NULL, p, i+1));
if (b1 < b2 * MinFactorWicking) continue;
double z = (iClose(NULL, p, i+1) + iOpen(NULL, p, i+1)) / 2;
if (Close[0] == iHigh(NULL, p, 0)) {
if (iClose(NULL, p, i+1) > iOpen(NULL, p, i+1)) continue;
if (Close[0] <= z) continue;
if (Old > z) continue;
//if (iOpen(NULL, p, 2) - iClose(NULL, p, 2) > 20*Point) continue;
DisplayAlert("Look for a "+Symbol()+" SHORT on "+PeriodNice(p)+" (wick)");
t = iTime(NULL, p, 0);
return(0);
}
if (Close[0] == iLow(NULL, p, 0)) {
if (iClose(NULL, p, i+1) < iOpen(NULL, p, i+1)) continue;
if (Close[0] >= z) continue;
if (Old < z) continue;
//if (iClose(NULL, p, 2) - iOpen(NULL, p, 2) > 20*Point) continue;
DisplayAlert("Look for a "+Symbol()+" LONG on "+PeriodNice(p)+" (wick)");
t = iTime(NULL, p, 0);
return(0);
}
}
--------------------------------