Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pine script 如何显示列表中的第一个数据-Pine脚本(Tradingview)_Pine Script - Fatal编程技术网

Pine script 如何显示列表中的第一个数据-Pine脚本(Tradingview)

Pine script 如何显示列表中的第一个数据-Pine脚本(Tradingview),pine-script,Pine Script,我有一个返回正确列表的代码。我想展示名单上的第一支蜡烛。帮助我 你可以用一个标志来表示做多,用一个标志来表示做空。在pine脚本中使用标志的重要一点是记住使用历史引用操作符[]访问以前的状态 下面是一个例子,每当close>ema55时,你就做多,每当closeema55 sellCondition=isLong且关闭

我有一个返回正确列表的代码。我想展示名单上的第一支蜡烛。帮助我


你可以用一个标志来表示做多,用一个标志来表示做空。在pine脚本中使用标志的重要一点是记住使用历史引用操作符
[]
访问以前的状态

下面是一个例子,每当
close>ema55
时,你就做多,每当
close
时,你就做空

//@version=3
study(title="LONG Test", shorttitle="Test", overlay=true)

lenEma55 = input(55, minval=1, title="Length EMA 55")

isLong = false
isLong := nz(isLong[1])

isShort = false
isShort := nz(isShort[1])

ema55 = ema(close, lenEma55)
plot(ema55, color=green, linewidth=2)

buyCondition = not isLong and close > ema55
sellCondition = isLong and close < ema55

if (buyCondition)
    isLong := true
    isShort := false

if (sellCondition)
    isLong := false
    isShort = true

plotshape(buyCondition, color=green, style=shape.arrowdown, text="LONG",location=location.belowbar)
plotshape(sellCondition, color=red, style=shape.arrowdown, text="SHORT",location=location.abovebar)
/@version=3
研究(title=“长测试”,shorttitle=“测试”,叠加=真)
lenEma55=输入(55,最小值=1,title=“长度EMA 55”)
isLong=false
isLong:=nz(isLong[1])
isShort=false
isShort:=nz(isShort[1])
ema55=ema(关闭,lenEma55)
绘图(ema55,颜色=绿色,线宽=2)
buyCondition=不长且关闭>ema55
sellCondition=isLong且关闭
您的短期状况是什么?你可以使用一个标志来表示长,然后在绘制形状之前检查该标志。你能给我一个Pine中的示例检查标志吗?别用我的语言。告诉我你的短期状况,然后我可以帮助你@巴里斯·雅库特非常感谢你。你帮我解决了一个愚蠢的问题。谢谢大家!@JaTuan如果我的答案对您有帮助,请单击我答案旁边的复选标记,将其标记为“已接受答案”好吗?
//@version=3
study(title="LONG Test", shorttitle="Test", overlay=true)

lenEma55 = input(55, minval=1, title="Length EMA 55")

isLong = false
isLong := nz(isLong[1])

isShort = false
isShort := nz(isShort[1])

ema55 = ema(close, lenEma55)
plot(ema55, color=green, linewidth=2)

buyCondition = not isLong and close > ema55
sellCondition = isLong and close < ema55

if (buyCondition)
    isLong := true
    isShort := false

if (sellCondition)
    isLong := false
    isShort = true

plotshape(buyCondition, color=green, style=shape.arrowdown, text="LONG",location=location.belowbar)
plotshape(sellCondition, color=red, style=shape.arrowdown, text="SHORT",location=location.abovebar)