简体   繁体   English

Pinescript:如何隔离指标的一部分以根据另一个烛条模式进行计算

[英]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.

相关问题 PineScript 多帧指示器警报未在收盘时触发 - PineScript multi frame indicator alert not triggering at closing candle Pinescript:在指标中引用另一种证券 - Pinescript: Referencing another security in an indicator 如何在 PineScript 中检查一系列相似的蜡烛类型 - How to check for a sequence of similar candle types in PineScript 如何检测未通过 PineScript 中另一根蜡烛灯芯的烛台的下一个打开/关闭? - How to detect the next open/close of a candlestick that doesn't go through a wick of another candle in PineScript? 如何在 PineScript 中获取蜡烛的百分比变化数据? - How to get the percentage change data of a candle in PineScript? Tradingview Pinescript 如何使用 Session 获取开盘蜡烛的交易量 - Tradingview Pinescript How to use Session to get volume of the opening candle Pinescript:如何知道已下订单(在当前蜡烛上)以应用进入延迟 - Pinescript: How to know order was placed (on the current candle) to apply an entry delay 如何在 pinescript 的 1 分钟蜡烛中逐秒学习音量变化? - How to learn volume changes sec by sec in a 1min candle at pinescript? 如何在蜡烛 pinescript 下方动态设置止损 - How to set stop loss dynamically below a candle pinescript 如何在 PineScript 中读取 1 个指标的 2 个时间帧数据? - How to read in 2 timeframe data of 1 indicator in PineScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM