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

//@version=5

// @description This library calculate the slope of a serie between two points
library("Slope_TK")

// @function Return the slope between the actual bar and the older bar in the 'size' position
// @param serie = serie from which you want calculate the slope
// @param size = the number of bars between the two bars on which the slope is calculated
// @returns The slope of the line beween the two values : ( serie[size], bar_index[size] ) and ( serie, bar_index )

export slope(float serie, int size) => 
    // Slope value
    // a = (y2 - y1) / (x2 - x1)
    slope = (serie[0]-serie[size])
    slope