Allan you could maybe look at the linear regression of slope function in AB instead of ROC?
LinRegSlope
- linear regression slope Statistical functions
(AFL 1.4)
SYNTAX LinRegSlope( ARRAY, periods )
RETURNS ARRAY
FUNCTION Calculates linear regression line slope from the ARRAY using periods range. The function accepts periods parameter that can be constant as well as time-variant (array).
EXAMPLE x = Cum(1);
lastx = LastValue( x ); Daysback = 10; aa = LastValue( LinRegIntercept( Close, Daysback) );
bb = LastValue( LinRegSlope( Close, Daysback ) );
y = Aa + bb * ( x - (Lastx - DaysBack) ); Plot( Close, "Close", colorBlack, styleCandle );
Plot( IIf( x >= (lastx - Daysback), y, -1e10 ), "LinReg", colorRed );
Cheers
Thanks for the suggestion. I'll have a look over it tomorrow and learn more about how it works.