Pinescript:绘制交叉蜡烛的价格

时间:2021-02-06 02:23:04

标签: pine-script

我打算为 Crossover 做一个很长的条目,并想了解一下

  1. 如何在图表上绘制交叉的收盘价?

  2. 找出发生交叉时最后 10 根蜡烛的最高价格是多少?

下面的函数给了我入口。

src = input(close, title="Source")
offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)
out1 = ema(src, len1)
out2 = ema(src, len2)
out3 = ema(src, len3)
Long_TP1 = crossover(out1,out3)

1 个答案:

答案 0 :(得分:0)

//@version=4
study(title="Help (Price Cross)", overlay=true)
len1 = input(defval=5,    title="Length 1")
len2 = input(defval=13,   title="Length 2")
len3 = input(defval=19,   title="Length 3")
src = input(close, title="Source")
offset = input(title="Offset", type=input.integer, defval=0, minval=-500, maxval=500)

out1 = ema(src, len1)
out2 = ema(src, len2)
out3 = ema(src, len3)
Long_TP1 = crossover(out1, out3)

var price_cr =0.0
var high10 = 0.0
hitemp = highest(high, 10)

if Long_TP1
    price_cr := close
    high10 := hitemp

plot(price_cr, color=color.blue)  
plot(high10, color=color.red)