Reputation: 25
Trying to plot a selected background color for reminding myself while I'm trading of when intraday margin rates begin and end. I copied this from another indicator and fiddled with it, though I didn't change very much at all. Keep getting "undeclared identifier" errors. Can't understand what I'm doing wrong. Errors:
Error: Undeclared identifier `input.string`;
Error: Undeclared identifier `input.string`;
Error: Undeclared identifier `begin0`;
Error: Undeclared identifier `end0`;
Error: Undeclared identifier `sess0`;
Error: Undeclared identifier `bgPlot0`
Code:
study(title="Highlight/Display/Show intraday trading session/period", shorttitle="intraday", overlay=true)
use0 = input(true, title="Highlight intraday trading session")
begin0 = input(title="Begin", type=input.string, defval="0800")
end0 = input(title="End", type=input.string, defval="1500")
sess0 = begin0 + "-" + end0
bgPlot0 = time(period, sess0)
bgcolor(use0 and bgPlot0 > 0 ? black : na, transp=98)
Upvotes: 0
Views: 138
Reputation: 8779
You have mixed v3 and v4 syntax:
//@version=4
study(title="Highlight/Display/Show intraday trading session/period", shorttitle="intraday", overlay=true)
use0 = input(true, title="Highlight intraday trading session")
begin0 = input(title="Begin", type=input.string, defval="0800")
end0 = input(title="End", type=input.string, defval="1500")
sess0 = begin0 + "-" + end0
bgPlot0 = time(timeframe.period, sess0)
bgcolor(use0 and bgPlot0 > 0 ? color.black : na, transp=98)
These are the v4 docs:
https://www.tradingview.com/pine-script-reference/v4/
https://www.tradingview.com/pine-script-docs/en/v4/Introduction.html
Upvotes: 1