[英]How to develop a "Histogram Color Change" based strategy in pine-script TradingView
I am using MACD-Histogram as one of the main technical analysis tool for some times now.我使用 MACD-Histogram 作为主要技术分析工具之一已经有一段时间了。 In my experience the the zero-line crossover of histogram along with histogram color change and its fading or saturating all are profitable trading signals with high degree of accuracy on higher time frame particularly.
根据我的经验,直方图的零线交叉以及直方图颜色的变化及其褪色或饱和都是有利可图的交易信号,尤其是在更高的时间范围内具有高度的准确性。
The zero-line crossover strategy is available by default in TradingView. TradingView 中默认提供零线交叉策略。 Now I want to write a strategy based on change in histogram color, color fading and saturating.
现在我想写一个基于直方图颜色变化、褪色和饱和度的策略。 Which functions and arguments should I be using in Pine-script?
我应该在 Pine-script 中使用哪些函数和 arguments? Please help.
请帮忙。 Thanks for your time, Regards.
谢谢你的时间,问候。
Well, you have access to how histogram color is calculated.好吧,您可以访问如何计算直方图颜色。
plot(hist, title="Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below)))
So, you need to break it down to something like that:所以,你需要把它分解成这样的东西:
is_grow_above = (hist>=0) and (hist[1] < hist)
is_fall_above = (hist>=0) and not (hist[1] < hist)
is_grow_below = not (hist>=0) and (hist[1] < hist)
is_fall_below = not (hist>=0) and not (hist[1] < hist)
Then compare them with their previous values to see if there is a color change:然后将它们与之前的值进行比较,看看是否有颜色变化:
is_new_grow_above = not is_grow_above[1] and is_grow_above
is_new_fall_above = not is_fall_above[1] and is_fall_above
is_new_grow_below = not is_grow_below[1] and is_grow_below
is_new_fall_below = not is_fall_below[1] and is_fall_below
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.