SHARE
TWEET

Untitled

a guest Aug 14th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
  3.         """
  4.         Based on TA indicators, populates the buy signal for the given dataframe
  5.         :param dataframe: DataFrame populated with indicators
  6.         :param metadata: Additional information, like the currently traded pair
  7.         :return: DataFrame with buy column
  8.         """
  9.         dataframe.loc[
  10.             (
  11.                 (dataframe['close']>=dataframe['bb_mid']) & dataframe['close']<=dataframe['bb_mid']*1.05) &
  12.                 (dataframe['rsi']=< 30)
  13.             ),
  14.             'buy'] = 1
  15.  
  16.         return dataframe
  17.  
  18.     def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
  19.         """
  20.         Based on TA indicators, populates the sell signal for the given dataframe
  21.         :param dataframe: DataFrame populated with indicators
  22.         :param metadata: Additional information, like the currently traded pair
  23.         :return: DataFrame with buy column
  24.         """
  25.         dataframe.loc[
  26.             (
  27.                 (dataframe['close']>=dataframe['bb_upperband']) |
  28.                 (dataframe['rsi'] > 80)
  29.             ),
  30.             'sell'] = 1
  31.         return dataframe
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top