Three Golden By Moonalert 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TED0Title

//@version=4
//@version=4
study(shorttitle="3Goldens + 3EMA + MyBB", title="Bollinger Bands", overlay=true, resolution="")
length = input(20, minval=1)
src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)
plot(basis, "Middle BB", color=#bad6d6, offset = offset)
p1 = plot(upper, "Upper BB", color=color.teal, offset = offset)
p2 = plot(lower, "Lower BB", color=color.teal, offset = offset)
fill(p1, p2, title = "Background", color=#126161)

//My928s

plot(ema(close, 20), color=#0088FA, linewidth=1, title='EMA 20')
plot(ema(close, 50), color=#FA00D0, linewidth=1, title='EMA 50')
plot(ema(close, 200), color=#FF7000, linewidth=2, title='EMA 200')

//input
condition1=input(title="Condition MACD Cross 0",type=input.bool,defval=true)
condition2=input(title="Condition MACD Cross Signal",type=input.bool,defval=false)

BB_length=input(title="BB_length",type=input.float,defval=2)
BB_StdDev=input(title="BB_StdDev",type=input.integer,defval=20)
RSI_length=input(title="BB_RSI",type=input.integer,defval=14)
Flast_MACD=input(title="Flast_MACD",type=input.integer,defval=12)
Slow_MACD=input(title="Slow_MACD",type=input.integer,defval=26)
Signal_MACD=input(title="Signal_MACD",type=input.integer,defval=9)

// indicator
[middle, uppermoon, lowerdown] = bb(close, BB_StdDev, BB_length)
rsi = rsi(close,RSI_length)
[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)


//My

// conditon 


l = if condition1==1 and condition2 == 0 and crossover(macdLine , 0)
    l=1
else if condition1==0 and condition2 == 1 and crossover(macdLine , signalLine)
    l=1
else
    l=0

s = if condition1==1 and condition2 == 0 and crossunder(macdLine , 0)
    s=1
else if condition1==0 and condition2 == 1 and crossunder(macdLine , signalLine)
    s=1
else
    s=0   
    
h = if condition1==1 and condition2 == 0 and macdLine > 0
    h=1
else if condition1==0 and condition2 == 1 and macdLine > signalLine
    h=1
else
    h=0   
    
o = if condition1==1 and condition2 == 0 and macdLine < 0
    o=1
else if condition1==0 and condition2 == 1 and macdLine < signalLine
    o=1
else
    o=0      
    
r = rsi > 50
b = close > middle
con1 = close > middle and rsi > 50 and l 
con2 = close > middle or rsi > 50 or h 
con3 = close < middle and rsi < 50 and s 
    
con4 = close > middle and rsi > 50 and h
con5 = close < middle and rsi < 50 and o

barcolor(con4? color.green: na)
barcolor(con5? color.red: na)
barcolor(con3? color.red : color.yellow)
plotshape(con1, style=shape.circle,size=size.tiny ,location=location.belowbar,color=color.green)
plotshape(con3, style=shape.circle ,size=size.tiny,color=color.red)

alertcondition(con1, title='Alert on Green Bar', message='Green Bar! signal Buy')
alertcondition(con3, title='Alert on Red Bar', message='Red Bar! signal Sell')
///My928s edits v3
