大佬教程收集整理的这篇文章主要介绍了Tradingview : Pinescript - 创建 2 系列的联合并隔离系列的最后一个元素,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
寻找两个问题的答案。
背景:我标记了最大(和最小)枢轴点的代码。
我要做的是“预先确定”一个枢轴点。常规枢轴点用 Source = RSI,limit = 21 标识。正在考虑指定 Source = RSI,limit = 5 以“预先识别”可能的枢轴点(用灰色标签绘制)。
如果有更好的方法可以做到这一点,我全心全意
问题 1
在我正在处理的情况下,我做了以下事情
对于灰色标签,我只想要 ~last~ 值(在本例中,它是 67.06)。我 need to have the last value in serIEs
形式(在本例中为 upper_bound_pivot[0] = 67.06)见下图在图片中 BEFORE 是我现在所拥有的。 AFTER 是目标。
问题 2
接下来,我想将结果系列与另一个系列(就像 UNION 一样)结合起来。话虽如此,有没有办法实现像 SerIEs A UNION SerIEs B
这样的东西?
它在下面的代码中使用:
// HOWTO : OB_pivot_data UNION testme
如何在 Pinescript 下完成这两项任务?
任何帮助、提示或建议将不胜感激。
TIA
图片
功能枢轴:
pivothl(src,len,isHigh,_style,_yloc,_color,_offset,_displayResults ) =>
p = nz(src[len])
isFound = true
for i = 0 to len - 1
if isHigh and src[i] > p
isFound := false
if not isHigh and src[i] < p
isFound := false
for i = len + 1 to 2 * len
if isHigh and src[i] >= p
isFound := false
if not isHigh and src[i] <= p
isFound := false
if _displayResults and isFound
label.new(bar_index[len],p,tostring( truncate(p,2) ),style=_style,yloc=_yloc,color=_color,textcolor=color.white)
return_data = isFound == false ? na : p
FUNCTION PIVOTHL_FirsT_ONLY
pivothl_first_only(src,_displayResults ) =>
start_src = src
upper_bound_pivot = pivothl(start_src,true,true )
return_data = upper_bound_pivot == false ? na : upper_bound_pivot
return_data
主要
pivot_OB_LB = input(Title="Pivot Over Bought Lookback :",type=input.integer,defval=21 )
pivot_OS_LB = input(Title="Pivot Over Sold Lookback :",defval=21 )
pivot_OB_LB_peek = input(Title="Peek Pivot Over Bought Lookback :",defval=5)
lenH = pivot_OB_LB
lenL = pivot_OS_LB
OB_pivot_data = pivothl(rsi,lenH,label.style_labeldown,yloc.price,color.red,true)
OS_pivot_data = pivothl(rsi,lenL,false,label.style_labelup,color.green,true )
dBUG_OB_pivot_data = OB_pivot_data >= 0 ? OB_pivot_data : 0
dBUG_OS_pivot_data = OS_pivot_data >= 0 ? OS_pivot_data : 100 // just arbitrary number chosen (100)
[ ... snip ... ]
// get last value only place into serIEs
testme = pivothl_first_only(rsi,pivot_OB_LB_peek,color.silver,false)
pl_testme = testme > 0 ? testme : 0
plot( pl_testme,offset = -pivot_OB_LB_peek,color=color.purple )
更新:这就是我发现对我有用的东西(似乎正在工作......):
pivothl_combine_upper_and_lower (src,len,oBought,oSold) =>
combined = 0.0
if print_OBought != 0
p = src[len]
combined := p
else
if print_OSold != 0
p = src[len]
combined := p
combined
以上是大佬教程为你收集整理的Tradingview : Pinescript - 创建 2 系列的联合并隔离系列的最后一个元素全部内容,希望文章能够帮你解决Tradingview : Pinescript - 创建 2 系列的联合并隔离系列的最后一个元素所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。