MACD编辑添加峰谷柱HIGHLGHT + Alert

问题描述

我希望 FIRST FALL-ABOVE 蜡烛和 FIRST GROW-BELOW 蜡烛具有突出显示的背景,Fall Above 是石灰,Grow 下面是红色。我怎么才能只在那些第一支蜡烛上获得背景高光?

如何在这些蜡烛上创建警报条件?任何帮助将不胜感激。类似于以下内容,然后是 MACD 代码本身。

//Alert condition and first growth and first shrunk candle marked 
peak = bcolor == green and bcolor[1] == lime
trough = bcolor == maroon and bcolor[1] == red
bgcolor(color = peak ? lime : trough ? red : na)
alertcondition(peak,"Peak Top","Top Peak (short)")
alertcondition(trough,"Trough Bottom","Bottom Trough (long)")



//MACD
study(title="MACD",shorttitle="MACD",resolution="")

fast_length = input(title="Fast Length",type=input.integer,defval=12)
slow_length = input(title="Slow Length",defval=26)
src = input(title="Source",type=input.source,defval=close)
signal_length = input(title="Signal Smoothing",minval = 1,maxval = 50,defval = 9)
sma_source = input(title="Simple MA (Oscillator)",type=input.bool,defval=false)
sma_signal = input(title="Simple MA (Signal Line)",defval=false)

// colors
col_grow_above = #26A69A
col_grow_below = #FFCDD2
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_macd = #0094ff
col_signal = #ff6a00

// Calculation
fast_ma = sma_source ? sma(src,fast_length) : ema(src,fast_length)
slow_ma = sma_source ? sma(src,slow_length) : ema(src,slow_length)
macd = fast_ma - slow_ma
signal = sma_signal ? sma(macd,signal_length) : ema(macd,signal_length)
hist = macd - signal
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) ),transp=0 )
plot(macd,title="MACD",color=col_macd,transp=0)
plot(signal,title="Signal",color=col_signal,transp=0)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)