CustomFreqtradeStrategy
♡
Basics
mode: spot
outdated
Settings
has minimal roi
startup candle count: 1
Other
file_communicator
15 related strategies (⧉ identical code, ≈ similar name)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | from freqtrade.strategy import IStrategy import pandas as pd import json import os # duplicate import from file_communicator import FileCommunicator class CustomFreqtradeStrategy(IStrategy, FileCommunicator): """ FreqTrade Strategy linked with ARVTrading. It does two things: - Write price data for selected cryptos to file - Make orders (buy, sell) when told in file """ startup_candle_count = 1 # requires no candles since it only writes current price # Define the minimal ROI for the strategy minimal_roi = { "0": 1 } start_prices = {} # Dict to keep track of starting prices trading_cryptos_list = [] # Method to populate indicators. This is also utilized to write required data to a file def populate_indicators(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame: # First, load the user-specified crypto_symbols from file into cache communication_data = self._read_from_file(self.COMMUNICATION_FILE) # the symbols we're considering out of all available self.trading_cryptos_list = communication_data["crypto_list"] current_symbol = metadata["pair"] print(current_symbol, self.trading_cryptos_list) if current_symbol in self.trading_cryptos_list: # If this is the first time we are seeing this symbol in the session, store its starting price if current_symbol not in self.start_prices: self.start_prices[current_symbol] = dataframe.iloc[0]['open'] # Calculate the growth from start price to current price current_price = dataframe.iloc[-1]['close'] growth = ( current_price - self.start_prices[current_symbol]) / self.start_prices[current_symbol] # Prepare data to be saved data_to_save = { 'start_price': self.start_prices[current_symbol], 'end_price': current_price, 'growth': growth } # Save the data self._write_to_file(self.DATA_FILE.format( pair=current_symbol.replace("/", "-")), data_to_save) return dataframe # Method to generate buy signals # Method to generate buy signals def populate_buy_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame: current_symbol = metadata["pair"] # Initially set no buy signals dataframe['enter_long'] = 0 if current_symbol in self.trading_cryptos_list: # Check the order file to see if a buy order is signaled order_data = self._read_from_file(self.ORDER_FILE) # If buy action is required for the current pair, set the buy signal if order_data['action'] == 'buy' and order_data['symbol'] == metadata["pair"]: dataframe.loc[dataframe.index[-1], 'enter_long'] = 1 # Reset the action in the order file to prevent repetitive orders order_data['action'] = None self._write_to_file(self.ORDER_FILE, order_data) return dataframe # Method to generate sell signals def populate_sell_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame: current_symbol = metadata["pair"] # Initially set no sell signals dataframe['exit_long'] = 0 if current_symbol in self.trading_cryptos_list: # Check the order file to see if a sell order is signaled order_data = self._read_from_file(self.ORDER_FILE) # If sell action is required for the current pair, set the sell signal if order_data['action'] == 'sell' and order_data['symbol'] == metadata["pair"]: dataframe.loc[dataframe.index[-1], 'exit_long'] = 1 # Reset the action in the order file to prevent repetitive orders order_data['action'] = None self._write_to_file(self.ORDER_FILE, order_data) return dataframe |
Strategy League — fixed backtest that feeds the ranking
The fixed-params backtest (33 pairs · 20210101-20260101) — the only run that feeds the Strategy League ranking.
Backtests — over a market period
Backtest this strategy over a chosen crypto-cycle period. These don't affect the League ranking, and need that period's candle data downloaded.
Log in or sign up to run backtests.
| Period | Range | Total % | Win % | Max DD | Trades | |
|---|---|---|---|---|---|---|
| 2020 · DeFi Summer & Pre-Halving Rally | 20200101-20210101 | not run | ||||
| 2021 · Institutional Bull Market | 20210101-20220101 | not run | ||||
| 2022 · Post-Bull Crash & Macro Tightening | 20220101-20230101 | not run | ||||
| 2023–2024 · Recovery & ETF Anticipation | 20230101-20250101 | not run | ||||
| 2025–2026 · Current Cycle | 20250101-20260101 | not run | ||||
Walk forward
Out-of-sample backtest on recent data · 33 pairs · 20260101-20260701.
Backtest trust check
Static source analysis — instant, does not run the strategy. Flags future-data leaks, backtest-realism problems, and indicators worth a second look.
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.