Skip to content

Instantly share code, notes, and snippets.

@stanwu
Created November 21, 2020 12:32
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 stanwu/69265c159e141795e156d4e3b81efdf8 to your computer and use it in GitHub Desktop.
Save stanwu/69265c159e141795e156d4e3b81efdf8 to your computer and use it in GitHub Desktop.
MAs for risk managememt
//@version=1
study(title="注意空頭", overlay=true)
short = sma(close, 5)
long = sma(close, 250) * 0.975
enter_period = sma(sign(short-long)*0.1-0.1, 22)*22
enter_indicator = enter_period<0?1:0
plot(short, color = teal)
plot(long, color = orange)
plotarrow(enter_indicator, colorup=orange, colordown=orange, maxheight=20,transp=30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment