Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- // Modified from magic moving averages
- // Right click on the candles and click send to front for your viewing pleasure
- study(title="Moving Averages", shorttitle='MAs', overlay=true)
- // functions
- ave_one = ema(close, 9)
- ave_two = ema(close, 20)
- ave_three = ema(close, 50)
- ave_four = ema(close, 200)
- MA4 = plot(ave_four, color=red, linewidth=3, title="EMA200")
- MA3 = plot(ave_three, color=purple,linewidth=5, title="EMA50")
- MA2 = plot(ave_two, color=black,linewidth=5, title="EMA20")
- MA1 = plot(ave_one, color=white,linewidth=3, title="EMA9")
- // Reverse for tether, might flip
- reverse = input(false, title='Reverse for Tether', type=bool)
- cloud_regular() =>
- cloud_fill_color = ave_four<=ave_three ? #00ffab : red
- cloud_reverse() =>
- cloud_fill_color = ave_three>=ave_four ? #00ffab : red
- buy_regular() =>
- buy_zone_color = ave_two<=ave_three ? purple : #fef65b
- buy_reverse() =>
- buy_zone_color = ave_two>=ave_three ? purple : #fef65b
- cloud_fill_color = reverse == false ? cloud_regular() : cloud_reverse()
- buy_zone_color = reverse == false ? buy_regular() : buy_reverse()
- fill(MA3,MA4,color = cloud_fill_color, transp=65)
- fill(MA2,MA3,color = buy_zone_color, transp=20)
- percent_diff() =>
- abs(sma(close, 150) - close) / ((sma(close, 150) + close) / 2) * 100
- madb = percent_diff() >= 21 and close <= ave_three and close <= ave_two and close > ave_one ? true : false
- // red exclamation =
- plotchar(madb, char='!', color=red, location=location.top, size=size.small)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement