V 1n in post 1, with the added check that the stack MA's must be separating. To save a download, place this at the start of bool detectMaStack
Code: Select all
//Check the moving averages are widening - the direction does not matter yet
double confirmation[2];
confirmation[0] = (MathAbs(iMA(symbol, timeframe, period, mashift, method, applied, shift) - iMA(symbol, timeframe, period1, mashift, method, applied, shift)));
confirmation[1] = (MathAbs(iMA(symbol, timeframe, period, mashift, method, applied, shift+1) - iMA(symbol, timeframe, period1, mashift, method, applied, shift+1)));
if (!confirmation[0] > confirmation[1])
return(false);