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

Re: angle finder



PureBytes Links

Trading Reference Links

John Davis asked:
>would anyone have a tool that would display the angle of a moving
>average?or any indicator ,I have seen one for e signal, It is a
>small square box that displays the angle as the slope changes. It
>is very handy,I need one for 2000i, I would apreciate any input

Angle is meaningless in charts that have different units on each
axis, and even more meaningless when the scale of each axis is
arbitrary.  For example, a 45 degree angle at one scale would be
a 30 degree angle if the vertical scale units doubled, or if the
horizontal scale units halved.  In other words, you won't ever get
consistent measurements.

The only invariant angle measurement is a slope.  The slope of a
moving average is simply the difference between the current value
and the previous value.  You can display this in a subgraph; e.g.

 ---------------------------------------------------------------
{indicator: moving average slope}
inputs: price(close), length(21);
var: avg(0);
avg = average(price, length);
plot1(avg - avg[1], "slope");
 ---------------------------------------------------------------

Another thing you can do is display text next to the moving average
itself.  I think this has to be in the price graph, not a subgraph.

 ---------------------------------------------------------------
{indicator: moving average with slope displayed}
inputs: price(close), length(21);
var: avg(0), txid(0);
avg = average(price, length);
if currentbar = 1 then begin
   txid = Text_New(date, time, price, NumToStr(price-price[1], 3);
   if txid >= 0 then Text_SetStyle(txid, 1, 2);
end;
plot1(avg, "average");
if LastBarOnChart and txid >= 0 then
    Text_SetLocation(txid, date, time, price, NumToStr(avg-avg[1], 3));
 ---------------------------------------------------------------

Warning: code above was written from my head, and untested.  For
educational purposes only; use at your own risk.

-- 
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \ 
 // __)    Unicorn Research Corporation -- http://unicorn.us.com