Skip to content

Instantly share code, notes, and snippets.

@saleh-old
Created June 9, 2020 07:56
Show Gist options
  • Save saleh-old/033ee0e96e990ad08a4b5b2d938a4b72 to your computer and use it in GitHub Desktop.
Save saleh-old/033ee0e96e990ad08a4b5b2d938a4b72 to your computer and use it in GitHub Desktop.
@property
def trend(self):
short_ema = ta.ema(self.candles, 50)
long_ema = ta.ema(self.candles, 100)
longer_ema = ta.ema(self.candles, 200)
if short_ema > long_ema > longer_ema:
return 1
elif short_ema < long_ema < longer_ema:
return -1
else:
return 0
@property
def current_candle_touches_long_ema(self):
long_ema = ta.ema(self.candles, 50)
return self.high >= long_ema >= self.low
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment