[英]Pinescript: How to isolate a section of an indicator to calculating based on another candle stick pattern
I'm still very new to Pinescript, but am eagerly learning the language.我对 Pinescript 还是很陌生,但我非常渴望学习这门语言。 I was never really tech saavy, no know programming languages until tinkering with Pinescript.
我从来都不是真正的技术专家,在修补 Pinescript 之前不知道编程语言。
The indicator I would like to modify to my trading style is called Vumanchu Cipher B: https://www.tradingview.com/script/Msm4SjwI-VuManChu-Cipher-B-Divergences/我想修改为我的交易风格的指标称为 Vumanchu Cipher B: https ://www.tradingview.com/script/Msm4SjwI-VuManChu-Cipher-B-Divergences/
It's the Money Flow Indicator, where the calculation can be found from lines 314-316:这是资金流量指标,可以从第 314-316 行找到计算结果:
// RSI + MFI Area
rsiMFI = f_rsimfi(rsiMFIperiod, rsiMFIMultiplier, timeframe.period)
rsiMFIColor = rsiMFI > 0 ? #3ee145 : #ff3d2e
Thank you in advance if you can help me out!!如果你能帮助我,提前谢谢你!!
I've been trying my best to see if I can isolate the money flow to use calculations based on Heiken Ashi (HA) Candles instead of using the japanese candles I trade with.我一直在尽力看看我是否可以隔离资金流以使用基于 Heiken Ashi (HA) 蜡烛的计算,而不是使用我与之交易的日本蜡烛。
I know I have to use something like these commands:我知道我必须使用类似这些命令的东西:
useHA=input(true,"Use heikin ashi candles?")
ha_AP=security(heikinashi(syminfo.tickerid), timeframe.period, AP)
But keep getting errors when I make attempts to put them all together.但是,当我尝试将它们放在一起时,总是会出错。 :'(((
:'(((
So I guess to summarize, I'd like the Vumanchu indicator to make calculations based on japanese candles, while the Money Flow calculates based on Heiken Ashi.所以我想总结一下,我希望 Vumanchu 指标基于日本蜡烛进行计算,而资金流量基于 Heiken Ashi 进行计算。
I hope this makes sense:')我希望这是有道理的:')
In this script, f_rsimfi
is:在此脚本中,
f_rsimfi
是:
f_rsimfi(_period, _multiplier, _tf) => security(syminfo.tickerid, _tf, sma(((close - open) / (high - low)) * _multiplier, _period) - rsiMFIPosY)
As you can see, this function already uses security
function, so you can't call the security
function again.可以看到,这个函数已经使用了
security
函数,所以不能再调用security
函数了。
You can however, change the symbol
parameter of the security
function to use heikinashi
instead of "regular" candles.但是,您可以更改
security
函数的symbol
参数以使用heikinashi
而不是“常规”蜡烛。 You can for example first set an input
as you wanted:例如,您可以首先根据需要设置
input
:
useHA=input(true,"Use heikin ashi candles?")
Then decide which syminfo.tickerid
to use according to this input:然后根据这个输入决定使用哪个
syminfo.tickerid
:
t = useHA ? heikinashi(syminfo.tickerid) : syminfo.tickerid
And finally change the function so it will calculate accordingly:最后更改函数,使其进行相应计算:
f_rsimfi(_period, _multiplier, _tf) => security(t, _tf, sma(((close - open) / (high - low)) * _multiplier, _period) - rsiMFIPosY)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.