我正在尝试将夏令时纳入我的策略帐户中。该策略取决于交易所的开放时间。(不是加密货币)。
我的代码是:
dst=0
t=time(timeframe.period,"0400-0500:23456")
t1=time(timeframe.period,"0500-0555:23456")
//This resolves daylight saving back to 2016
dsfallback2020 = timestamp(2019,10,25,08,00)
dsspringfor2020 = timestamp(2020,03,29,08,00)
dsfallback2019 = timestamp(2019,10,27,08,00)
dsspringfor2019 = timestamp(2019,03,31,08,00)
dsfallback2018 = timestamp(2018,10,28,08,00)
dsspringfor2018 = timestamp(2018,03,25,08,00)
dsfallback2017 = timestamp(2017,10,25,08,00)
dsspringfor2017 = timestamp(2017,03,26,08,00)
dsfallback2016 = timestamp(2017,10,30,08,00)
dsspringfor2016 = timestamp(2017,03,27,08,00)
if (t > dsspringfor2020 and t < dsfallback2020)
dst:=1
else if (t > dsspringfor2019 and t < dsfallback2019)
dst:=1
else if (t > dsspringfor2018 and t < dsfallback2018)
dst:=1
else if (t > dsspringfor2018 and t < dsfallback2018) …Run Code Online (Sandbox Code Playgroud) 我正在尝试添加具有多个选项的输入,如下所示,并根据 TradingView 中的用户选择显示图表:
我尝试过的是:
emaInput = input.string("50 EMA", "Choose EMA", options = ["50 EMA", "100 EMA", "200 EMA"])
upTrend = plot(dir == 1 and emaInput == '200 EMA' ? longStop : na, title='Uptrend Line', style=plot.style_linebr, linewidth=2, color=color.new(color.green, 0))
Run Code Online (Sandbox Code Playgroud)
保存脚本时出现以下错误:
无法使用参数“expr1”=“emaInput”调用“operator and”。使用了“输入字符串”类型的参数,但需要“系列布尔”
任何帮助将不胜感激!
我试图找到蜡烛的完整尺寸,无论是看涨还是看跌,所以我尝试:
FullLength = maths.abs(high-low)但都FullLength = abs(high-low)
不起作用。我收到消息:
Could not find function or function reference 'maths.abs'.
Could not find function or function reference 'abs'.
Run Code Online (Sandbox Code Playgroud)
任何想法都非常感激。提前致谢。
我想在一个月(对于每日和每周图表)或一年(对于每月图表)的每个第一个柱上绘制一条垂直虚线。我怎样才能做到这一点?我不知道如何获取这些条形索引。
添加: 我在 这篇文章中读到 ,“line.new”的每个指标最多 54 行的限制。但是,当以直方图样式使用绘图函数时(=仅绘制单个垂直直方图条),我无法绘制虚线...并且我更喜欢带有虚线的解决方案...