Sorry, for my coding is hella rusty, and I'm trying to figure out pinescript.
Simple script to which I'm trying to add time variable. The goal it to have the plot only during RTH (NY trading hours).
I've gotten as far as "IF statement must be inside the plot command, and not the other way around", but I can't seem to make my way any further than that. Please, help.
study("Pivot High Low Points", overlay =true)
t = time(timeframe.period, "0930-1600")
time_cond = not na(t)
lb = input(defval = 5, title="Left Bars")
rb = input(defval = 5, title="Right Bars")
mb = lb + rb + 1
plotshape(iff(not na(high[mb]), iff(highestbars(mb) == -lb, high[lb], na), na), style = shape.triangledown, location = location.abovebar, color = color.red, size = size.tiny, offset = -lb)
plotshape(iff(not na(low[mb]), iff(lowestbars(mb) == -lb, low[lb], na), na), style = shape.triangleup, location = location.belowbar, color = color.lime, size = size.tiny, offset = -lb)
The question is, how do I insert the "if and time_cond" into the plotshape command? Thank you!
couldn't figure it out. Will not compile
Assign your if condition to a variable and then
andit with yourtime_cond.Note: Since you are using
offsetin yourplotshape(), you might need to adjust your time condition depending on your needs.