Transmit signals to overlay
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © x7-am
//@version=5

// This indicator transmit signals from another indicator panel to the main panel over the chart, when it is not possible to use the main one with the "overlay=true" attribute.
indicator("Transmit signals", timeframe='', overlay=true)

data = input.source(close, 'Source', 'Select the source of the input data') // input data signal must be '1' to BUY, and '0' to SELL

plotshape(data==1, title='BUY', style=shape.triangleup, color=color.green, location=location.belowbar, size=size.tiny, display=display.pane)
plotshape(data==0, title='SELL', style=shape.triangledown, color=color.red, location=location.abovebar, size=size.tiny, display=display.pane)
bgcolor(data==1 ? #1c942085 : data==0 ? #ae272787 : na, display=display.all)

//--------------------------------
//----    Signals to Alert    ----

plot(data, title='BUYSELL',display=display.none,editable=false) // This hidden plot for BUY and SELL alert in one message
alertcondition(data==1 or data==0, title='Alert BUY & SELL', message='BUY(1) or SELL(0): {{plot("BUYSELL")}}') // BUY and SELL alert in one message, 1 = BUY and 0 = SELL

// One alert in BUY and second alert to SELL message 
alertcondition(data==1, title='Alert BUY', message='BUY')
alertcondition(data==0, title='Alert SELL', message='SELL')