Skip to content

Instantly share code, notes, and snippets.

@michaelwclark
Created March 7, 2022 02:51
Show Gist options
  • Select an option

  • Save michaelwclark/7a1858f31d8669b4fcfa7bc84f20effc to your computer and use it in GitHub Desktop.

Select an option

Save michaelwclark/7a1858f31d8669b4fcfa7bc84f20effc to your computer and use it in GitHub Desktop.
EMA CLOUDS 8/21 Pinescript
//@version=5
indicator(title='EMA 8/21 Clouds [GENOME]', shorttitle='EMA_8_21_G', overlay=true)
// EMA INPUTS
emaShortInput = input.int(8, minval=1, title='EMA Short Period')
emaLongInput = input.int(21, minval=1, title='EMA Long Period')
// GENERATE EMAS
emaShort = ta.ema(close, emaShortInput)
emaLong = ta.ema(close, emaLongInput)
// DRAW EMA LINES
emaShortLine = plot(emaShort, color=color.new(color.blue, 0), title='EMA Short Line')
emaLongLine = plot(emaLong, color=color.new(color.yellow, 0), title='EMA Long Line')
fillColor = color.white
if emaShort < emaLong
fillColor := color.red
fillColor
if emaShort > emaLong
fillColor := color.lime
fillColor
// CLOUDS
fill(emaLongLine, emaShortLine, color=color.new(fillColor, 75), title='EMA Short Cloud Fill')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment