Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # --- Do not remove these libs ---
- from freqtrade.strategy.interface import IStrategy
- from pandas import DataFrame
- from technical.indicators import accumulation_distribution
- from technical.util import resample_to_interval, resampled_merge
- # --------------------------------
- # Add your lib to import here
- import talib.abstract as ta
- import freqtrade.vendor.qtpylib.indicators as qtpylib
- import numpy # noqa
- from technical.indicators import ichimoku
- # This class is a sample. Feel free to customize it.
- class ichis(IStrategy):
- # Minimal ROI designed for the strategy.
- # This attribute will be overridden if the config file contains "minimal_roi"
- minimal_roi = {
- "0": 1
- }
- # Optimal stoploss designed for the strategy
- # This attribute will be overridden if the config file contains "stoploss"
- stoploss = -0.1
- # trailing stoploss
- trailing_stop = True
- trailing_stop_positive = -0.15
- trailing_stop_positive_offset = 0.20 # Disabled / not configured
- trailing_only_offset_is_reached = True
- # Optimal ticker interval for the strategy
- ticker_interval = '15m'
- # run "populate_indicators" only for new candle
- process_only_new_candles = False
- # Experimental settings (configuration will overide these if set)
- use_sell_signal = True
- sell_profit_only = False
- ignore_roi_if_buy_signal = False
- # Optional order type mapping
- order_types = {
- 'buy': 'limit',
- 'sell': 'limit',
- 'stoploss': 'market',
- 'stoploss_on_exchange': False
- }
- # Optional order time in force
- order_time_in_force = {
- 'buy': 'gtc',
- 'sell': 'gtc'
- }
- def informative_pairs(self):
- """
- Define additional, informative pair/interval combinations to be cached from the exchange.
- These pair/interval combinations are non-tradeable, unless they are part
- of the whitelist as well.
- For more information, please consult the documentation
- :return: List of tuples in the format (pair, interval)
- Sample: return [("ETH/USDT", "5m"),
- ("BTC/USDT", "15m"),
- ]
- """
- return []
- def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
- ichi=ichimoku(dataframe)
- dataframe['tenkan']=ichi['tenkan_sen']
- dataframe['kijun']=ichi['kijun_sen']
- dataframe['senkou_a']=ichi['senkou_span_a']
- dataframe['senkou_b']=ichi['senkou_span_b']
- dataframe['cloud_green']=ichi['cloud_green']
- dataframe['cloud_red']=ichi['cloud_red']
- return dataframe
- def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
- """
- Based on TA indicators, populates the buy signal for the given dataframe
- :param dataframe: DataFrame populated with indicators
- :param metadata: Additional information, like the currently traded pair
- :return: DataFrame with buy column
- """
- dataframe.loc[
- (
- (dataframe['tenkan'].shift(1)<dataframe['kijun'].shift(1)) &
- (dataframe['tenkan']>dataframe['kijun']) &
- (dataframe['cloud_red']==True) &
- ),
- 'buy'] = 1
- return dataframe
- def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
- """
- Based on TA indicators, populates the sell signal for the given dataframe
- :param dataframe: DataFrame populated with indicators
- :param metadata: Additional information, like the currently traded pair
- :return: DataFrame with buy column
- """
- dataframe.loc[
- (
- ),
- 'sell'] = 1
- return dataframe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement