Ultra-simple strategy to verify the trade pipeline. Signals: - Buy: Close Price > SMA(20) - Sell: Close Price < SMA(20)
Timeframe
5m
Direction
Long Only
Stoploss
-10.0%
Trailing Stop
No
ROI
0m: 1.0%
Interface Version
3
Startup Candles
20
Indicators
1
freqtrade/freqtrade-strategies
author@: lenik
import pandas as pd
import pandas_ta as ta
from freqtrade.strategy import IStrategy
class SimpleVerifiedStrategy(IStrategy):
"""
Ultra-simple strategy to verify the trade pipeline.
Signals:
- Buy: Close Price > SMA(20)
- Sell: Close Price < SMA(20)
"""
INTERFACE_VERSION = 3
timeframe = '5m'
process_only_new_candles = False
minimal_roi = {"0": 0.01}
stoploss = -0.10
startup_candle_count = 20
def populate_indicators(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
dataframe['sma'] = ta.sma(dataframe['close'], length=20)
return dataframe
def populate_entry_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
dataframe.loc[
(dataframe['close'] > dataframe['sma']) &
(dataframe['volume'] > 0),
'enter_long'] = 1
return dataframe
def populate_exit_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
dataframe.loc[
(dataframe['close'] < dataframe['sma']) &
(dataframe['volume'] > 0),
'exit_long'] = 1
return dataframe