在Pine Editor TradingView中排名一组值
我试图根据3个值的排名(EMA50,EMA100,EMA200)设置标签行位置。是否有可以实现这一目标的等级函数?尝试根据值大小设置下面的表行(0,1,2)。
IE如果EMA50 = 20,EMA100 = 15,EMA200 = 25,那么我希望它们在表行中排序为:
EMA100 EMA50 EMA200
if barstate.islast
txt0 = "EMA50"
txt01 = "EMA100"
txt02 = "EMA200"
table.cell(myTable2,0,0,text=txt0,bgcolor=color.black,text_color= color.white)
table.cell(myTable2,0,1,text=txt01,bgcolor=color.black,text_color= color.white)
table.cell(myTable2,0,2,text=txt01,bgcolor=color.black,text_color= color.white)
I am trying to set the label row position based on the ranking of 3 values (EMA50,EMA100, EMA200). Is there a rank function that can accomplish this? Trying to set a table row below (0,1,2) based on value size.
i.e. if EMA50 = 20, EMA100 = 15, EMA200 = 25 then I would want them sorted in the table row as:
EMA100
EMA50
EMA200
if barstate.islast
txt0 = "EMA50"
txt01 = "EMA100"
txt02 = "EMA200"
table.cell(myTable2,0,0,text=txt0,bgcolor=color.black,text_color= color.white)
table.cell(myTable2,0,1,text=txt01,bgcolor=color.black,text_color= color.white)
table.cell(myTable2,0,2,text=txt01,bgcolor=color.black,text_color= color.white)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能会有更轻松的方法,但是我使用不同的EMA将不同的EMA附加到数组,而不是对数组进行排序。
这是一个示例代码:
There might be easier way, but I use append the different EMA to an array and than sort the array.
Here is an example code: