'time' 不是变量声明中的有效类型关键字
'time' is not a valid type keyword in variable declaration
我正在遵循 PineCoders 为 Pine 制定的最佳实践,我意识到没有 time
这样的类型。出现以下情况怎么办?
'time' is not a valid type keyword in variable declaration
请注意,我可以轻松地从 i_startDateTime
和 i_endDateTime
中删除 time
前缀并解决问题,但我希望它使用最佳实践。就像 LucF goy 所做的那样 https://www.tradingview.com/script/Xh8tLDTe-Delta-Volume-Realtime-Action-LucF/.
var string START_TIME = "2018-01-01T00:00"
var string END_TIME = "2030-01-01T00:00"
var string GP12 = "Date range filtering"
bool i_dateFilter = input(false, "Date Range Filtering", group = GP12)
time i_startDateTime = input(timestamp(START_TIME), "Start Date/Time", type = input.time, group = GP12)
time i_endDateTime = input(timestamp(END_TIME), "End Date/Time", type = input.time, group = GP12)
f_tradeDateIsAllowed() => i_dateFilter ? (time >= i_startDateTime and time <= i_endDateTime) : true
timestamp()
函数returns和int
,所以你的变量也必须声明为int
,或者在定义时省略int
变量。
//@version=4
study("Time", "T", overlay=true)
var string START_TIME = "2018-01-01T00:00"
var string END_TIME = "2030-01-01T00:00"
var string GP12 = "Date range filtering"
var bool i_dateFilter = input(false, "Date Range Filtering", group = GP12)
var int i_fromDate = input(timestamp(START_TIME), "Start Date/Time", type = input.time, group = GP12)
var int i_toDate = input(timestamp(END_TIME), "End Date/Time", type = input.time, group = GP12)
plot(na)
我正在遵循 PineCoders 为 Pine 制定的最佳实践,我意识到没有 time
这样的类型。出现以下情况怎么办?
'time' is not a valid type keyword in variable declaration
请注意,我可以轻松地从 i_startDateTime
和 i_endDateTime
中删除 time
前缀并解决问题,但我希望它使用最佳实践。就像 LucF goy 所做的那样 https://www.tradingview.com/script/Xh8tLDTe-Delta-Volume-Realtime-Action-LucF/.
var string START_TIME = "2018-01-01T00:00"
var string END_TIME = "2030-01-01T00:00"
var string GP12 = "Date range filtering"
bool i_dateFilter = input(false, "Date Range Filtering", group = GP12)
time i_startDateTime = input(timestamp(START_TIME), "Start Date/Time", type = input.time, group = GP12)
time i_endDateTime = input(timestamp(END_TIME), "End Date/Time", type = input.time, group = GP12)
f_tradeDateIsAllowed() => i_dateFilter ? (time >= i_startDateTime and time <= i_endDateTime) : true
timestamp()
函数returns和int
,所以你的变量也必须声明为int
,或者在定义时省略int
变量。
//@version=4
study("Time", "T", overlay=true)
var string START_TIME = "2018-01-01T00:00"
var string END_TIME = "2030-01-01T00:00"
var string GP12 = "Date range filtering"
var bool i_dateFilter = input(false, "Date Range Filtering", group = GP12)
var int i_fromDate = input(timestamp(START_TIME), "Start Date/Time", type = input.time, group = GP12)
var int i_toDate = input(timestamp(END_TIME), "End Date/Time", type = input.time, group = GP12)
plot(na)