[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Line of Best Fit and Slope of an MA?



PureBytes Links

Trading Reference Links

Try this to get slope of your calculated MA15 array.

LinRegSlope(MA15,15)

2008/7/8 ozzyapeman <zoopfree@xxxxxxxxxxx>:

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!




--
John Ayling
e: john@xxxxxxxxxxxxxxxxx
m: 0414 640 930
p: +61 2 4782 7286 __._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___