Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- strategy("101 Michaels Bands Back to Basics", overlay=true)
- sma12 = ta.sma(close, 12)
- sma22 = ta.sma(close, 22)
- sma50 = ta.sma(close, 50)
- // Declare bandColor variable
- var color bandColor = na
- // Entry conditions
- longCondition = sma12 > sma22 and sma50 < sma22
- shortCondition = sma12 < sma22 and sma50 > sma22
- // Entry
- if (longCondition)
- bandColor := color.green
- strategy.entry("Long", strategy.long)
- if (shortCondition)
- bandColor := color.red
- strategy.entry("Short", strategy.short)
- // Plots
- plot(sma12, color=bandColor, linewidth=1)
- plot(sma22, color=bandColor, linewidth=3)
- plot(sma50, color=color.blue, linewidth=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement