Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=4
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © EduardoMattje
- study("Highs and lows", "HnL", true)
- // Inputs
- i_displayLimit = input(0, "Display limit", minval=0, tooltip="Keep this at 0 if you want to display all values.\nChange it to hide past values, up until the specified number.")
- // Variable
- getHigh(resolution) => security(syminfo.tickerid, resolution, high[1], lookahead=barmerge.lookahead_on)
- getLow(resolution) => security(syminfo.tickerid, resolution, low[1], lookahead=barmerge.lookahead_on)
- yesterdayHigh = getHigh("D")
- yesterdayLow = getLow("D")
- weekHigh = getHigh("W")
- weekLow = getLow("W")
- monthHigh = getHigh("M")
- monthLow = getLow("M")
- // Plots
- plot(yesterdayHigh, "Yesterday's high", color.teal, style=plot.style_stepline, show_last=i_displayLimit)
- plot(yesterdayLow, "Yesterday's low", color.red, style=plot.style_stepline, show_last=i_displayLimit)
- plot(weekHigh, "Last week's high", color.teal, 2, plot.style_stepline, show_last=i_displayLimit)
- plot(weekLow, "Last week's low", color.red, 2, plot.style_stepline, show_last=i_displayLimit)
- plot(monthHigh, "Last month's high", color.teal, 4, plot.style_stepline, show_last=i_displayLimit)
- plot(monthLow, "Last month's low", color.red, 4, plot.style_stepline, show_last=i_displayLimit)
Add Comment
Please, Sign In to add comment