Wondering if anyone out there can help me on this one. The system I'm trying to build makes use of a simple moving average, amongst other indicators and parameters:
MA15 = MA(C,15);
Plot(MA15, "MA15", colorRed);
But I don't just want to test if price is above or below the MA. I also want to figure out if a recent section of the MA is 'pointing up or pointing down' and to what degree. I figure the best way to achieve this is to convert the 15-period MA curve within a given bar range to a "best fit" straight line. I then want to be able to calculate the slope of that line.
For example, I might want to look at a section of the 15-period MA from the current close price, back seven bars. I then want to convert this small section to a "best fit" straight line, then calculate the slope of the line.If the slope is negative, the MA is obviously pointing down, positive and it's up. The absolute value of the slope will tell me how steep it currently is.
Any idea how best to approach the above? Or is there already some built-in indicator or function that will essentially allow me to do the above?
Thanks!