DegreeALine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © atazed

//@version=5

// @description TODO: add library description here
library("DegreeALine",overlay=true)

// @function TODO: add function description here
// @param x1 First X coordinate of a line, index of the bar where the line starts.
// @param y1 First Y coordinate of a line, price on the price scale.
// @param x2 Second X coordinate of a line, index of the bar where the line ends.
// @param y2 Second Y coordinate of a line, price on the price scale.
// @returns Degree Of Line
export Degree(int X1,float Y1,int X2,float Y2) =>
    rad2degree = 180 / 3.14159265359 
    HighRange=ta.highest(close,100)
    LowRange=ta.lowest(close,100)
    Navasan=((HighRange-LowRange)*100)/LowRange
    navasanAlan=((math.abs(Y2 - Y1)*100)/Y1)
    NavasaneKoli=(navasanAlan*100)/Navasan
    ang = Y2>Y1?rad2degree * math.atan(NavasaneKoli / math.abs(X2-X1)):-1*rad2degree * math.atan(NavasaneKoli / math.abs(X2-X1))
    ang
