【发布时间】:2021-05-15 09:31:09
【问题描述】:
我想创建一个简单的交叉条件,我想在交叉点上有一个买入卖出信号,我已经尝试过没有结果,但我希望它有结果,以便我可以为我的 VWMA 设置不同的时间范围。这是我的代码,请编辑它并告诉我,这将是一个很大的帮助。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bhavikap141
//@version=4
strategy(title="VWMA", shorttitle="VWMA", overlay=true)
len = input(33, "Length", minval=1)
src = input(close, "Source", type = input.source)
resolution = input(title="Resolution", type=input.resolution, defval="5")
outer = vwma(src, len)
ss1 = security(syminfo.tickerid, resolution, outer, gaps=true)
mm2 = plot(ss1, color=#3A6CA8)
length = input(20, "Length", minval=1)
srce = input(close, "Source", type = input.source)
res = input(title="Resolution", type=input.resolution, defval="15")
//ma = vwma(src, len)
//offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)
//plot(ma, title="VWMA", color=#3A6CA8, offset = offset)
out = vwma(srce, length)
s1 = security(syminfo.tickerid, res, out, gaps=true)
m2 = plot(s1, color=#3A6CA8)
我对 pinescrpit 不太熟悉,所以我尽力添加条件,但总是很糟糕。所以我的代码中只需要一个条件。
【问题讨论】:
标签: pine-script trading crossover