Timeframe
1m
Direction
Long Only
Stoploss
-18.0%
Trailing Stop
Yes
ROI
0m: 100.0%
Interface Version
3
Startup Candles
N/A
Indicators
4
freqtrade/freqtrade-strategies
Strategy 005 author@: Gerald Lonlas github@: https://github.com/freqtrade/freqtrade-strategies
freqtrade/freqtrade-strategies
author@: Gert Wohlgemuth
freqtrade/freqtrade-strategies
Strategy 004 author@: Gerald Lonlas github@: https://github.com/freqtrade/freqtrade-strategies
# pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
# flake8: noqa: F401
# --- Do not remove these libs ---
import numpy as np # noqa
import pandas as pd # noqa
from pandas import DataFrame
from datetime import datetime, timedelta, timezone
from freqtrade.exchange import timeframe_to_minutes
from freqtrade.strategy import (BooleanParameter, CategoricalParameter, DecimalParameter,
IStrategy, IntParameter, merge_informative_pair, informative)
from technical.util import resample_to_interval, resampled_merge
from freqtrade.persistence import Trade
from freqtrade.optimize.space import Categorical, Dimension, Integer, SKDecimal, Real # noqa
# --------------------------------
# Add your lib to import here
import talib.abstract as ta
import pandas_ta as pta
import freqtrade.vendor.qtpylib.indicators as qtpylib
from technical.pivots_points import pivots_points
from typing import Any, Dict, List, Optional
# 13% APR 1 year backtest
class williamr(IStrategy):
custom_info = {}
INTERFACE_VERSION = 3
timeframe = '1m'
can_short: bool = True
minimal_roi = {
"0": 1
}
stoploss = -0.18
trailing_stop= True
trailing_stop_positive=0.1
trailing_stop_positive_offset= 0.4
trailing_only_offset_is_reached= True
custom_price_max_distance_ratio = 1
process_only_new_candles = True
use_exit_signal = True
exit_profit_only = False
ignore_roi_if_entry_signal = True
startup_candle_count: int = 10
# Optional order type mapping.
order_types = {
'entry': 'limit',
'exit': 'limit',
'stoploss': 'limit',
'stoploss_on_exchange': False
}
# Optional order time in force.
order_time_in_force = {
'entry': 'gtc',
'exit': 'gtc'
}
@property
def plot_config(self):
return {
# Main plot indicators (Moving averages, ...)
'main_plot': {
},
'subplots': {
"MACD": {
'macdh': {'color': 'blue'},
'macdd': {'color': 'cyan'},
'macdf': {'color': 'purple'},
},
"CCI": {
'cci': {'color': 'red'},
},
}
}
@property
def protections(self):
return [
{
"method": "CooldownPeriod",
"stop_duration_candles": 15
}
]
def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float,
proposed_stake: float, min_stake: float, max_stake: float,
entry_tag: str, **kwargs) -> float:
return (100)
def leverage(self, pair: str, current_time: 'datetime', current_rate: float,
proposed_leverage: float, max_leverage: float, side: str,
**kwargs) -> float:
return 10
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 [("ETH/USDT:USDT", "5m")]
@informative('5m')
@informative('15m')
@informative('1d')
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['williamr'] = ta.WILLR(dataframe, timeperiod=10)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# 5m #
dataframe.loc[
(
(dataframe['williamr_1d'] <= -90) & (dataframe['williamr_1d'].shift(10) >= -85) &
(dataframe['volume'] > 0) # Make sure Volume is not 0
),
['enter_long', 'enter_tag']] = (1, 'openai_told_me_to_enter')
dataframe.loc[
(
(dataframe['williamr_1d'] <= -10) & (dataframe['williamr_1d'].shift(10) >= -25) &
(dataframe['volume'] > 0) # Make sure Volume is not 0
),
['enter_short', 'enter_tag']] = (1, "yodo_knows_better_en")
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['volume'] > 0) # Make sure Volume is not 0
),
['exit_long', 'exit_tag']] = (0, "open_ai_told_me_to_exit")
dataframe.loc[
(
(dataframe['volume'] > 0) # Make sure Volume is not 0
),
['exit_short', 'exit_tag']] = (0, 'yodo_knows_better_ex')
return dataframe