Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator('45 Degree Angle from Last Low/High', overlay=true)
- // Determine whether the last point was a high or low
- lastHigh = ta.highest(high, 500)
- lastLow = ta.lowest(low, 500)
- lastPoint = bar_index - nz(math.max(lastLow, lastHigh))
- // Calculate the slope of the line
- slope = 1
- // Calculate the y-intercept of the line
- yIntercept = lastHigh - slope * (bar_index - lastPoint)
- // Plot the line
- plot(slope * (bar_index - lastPoint) + yIntercept, color=color.new(color.green, 0))
Advertisement
Add Comment
Please, Sign In to add comment