Click here to Login





                                                   Angle of an SMA line

  0

0
Gilari Decosta
2010-11-17 11:18:59


Sir,
Is there any formulae to find angle of SMA Line?
Please Inform me
Thanks
Gilari



QuantShare
2010-11-18 04:31:03

  0

Best Answer
To calculate the angle of a time-series:
a = LinearReg_Angle(sma(30), 2);



Obuli Govindaraju
2013-04-12 07:29:14

  0

The value returned by LinearReg_Angle() functions - is that in degrees or something else? If something else how do I get it to degrees.

For example if I use AutoSR function and I want the angle of a support line in degrees what should I do?

Thanks.



QuantShare
2013-04-12 11:03:03

  1

Yes, it is in degree. The "linearreg_slope" function returns the result in radians.

To get the angle of a support line, you can do that using "LinearReg_Angle".
Read more about this here:
http://www.quantshare.com/sa-437-detect-chart-patterns-using-the-auto-support-resistance-indicator

Or if you want to calculate the angle of each support line (for each trading bar), you can find the information here:
http://www.quantshare.com/sa-453-backtesting-chart-patterns-using-the-auto-support-and-resistance-indicator



Obuli Govindaraju
2013-04-12 18:19:45

  0

I am getting different results from what you have stated with LinearReg_Angle() function.

Here is a code I executed on SP500 (^GSPC)

period = 100;
sup = AutoSR(0,0,period);
Plot(sup,"Support",colorRed,ChartLine,StyleNoScale);
supAngle = LinearReg_Angle(sup,period);

Looking at the Debug, the value of supAngle comes out as 108.19 (which doesn't make sense if it is in degrees)

I then used the drawing tool http://www.quantshare.com/item-621-slope-angle-of-a-trendline to draw a line on top of the support line plotted by the code above. This drawing tool returns a value 27% which is the angle of the support line.

If LinearReg_Angle() is supposed to return degrees then I expect to see 27 for the supAngle value which is not the case.

What am I missing?




QuantShare
2013-04-13 12:22:18

  0

Hi,

You should not compare the result with the drawing tool, because the latter returns the visual angle, and you may notice that the angle changes if you resize the chart.

However, you are right. There is an issue in the calculation of the "LinearReg_Angle". It will be fixed in the next release.
In the meantime, here is how to calculate the right angle:

supAngle = Atan(LinearReg_slope(sup,period))*(180/3.14);






Obuli Govindaraju
2013-04-13 18:36:34

  0

Thanks for the clarification on visual angle. So if LinearReg_Angle() does not return visual angle then what "angle" does it return?

What does angle mean in this context?



QuantShare
2013-04-13 20:18:45

  0

It returns the angle of the linear equation returned by the linear regression. The angle looks correct visually when the difference between the X values (Each bar) is equal to the difference between Y values (Same distance between increments).



Obuli Govindaraju
2013-04-13 22:40:23

  0

Great! Thanks for the reply.

I should have realized that it is the angle of the linear regression line since that is what the function is.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
    To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










    QuantShare

    Trading Items
    Slope Angle of a Trendline
    Relative Vigor Index - Signal Line
    Standard Error of the Estimate of a Regression Line
    Stock Bounces off its Previous Resistance or Support Line
    5x5 SMA & RSI Forex Strategy

    How-to Lessons
    How to draw an horizontal segment line using QS language
    How to dynamically update the settings of an indicator
    How to download and use U.S. stocks earnings data
    How to install the previous version of QuantShare
    How to use the Fibonacci retracement drawing tool

    Related Forum Threads
    INTRADAY CHART AND VERTICAL LINE TO SEPARATE EACH DAYS
    Guru, formula for line cross
    Positioning horizontal line
    Arrow has the same properties as a trend line
    Problem drawing trend line using version 2.91

    Blog Posts
    Custom Indicator: Accumulation Distribution Line
    Learn How to Create Your Own Technical Analysis Indicators
    QuantShare Programming Language Tutorial
    Detect chart patterns using the auto support/resistance indicator
    10 masks to create thousands of rules to use into your trading sy...









    QuantShare
    Product
    QuantShare
    Features
    Create an account
    Affiliate Program
    Support
    Contact Us
    Trading Forum
    How-to Lessons
    Manual
    Company
    About Us
    Privacy
    Terms of Use

    Copyright © 2025 QuantShare.com
    Social Media
    Follow us on Facebook
    Twitter Follow us on Twitter
    Google+
    Follow us on Google+
    RSS Trading Items



    Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.