//@version =2
study(title="MD open close high Kijun-ema bb dolcha", shorttitle="MD-Ma ",
overlay=true)
Length = input(34, minval=1)
Trigger = input(6, minval=1),
donchian(len) => avg(lowest(len), highest(len))
conversionLine = donchian(Trigger)
baseLine = donchian(Length)
leadLine1 = avg(conversionLine, baseLine)
kjuncol = conversionLine > baseLine ? blue : conversionLine < baseLine ? red :
orange
plot(baseLine, color=kjuncol,linewidth=2,transp=5, title="Base Line")
almatrend = alma(baseLine, 34, 0.9, 6)
plot(almatrend,transp=15)
// stratergy from Robert N. 030615
// previous day close and high low , todays open excellent for intraday trading
odl = input(true, title="Open Daily Line")
dopen = security(tickerid, 'D', open)
dcolor = close < dopen ? red : green
plot(odl and dopen ? dopen :na , title="Daily_Open",style=circles, color=dcolor,
linewidth=2)
cdl = input(true, title="Previous Closing Daily Line")
dclose = security(tickerid, 'D', close[1])
dhigh =security(tickerid, 'D', high[1])
dlow=security(tickerid, 'D', low[1])
dcolor2 = close < dclose ? red : green
plot(cdl and dclose ? dclose :na , title="Daily_Close",style=circles,
color=dcolor2, linewidth=2)
plot(cdl and dhigh ? dhigh :na , title="Daily_High",style=circles, color= blue,
linewidth=1)
plot(cdl and dlow ? dlow :na , title="Daily_Low",style=circles, color= fuchsia ,
linewidth=1)
//programmed by Maheswarra Reddy
dropn(src, n) =>
na(src[n]) ? na : src
src = input(close, type=source, title="Source")
length1 = input(5, title="EMA-5 period", minval=1)
length2 = input(34, title="EMA-34 period", minval=1)
length3 = input(200, title="EMA-200 period", minval=1)
vwapval = vwap(close)
sma20 = input(20, title="SMA period", minval=1)
sma8 = input(8, title="SMA period", minval=1)
// User-defined length for EMA
// Calculate the EMA with the user-defined length
emaValue = ema(close, length1)
// Condition 1 for Sell Alert: Candle 1 closes above EMA and low of the candle is >
EMA
sell_candle1_condition = (close[1] > emaValue[1]) and (low[1] > emaValue[1])
// Condition 2 for Sell Alert: Next candle (Candle 2) is red, its low touches EMA,
and its close is below the open of Candle 1
sell_candle2_condition = (close < open) and (low <= emaValue) and (close < close[1]
or(close<open[1]))
// Sell Alert condition: Candle 1 meets the first condition and Candle 2 meets the
second condition
sell_alert_condition = sell_candle1_condition and sell_candle2_condition
// Condition 1 for Buy Alert: Candle 1 closes below EMA and high of the candle is <
EMA
buy_candle1_condition = (close[1] < emaValue[1]) and (high[1] < emaValue[1])
// Condition 2 for Buy Alert: Next candle (Candle 2) is green, its high touches
EMA, and its close is above the open of Candle 1
buy_candle2_condition = (close > open) and (high >= emaValue) and (close > close[1]
or (close>open[1]))
// Buy Alert condition: Candle 1 meets the first condition and Candle 2 meets the
second condition
buy_alert_condition = buy_candle1_condition and buy_candle2_condition
// Plot the EMA with the user-defined length
plot(emaValue, title="EMA", color=blue)
// Plot shapes for visual reference
plotshape(series=sell_alert_condition, location=location.abovebar, color=red,
style=shape.arrowdown, text="Alert")
plotshape(series=buy_alert_condition, location=location.belowbar, color=green,
style=shape.arrowup, text="Alert")
// Sell Alert message
alertcondition(sell_alert_condition, title="Alert", message="Sell Alert: Candle 1
closed above EMA and its low is > EMA. Next candle is red, touches EMA, and closes
below the open of Candle 1.")
// Buy Alert message
alertcondition(buy_alert_condition, title="Alert", message="Buy Alert: Candle 1
closed below EMA and its high is < EMA. Next candle is green, touches EMA, and
closes above the open of Candle 1.")
dropCandles = input(1, minval=0, title="Drop first N candles")
price = dropn(src, dropCandles)
plot(vwapval,title="vwap", color = #dfa343, transp=0, linewidth=2)
plot(ema(price, length1), title="EMA-5", color=#3a25af, transp=0, linewidth=1)
plot(ema(price, length2), title="EMA-34", color=#ca1212, transp=0, linewidth=2)
plot(ema(price, length3), title="EMA-200", color=#35f3f7, transp=0, linewidth=1)
plot(sma(price, sma20), title="SMA20", color=#5abb5e, transp=0, linewidth=1)
plot(sma(price, sma8), title="SMA8", color=#32a637, transp=0, linewidth=1)
length = input(20, title="BB", minval=1)
mult = input(1.5, minval=0.001, maxval=10, step=0.1)
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
//plot(basis, title="Middle band", color=#2db4aa) //sma
p1a = plot(upper, title="Upper Band", color=#021d1b)
p1b = plot(lower, title="Lower Band", color=#011312)