简体   繁体   English

松脚本吧,因为困惑

[英]Pine script barssince confused

I am new to Pine script and I will appreciate it very much any kind of help.我是 Pine 脚本的新手,我将非常感谢它的任何帮助。 I have been using Python for my strategies but I am very interested in Pine script.我一直在使用 Python 作为我的策略,但我对 Pine 脚本非常感兴趣。 Based on the code below I would like to know if on the line below "NH = valuewhen(high>k1[1],high,0)" is k1[1] a series (list) or just one value.根据下面的代码,我想知道“NH = valuewhen(high>k1[1],high,0)”下面的行是 k1[1] 一个系列(列表)还是一个值。 What about barssince(high>k1[1]) below?下面的barsince(high>k1[1])怎么样? Basically my question is: what is the difference of the value of k1[1] between valuewhen(high>k1[1],high,0) and barssince(high>k1[1])基本上我的问题是: valuewhen(high>k1[1],high,0)barsince(high>k1[1])之间的 k1[1] 值有什么区别

boxp=input(5, "BOX LENGTH")

LL = lowest(low,boxp)
k1=highest(high,boxp)
k2=highest(high,boxp-1)
k3=highest(high,boxp-2)

NH =  valuewhen(high>k1[1],high,0)
box1 =k3<k2
TopBox = valuewhen(barssince(high>k1[1])==boxp-2 and box1, NH, 0)

highest() returs series float so, k1 is of series in all cases. high highest()返回series float ,因此k1在所有情况下都是series

[] in pinescript is called History reference operator and is used to refer to the historical values of any variable of the series type. pinescript中的[]称为History 引用运算符,用于引用任何系列类型变量的历史值。

So, k[1] refers to k 's previous value.因此, k[1]指的是k的先前值。

valuewhen(high>k1[1],high,0) will return the high price when high > k[1] was true the last time. valuewhen(high>k1[1],high,0)将在high > k[1]最后一次为true时返回high价。

barssince(high>k1[1]) will tell you how many bars ago this was. barssince(high>k1[1])会告诉你这是多少柱之前。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM