3M WR Dmi
3M WR Dmi
3M WR Dmi
0
at https://mozilla.org/MPL/2.0/
// © pravin18001
//@version=5
strategy(title="3M Sentiment DMI WR", overlay=true, margin_long=10000,
margin_short=10000)
//RSI
indicator(title="Relative Strength Index", shorttitle="RSI", format=format.price,
precision=2, timeframe="", timeframe_gaps=true)
// Divergence
lookbackRight = 5
lookbackLeft = 5
rangeUpper = 60
rangeLower = 5
bearColor = color.red
bullColor = color.green
textColor = color.white
noneColor = color.new(color.white, 100)
//------------------------------------------------------------------------------
// Regular Bullish
// rsi: Higher Low
plotshape(
bullCond ? rsi[lookbackRight] : na,
offset=-lookbackRight,
title="Regular Bullish Label",
text=" Bull ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor
)
//------------------------------------------------------------------------------
// Regular Bearish
// rsi: Lower High
plot(
phFound ? rsi[lookbackRight] : na,
offset=-lookbackRight,
title="Regular Bearish",
linewidth=2,
color=(bearCond ? bearColor : noneColor)
)
plotshape(
bearCond ? rsi[lookbackRight] : na,
offset=-lookbackRight,
title="Regular Bearish Label",
text=" Bear ",
style=shape.labeldown,
location=location.absolute,
color=bearColor,
textcolor=textColor
)
// Strategy exit
strategy.exit("Long Exit", "Long", limit=long_target, stop=long_stop_loss)
strategy.exit("Short Exit", "Short", limit=short_target, stop=short_stop_loss)
// Strategy exit
strategy.exit("Long Exit", "Long", limit=long_target, stop=long_stop_loss)
strategy.exit("Short Exit", "Short", limit=short_target, stop=short_stop_loss)