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

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



PureBytes Links

Trading Reference Links

There are probably a 1000 ways to do this. 
The MA is already a "best fit" line. 

If the highest MA high is more recent than the lowest MA low the 
slope is up.

If MA > Ref(MA,-nBars) the slope up over n bars. It may be down over 
the most recent part. Or the polarity of MA - Ref(MA,-nBars) tells if 
it is going up or down. 

But consider C > Ref(C,-nBars) the slope up over n bars. This tells 
if it is going up or down. This changes long before the MA turns. 
Often by the time an MA turns you have missed a good part of the move.

The slope of the line in radians is aTan((C - Ref(C, -nBars)) / 
nBars); negative is sloping down and positive is up but the angle 
tells how fast it is moving. Plotting the aTan over the price is very 
interesting. I used 5 and 7 bars. If the market slows even a little 
with 5 bars there is a violent change of direction in the aTan plot. 
Using 7 bars smooths it out a bit.

Or you can determine the slope from the lowest low to current price. 

And the list goes on and on. 

But another thing you might want to consider is comparing the slope 
on multiple time frames. Maybe using a quicker period to time entries 
within a longer term trend. 

Barry

--- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" <zoopfree@xxx> wrote:
>
> 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!
>



------------------------------------

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
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/