较低的时间框架确认单独工作,但合并时不起作用.Pinescript,Tradingview



我遇到了在较高时间段从较低时间段添加条件的问题,请提前感谢您的帮助。

---------工作这起作用,并在创建的标签中给我信息,示例标签显示30min(真,真,假,假(:

var label long1 = na
var label long2 = na
var label short1 = na
var label short2 = na
bclose1  = request.security_lower_tf(syminfo.tickerid, "15", longSignal)
bclose2  = request.security_lower_tf(syminfo.tickerid, "30", longSignal)
sclose1  = request.security_lower_tf(syminfo.tickerid, "15", shortSignal)
sclose2  = request.security_lower_tf(syminfo.tickerid, "30", shortSignal)
longlabl1  = "15m - Longs" + "n" + str.tostring(bclose1)
longlabl2  = "30m - Longs" + "n" + str.tostring(bclose2) 
shortlabl1 = "15m - Shorts" + "n" + str.tostring(sclose1)
shortlabl2 = "30m - Shorts" + "n" + str.tostring(sclose2) 
if bar_index == last_bar_index
long1 := label.new(bar_index, low, text=longlabl1, color=color.green, textcolor=color.white, style=label.style_label_up)
if bar_index == last_bar_index
long2 := label.new(bar_index + 25, low, text=longlabl2, color=color.green, textcolor=color.white, style=label.style_label_up)

if bar_index == last_bar_index
short1 := label.new(bar_index, high , text=shortlabl1, color=color.red, textcolor=color.white, style=label.style_label_down)
if bar_index == last_bar_index
short2 := label.new(bar_index + 25, high, text=shortlabl2, color=color.red, textcolor=color.white, style=label.style_label_down)  

--------------------------不工作

我想做的改变是将信号合并为一个信号:

//Consolidated Long signal from 15m, 30m, and current which is 120m
bclose1  = (request.security_lower_tf(syminfo.tickerid, "15", longSignal))  and (request.security_lower_tf(syminfo.tickerid, "30", longSignal))  and longSignal
//Consolidated Short signal from 15m, 30m, and current which is 120m
sclose1  = (request.security_lower_tf(syminfo.tickerid, "15", shortSignal)) and (request.security_lower_tf(syminfo.tickerid, "30", shortSignal)) and shortSignal
longlabl1  = "All 3 Longs" + "n" + str.tostring(bclose1)
shortlabl1 = "All 3 Shorts" + "n" + str.tostring(sclose1)
if bar_index == last_bar_index
long1 := label.new(bar_index, low, text=longlabl1, color=color.green, textcolor=color.white, style=label.style_label_up)
if bar_index == last_bar_index
short1 := label.new(bar_index, high , text=shortlabl1, color=color.red, textcolor=color.white, style=label.style_label_down)

-----------错误无法调用";操作员和";参数"exper1"="call"request.security_lower_tf"(bool[]("。使用了"bool[]"类型的参数,但应为"simple bool";

不确定什么是"简单的bool",但我猜这是真是假,这是一个更复杂的bool。

我想知道把东西放在一个数组中是否会有帮助,但我不确定。

再次感谢!

"我想知道把东西放在一个数组中是否会有帮助;事实上,这就是你必须做的。此函数返回一个数组,而不是单个值这是有道理的,因为当我们在一个5米的图表上查询1米蜡烛的数据时,这个函数将返回一个由5个1米蜡烛组成的数组

干杯Dave

最新更新