diff --git a/config/Local_Test.json b/config/Local_Test.json new file mode 100644 index 0000000..50a2f78 --- /dev/null +++ b/config/Local_Test.json @@ -0,0 +1,83 @@ +{ + "$schema": "https://schema.freqtrade.io/schema.json", + "max_open_trades": 1, + "stake_currency": "USDT", + "stake_amount": "unlimited", + "tradable_balance_ratio": 0.99, + "fiat_display_currency": "USD", + "dry_run": true, + "db_url": "sqlite:///tradesv3.ema26_ema52_cross.sqlite", + "dry_run_wallet": 1000, + "cancel_open_orders_on_exit": true, + "trading_mode": "futures", + "margin_mode": "isolated", + "can_short" : true, + "timeframe" : "1m", + "process_only_new_candles" : false, + "unfilledtimeout": { + "entry": 1, + "exit": 1, + "exit_timeout_count": 5, + "unit": "minutes" + }, + "entry_pricing": { + "price_side": "same", + "use_order_book": true, + "order_book_top": 1, + "price_last_balance": 0.0, + "check_depth_of_market": { + "enabled": false, + "bids_to_ask_delta": 1 + } + }, + "exit_pricing":{ + "price_side": "same", + "use_order_book": true, + "order_book_top": 1 + }, + "exchange": { + "name": "binance", + "key": "hvoXanRExQvcN4tyGFvEnsSF4gqxXp6ZJnBu5lnhvlVuHaDbj2PhLBQGCLkkyeI8", + "secret": "3UKA2oyDj7OoXrausmnaLwLlNfXmlNf2imBdmQqqKHArcJfk6X9xjaUF19wzu82l", + "ccxt_config": {}, + "ccxt_async_config": {}, + "pair_whitelist": [ + "SOL/USDT:USDT" + ], + "pair_blacklist": [ + "BNB/.*" + ] + }, + "pairlists": [ + { + "method": "StaticPairList", + "number_assets": 1, + "sort_key": "quoteVolume", + "min_value": 0, + "refresh_period": 1800 + } + ], + "telegram": { + "enabled": false, + "token": "7677670958:AAFL_jgZvNUTPR3R3vWieREX_tDVi9w2C1Y", + "chat_id": "580807463" + }, + "api_server": { + "enabled": true, + "listen_ip_address": "0.0.0.0", + "listen_port": 8821, + "verbosity": "error", + "enable_openapi": false, + "jwt_secret_key": "14d3510740e2c39a973a8895f1aa2704d98d08b86170260085709fa5ea48251d", + "ws_token": "dtKKDnafBrX4icq_ZCw7acJTahTK4h_yvg", + "CORS_origins": [], + "username": "freqtrader", + "password": "FreqTrade007" + }, + "bot_name": "freqtrade", + "initial_state": "running", + "force_entry_enable": false, + "internals": { + "process_throttle_secs": 2 + } +} \ No newline at end of file diff --git a/strategies/EMA26_EMA52_Cross.py b/strategies/EMA26_EMA52_Cross.py index 19ec1b7..8254bcf 100644 --- a/strategies/EMA26_EMA52_Cross.py +++ b/strategies/EMA26_EMA52_Cross.py @@ -22,13 +22,13 @@ logger = logging.getLogger(__name__) ### Now you can use logger.info('asfd') to log # freqtrade plot-dataframe --strategy ChanLun_BTC --datadir user_data/data/binance -c ./user_data/ChanLun_SOL_30.json --timerange=20250309- -# freqtrade trade -c ./user_data/Chan/config/EMA26_EMA52_Cross.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies -# freqtrade backtesting -c ./user_data/Chan/config/EMA26_EMA52_Cross.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies --timerange=20260101- -# freqtrade download-data -c ./user_data/Chan/config/EMA26_EMA52_Cross.json -t 1m 1m 1h 1d 1w 1M --pairs SOL/USDT:USDT --timerange=20240101- -# freqtrade download-data -c ./user_data/Chan/config/EMA26_EMA52_Cross.json -t 1m 1h 1d 1M --pairs SOL/USDT:USDT --timerange=20170101- -# freqtrade hyperopt --hyperopt-loss SharpeHyperOptLossDaily --spaces roi --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies -c ./user_data/Chan/config/EMA26_EMA52_Cross.json -e 200 --timerange=20250201-20250901 -# freqtrade edge -c ./user_data/Chan/config/EMA26_EMA52_Cross.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies --timerange 20250721-20250901 -# freqtrade plot-dataframe -c ./user_data/Chan/config/EMA26_EMA52_Cross.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies --timerange 20250721-20250901 +# freqtrade trade -c ./user_data/Chan/config/Local_Test.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies +# freqtrade backtesting -c ./user_data/Chan/config/Local_Test.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies --timerange=20260101- +# freqtrade download-data -c ./user_data/Chan/config/Local_Test.json -t 1m 1h 1d 1w 1M --pairs SOL/USDT:USDT --timerange=20240101- +# freqtrade download-data -c ./user_data/Chan/config/Local_Test.json -t 1m 1h 1d 1M --pairs SOL/USDT:USDT --timerange=20170101- +# freqtrade hyperopt --hyperopt-loss SharpeHyperOptLossDaily --spaces roi --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies -c ./user_data/Chan/config/Local_Test.json -e 200 --timerange=20250201-20250901 +# freqtrade edge -c ./user_data/Chan/config/Local_Test.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies --timerange 20250721-20250901 +# freqtrade plot-dataframe -c ./user_data/Chan/config/Local_Test.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies --timerange 20250721-20250901 # sudo docker compose run --rm chanlun_btc backtesting -c ./user_data/Chan/config/EMA26_EMA52_Cross.json --strategy EMA26_EMA52_Cross --strategy-path ./user_data/Chan/strategies --timerange=20250721- # sudo docker compose run --rm chanlun_btc download-data -c ./user_data/Chan/config/EMA26_EMA52_Cross.json --pairs BTC/USDT:USDT -t 1m --timerange 20240101- @@ -72,7 +72,7 @@ class EMA26_EMA52_Cross(IStrategy): lev = 1.0 stoploss = -0.3 # 设置为很大的负值,让custom_stoploss来控制 use_custom_stoploss = False # 启用自定义止损 - + startup_candle_count = 1600 trailing_stop = False trailing_stop_positive = 0.03 trailing_stop_positive_offset = 0.06 @@ -88,6 +88,7 @@ class EMA26_EMA52_Cross(IStrategy): dataframe_15m = self.add_indicators(dataframe_15m) dataframe_30m = self.add_indicators(dataframe_30m) dataframe_60m = self.add_indicators(dataframe_60m) + dataframe = self.add_indicators(dataframe) dataframe = resampled_merge(dataframe, dataframe_15m) dataframe = resampled_merge(dataframe, dataframe_30m) dataframe = resampled_merge(dataframe, dataframe_60m) @@ -150,6 +151,9 @@ class EMA26_EMA52_Cross(IStrategy): time = self.time30 cross_up = 'resample_{}_ema26_cross_up_52'.format(self.get_ticker_indicator() * time) cross_down = 'resample_{}_ema26_cross_down_52'.format(self.get_ticker_indicator() * time) + #time = 1 + #cross_up = 'ema26_cross_up_52' + #cross_down = 'ema26_cross_down_52' dataframe.loc[ (dataframe[cross_up].shift(time) == True), ['enter_long', 'enter_tag']] = (1, 'long_signal') @@ -161,6 +165,9 @@ class EMA26_EMA52_Cross(IStrategy): time = self.time30 cross_up = 'resample_{}_ema26_cross_up_52'.format(self.get_ticker_indicator() * time) cross_down = 'resample_{}_ema26_cross_down_52'.format(self.get_ticker_indicator() * time) + #time = 1 + #cross_up = 'ema26_cross_up_52' + #cross_down = 'ema26_cross_down_52' dataframe.loc[ (dataframe[cross_down].shift(time) == True), ['exit_long', 'exit_tag']] = (1, 'long_signal')