Skip to content

Instantly share code, notes, and snippets.

@princefr
Last active June 24, 2020 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save princefr/307deb1aba74a12dd494dae89ef07050 to your computer and use it in GitHub Desktop.
Save princefr/307deb1aba74a12dd494dae89ef07050 to your computer and use it in GitHub Desktop.
ma_alert is changing color
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © prince_ond
//@version=4
study("Mon Script", overlay=true)
ma = ema(close, 20)
ma_color() => ma[5] > ma[2] ? color.red : color.green
ma__isdown = ma[5] > ma[2]
ma_is_up = ma[5] < ma[2]
plot(ma, color=ma_color())
alertcondition(ma_is_up, title='Buy Signal {{exchange}} ', message='{"exchange" : "{{exchange}}" , "pairs": "{{ticker}}" , "direction": "buy", "price": "{{close}}", "type": "enter_long"}')
alertcondition(ma__isdown, title='Sell Signal {{exchange}} ', message='{"exchange" : "{{exchange}}" , "pairs": "{{ticker}}" , "direction": "buy", "price": "{{close}}", "type": "enter_sell"}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment