gpt4 book ai didi

pine-script - 无法使用参数调用 'plot' (series[float],

转载 作者:行者123 更新时间:2023-12-05 03:52:20 27 4
gpt4 key购买 nike

10 天前,我开始尝试了解 Pine,但我没有编程经验,一些 sql 报告是我的全部经验。我希望我能边走边学概念。我已经阅读了大部分手册/引用资料,但需要一段时间才能完全理解。

第一个错误是我采用了一些版本 3 代码并将其粘贴到 V4 中,并且大部分转换都是正确的,但我知道有错误,我只是无法弄清楚当我尝试绘制系列时,出现以下错误为每一个:第 189 行:无法使用参数调用“plot”(series[float],color=const color,style=const string,linewidth=literal integer,title=literal string);可用的重载:plot(series[float], const string, series[color], input integer, input integer, input bool, input integer, input float, series[integer], input bool, series[float], const bool, input整数, const 整数, 字符串) => plot; plot(fun_arg__, const string, fun_arg__, input integer, input integer, input bool, input integer, input float, series[integer], input bool, series[float], const bool, 输入整数, const integer, string) =>情节;

 //@version=4
study(title = "Study1", overlay = true)

> Blockquote


//strategy("Daily ATR Stop", overlay=true, precision=5)

smaFastLkb = input(14, minval=1, title='Fast SMA Period')
smaSlowLkb = input(28, minval=1, title='Slow SMA Period')
atrLkb = input(7, minval=1, title='ATR Stop Period')
atrRes = input("D", type= input.resolution, title='ATR Resolution')
atrMult = input(1, step=0.25, title='ATR Stop Multiplier')


// Get the indicators
// -------------------
atr = security(syminfo.tickerid , atrRes, atr(atrLkb))
smaFast = sma(close, smaFastLkb)
smaSlow = sma(close, smaSlowLkb)


longCondition = crossover(smaFast, smaSlow)
//if (longCondition)
// strategy.entry("Long", strategy.long)

shortCondition = crossunder(smaFast, smaSlow)
//if (shortCondition)
// strategy.entry("Short", strategy.short)

// Calc ATR Stops

float longStop = na
longStop := shortCondition ? na : longCondition ? close - (atr * atrMult) : longStop[1]
shortStop = float(na)
shortStop := longCondition ? na : shortCondition ? close + (atr * atrMult) : shortStop[1]

// Place the exits
//strategy.exit("Long ATR Stop", "Long", stop=longStop)
//strategy.exit("Short ATR Stop", "Short", stop=shortStop)

// Plot the stoplosses
plot(smaFast, color=color.orange, style = line.style_dashed, linewidth=2, title='Fast SMA')
plot(smaFast, color=color.purple, style = line.style_dashed, linewidth=2, title='Slow SMA')
plot(longStop, color=color.red, style = line.style_dashed, title='Long ATR Stop')
plot(shortStop, color= color.maroon,style = line.style_dashed, title='Short ATR Stop')

最佳答案

您为 line.new() 使用了 style= 参数:

plot(smaFast,   color=color.orange, style = plot.style_circles,  linewidth=2, title='Fast SMA') 
plot(smaFast, color=color.purple, style = plot.style_circles, linewidth=2, title='Slow SMA')
plot(longStop, color=color.red, style = plot.style_circles, title='Long ATR Stop')
plot(shortStop, color= color.maroon,style = plot.style_circles, title='Short ATR Stop')

当您在函数调用中遇到编译器错误时,请研究 refman 中的函数以确保您正确使用它。这是 plot() 的条目. plot() 没有虚线样式。您可以使用它来模拟一个,这使得颜色每隔一格不可见:

plot(smaFast,   color=bar_index % 2 == 0 ? color.orange : na, style = plot.style_line,  linewidth=2, title='Fast SMA') 

关于pine-script - 无法使用参数调用 'plot' (series[float],,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62252670/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com