0
votes

I would like to combine 2 indicators to trigger 'buy' or 'sell' signals in Pine Editor on TradingView.

At the moment I have code for Demark9 indicator but I would like to combine with a secondary indicator under the same 'IF' statement.

For example:

BUY: If Demark9 location.belowbar is TRUE AND MACD indicator is TRUE THEN plot 'Buy' signal on chart.

SELL: If Demark9 location.abovebar is TRUE AND MACD indicator is TRUE THEN 'Sell' signal

Below is the code that currently works but I want to add an additional indicator into the same buy or sell signal:

//DeMark_9_Indicator_1
study("Nathan's Bot Indicator",overlay=true)
TD = close > close[4] ?nz(TD[1])+1:0
TS = close < close[4] ?nz(TS[1])+1:0
TDUp = TD - valuewhen(TD < TD[1], TD , 1 )
TDDn = TS - valuewhen(TS < TS[1], TS , 1 )
plotshape(TDUp==7?true:na,style=shape.triangledown,text="7",color=green,location=location.abovebar)
plotshape(TDUp==8?true:na,style=shape.triangledown,text="8",color=green,location=location.abovebar)
plotshape(TDUp==9?true:na,style=shape.triangledown,text="⚠️",color=green,location=location.abovebar)
plotshape(TDDn==7?true:na,style=shape.triangleup,text="7",color=red,location=location.belowbar)
plotshape(TDDn==8?true:na,style=shape.triangleup,text="8",color=red,location=location.belowbar)
plotshape(TDDn==9?true:na,style=shape.triangleup,text="✅",color=red,location=location.belowbar)

Any help is super apprecaited.

THANK YOU UNIVERSE