import copy import logging import pathlib import rapidjson import freqtrade.vendor.qtpylib.indicators as qtpylib import numpy as np import talib.abstract as ta import pandas as pd import pandas_ta as pta from freqtrade.strategy.interface import IStrategy from freqtrade.strategy import merge_informative_pair from freqtrade.strategy import DecimalParameter, CategoricalParameter from pandas import DataFrame, Series from functools import reduce from freqtrade.persistence import Trade from datetime import datetime, timedelta import time from typing import Optional import warnings log = logging.getLogger(__name__) # log.setLevel(logging.DEBUG) warnings.simplefilter(action="ignore", category=pd.errors.PerformanceWarning) ############################################################################################################# ## NostalgiaForInfinityX3 by iterativ ## ## https://github.com/iterativv/NostalgiaForInfinity ## ## ## ## Strategy for Freqtrade https://github.com/freqtrade/freqtrade ## ## ## ############################################################################################################# ## GENERAL RECOMMENDATIONS ## ## ## ## For optimal performance, suggested to use between 4 and 6 open trades, with unlimited stake. ## ## A pairlist with 40 to 80 pairs. Volume pairlist works well. ## ## Prefer stable coin (USDT, BUSDT etc) pairs, instead of BTC or ETH pairs. ## ## Highly recommended to blacklist leveraged tokens (*BULL, *BEAR, *UP, *DOWN etc). ## ## Ensure that you don't override any variables in you config.json. Especially ## ## the timeframe (must be 5m). ## ## use_exit_signal must set to true (or not set at all). ## ## exit_profit_only must set to false (or not set at all). ## ## ignore_roi_if_entry_signal must set to true (or not set at all). ## ## ## ############################################################################################################# ## DONATIONS ## ## ## ## BTC: bc1qvflsvddkmxh7eqhc4jyu5z5k6xcw3ay8jl49sk ## ## ETH (ERC20): 0x83D3cFb8001BDC5d2211cBeBB8cB3461E5f7Ec91 ## ## BEP20/BSC (USDT, ETH, BNB, ...): 0x86A0B21a20b39d16424B7c8003E4A7e12d78ABEe ## ## TRC20/TRON (USDT, TRON, ...): TTAa9MX6zMLXNgWMhg7tkNormVHWCoq8Xk ## ## ## ## REFERRAL LINKS ## ## ## ## Binance: https://accounts.binance.com/en/register?ref=C68K26A9 (20% discount on trading fees) ## ## Kucoin: https://www.kucoin.com/r/af/QBSSS5J2 (20% lifetime discount on trading fees) ## ## Gate.io: https://www.gate.io/referral/invite/UAARUlhf_2130_103 (20% lifetime discount on trading fees) ## ## OKX: https://www.okx.com/join/11749725931 (20% discount on trading fees) ## ## MEXC: https://promote.mexc.com/a/nfi (10% discount on trading fees) ## ## ByBit: https://partner.bybit.com/b/nfi ## ## Bitget: https://bonus.bitget.com/nfi (lifetime 20% rebate all & 10% discount on spot fees) ## ## HTX: https://www.htx.com/invite/en-us/1f?invite_code=ubpt2223 ## ## (Welcome Bonus worth 241 USDT upon completion of a deposit and trade) ## ## Bitvavo: https://account.bitvavo.com/create?a=D22103A4BC (no fees for the first € 1000) ## ############################################################################################################# class NostalgiaForInfinityX3(IStrategy): INTERFACE_VERSION = 3 def version(self) -> str: return "v13.2.9" stoploss = -0.99 # Trailing stoploss (not used) trailing_stop = False trailing_only_offset_is_reached = True trailing_stop_positive = 0.01 trailing_stop_positive_offset = 0.03 use_custom_stoploss = False # Optimal timeframe for the strategy. timeframe = "5m" info_timeframes = ["15m", "1h", "4h", "1d"] # BTC informatives btc_info_timeframes = ["5m", "15m", "1h", "4h", "1d"] # Backtest Age Filter emulation has_bt_agefilter = True bt_min_age_days = 3 # Exchange Downtime protection has_downtime_protection = False # Do you want to use the hold feature? (with hold-trades.json) hold_support_enabled = True # Run "populate_indicators()" only for new candle. process_only_new_candles = True # These values can be overridden in the "ask_strategy" section in the config. use_exit_signal = True exit_profit_only = False ignore_roi_if_entry_signal = True # Number of candles the strategy requires before producing valid signals startup_candle_count: int = 800 # Long Normal mode tags long_normal_mode_tags = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"] # Long Pump mode tags long_pump_mode_tags = ["21", "22", "23", "24", "25", "26"] # Long Quick mode tags long_quick_mode_tags = ["41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53"] # Long rebuy mode tags long_rebuy_mode_tags = ["61", "62"] # Long high profit mode tags long_mode_tags = ["81", "82"] # Long rapid mode tags long_rapid_mode_tags = ["101", "102", "103", "104", "105", "106", "107", "108", "109", "110"] # Long grind mode tags long_grind_mode_tags = ["120"] long_normal_mode_name = "long_normal" long_pump_mode_name = "long_pump" long_quick_mode_name = "long_quick" long_rebuy_mode_name = "long_rebuy" long_high_profit_mode_name = "long_hp" long_rapid_mode_name = "long_rapid" long_grind_mode_name = "long_grind" # Shorting # Short normal mode tags short_normal_mode_tags = ["500", "501"] # Short Pump mode tags short_pump_mode_tags = ["521", "522", "523", "524", "525", "526"] # Short Quick mode tags short_quick_mode_tags = ["541", "542", "543", "544", "545", "546", "547", "548", "549", "550"] # Short rebuy mode tags short_rebuy_mode_tags = ["561"] # Short mode tags short_mode_tags = ["581", "582"] # Short rapid mode tags short_rapid_mode_tags = ["601", "602", "603", "604", "605", "606", "607", "608", "609", "610"] # Short grind mode tags short_grind_mode_tags = ["620"] short_normal_mode_name = "short_normal" short_pump_mode_name = "short_pump" short_quick_mode_name = "short_quick" short_rebuy_mode_name = "short_rebuy" short_high_profit_mode_name = "short_hp" short_rapid_mode_name = "short_rapid" is_futures_mode = False futures_mode_leverage = 3.0 futures_mode_leverage_rebuy_mode = 3.0 futures_mode_leverage_grind_mode = 3.0 # Stop thresholds. 0: Doom Bull, 1: Doom Bear, 2: u_e Bull, 3: u_e Bear, 4: u_e mins Bull, 5: u_e mins Bear. # 6: u_e ema % Bull, 7: u_e ema % Bear, 8: u_e RSI diff Bull, 9: u_e RSI diff Bear. # 10: enable Doom Bull, 11: enable Doom Bear, 12: enable u_e Bull, 13: enable u_e Bear. stop_thresholds = [-0.2, -0.2, -0.025, -0.025, 720, 720, 0.016, 0.016, 24.0, 24.0, False, False, True, True] # Based on the the first entry (regardless of rebuys) stop_threshold = 4.0 stop_threshold_futures = 12.0 stop_threshold_futures_rapid = 12.0 stop_threshold_spot_rapid = 4.0 stop_threshold_spot_rebuy = 2.0 stop_threshold_futures_rebuy = 4.0 # user specified fees to be used for profit calculations custom_fee_open_rate = None custom_fee_close_rate = None # Rebuy mode minimum number of free slots rebuy_mode_min_free_slots = 2 # Position adjust feature position_adjustment_enable = True # Grinding feature grinding_enable = True # Grinding grind_derisk_spot = -0.40 grind_derisk_futures = -0.50 grind_1_stop_grinds_spot = -0.70 grind_1_profit_threshold_spot = 0.018 grind_1_stakes_spot = [0.22, 0.24, 0.26] grind_1_sub_thresholds_spot = [-0.065, -0.075, -0.085] grind_1_stop_grinds_futures = -0.70 grind_1_profit_threshold_futures = 0.018 grind_1_stakes_futures = [0.22, 0.24, 0.26] grind_1_sub_thresholds_futures = [-0.065, -0.075, -0.085] grind_2_stop_grinds_spot = -0.70 grind_2_profit_threshold_spot = 0.018 grind_2_stakes_spot = [0.16, 0.26, 0.32] grind_2_sub_thresholds_spot = [-0.065, -0.075, -0.085] grind_2_stop_grinds_futures = -0.70 grind_2_profit_threshold_futures = 0.018 grind_2_stakes_futures = [0.16, 0.26, 0.32] grind_2_sub_thresholds_futures = [-0.065, -0.075, -0.085] grind_3_stop_grinds_spot = -0.70 grind_3_profit_threshold_spot = 0.018 grind_3_stakes_spot = [0.16, 0.18, 0.20] grind_3_sub_thresholds_spot = [-0.065, -0.075, -0.085] grind_3_stop_grinds_futures = -0.70 grind_3_profit_threshold_futures = 0.018 grind_3_stakes_futures = [0.16, 0.18, 0.20] grind_3_sub_thresholds_futures = [-0.065, -0.075, -0.085] grind_4_stop_grinds_spot = -0.70 grind_4_profit_threshold_spot = 0.018 grind_4_stakes_spot = [0.16, 0.18, 0.20] grind_4_sub_thresholds_spot = [-0.065, -0.075, -0.085] grind_4_stop_grinds_futures = -0.70 grind_4_profit_threshold_futures = 0.018 grind_4_stakes_futures = [0.16, 0.18, 0.20] grind_4_sub_thresholds_futures = [-0.065, -0.075, -0.085] grind_5_stop_grinds_spot = -0.70 grind_5_profit_threshold_spot = 0.048 grind_5_stakes_spot = [0.16, 0.18, 0.20] grind_5_sub_thresholds_spot = [-0.065, -0.075, -0.085] grind_5_stop_grinds_futures = -0.70 grind_5_profit_threshold_futures = 0.048 grind_5_stakes_futures = [0.16, 0.18, 0.20] grind_5_sub_thresholds_futures = [-0.065, -0.075, -0.085] grind_6_stop_grinds_spot = -0.70 grind_6_profit_threshold_spot = 0.018 grind_6_stakes_spot = [0.05, 0.057, 0.065, 0.074, 0.084, 0.095, 0.107, 0.121, 0.137] grind_6_sub_thresholds_spot = [-0.03, -0.035, -0.04, -0.045, -0.05, -0.055, -0.06, -0.065, -0.07] grind_6_stop_grinds_futures = -0.70 grind_6_profit_threshold_futures = 0.018 grind_6_stakes_futures = [0.05, 0.057, 0.065, 0.074, 0.084, 0.095, 0.107, 0.121, 0.137] grind_6_sub_thresholds_futures = [-0.03, -0.035, -0.04, -0.045, -0.05, -0.055, -0.06, -0.065, -0.07] grind_1_derisk_1_stop_grinds_spot = -0.70 grind_1_derisk_1_profit_threshold_spot = 0.018 grind_1_derisk_1_stakes_spot = [0.25, 0.30, 0.35] grind_1_derisk_1_sub_thresholds_spot = [-0.07, -0.08, -0.09] grind_1_derisk_1_stop_grinds_futures = -0.70 grind_1_derisk_1_profit_threshold_futures = 0.018 grind_1_derisk_1_stakes_futures = [0.25, 0.30, 0.35] grind_1_derisk_1_sub_thresholds_futures = [-0.07, -0.08, -0.09] grind_2_derisk_1_stop_grinds_spot = -0.70 grind_2_derisk_1_profit_threshold_spot = 0.018 grind_2_derisk_1_stakes_spot = [0.16, 0.22, 0.28] grind_2_derisk_1_sub_thresholds_spot = [-0.065, -0.075, -0.085] grind_2_derisk_1_stop_grinds_futures = -0.70 grind_2_derisk_1_profit_threshold_futures = 0.018 grind_2_derisk_1_stakes_futures = [0.16, 0.22, 0.28] grind_2_derisk_1_sub_thresholds_futures = [-0.065, -0.075, -0.085] # Non rebuy modes regular_mode_stake_multiplier_spot = [0.5] regular_mode_stake_multiplier_futures = [0.5] regular_mode_use_grind_stops = False regular_mode_rebuy_stakes_spot = [0.10, 0.10, 0.10] regular_mode_rebuy_thresholds_spot = [-0.12, -0.14, -0.16] regular_mode_grind_1_stakes_spot = [0.22, 0.24, 0.26] regular_mode_grind_1_thresholds_spot = [-0.06, -0.07, -0.09] regular_mode_grind_1_stop_grinds_spot = -0.20 regular_mode_grind_1_profit_threshold_spot = 0.018 regular_mode_grind_2_stakes_spot = [0.14, 0.20, 0.26] regular_mode_grind_2_thresholds_spot = [-0.04, -0.06, -0.08] regular_mode_grind_2_stop_grinds_spot = -0.20 regular_mode_grind_2_profit_threshold_spot = 0.018 regular_mode_grind_3_stakes_spot = [0.18, 0.20, 0.22] regular_mode_grind_3_thresholds_spot = [-0.03, -0.06, -0.08] regular_mode_grind_3_stop_grinds_spot = -0.20 regular_mode_grind_3_profit_threshold_spot = 0.018 regular_mode_grind_4_stakes_spot = [0.18, 0.20, 0.22] regular_mode_grind_4_thresholds_spot = [-0.03, -0.06, -0.08] regular_mode_grind_4_stop_grinds_spot = -0.20 regular_mode_grind_4_profit_threshold_spot = 0.018 regular_mode_grind_5_stakes_spot = [0.18, 0.20, 0.22] regular_mode_grind_5_thresholds_spot = [-0.03, -0.06, -0.08] regular_mode_grind_5_stop_grinds_spot = -0.20 regular_mode_grind_5_profit_threshold_spot = 0.048 regular_mode_grind_6_stakes_spot = [0.05, 0.057, 0.065, 0.074, 0.084, 0.095, 0.107, 0.121, 0.137] regular_mode_grind_6_thresholds_spot = [-0.025, -0.03, -0.035, -0.04, -0.045, -0.05, -0.055, -0.06, -0.065] regular_mode_grind_6_stop_grinds_spot = -0.20 regular_mode_grind_6_profit_threshold_spot = 0.018 regular_mode_derisk_1_spot = -2.0 regular_mode_derisk_1_spot_old = -2.0 regular_mode_derisk_1_reentry_spot = -0.08 regular_mode_derisk_spot = -4.0 regular_mode_derisk_spot_old = -4.0 regular_mode_rebuy_stakes_futures = [0.10, 0.10, 0.10] regular_mode_rebuy_thresholds_futures = [-0.12, -0.14, -0.16] regular_mode_grind_1_stakes_futures = [0.22, 0.24, 0.26] regular_mode_grind_1_thresholds_futures = [-0.06, -0.07, -0.09] regular_mode_grind_1_stop_grinds_futures = -0.20 regular_mode_grind_1_profit_threshold_futures = 0.018 regular_mode_grind_2_stakes_futures = [0.14, 0.20, 0.26] regular_mode_grind_2_thresholds_futures = [-0.04, -0.06, -0.08] regular_mode_grind_2_stop_grinds_futures = -0.20 regular_mode_grind_2_profit_threshold_futures = 0.018 regular_mode_grind_3_stakes_futures = [0.18, 0.20, 0.22] regular_mode_grind_3_thresholds_futures = [-0.03, -0.06, -0.08] regular_mode_grind_3_stop_grinds_futures = -0.20 regular_mode_grind_3_profit_threshold_futures = 0.018 regular_mode_grind_4_stakes_futures = [0.18, 0.20, 0.22] regular_mode_grind_4_thresholds_futures = [-0.03, -0.06, -0.08] regular_mode_grind_4_stop_grinds_futures = -0.20 regular_mode_grind_4_profit_threshold_futures = 0.018 regular_mode_grind_5_stakes_futures = [0.18, 0.20, 0.22] regular_mode_grind_5_thresholds_futures = [-0.03, -0.06, -0.08] regular_mode_grind_5_stop_grinds_futures = -0.20 regular_mode_grind_5_profit_threshold_futures = 0.048 regular_mode_grind_6_stakes_futures = [0.05, 0.057, 0.065, 0.074, 0.084, 0.095, 0.107, 0.121, 0.137] regular_mode_grind_6_thresholds_futures = [-0.025, -0.03, -0.035, -0.04, -0.045, -0.05, -0.055, -0.06, -0.065] regular_mode_grind_6_stop_grinds_futures = -0.20 regular_mode_grind_6_profit_threshold_futures = 0.018 regular_mode_derisk_1_futures = -4.0 regular_mode_derisk_1_futures_old = -4.0 regular_mode_derisk_1_reentry_futures = -0.08 # without leverage regular_mode_derisk_futures = -8.0 regular_mode_derisk_futures_old = -8.0 # Rebuy mode rebuy_mode_stake_multiplier = 0.2 rebuy_mode_stake_multiplier_alt = 0.3 rebuy_mode_max = 3 rebuy_mode_derisk_spot = -0.9 rebuy_mode_derisk_futures = -2.0 rebuy_mode_stakes_spot = [1.0, 2.0, 4.0] rebuy_mode_stakes_futures = [1.0, 2.0, 4.0] rebuy_mode_thresholds_spot = [-0.08, -0.10, -0.12] rebuy_mode_thresholds_futures = [-0.08, -0.10, -0.12] # Grind mode grind_mode_stake_multiplier_spot = [0.20, 0.30, 0.40, 0.50, 0.60, 0.70] grind_mode_stake_multiplier_futures = [0.20, 0.30, 0.40, 0.50] grind_mode_first_entry_profit_threshold_spot = 0.018 grind_mode_first_entry_profit_threshold_futures = 0.018 grind_mode_first_entry_stop_threshold_spot = -0.30 grind_mode_first_entry_stop_threshold_futures = -0.30 grind_mode_max_slots = 1 grind_mode_coins = [ "MATIC", "ADA", "ARB", "DOT", "XLM", "ALGO", "RNDR", "XMR", "AVAX", "NEAR", "DOGE", "ETC", "FTM", "KAS", "HBAR", "SUI", "TON", "XRP", "UNI", "LTC", "FIL", "ATOM", "GRT", "LINK", "VET", "THETA", "EOS", "LRC", "QTUM", "CELR", ] # Profit max thresholds profit_max_thresholds = [0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.05, 0.05] # Max allowed buy "slippage", how high to buy on the candle max_slippage = 0.012 # BTC/ETH stakes btc_stakes = ["BTC", "ETH"] ############################################################# # Buy side configuration long_entry_signal_params = { # Enable/Disable conditions # ------------------------------------------------------- "long_entry_condition_1_enable": True, "long_entry_condition_2_enable": True, "long_entry_condition_3_enable": True, "long_entry_condition_4_enable": True, "long_entry_condition_5_enable": True, "long_entry_condition_6_enable": True, "long_entry_condition_7_enable": True, "long_entry_condition_8_enable": True, "long_entry_condition_9_enable": True, "long_entry_condition_10_enable": True, "long_entry_condition_11_enable": True, "long_entry_condition_12_enable": True, "long_entry_condition_13_enable": True, "long_entry_condition_14_enable": True, "long_entry_condition_21_enable": True, "long_entry_condition_22_enable": True, "long_entry_condition_23_enable": True, "long_entry_condition_24_enable": True, "long_entry_condition_25_enable": True, "long_entry_condition_26_enable": True, "long_entry_condition_41_enable": True, "long_entry_condition_42_enable": True, "long_entry_condition_43_enable": True, "long_entry_condition_44_enable": True, "long_entry_condition_45_enable": True, "long_entry_condition_46_enable": True, "long_entry_condition_47_enable": True, "long_entry_condition_48_enable": True, "long_entry_condition_49_enable": True, "long_entry_condition_50_enable": True, "long_entry_condition_51_enable": True, "long_entry_condition_52_enable": True, "long_entry_condition_53_enable": True, "long_entry_condition_61_enable": True, "long_entry_condition_62_enable": True, "long_entry_condition_81_enable": True, "long_entry_condition_82_enable": True, "long_entry_condition_101_enable": True, "long_entry_condition_102_enable": True, "long_entry_condition_103_enable": True, "long_entry_condition_104_enable": True, "long_entry_condition_105_enable": True, "long_entry_condition_106_enable": True, "long_entry_condition_107_enable": True, "long_entry_condition_108_enable": True, "long_entry_condition_109_enable": True, "long_entry_condition_110_enable": True, "long_entry_condition_120_enable": True, } short_entry_signal_params = { # Enable/Disable conditions # ------------------------------------------------------- "short_entry_condition_500_enable": True, "short_entry_condition_501_enable": True, } buy_protection_params = {} ############################################################# entry_24_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=True) entry_24_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=True) entry_24_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=True) entry_24_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=True) entry_24_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=True) entry_24_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=True) entry_24_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.80, decimals=2, space="buy", optimize=True) entry_24_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.90, decimals=2, space="buy", optimize=True) entry_24_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=1.10, decimals=2, space="buy", optimize=True) entry_24_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.20, decimals=2, space="buy", optimize=True) entry_24_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=True) entry_24_ema_50_over_ema_200_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=True) entry_24_ema_12_1h_over_ema_200_1h_enabled = CategoricalParameter( [True, False], default=True, space="buy", optimize=True ) entry_24_rsi_3_min = DecimalParameter(00.0, 30.0, default=2.0, decimals=0, space="buy", optimize=True) entry_24_rsi_3_max = DecimalParameter(30.0, 70.0, default=46.0, decimals=0, space="buy", optimize=True) entry_24_rsi_3_15m_min = DecimalParameter(00.0, 36.0, default=2.0, decimals=0, space="buy", optimize=True) entry_24_rsi_3_1h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=True) entry_24_rsi_3_4h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=True) entry_24_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=True) entry_24_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=True) entry_24_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=True) entry_24_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=True) entry_24_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=True) entry_24_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=True) entry_24_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=True) entry_24_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=True) entry_24_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=True) entry_24_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=True) entry_24_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=True) entry_24_rsi_14_min = DecimalParameter(20.0, 60.0, default=26.0, decimals=0, space="buy", optimize=True) entry_24_rsi_14_max = DecimalParameter(20.0, 60.0, default=46.0, decimals=0, space="buy", optimize=True) entry_24_cti_20_max = DecimalParameter(-0.99, -0.60, default=-0.75, decimals=2, space="buy", optimize=True) entry_24_r_14_max = DecimalParameter(-100.0, 80.0, default=-97.0, decimals=0, space="buy", optimize=True) entry_24_ewo_50_200_min = DecimalParameter(2.0, 10.0, default=7.0, decimals=1, space="buy", optimize=True) entry_24_ewo_50_200_max = DecimalParameter(10.0, 30.0, default=24.0, decimals=1, space="buy", optimize=True) entry_24_sma_offset = DecimalParameter(0.960, 0.999, default=0.972, decimals=3, space="buy", optimize=True) entry_25_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_25_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_25_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_25_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_25_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_25_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_25_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.5, decimals=2, space="buy", optimize=False) entry_25_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.75, decimals=2, space="buy", optimize=False) entry_25_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.90, decimals=2, space="buy", optimize=False) entry_25_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_25_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_25_rsi_3_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_25_rsi_3_max = DecimalParameter(30.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_25_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=False) entry_25_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=False) entry_25_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=False) entry_25_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=False) entry_25_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_25_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=75.0, decimals=0, space="buy", optimize=False) entry_25_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_25_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=75.0, decimals=0, space="buy", optimize=False) entry_25_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_25_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_25_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_25_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_25_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_25_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_25_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_25_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_25_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_25_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-20.0, decimals=0, space="buy", optimize=False) entry_25_rsi_14_max = DecimalParameter(20.0, 46.0, default=46.0, decimals=0, space="buy", optimize=False) entry_25_cti_20_max = DecimalParameter(-0.9, 0.0, default=-0.9, decimals=1, space="buy", optimize=False) entry_25_ewo_50_200_min = DecimalParameter(1.0, 8.0, default=2.6, decimals=1, space="buy", optimize=False) entry_25_sma_offset = DecimalParameter(0.920, 0.950, default=0.942, decimals=3, space="buy", optimize=False) entry_26_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_26_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_26_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_26_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_26_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_26_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_26_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.80, decimals=2, space="buy", optimize=False) entry_26_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.90, decimals=2, space="buy", optimize=False) entry_26_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=1.10, decimals=2, space="buy", optimize=False) entry_26_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.20, decimals=2, space="buy", optimize=False) entry_26_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_26_rsi_3_min = DecimalParameter(00.0, 30.0, default=2.0, decimals=0, space="buy", optimize=False) entry_26_rsi_3_max = DecimalParameter(30.0, 70.0, default=46.0, decimals=0, space="buy", optimize=False) entry_26_rsi_3_15m_min = DecimalParameter(00.0, 36.0, default=4.0, decimals=0, space="buy", optimize=False) entry_26_rsi_3_1h_min = DecimalParameter(00.0, 36.0, default=6.0, decimals=0, space="buy", optimize=False) entry_26_rsi_3_4h_min = DecimalParameter(00.0, 36.0, default=6.0, decimals=0, space="buy", optimize=False) entry_26_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_26_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_26_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_26_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_26_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_26_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_26_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_26_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_26_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_26_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_26_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_26_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_26_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_26_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_26_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_26_bb_offset = DecimalParameter(0.978, 0.999, default=0.992, decimals=3, space="buy", optimize=False) entry_26_ema_open_offset = DecimalParameter(0.0100, 0.0400, default=0.018, decimals=3, space="buy", optimize=False) entry_26_ewo_50_200_1h_min = DecimalParameter(1.0, 8.0, default=1.2, decimals=1, space="buy", optimize=False) entry_45_close_max_12 = DecimalParameter(00.50, 0.95, default=0.88, decimals=2, space="buy", optimize=False) entry_45_close_max_24 = DecimalParameter(00.50, 0.95, default=0.84, decimals=2, space="buy", optimize=False) entry_45_close_max_48 = DecimalParameter(00.50, 0.95, default=0.8, decimals=2, space="buy", optimize=False) entry_45_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.7, decimals=2, space="buy", optimize=False) entry_45_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.66, decimals=2, space="buy", optimize=False) entry_45_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.6, decimals=2, space="buy", optimize=False) entry_45_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.56, decimals=2, space="buy", optimize=False) entry_45_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.86, decimals=2, space="buy", optimize=False) entry_45_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.9, decimals=2, space="buy", optimize=False) entry_45_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.36, decimals=2, space="buy", optimize=False) entry_45_sup_level_1h_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_45_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_45_sup_level_4h_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_45_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_45_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_45_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_45_rsi_3_min = DecimalParameter(00.0, 30.0, default=5.0, decimals=0, space="buy", optimize=False) entry_45_rsi_3_max = DecimalParameter(30.0, 60.0, default=46.0, decimals=0, space="buy", optimize=False) entry_45_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_45_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_45_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_45_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_45_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.92, decimals=2, space="buy", optimize=False) entry_45_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_45_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.92, decimals=2, space="buy", optimize=False) entry_45_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=75.0, decimals=0, space="buy", optimize=False) entry_45_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.92, decimals=2, space="buy", optimize=False) entry_45_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=75.0, decimals=0, space="buy", optimize=False) entry_45_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-6.0, decimals=0, space="buy", optimize=False) entry_45_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_45_rsi_14_min = DecimalParameter(10.0, 40.0, default=26.0, decimals=0, space="buy", optimize=False) entry_45_rsi_14_max = DecimalParameter(20.0, 60.0, default=40.0, decimals=0, space="buy", optimize=False) entry_45_cti_20_max = DecimalParameter(-0.99, -0.50, default=-0.54, decimals=2, space="buy", optimize=False) entry_45_sma_offset = DecimalParameter(0.940, 0.984, default=0.952, decimals=3, space="buy", optimize=False) entry_46_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_46_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_46_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_46_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_46_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_46_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_46_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.5, decimals=2, space="buy", optimize=False) entry_46_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.75, decimals=2, space="buy", optimize=False) entry_46_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.90, decimals=2, space="buy", optimize=False) entry_46_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_46_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_46_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_46_rsi_3_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_46_rsi_3_max = DecimalParameter(30.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_46_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_46_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_46_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_46_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_46_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_46_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_46_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_46_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_46_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_46_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_46_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_46_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_46_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_46_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_46_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_46_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_46_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_46_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_46_rsi_14_max = DecimalParameter(26.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_47_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_47_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_47_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_47_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_47_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_47_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_47_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.5, decimals=2, space="buy", optimize=False) entry_47_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.75, decimals=2, space="buy", optimize=False) entry_47_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.90, decimals=2, space="buy", optimize=False) entry_47_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_47_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_47_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_47_rsi_3_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_47_rsi_3_max = DecimalParameter(30.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_47_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=16.0, decimals=0, space="buy", optimize=False) entry_47_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_47_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_47_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_47_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.85, decimals=2, space="buy", optimize=False) entry_47_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_47_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.85, decimals=2, space="buy", optimize=False) entry_47_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_47_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_47_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_47_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_47_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_47_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_47_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_47_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_47_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_47_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_47_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_47_rsi_14_min = DecimalParameter(20.0, 40.0, default=24.0, decimals=0, space="buy", optimize=False) entry_47_rsi_14_max = DecimalParameter(26.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_47_rsi_20_min = DecimalParameter(20.0, 40.0, default=24.0, decimals=0, space="buy", optimize=False) entry_47_rsi_20_max = DecimalParameter(26.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_47_cti_20_max = DecimalParameter(-0.8, 0.8, default=-0.7, decimals=1, space="buy", optimize=False) entry_47_ema_offset = DecimalParameter(0.980, 0.999, default=0.992, decimals=3, space="buy", optimize=False) entry_47_high_max_12_1h_max = DecimalParameter(00.70, 0.95, default=0.88, decimals=2, space="buy", optimize=False) entry_48_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_48_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_48_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_48_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_48_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_48_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_48_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.5, decimals=2, space="buy", optimize=False) entry_48_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.75, decimals=2, space="buy", optimize=False) entry_48_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.90, decimals=2, space="buy", optimize=False) entry_48_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_48_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_48_ema_50_1h_over_ema_200_1h_enabled = CategoricalParameter( [True, False], default=True, space="buy", optimize=True ) entry_48_rsi_3_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_48_rsi_3_max = DecimalParameter(30.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_48_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_48_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=10.0, decimals=0, space="buy", optimize=False) entry_48_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=10.0, decimals=0, space="buy", optimize=False) entry_48_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=10.0, decimals=0, space="buy", optimize=False) entry_48_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_48_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_48_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_48_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_48_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_48_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_48_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_48_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_48_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_48_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_48_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_48_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_48_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_48_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_48_rsi_14_max = DecimalParameter(26.0, 50.0, default=38.0, decimals=0, space="buy", optimize=False) entry_48_cci_20_max = DecimalParameter(-180.0, -80.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_48_sma_offset = DecimalParameter(0.940, 0.978, default=0.962, decimals=3, space="buy", optimize=False) entry_48_inc_min = DecimalParameter(0.01, 0.04, default=0.022, decimals=3, space="buy", optimize=False) entry_49_close_max_12 = DecimalParameter(00.50, 0.95, default=0.88, decimals=2, space="buy", optimize=False) entry_49_close_max_24 = DecimalParameter(00.50, 0.95, default=0.86, decimals=2, space="buy", optimize=False) entry_49_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_49_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_49_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_49_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_49_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.5, decimals=2, space="buy", optimize=False) entry_49_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.75, decimals=2, space="buy", optimize=False) entry_49_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.90, decimals=2, space="buy", optimize=False) entry_49_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_49_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_49_ema_12_1h_over_ema_200_1h_enabled = CategoricalParameter( [True, False], default=True, space="buy", optimize=True ) entry_49_rsi_3_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_49_rsi_3_max = DecimalParameter(30.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_49_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_49_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=10.0, decimals=0, space="buy", optimize=False) entry_49_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=10.0, decimals=0, space="buy", optimize=False) entry_49_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=10.0, decimals=0, space="buy", optimize=False) entry_49_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_49_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_49_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_49_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_49_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_49_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_49_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_49_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_49_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_49_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_49_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_49_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_49_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_49_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_49_rsi_14_max = DecimalParameter(26.0, 50.0, default=36.0, decimals=0, space="buy", optimize=False) entry_49_r_14_max = DecimalParameter(-99.0, -70.0, default=-50.0, decimals=0, space="buy", optimize=False) entry_49_inc_min = DecimalParameter(0.01, 0.04, default=0.028, decimals=3, space="buy", optimize=False) entry_50_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_50_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_50_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_50_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_50_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_50_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_50_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.80, decimals=2, space="buy", optimize=False) entry_50_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.90, decimals=2, space="buy", optimize=False) entry_50_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=1.10, decimals=2, space="buy", optimize=False) entry_50_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.20, decimals=2, space="buy", optimize=False) entry_50_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_ema_200_not_dec_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_ema_200_not_dec_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_50_ema_12_1h_over_ema_200_1h_enabled = CategoricalParameter( [True, False], default=True, space="buy", optimize=False ) entry_50_rsi_3_min = DecimalParameter(00.0, 30.0, default=0.0, decimals=0, space="buy", optimize=False) entry_50_rsi_3_max = DecimalParameter(30.0, 70.0, default=46.0, decimals=0, space="buy", optimize=False) entry_50_rsi_3_15m_min = DecimalParameter(00.0, 36.0, default=0.0, decimals=0, space="buy", optimize=False) entry_50_rsi_3_1h_min = DecimalParameter(00.0, 36.0, default=0.0, decimals=0, space="buy", optimize=False) entry_50_rsi_3_4h_min = DecimalParameter(00.0, 36.0, default=0.0, decimals=0, space="buy", optimize=False) entry_50_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=0.0, decimals=0, space="buy", optimize=False) entry_50_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.80, decimals=2, space="buy", optimize=False) entry_50_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_50_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_50_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_50_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_50_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_50_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_50_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_50_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_50_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_50_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_50_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_50_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_50_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_50_bb_offset = DecimalParameter(0.970, 0.999, default=0.995, decimals=3, space="buy", optimize=False) entry_50_ema_open_offset = DecimalParameter(0.020, 0.040, default=0.020, decimals=3, space="buy", optimize=False) entry_102_close_max_12 = DecimalParameter(00.50, 0.95, default=0.92, decimals=2, space="buy", optimize=False) entry_102_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_102_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_102_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.65, decimals=2, space="buy", optimize=False) entry_102_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_102_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.55, decimals=2, space="buy", optimize=False) entry_102_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.5, decimals=2, space="buy", optimize=False) entry_102_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.75, decimals=2, space="buy", optimize=False) entry_102_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.90, decimals=2, space="buy", optimize=False) entry_102_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_102_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_102_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_102_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_102_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_102_sup_level_1d_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_102_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_102_ema_200_not_dec_1h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_102_ema_200_not_dec_4h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_102_ema_200_not_dec_1d_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_102_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_102_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_102_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_102_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_102_rsi_3_min = DecimalParameter(00.0, 30.0, default=12.0, decimals=0, space="buy", optimize=False) entry_102_rsi_3_max = DecimalParameter(30.0, 70.0, default=30.0, decimals=0, space="buy", optimize=False) entry_102_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=16.0, decimals=0, space="buy", optimize=False) entry_102_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=12.0, decimals=0, space="buy", optimize=False) entry_102_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=12.0, decimals=0, space="buy", optimize=False) entry_102_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_102_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_102_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_102_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_102_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_102_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_102_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_102_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_102_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_102_rsi_14_max = DecimalParameter(20.0, 60.0, default=46.0, decimals=0, space="buy", optimize=False) entry_102_ema_offset = DecimalParameter(0.940, 0.984, default=0.966, decimals=3, space="buy", optimize=False) entry_102_bb_offset = DecimalParameter(0.970, 1.010, default=0.999, decimals=3, space="buy", optimize=False) entry_103_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_103_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_103_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_103_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_103_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_103_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_103_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.80, decimals=2, space="buy", optimize=False) entry_103_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.90, decimals=2, space="buy", optimize=False) entry_103_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.95, decimals=2, space="buy", optimize=False) entry_103_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_103_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_103_res_level_1h_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_103_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_103_res_level_4h_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_103_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_103_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_103_ema_200_not_dec_1h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_103_ema_200_not_dec_4h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_103_ema_200_not_dec_1d_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_103_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_103_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_103_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_103_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_103_rsi_3_min = DecimalParameter(00.0, 30.0, default=10.0, decimals=0, space="buy", optimize=False) entry_103_rsi_3_max = DecimalParameter(30.0, 70.0, default=65.0, decimals=0, space="buy", optimize=False) entry_103_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_103_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_103_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=20.0, decimals=0, space="buy", optimize=False) entry_103_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=1.0, decimals=0, space="buy", optimize=False) entry_103_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.85, decimals=2, space="buy", optimize=False) entry_103_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=85.0, decimals=0, space="buy", optimize=False) entry_103_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_103_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=85.0, decimals=0, space="buy", optimize=False) entry_103_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_103_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=85.0, decimals=0, space="buy", optimize=False) entry_103_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_103_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_103_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_103_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-5.0, decimals=0, space="buy", optimize=False) entry_103_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_103_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-25.0, decimals=0, space="buy", optimize=False) entry_103_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-90.0, decimals=0, space="buy", optimize=False) entry_103_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-25.0, decimals=0, space="buy", optimize=False) entry_103_rsi_14_min = DecimalParameter(20.0, 60.0, default=24.0, decimals=0, space="buy", optimize=False) entry_103_sma_offset = DecimalParameter(0.930, 0.972, default=0.958, decimals=3, space="buy", optimize=False) entry_103_bb_offset = DecimalParameter(0.940, 1.010, default=0.948, decimals=3, space="buy", optimize=False) entry_104_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_104_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_104_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_104_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_104_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_104_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_104_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.80, decimals=2, space="buy", optimize=False) entry_104_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.90, decimals=2, space="buy", optimize=False) entry_104_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.95, decimals=2, space="buy", optimize=False) entry_104_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_104_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_res_level_1d_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_104_ema_200_not_dec_1h_enabled = CategoricalParameter([True, False], default=True, space="buy", optimize=False) entry_104_ema_200_not_dec_4h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_104_ema_200_not_dec_1d_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_104_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_104_rsi_3_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_104_rsi_3_max = DecimalParameter(30.0, 70.0, default=46.0, decimals=0, space="buy", optimize=False) entry_104_rsi_3_15m_min = DecimalParameter(00.0, 36.0, default=6.0, decimals=0, space="buy", optimize=False) entry_104_rsi_3_1h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=False) entry_104_rsi_3_4h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=False) entry_104_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=False) entry_104_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.80, decimals=2, space="buy", optimize=False) entry_104_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=70.0, decimals=0, space="buy", optimize=False) entry_104_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_104_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=70.0, decimals=0, space="buy", optimize=False) entry_104_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_104_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=70.0, decimals=0, space="buy", optimize=False) entry_104_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_104_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_104_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_104_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_104_rsi_14_min = DecimalParameter(20.0, 60.0, default=30.0, decimals=0, space="buy", optimize=False) entry_104_rsi_14_max = DecimalParameter(20.0, 60.0, default=46.0, decimals=0, space="buy", optimize=False) entry_104_sma_offset = DecimalParameter(0.940, 0.984, default=0.956, decimals=3, space="buy", optimize=False) entry_106_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_106_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_106_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_106_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_106_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_106_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_106_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.5, decimals=2, space="buy", optimize=False) entry_106_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.75, decimals=2, space="buy", optimize=False) entry_106_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=0.90, decimals=2, space="buy", optimize=False) entry_106_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.00, decimals=2, space="buy", optimize=False) entry_106_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_ema_200_not_dec_1h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_106_ema_200_not_dec_4h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_106_ema_200_not_dec_1d_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_106_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_106_rsi_3_min = DecimalParameter(00.0, 30.0, default=2.0, decimals=0, space="buy", optimize=False) entry_106_rsi_3_max = DecimalParameter(30.0, 60.0, default=60.0, decimals=0, space="buy", optimize=False) entry_106_rsi_3_15m_min = DecimalParameter(00.0, 30.0, default=2.0, decimals=0, space="buy", optimize=False) entry_106_rsi_3_1h_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_106_rsi_3_4h_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_106_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=6.0, decimals=0, space="buy", optimize=False) entry_106_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_106_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_106_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_106_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_106_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.9, decimals=2, space="buy", optimize=False) entry_106_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_106_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_106_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_106_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_106_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_106_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_106_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_106_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_106_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_106_cti_20_max = DecimalParameter(-0.9, 0.0, default=-0.7, decimals=1, space="buy", optimize=False) entry_106_ewo_50_200_max = DecimalParameter(-10.0, -2.0, default=-8.0, decimals=1, space="buy", optimize=True) entry_106_sma_offset = DecimalParameter(0.980, 0.999, default=0.986, decimals=3, space="buy", optimize=True) entry_107_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_107_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_107_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_107_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_107_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_107_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_107_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.80, decimals=2, space="buy", optimize=False) entry_107_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.90, decimals=2, space="buy", optimize=False) entry_107_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=1.10, decimals=2, space="buy", optimize=False) entry_107_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.20, decimals=2, space="buy", optimize=False) entry_107_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_ema_200_not_dec_1h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_107_ema_200_not_dec_4h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_107_ema_200_not_dec_1d_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_107_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_107_rsi_3_min = DecimalParameter(00.0, 30.0, default=2.0, decimals=0, space="buy", optimize=False) entry_107_rsi_3_max = DecimalParameter(30.0, 70.0, default=46.0, decimals=0, space="buy", optimize=False) entry_107_rsi_3_15m_min = DecimalParameter(00.0, 36.0, default=2.0, decimals=0, space="buy", optimize=False) entry_107_rsi_3_1h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=False) entry_107_rsi_3_4h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=False) entry_107_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=False) entry_107_cti_20_1h_min = DecimalParameter(-0.99, -0.50, default=-0.95, decimals=2, space="buy", optimize=False) entry_107_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.80, decimals=2, space="buy", optimize=False) entry_107_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=80.0, decimals=0, space="buy", optimize=False) entry_107_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.90, decimals=2, space="buy", optimize=False) entry_107_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_107_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_107_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_107_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_107_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_107_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_107_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_107_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_107_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_107_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_107_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_107_bb40_bbdelta_close = DecimalParameter(0.030, 0.060, default=0.040, decimals=3, space="buy", optimize=False) entry_107_bb40_closedelta_close = DecimalParameter( 0.010, 0.040, default=0.020, decimals=3, space="buy", optimize=False ) entry_107_bb40_tail_bbdelta = DecimalParameter(0.10, 0.60, default=0.40, decimals=2, space="buy", optimize=False) entry_107_cti_20_max = DecimalParameter(-0.90, -0.50, default=-0.75, decimals=2, space="buy", optimize=False) entry_107_r_480_min = DecimalParameter(-100.0, -80.0, default=-94.0, decimals=0, space="buy", optimize=False) entry_108_close_max_12 = DecimalParameter(00.50, 0.95, default=0.80, decimals=2, space="buy", optimize=False) entry_108_close_max_24 = DecimalParameter(00.50, 0.95, default=0.75, decimals=2, space="buy", optimize=False) entry_108_close_max_48 = DecimalParameter(00.50, 0.95, default=0.70, decimals=2, space="buy", optimize=False) entry_108_high_max_24_1h = DecimalParameter(00.40, 0.95, default=0.60, decimals=2, space="buy", optimize=False) entry_108_high_max_24_4h = DecimalParameter(00.40, 0.95, default=0.50, decimals=2, space="buy", optimize=False) entry_108_high_max_6_1d = DecimalParameter(00.30, 0.95, default=0.45, decimals=2, space="buy", optimize=False) entry_108_hl_pct_change_6_1h = DecimalParameter(00.30, 0.90, default=0.80, decimals=2, space="buy", optimize=False) entry_108_hl_pct_change_12_1h = DecimalParameter(00.40, 1.00, default=0.90, decimals=2, space="buy", optimize=False) entry_108_hl_pct_change_24_1h = DecimalParameter(00.50, 1.20, default=1.10, decimals=2, space="buy", optimize=False) entry_108_hl_pct_change_48_1h = DecimalParameter(00.60, 1.60, default=1.20, decimals=2, space="buy", optimize=False) entry_108_sup_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_res_level_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_sup_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_res_level_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_sup_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_res_level_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_ema_200_not_dec_1h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_108_ema_200_not_dec_4h_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_108_ema_200_not_dec_1d_enabled = CategoricalParameter( [True, False], default=False, space="buy", optimize=False ) entry_108_not_downtrend_15m_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_not_downtrend_1h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_not_downtrend_4h_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_not_downtrend_1d_enabled = CategoricalParameter([True, False], default=False, space="buy", optimize=False) entry_108_rsi_3_min = DecimalParameter(00.0, 30.0, default=0.0, decimals=0, space="buy", optimize=False) entry_108_rsi_3_max = DecimalParameter(30.0, 70.0, default=46.0, decimals=0, space="buy", optimize=False) entry_108_rsi_3_15m_min = DecimalParameter(00.0, 36.0, default=2.0, decimals=0, space="buy", optimize=False) entry_108_rsi_3_1h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=False) entry_108_rsi_3_4h_min = DecimalParameter(00.0, 36.0, default=8.0, decimals=0, space="buy", optimize=False) entry_108_rsi_3_1d_min = DecimalParameter(00.0, 30.0, default=8.0, decimals=0, space="buy", optimize=False) entry_108_cti_20_1h_min = DecimalParameter(-0.99, -0.50, default=-0.95, decimals=2, space="buy", optimize=False) entry_108_cti_20_1h_max = DecimalParameter(0.0, 0.99, default=0.90, decimals=2, space="buy", optimize=False) entry_108_rsi_14_1h_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_108_cti_20_4h_max = DecimalParameter(0.0, 0.99, default=0.90, decimals=2, space="buy", optimize=False) entry_108_rsi_14_4h_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_108_cti_20_1d_max = DecimalParameter(0.0, 0.99, default=0.95, decimals=2, space="buy", optimize=False) entry_108_rsi_14_1d_max = DecimalParameter(50.0, 90.0, default=90.0, decimals=0, space="buy", optimize=False) entry_108_r_14_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_108_r_14_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_108_r_14_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_108_r_14_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_108_r_480_1h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_108_r_480_1h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_108_r_480_4h_min = DecimalParameter(-100.0, -70.0, default=-100.0, decimals=0, space="buy", optimize=False) entry_108_r_480_4h_max = DecimalParameter(-40.0, -0.0, default=-0.0, decimals=0, space="buy", optimize=False) entry_108_rsi_14_min = DecimalParameter(10.0, 40.0, default=15.0, decimals=0, space="buy", optimize=False) entry_108_cti_20_max = DecimalParameter(-0.70, -0.40, default=-0.50, decimals=2, space="buy", optimize=False) entry_108_r_14_max = DecimalParameter(-100.0, 80.0, default=-90.0, decimals=0, space="buy", optimize=False) entry_108_bb_offset = DecimalParameter(0.970, 0.999, default=0.999, decimals=3, space="buy", optimize=False) entry_108_ema_open_offset = DecimalParameter(0.0100, 0.0400, default=0.0200, decimals=4, space="buy", optimize=False) ############################################################# # CACHES hold_trades_cache = None target_profit_cache = None ############################################################# # # # $$$$$$\ $$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$\ $$\ # $$ __$$\ $$ __$$\ $$$\ $$$ |$$$\ $$$ |$$ __$$\ $$$\ $$ | # $$ / \__|$$ / $$ |$$$$\ $$$$ |$$$$\ $$$$ |$$ / $$ |$$$$\ $$ | # $$ | $$ | $$ |$$\$$\$$ $$ |$$\$$\$$ $$ |$$ | $$ |$$ $$\$$ | # $$ | $$ | $$ |$$ \$$$ $$ |$$ \$$$ $$ |$$ | $$ |$$ \$$$$ | # $$ | $$\ $$ | $$ |$$ |\$ /$$ |$$ |\$ /$$ |$$ | $$ |$$ |\$$$ | # \$$$$$$ | $$$$$$ |$$ | \_/ $$ |$$ | \_/ $$ | $$$$$$ |$$ | \$$ | # \______/ \______/ \__| \__|\__| \__| \______/ \__| \__| # # # # $$$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\ # $$ _____|$$ | $$ |$$$\ $$ |$$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |$$ __$$\ # $$ | $$ | $$ |$$$$\ $$ |$$ / \__| $$ | $$ | $$ / $$ |$$$$\ $$ |$$ / \__| # $$$$$\ $$ | $$ |$$ $$\$$ |$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |\$$$$$$\ # $$ __| $$ | $$ |$$ \$$$$ |$$ | $$ | $$ | $$ | $$ |$$ \$$$$ | \____$$\ # $$ | $$ | $$ |$$ |\$$$ |$$ | $$\ $$ | $$ | $$ | $$ |$$ |\$$$ |$$\ $$ | # $$ | \$$$$$$ |$$ | \$$ |\$$$$$$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |\$$$$$$ | # \__| \______/ \__| \__| \______/ \__| \______| \______/ \__| \__| \______/ # # ############################################################################################### # COMMON FUNCTIONS FOR BOTH LONG AND SHORT SIDE STARTS HERE ############################################################################################### def __init__(self, config: dict) -> None: if "ccxt_config" not in config["exchange"]: config["exchange"]["ccxt_config"] = {} if "ccxt_async_config" not in config["exchange"]: config["exchange"]["ccxt_async_config"] = {} options = { "brokerId": None, "broker": {"spot": None, "margin": None, "future": None, "delivery": None}, "partner": { "spot": {"id": None, "key": None}, "future": {"id": None, "key": None}, "id": None, "key": None, }, } config["exchange"]["ccxt_config"]["options"] = options config["exchange"]["ccxt_async_config"]["options"] = options super().__init__(config) if ("exit_profit_only" in self.config and self.config["exit_profit_only"]) or ( "sell_profit_only" in self.config and self.config["sell_profit_only"] ): self.exit_profit_only = True if "stop_threshold_spot" in self.config: self.stop_threshold = self.config["stop_threshold_spot"] if "stop_threshold_futures" in self.config: self.stop_threshold_futures = self.config["stop_threshold_futures"] if "regular_mode_stake_multiplier_spot" in self.config: self.regular_mode_stake_multiplier_spot = self.config["regular_mode_stake_multiplier_spot"] if "regular_mode_stake_multiplier_futures" in self.config: self.regular_mode_stake_multiplier_futures = self.config["regular_mode_stake_multiplier_futures"] if "regular_mode_derisk_1_spot" in self.config: self.regular_mode_derisk_1_spot = self.config["regular_mode_derisk_1_spot"] if "regular_mode_derisk_1_spot_old" in self.config: self.regular_mode_derisk_1_spot_old = self.config["regular_mode_derisk_1_spot_old"] if "regular_mode_derisk_spot" in self.config: self.regular_mode_derisk_spot = self.config["regular_mode_derisk_spot"] if "regular_mode_derisk_spot_old" in self.config: self.regular_mode_derisk_spot_old = self.config["regular_mode_derisk_spot_old"] if "regular_mode_derisk_1_futures" in self.config: self.regular_mode_derisk_1_futures = self.config["regular_mode_derisk_1_futures"] if "regular_mode_derisk_1_futures_old" in self.config: self.regular_mode_derisk_1_futures_old = self.config["regular_mode_derisk_1_futures_old"] if "regular_mode_derisk_futures" in self.config: self.regular_mode_derisk_futures = self.config["regular_mode_derisk_futures"] if "regular_mode_derisk_futures_old" in self.config: self.regular_mode_derisk_futures_old = self.config["regular_mode_derisk_futures_old"] if "custom_fee_open_rate" in self.config: self.custom_fee_open_rate = self.config["custom_fee_open_rate"] if "custom_fee_close_rate" in self.config: self.custom_fee_close_rate = self.config["custom_fee_close_rate"] if "futures_mode_leverage" in self.config: self.futures_mode_leverage = self.config["futures_mode_leverage"] if "futures_mode_leverage_rebuy_mode" in self.config: self.futures_mode_leverage_rebuy_mode = self.config["futures_mode_leverage_rebuy_mode"] if "futures_mode_leverage_grind_mode" in self.config: self.futures_mode_leverage_grind_mode = self.config["futures_mode_leverage_grind_mode"] if "grind_1_profit_threshold_spot" in self.config: self.grind_1_profit_threshold_spot = self.config["grind_1_profit_threshold_spot"] if "grind_1_profit_threshold_futures" in self.config: self.grind_1_profit_threshold_futures = self.config["grind_1_profit_threshold_futures"] if "grind_2_profit_threshold_spot" in self.config: self.grind_2_profit_threshold_spot = self.config["grind_2_profit_threshold_spot"] if "grind_2_profit_threshold_futures" in self.config: self.grind_2_profit_threshold_futures = self.config["grind_2_profit_threshold_futures"] if "grind_3_profit_threshold_spot" in self.config: self.grind_3_profit_threshold_spot = self.config["grind_3_profit_threshold_spot"] if "grind_3_profit_threshold_futures" in self.config: self.grind_3_profit_threshold_futures = self.config["grind_3_profit_threshold_futures"] if "grind_4_profit_threshold_spot" in self.config: self.grind_4_profit_threshold_spot = self.config["grind_4_profit_threshold_spot"] if "grind_4_profit_threshold_futures" in self.config: self.grind_4_profit_threshold_futures = self.config["grind_4_profit_threshold_futures"] if "grind_5_profit_threshold_spot" in self.config: self.grind_5_profit_threshold_spot = self.config["grind_5_profit_threshold_spot"] if "grind_5_profit_threshold_futures" in self.config: self.grind_5_profit_threshold_futures = self.config["grind_5_profit_threshold_futures"] if "grind_6_profit_threshold_spot" in self.config: self.grind_6_profit_threshold_spot = self.config["grind_6_profit_threshold_spot"] if "grind_6_profit_threshold_futures" in self.config: self.grind_6_profit_threshold_futures = self.config["grind_6_profit_threshold_futures"] if "grind_1_derisk_1_profit_threshold_spot" in self.config: self.grind_1_derisk_1_profit_threshold_spot = self.config["grind_1_derisk_1_profit_threshold_spot"] if "grind_1_derisk_1_profit_threshold_futures" in self.config: self.grind_1_derisk_1_profit_threshold_futures = self.config["grind_1_derisk_1_profit_threshold_futures"] if "grind_2_derisk_1_profit_threshold_spot" in self.config: self.grind_2_derisk_1_profit_threshold_spot = self.config["grind_2_derisk_1_profit_threshold_spot"] if "grind_2_derisk_1_profit_threshold_futures" in self.config: self.grind_2_derisk_1_profit_threshold_futures = self.config["grind_2_derisk_1_profit_threshold_futures"] if "regular_mode_grind_1_profit_threshold_spot" in self.config: self.regular_mode_grind_1_profit_threshold_spot = self.config["regular_mode_grind_1_profit_threshold_spot"] if "regular_mode_grind_1_profit_threshold_futures" in self.config: self.regular_mode_grind_1_profit_threshold_futures = self.config["regular_mode_grind_1_profit_threshold_futures"] if "regular_mode_grind_2_profit_threshold_spot" in self.config: self.regular_mode_grind_2_profit_threshold_spot = self.config["regular_mode_grind_2_profit_threshold_spot"] if "regular_mode_grind_2_profit_threshold_futures" in self.config: self.regular_mode_grind_2_profit_threshold_futures = self.config["regular_mode_grind_2_profit_threshold_futures"] if "regular_mode_grind_3_profit_threshold_spot" in self.config: self.regular_mode_grind_3_profit_threshold_spot = self.config["regular_mode_grind_3_profit_threshold_spot"] if "regular_mode_grind_3_profit_threshold_futures" in self.config: self.regular_mode_grind_3_profit_threshold_futures = self.config["regular_mode_grind_3_profit_threshold_futures"] if "regular_mode_grind_4_profit_threshold_spot" in self.config: self.regular_mode_grind_4_profit_threshold_spot = self.config["regular_mode_grind_4_profit_threshold_spot"] if "regular_mode_grind_4_profit_threshold_futures" in self.config: self.regular_mode_grind_4_profit_threshold_futures = self.config["regular_mode_grind_4_profit_threshold_futures"] if "regular_mode_grind_5_profit_threshold_spot" in self.config: self.regular_mode_grind_5_profit_threshold_spot = self.config["regular_mode_grind_5_profit_threshold_spot"] if "regular_mode_grind_5_profit_threshold_futures" in self.config: self.regular_mode_grind_5_profit_threshold_futures = self.config["regular_mode_grind_5_profit_threshold_futures"] if "grind_mode_max_slots" in self.config: self.grind_mode_max_slots = self.config["grind_mode_max_slots"] if "grind_mode_coins" in self.config: self.grind_mode_coins = self.config["grind_mode_coins"] if "max_slippage" in self.config: self.max_slippage = self.config["max_slippage"] if self.target_profit_cache is None: bot_name = "" if "bot_name" in self.config: bot_name = self.config["bot_name"] + "-" self.target_profit_cache = Cache( self.config["user_data_dir"] / ( "nfix4-profit_max-" + bot_name + self.config["exchange"]["name"] + "-" + self.config["stake_currency"] + ("-(backtest)" if (self.config["runmode"].value == "backtest") else "") + ("-(hyperopt)" if (self.config["runmode"].value == "hyperopt") else "") + ".json" ) ) # OKX, Kraken provides a lower number of candle data per API call if self.config["exchange"]["name"] in ["okx", "okex"]: self.startup_candle_count = 480 elif self.config["exchange"]["name"] in ["kraken"]: self.startup_candle_count = 710 elif self.config["exchange"]["name"] in ["bybit"]: self.startup_candle_count = 199 elif self.config["exchange"]["name"] in ["bitget"]: self.startup_candle_count = 499 elif self.config["exchange"]["name"] in ["bingx"]: self.startup_candle_count = 499 if ("trading_mode" in self.config) and (self.config["trading_mode"] in ["futures", "margin"]): self.is_futures_mode = True self.can_short = True # If the cached data hasn't changed, it's a no-op self.target_profit_cache.save() # Get Ticker Indicator # --------------------------------------------------------------------------------------------- def get_ticker_indicator(self): return int(self.timeframe[:-1]) # Mark Profit Target # --------------------------------------------------------------------------------------------- def mark_profit_target( self, mode_name: str, pair: str, sell: bool, signal_name: str, trade: Trade, current_time: datetime, current_rate: float, current_profit: float, last_candle, previous_candle_1, ) -> tuple: if sell and (signal_name is not None): return pair, signal_name return None, None # Exit Profit Target # --------------------------------------------------------------------------------------------- def exit_profit_target( self, mode_name: str, pair: str, trade: Trade, current_time: datetime, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) -> tuple: if previous_sell_reason in [f"exit_{mode_name}_stoploss_doom", f"exit_{mode_name}_stoploss"]: if profit_ratio > 0.04: # profit is over the threshold, don't exit self._remove_profit_target(pair) return False, None if profit_ratio < -0.18: if profit_ratio < (previous_profit - 0.04): return True, previous_sell_reason elif profit_ratio < -0.1: if profit_ratio < (previous_profit - 0.04): return True, previous_sell_reason elif profit_ratio < -0.04: if profit_ratio < (previous_profit - 0.04): return True, previous_sell_reason else: if profit_ratio < (previous_profit - 0.04): return True, previous_sell_reason elif previous_sell_reason in [f"exit_{mode_name}_stoploss_u_e"]: if profit_current_stake_ratio > 0.04: # profit is over the threshold, don't exit self._remove_profit_target(pair) return False, None if profit_ratio < (previous_profit - (0.20 if trade.realized_profit == 0.0 else 0.26)): return True, previous_sell_reason elif previous_sell_reason in [f"exit_profit_{mode_name}_max"]: if profit_init_ratio < -0.08: # profit is under the threshold, cancel it self._remove_profit_target(pair) return False, None if self.is_futures_mode: if 0.01 <= profit_init_ratio < 0.02: if profit_init_ratio < (previous_profit * 0.5): return True, previous_sell_reason elif 0.02 <= profit_init_ratio < 0.03: if profit_init_ratio < (previous_profit * 0.6): return True, previous_sell_reason elif 0.03 <= profit_init_ratio < 0.04: if profit_init_ratio < (previous_profit * 0.7): return True, previous_sell_reason elif 0.04 <= profit_init_ratio < 0.08: if profit_init_ratio < (previous_profit * 0.8): return True, previous_sell_reason elif 0.08 <= profit_init_ratio < 0.16: if profit_init_ratio < (previous_profit * 0.9): return True, previous_sell_reason elif 0.16 <= profit_init_ratio: if profit_init_ratio < (previous_profit * 0.95): return True, previous_sell_reason else: if 0.01 <= profit_init_ratio < 0.03: if profit_init_ratio < (previous_profit * 0.6): return True, previous_sell_reason elif 0.03 <= profit_init_ratio < 0.08: if profit_init_ratio < (previous_profit * 0.65): return True, previous_sell_reason elif 0.08 <= profit_init_ratio < 0.16: if profit_init_ratio < (previous_profit * 0.7): return True, previous_sell_reason elif 0.16 <= profit_init_ratio: if profit_init_ratio < (previous_profit * 0.75): return True, previous_sell_reason else: return False, None return False, None # Calc Total Profit # --------------------------------------------------------------------------------------------- def calc_total_profit( self, trade: "Trade", filled_entries: "Orders", filled_exits: "Orders", exit_rate: float ) -> tuple: """ Calculates the absolute profit for open trades. :param trade: trade object. :param filled_entries: Filled entries list. :param filled_exits: Filled exits list. :param exit_rate: The exit rate. :return tuple: The total profit in stake, ratio, ratio based on current stake, and ratio based on the first entry stake. """ fee_open_rate = trade.fee_open if self.custom_fee_open_rate is None else self.custom_fee_open_rate fee_close_rate = trade.fee_close if self.custom_fee_close_rate is None else self.custom_fee_close_rate total_amount = 0.0 total_stake = 0.0 total_profit = 0.0 current_stake = 0.0 for entry_order in filled_entries: if trade.is_short: entry_stake = entry_order.safe_filled * entry_order.safe_price * (1 - fee_open_rate) total_amount += entry_order.safe_filled total_stake += entry_stake total_profit += entry_stake else: entry_stake = entry_order.safe_filled * entry_order.safe_price * (1 + fee_open_rate) total_amount += entry_order.safe_filled total_stake += entry_stake total_profit -= entry_stake for exit_order in filled_exits: if trade.is_short: exit_stake = exit_order.safe_filled * exit_order.safe_price * (1 + fee_close_rate) total_amount -= exit_order.safe_filled total_profit -= exit_stake else: exit_stake = exit_order.safe_filled * exit_order.safe_price * (1 - fee_close_rate) total_amount -= exit_order.safe_filled total_profit += exit_stake if trade.is_short: current_stake = total_amount * exit_rate * (1 + fee_close_rate) total_profit -= current_stake else: current_stake = total_amount * exit_rate * (1 - fee_close_rate) total_profit += current_stake if self.is_futures_mode: total_profit += trade.funding_fees total_profit_ratio = total_profit / total_stake current_profit_ratio = total_profit / current_stake init_profit_ratio = total_profit / filled_entries[0].cost return total_profit, total_profit_ratio, current_profit_ratio, init_profit_ratio # Custom Exit # --------------------------------------------------------------------------------------------- def custom_exit( self, pair: str, trade: "Trade", current_time: "datetime", current_rate: float, current_profit: float, **kwargs ): df, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) last_candle = df.iloc[-1].squeeze() previous_candle_1 = df.iloc[-2].squeeze() previous_candle_2 = df.iloc[-3].squeeze() previous_candle_3 = df.iloc[-4].squeeze() previous_candle_4 = df.iloc[-5].squeeze() previous_candle_5 = df.iloc[-6].squeeze() enter_tag = "empty" if hasattr(trade, "enter_tag") and trade.enter_tag is not None: enter_tag = trade.enter_tag enter_tags = enter_tag.split() filled_entries = trade.select_filled_orders(trade.entry_side) filled_exits = trade.select_filled_orders(trade.exit_side) profit_stake = 0.0 profit_ratio = 0.0 profit_current_stake_ratio = 0.0 profit_init_ratio = 0.0 profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio = self.calc_total_profit( trade, filled_entries, filled_exits, current_rate ) max_profit = (trade.max_rate - trade.open_rate) / trade.open_rate max_loss = (trade.open_rate - trade.min_rate) / trade.min_rate count_of_entries = len(filled_entries) if count_of_entries > 1: initial_entry = filled_entries[0] if initial_entry is not None and initial_entry.average is not None: max_profit = (trade.max_rate - initial_entry.average) / initial_entry.average max_loss = (initial_entry.average - trade.min_rate) / trade.min_rate # Long Normal mode if any(c in self.long_normal_mode_tags for c in enter_tags): sell, signal_name = self.long_exit_normal( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Long Pump mode if any(c in self.long_pump_mode_tags for c in enter_tags): sell, signal_name = self.long_exit_pump( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Long Quick mode if any(c in self.long_quick_mode_tags for c in enter_tags): sell, signal_name = self.long_exit_quick( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Long Rebuy mode if all(c in self.long_rebuy_mode_tags for c in enter_tags): sell, signal_name = self.long_exit_rebuy( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Long high profit mode if any(c in self.long_mode_tags for c in enter_tags): sell, signal_name = self.long_exit_high_profit( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Long rapid mode if any(c in self.long_rapid_mode_tags for c in enter_tags): sell, signal_name = self.long_exit_rapid( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Long grind mode if all(c in self.long_grind_mode_tags for c in enter_tags): sell, signal_name = self.long_exit_grind( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Short normal mode if any(c in self.short_normal_mode_tags for c in enter_tags): sell, signal_name = self.short_exit_normal( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Short Pump mode if any(c in self.short_pump_mode_tags for c in enter_tags): sell, signal_name = self.short_exit_pump( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Short Quick mode if any(c in self.short_quick_mode_tags for c in enter_tags): sell, signal_name = self.short_exit_quick( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Short Rebuy mode if all(c in self.short_rebuy_mode_tags for c in enter_tags): sell, signal_name = self.short_exit_rebuy( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Short high profit mode if any(c in self.short_mode_tags for c in enter_tags): sell, signal_name = self.short_exit_high_profit( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Short rapid mode if any(c in self.short_rapid_mode_tags for c in enter_tags): sell, signal_name = self.short_exit_rapid( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Trades not opened by X4 if not trade.is_short and ( not any( c in ( self.long_normal_mode_tags + self.long_pump_mode_tags + self.long_quick_mode_tags + self.long_rebuy_mode_tags + self.long_mode_tags + self.long_rapid_mode_tags + self.long_grind_mode_tags ) for c in enter_tags ) ): # use normal mode for such trades sell, signal_name = self.long_exit_normal( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" # Trades not opened by X4 if trade.is_short and ( not any( c in ( self.short_normal_mode_tags + self.short_pump_mode_tags + self.short_quick_mode_tags + self.short_rebuy_mode_tags + self.short_mode_tags + self.short_rapid_mode_tags + self.short_grind_mode_tags ) for c in enter_tags ) ): # use normal mode for such trades sell, signal_name = self.short_exit_normal( pair, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) if sell and (signal_name is not None): return f"{signal_name} ( {enter_tag})" return None # Custom Stake Amount # --------------------------------------------------------------------------------------------- def custom_stake_amount( self, pair: str, current_time: datetime, current_rate: float, proposed_stake: float, min_stake: Optional[float], max_stake: float, leverage: float, entry_tag: Optional[str], side: str, **kwargs, ) -> float: enter_tags = entry_tag.split() if side == "long": # Rebuy mode if all(c in self.long_rebuy_mode_tags for c in enter_tags) or ( any(c in self.long_rebuy_mode_tags for c in enter_tags) and all(c in (self.long_rebuy_mode_tags + self.long_grind_mode_tags) for c in enter_tags) ): stake_multiplier = self.rebuy_mode_stake_multiplier # Low stakes, on Binance mostly if (proposed_stake * self.rebuy_mode_stake_multiplier) < min_stake: stake_multiplier = self.rebuy_mode_stake_multiplier_alt return proposed_stake * stake_multiplier # Grind mode elif all(c in self.long_grind_mode_tags for c in enter_tags): for _, item in enumerate( self.grind_mode_stake_multiplier_futures if self.is_futures_mode else self.grind_mode_stake_multiplier_spot ): if (proposed_stake * item) > min_stake: stake_multiplier = item return proposed_stake * stake_multiplier else: stake_multiplier = ( self.regular_mode_stake_multiplier_futures[0] if self.is_futures_mode else self.regular_mode_stake_multiplier_spot[0] ) if (proposed_stake * stake_multiplier) > min_stake: return proposed_stake * stake_multiplier else: return min_stake else: # Rebuy mode if all(c in self.short_rebuy_mode_tags for c in enter_tags) or ( any(c in self.short_rebuy_mode_tags for c in enter_tags) and all(c in (self.short_rebuy_mode_tags + self.short_grind_mode_tags) for c in enter_tags) ): stake_multiplier = self.rebuy_mode_stake_multiplier # Low stakes, on Binance mostly if (proposed_stake * self.rebuy_mode_stake_multiplier) < min_stake: stake_multiplier = self.rebuy_mode_stake_multiplier_alt return proposed_stake * stake_multiplier # Grind mode elif all(c in self.short_grind_mode_tags for c in enter_tags): for _, item in enumerate( self.grind_mode_stake_multiplier_futures if self.is_futures_mode else self.grind_mode_stake_multiplier_spot ): if (proposed_stake * item) > min_stake: stake_multiplier = item return proposed_stake * stake_multiplier else: stake_multiplier = ( self.regular_mode_stake_multiplier_futures[0] if self.is_futures_mode else self.regular_mode_stake_multiplier_spot[0] ) if (proposed_stake * stake_multiplier) > min_stake: return proposed_stake * stake_multiplier else: return min_stake return proposed_stake # Adjust Trade Position # --------------------------------------------------------------------------------------------- def adjust_trade_position( self, trade: Trade, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, **kwargs, ): if self.position_adjustment_enable == False: return None enter_tag = "empty" if hasattr(trade, "enter_tag") and trade.enter_tag is not None: enter_tag = trade.enter_tag enter_tags = enter_tag.split() # Rebuy mode if not trade.is_short and ( all(c in self.long_rebuy_mode_tags for c in enter_tags) or ( any(c in self.long_rebuy_mode_tags for c in enter_tags) and all(c in (self.long_rebuy_mode_tags + self.long_grind_mode_tags) for c in enter_tags) ) ): return self.long_rebuy_adjust_trade_position( trade, enter_tags, current_time, current_rate, current_profit, min_stake, max_stake, current_entry_rate, current_exit_rate, current_entry_profit, current_exit_profit, ) # Grinding elif not trade.is_short and ( any( c in ( self.long_normal_mode_tags + self.long_pump_mode_tags + self.long_quick_mode_tags + self.long_mode_tags + self.long_rapid_mode_tags + self.long_grind_mode_tags ) for c in enter_tags ) or not any( c in ( self.long_normal_mode_tags + self.long_pump_mode_tags + self.long_quick_mode_tags + self.long_rebuy_mode_tags + self.long_mode_tags + self.long_rapid_mode_tags + self.long_grind_mode_tags ) for c in enter_tags ) ): return self.long_grind_adjust_trade_position( trade, enter_tags, current_time, current_rate, current_profit, min_stake, max_stake, current_entry_rate, current_exit_rate, current_entry_profit, current_exit_profit, ) elif trade.is_short and ( any( c in ( self.short_normal_mode_tags + self.short_pump_mode_tags + self.short_quick_mode_tags + self.short_mode_tags + self.short_rapid_mode_tags + self.short_grind_mode_tags ) for c in enter_tags ) or not any( c in ( self.short_normal_mode_tags + self.short_pump_mode_tags + self.short_quick_mode_tags + self.short_rebuy_mode_tags + self.short_mode_tags + self.short_rapid_mode_tags + self.short_grind_mode_tags ) for c in enter_tags ) ): return self.short_grind_adjust_trade_position( trade, enter_tags, current_time, current_rate, current_profit, min_stake, max_stake, current_entry_rate, current_exit_rate, current_entry_profit, current_exit_profit, ) return None # Informative Pairs # --------------------------------------------------------------------------------------------- def informative_pairs(self): # get access to all pairs available in whitelist. pairs = self.dp.current_whitelist() # Assign tf to each pair so they can be downloaded and cached for strategy. informative_pairs = [] for info_timeframe in self.info_timeframes: informative_pairs.extend([(pair, info_timeframe) for pair in pairs]) if self.config["stake_currency"] in [ "USDT", "BUSD", "USDC", "DAI", "TUSD", "FDUSD", "PAX", "USD", "EUR", "GBP", "TRY", ]: if ("trading_mode" in self.config) and (self.config["trading_mode"] in ["futures", "margin"]): btc_info_pair = f"BTC/{self.config['stake_currency']}:{self.config['stake_currency']}" else: btc_info_pair = f"BTC/{self.config['stake_currency']}" else: if ("trading_mode" in self.config) and (self.config["trading_mode"] in ["futures", "margin"]): btc_info_pair = "BTC/USDT:USDT" else: btc_info_pair = "BTC/USDT" informative_pairs.extend([(btc_info_pair, btc_info_timeframe) for btc_info_timeframe in self.btc_info_timeframes]) return informative_pairs # Informative 1d Timeframe Indicators # --------------------------------------------------------------------------------------------- def informative_1d_indicators(self, metadata: dict, info_timeframe) -> DataFrame: tik = time.perf_counter() assert self.dp, "DataProvider is required for multiple timeframes." # Get the informative pair informative_1d = self.dp.get_pair_dataframe(pair=metadata["pair"], timeframe=info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- # RSI informative_1d["rsi_3"] = pta.rsi(informative_1d["close"], length=3, fillna=0.0) informative_1d["rsi_14"] = pta.rsi(informative_1d["close"], length=14, fillna=0.0) informative_1d["rsi_14_max_6"] = informative_1d["rsi_14"].rolling(6).max() # EMA informative_1d["ema_200"] = ta.EMA(informative_1d, timeperiod=200) informative_1d["ema_200_dec_4"] = (informative_1d["ema_200"].isnull()) | ( informative_1d["ema_200"] <= informative_1d["ema_200"].shift(4) ) # CTI informative_1d["cti_20"] = pta.cti(informative_1d["close"], length=20) informative_1d["cti_20_dec_3"] = informative_1d["cti_20"] < informative_1d["cti_20"].shift(3) # Pivots ( informative_1d["pivot"], informative_1d["res1"], informative_1d["res2"], informative_1d["res3"], informative_1d["sup1"], informative_1d["sup2"], informative_1d["sup3"], ) = pivot_points(informative_1d, mode="fibonacci") # S/R res_series = ( informative_1d["high"].rolling(window=5, center=True).apply(lambda row: is_resistance(row), raw=True).shift(2) ) sup_series = ( informative_1d["low"].rolling(window=5, center=True).apply(lambda row: is_support(row), raw=True).shift(2) ) informative_1d["res_level"] = Series( np.where( res_series, np.where(informative_1d["close"] > informative_1d["open"], informative_1d["close"], informative_1d["open"]), float("NaN"), ) ).ffill() informative_1d["res_hlevel"] = Series(np.where(res_series, informative_1d["high"], float("NaN"))).ffill() informative_1d["sup_level"] = Series( np.where( sup_series, np.where(informative_1d["close"] < informative_1d["open"], informative_1d["close"], informative_1d["open"]), float("NaN"), ) ).ffill() # Downtrend checks informative_1d["not_downtrend"] = (informative_1d["close"] > informative_1d["close"].shift(2)) | ( informative_1d["rsi_14"] > 50.0 ) informative_1d["is_downtrend_3"] = ( (informative_1d["close"] < informative_1d["open"]) & (informative_1d["close"].shift(1) < informative_1d["open"].shift(1)) & (informative_1d["close"].shift(2) < informative_1d["open"].shift(2)) ) # Wicks informative_1d["top_wick_pct"] = ( informative_1d["high"] - np.maximum(informative_1d["open"], informative_1d["close"]) ) / np.maximum(informative_1d["open"], informative_1d["close"]) informative_1d["bot_wick_pct"] = abs( (informative_1d["low"] - np.minimum(informative_1d["open"], informative_1d["close"])) / np.minimum(informative_1d["open"], informative_1d["close"]) ) # Candle change informative_1d["change_pct"] = (informative_1d["close"] - informative_1d["open"]) / informative_1d["open"] # Pump protections informative_1d["hl_pct_change_3"] = range_percent_change(self, informative_1d, "HL", 3) informative_1d["hl_pct_change_6"] = range_percent_change(self, informative_1d, "HL", 6) # Max highs informative_1d["high_max_6"] = informative_1d["high"].rolling(6).max() informative_1d["high_max_12"] = informative_1d["high"].rolling(12).max() # Max lows informative_1d["low_min_6"] = informative_1d["low"].rolling(6).min() informative_1d["low_min_12"] = informative_1d["low"].rolling(12).min() # Performance logging # ----------------------------------------------------------------------------------------- tok = time.perf_counter() log.debug(f"[{metadata['pair']}] informative_1d_indicators took: {tok - tik:0.4f} seconds.") return informative_1d # Informative 4h Timeframe Indicators # --------------------------------------------------------------------------------------------- def informative_4h_indicators(self, metadata: dict, info_timeframe) -> DataFrame: tik = time.perf_counter() assert self.dp, "DataProvider is required for multiple timeframes." # Get the informative pair informative_4h = self.dp.get_pair_dataframe(pair=metadata["pair"], timeframe=info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- # RSI informative_4h["rsi_3"] = pta.rsi(informative_4h["close"], length=3, fillna=0.0) informative_4h["rsi_14"] = pta.rsi(informative_4h["close"], length=14, fillna=0.0) informative_4h["rsi_14_max_3"] = informative_4h["rsi_14"].rolling(3).max() informative_4h["rsi_14_max_6"] = informative_4h["rsi_14"].rolling(6).max() # EMA informative_4h["ema_12"] = ta.EMA(informative_4h, timeperiod=12) informative_4h["ema_26"] = ta.EMA(informative_4h, timeperiod=26) informative_4h["ema_50"] = ta.EMA(informative_4h, timeperiod=50) informative_4h["ema_200"] = ta.EMA(informative_4h, timeperiod=200) informative_4h["ema_200_dec_24"] = (informative_4h["ema_200"].isnull()) | ( informative_4h["ema_200"] <= informative_4h["ema_200"].shift(24) ) # SMA informative_4h["sma_50"] = pta.sma(informative_4h["close"], length=50, fillna=0.0) informative_4h["sma_200"] = pta.sma(informative_4h["close"], length=200, fillna=0.0) informative_4h["sma_200_dec_48"] = ( (informative_4h["sma_200"].isnull()) | (informative_4h["sma_200"].eq(0.0)) | (informative_4h["sma_200"] <= informative_4h["sma_200"].shift(48)) ) # ZL MA informative_4h["zlma_50"] = pta.zlma(informative_4h["close"], length=50, mamode="ema", offset=0, fillna=0.0) informative_4h["zlma_50_dec"] = ( (informative_4h["zlma_50"].isnull()) | (informative_4h["zlma_50"].eq(0.0)) | (informative_4h["zlma_50"] <= informative_4h["zlma_50"].shift(1)) ) # Williams %R informative_4h["r_14"] = pta.willr( informative_4h["high"], informative_4h["low"], informative_4h["close"], length=14 ) informative_4h["r_480"] = pta.willr( informative_4h["high"], informative_4h["low"], informative_4h["close"], length=480 ) # CTI informative_4h["cti_20"] = pta.cti(informative_4h["close"], length=20) # S/R res_series = ( informative_4h["high"].rolling(window=5, center=True).apply(lambda row: is_resistance(row), raw=True).shift(2) ) sup_series = ( informative_4h["low"].rolling(window=5, center=True).apply(lambda row: is_support(row), raw=True).shift(2) ) informative_4h["res_level"] = Series( np.where( res_series, np.where(informative_4h["close"] > informative_4h["open"], informative_4h["close"], informative_4h["open"]), float("NaN"), ) ).ffill() informative_4h["res_hlevel"] = Series(np.where(res_series, informative_4h["high"], float("NaN"))).ffill() informative_4h["sup_level"] = Series( np.where( sup_series, np.where(informative_4h["close"] < informative_4h["open"], informative_4h["close"], informative_4h["open"]), float("NaN"), ) ).ffill() # Downtrend checks informative_4h["not_downtrend"] = (informative_4h["close"] > informative_4h["close"].shift(2)) | ( informative_4h["rsi_14"] > 50.0 ) informative_4h["is_downtrend_3"] = ( (informative_4h["close"] < informative_4h["open"]) & (informative_4h["close"].shift(1) < informative_4h["open"].shift(1)) & (informative_4h["close"].shift(2) < informative_4h["open"].shift(2)) ) # Wicks informative_4h["top_wick_pct"] = ( informative_4h["high"] - np.maximum(informative_4h["open"], informative_4h["close"]) ) / np.maximum(informative_4h["open"], informative_4h["close"]) informative_4h["bot_wick_pct"] = abs( (informative_4h["low"] - np.minimum(informative_4h["open"], informative_4h["close"])) / np.minimum(informative_4h["open"], informative_4h["close"]) ) # Candle change informative_4h["change_pct"] = (informative_4h["close"] - informative_4h["open"]) / informative_4h["open"] informative_4h["change_pct_min_3"] = informative_4h["change_pct"].rolling(3).min() informative_4h["change_pct_max_3"] = informative_4h["change_pct"].rolling(3).max() # Max highs informative_4h["high_max_3"] = informative_4h["high"].rolling(3).max() informative_4h["high_max_12"] = informative_4h["high"].rolling(12).max() informative_4h["high_max_24"] = informative_4h["high"].rolling(24).max() informative_4h["high_max_36"] = informative_4h["high"].rolling(36).max() informative_4h["high_max_48"] = informative_4h["high"].rolling(48).max() # Volume informative_4h["volume_mean_factor_6"] = informative_4h["volume"] / informative_4h["volume"].rolling(6).mean() # Performance logging # ----------------------------------------------------------------------------------------- tok = time.perf_counter() log.debug(f"[{metadata['pair']}] informative_1d_indicators took: {tok - tik:0.4f} seconds.") return informative_4h # Informative 1h Timeframe Indicators # --------------------------------------------------------------------------------------------- def informative_1h_indicators(self, metadata: dict, info_timeframe) -> DataFrame: tik = time.perf_counter() assert self.dp, "DataProvider is required for multiple timeframes." # Get the informative pair informative_1h = self.dp.get_pair_dataframe(pair=metadata["pair"], timeframe=info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- # RSI informative_1h["rsi_3"] = pta.rsi(informative_1h["close"], length=3, fillna=0.0) informative_1h["rsi_14"] = pta.rsi(informative_1h["close"], length=14, fillna=0.0) informative_1h["rsi_14_max_3"] = informative_1h["rsi_14"].rolling(3).max() informative_1h["rsi_14_max_6"] = informative_1h["rsi_14"].rolling(6).max() # EMA informative_1h["ema_12"] = ta.EMA(informative_1h, timeperiod=12) informative_1h["ema_26"] = ta.EMA(informative_1h, timeperiod=26) informative_1h["ema_50"] = ta.EMA(informative_1h, timeperiod=50) informative_1h["ema_200"] = ta.EMA(informative_1h, timeperiod=200) informative_1h["ema_200_dec_48"] = (informative_1h["ema_200"].isnull()) | ( informative_1h["ema_200"] <= informative_1h["ema_200"].shift(48) ) # SMA informative_1h["sma_50"] = pta.sma(informative_1h["close"], length=50, fillna=0.0) informative_1h["sma_200"] = pta.sma(informative_1h["close"], length=200, fillna=0.0) informative_1h["sma_200_dec_48"] = ( (informative_1h["sma_200"].isnull()) | (informative_1h["sma_200"].eq(0.0)) | (informative_1h["sma_200"] <= informative_1h["sma_200"].shift(48)) ) # ZL MA informative_1h["zlma_50"] = pta.zlma(informative_1h["close"], length=50, mamode="ema", offset=0, fillna=0.0) informative_1h["zlma_50_dec"] = ( (informative_1h["zlma_50"].isnull()) | (informative_1h["zlma_50"].eq(0.0)) | (informative_1h["zlma_50"] <= informative_1h["zlma_50"].shift(1)) ) # BB bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(informative_1h), window=20, stds=2) informative_1h["bb20_2_low"] = bollinger["lower"] informative_1h["bb20_2_mid"] = bollinger["mid"] informative_1h["bb20_2_upp"] = bollinger["upper"] informative_1h["bb20_2_width"] = (informative_1h["bb20_2_upp"] - informative_1h["bb20_2_low"]) / informative_1h[ "bb20_2_mid" ] # Williams %R informative_1h["r_14"] = pta.willr( informative_1h["high"], informative_1h["low"], informative_1h["close"], length=14 ) informative_1h["r_480"] = pta.willr( informative_1h["high"], informative_1h["low"], informative_1h["close"], length=480 ) # CTI informative_1h["cti_20"] = pta.cti(informative_1h["close"], length=20) informative_1h["cti_40"] = pta.cti(informative_1h["close"], length=40) informative_1h["cti_20_dec_3"] = informative_1h["cti_20"] < informative_1h["cti_20"].shift(3) # EWO informative_1h["ewo_50_200"] = ewo(informative_1h, 50, 200) # EverGet ChandelierExit high = informative_1h["high"] low = informative_1h["low"] close = informative_1h["close"] chandelier_atr = ta.ATR(high, low, close, 22) * 3.0 long_stop = (high.rolling(22).max() if True else high.rolling(22).apply(lambda x: x[:-1].max())) - chandelier_atr long_stop_prev = long_stop.shift(1).fillna(long_stop) long_stop = close.shift(1).where(close.shift(1) > long_stop_prev, long_stop) short_stop = (low.rolling(22).min() if True else low.rolling(22).apply(lambda x: x[:-1].min())) + chandelier_atr short_stop_prev = short_stop.shift(1).fillna(short_stop) short_stop = close.shift(1).where(close.shift(1) < short_stop_prev, short_stop) informative_1h["chandelier_dir"] = 1 informative_1h.loc[informative_1h["close"] <= long_stop_prev, "chandelier_dir"] = -1 informative_1h.loc[informative_1h["close"] > short_stop_prev, "chandelier_dir"] = 1 # S/R res_series = ( informative_1h["high"].rolling(window=5, center=True).apply(lambda row: is_resistance(row), raw=True).shift(2) ) sup_series = ( informative_1h["low"].rolling(window=5, center=True).apply(lambda row: is_support(row), raw=True).shift(2) ) informative_1h["res_level"] = Series( np.where( res_series, np.where(informative_1h["close"] > informative_1h["open"], informative_1h["close"], informative_1h["open"]), float("NaN"), ) ).ffill() informative_1h["res_hlevel"] = Series(np.where(res_series, informative_1h["high"], float("NaN"))).ffill() informative_1h["sup_level"] = Series( np.where( sup_series, np.where(informative_1h["close"] < informative_1h["open"], informative_1h["close"], informative_1h["open"]), float("NaN"), ) ).ffill() # Pump protections informative_1h["hl_pct_change_48"] = range_percent_change(self, informative_1h, "HL", 48) informative_1h["hl_pct_change_24"] = range_percent_change(self, informative_1h, "HL", 24) informative_1h["hl_pct_change_12"] = range_percent_change(self, informative_1h, "HL", 12) informative_1h["hl_pct_change_6"] = range_percent_change(self, informative_1h, "HL", 6) # Downtrend checks informative_1h["not_downtrend"] = (informative_1h["close"] > informative_1h["close"].shift(2)) | ( informative_1h["rsi_14"] > 50.0 ) informative_1h["is_downtrend_3"] = ( (informative_1h["close"] < informative_1h["open"]) & (informative_1h["close"].shift(1) < informative_1h["open"].shift(1)) & (informative_1h["close"].shift(2) < informative_1h["open"].shift(2)) ) # Wicks informative_1h["top_wick_pct"] = ( informative_1h["high"] - np.maximum(informative_1h["open"], informative_1h["close"]) ) / np.maximum(informative_1h["open"], informative_1h["close"]) # Candle change informative_1h["change_pct"] = (informative_1h["close"] - informative_1h["open"]) / informative_1h["open"] # Max highs informative_1h["high_max_6"] = informative_1h["high"].rolling(6).max() informative_1h["high_max_12"] = informative_1h["high"].rolling(12).max() informative_1h["high_max_24"] = informative_1h["high"].rolling(24).max() informative_1h["high_max_48"] = informative_1h["high"].rolling(48).max() # Max lows informative_1h["low_min_12"] = informative_1h["low"].rolling(12).min() informative_1h["low_min_24"] = informative_1h["low"].rolling(24).min() informative_1h["low_min_48"] = informative_1h["low"].rolling(48).min() # Performance logging # ----------------------------------------------------------------------------------------- tok = time.perf_counter() log.debug(f"[{metadata['pair']}] informative_1h_indicators took: {tok - tik:0.4f} seconds.") return informative_1h # Informative 15m Timeframe Indicators # --------------------------------------------------------------------------------------------- def informative_15m_indicators(self, metadata: dict, info_timeframe) -> DataFrame: tik = time.perf_counter() assert self.dp, "DataProvider is required for multiple timeframes." # Get the informative pair informative_15m = self.dp.get_pair_dataframe(pair=metadata["pair"], timeframe=info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- # RSI informative_15m["rsi_3"] = pta.rsi(informative_15m["close"], length=3) informative_15m["rsi_14"] = pta.rsi(informative_15m["close"], length=14) # EMA informative_15m["ema_12"] = ta.EMA(informative_15m, timeperiod=12) informative_15m["ema_26"] = ta.EMA(informative_15m, timeperiod=26) informative_15m["ema_200"] = ta.EMA(informative_15m, timeperiod=200) informative_15m["ema_200_dec_24"] = (informative_15m["ema_200"].isnull()) | ( informative_15m["ema_200"] <= informative_15m["ema_200"].shift(24) ) # SMA informative_15m["sma_200"] = ta.SMA(informative_15m, timeperiod=200) # ZL MA informative_15m["zlma_50"] = pta.zlma(informative_15m["close"], length=50, mamode="ema", offset=0) informative_15m["zlma_50_dec"] = (informative_15m["zlma_50"].isnull()) | ( informative_15m["zlma_50"] <= informative_15m["zlma_50"].shift(1) ) # BB - 20 STD2 bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(informative_15m), window=20, stds=2) informative_15m["bb20_2_low"] = bollinger["lower"] informative_15m["bb20_2_mid"] = bollinger["mid"] informative_15m["bb20_2_upp"] = bollinger["upper"] # CTI informative_15m["cti_20"] = pta.cti(informative_15m["close"], length=20) # EWO informative_15m["ewo_50_200"] = ewo(informative_15m, 50, 200) # Downtrend check informative_15m["not_downtrend"] = ( (informative_15m["close"] > informative_15m["open"]) | (informative_15m["close"].shift(1) > informative_15m["open"].shift(1)) | (informative_15m["close"].shift(2) > informative_15m["open"].shift(2)) | (informative_15m["rsi_14"] > 50.0) | (informative_15m["rsi_3"] > 25.0) ) # Performance logging # ----------------------------------------------------------------------------------------- tok = time.perf_counter() log.debug(f"[{metadata['pair']}] informative_15m_indicators took: {tok - tik:0.4f} seconds.") return informative_15m # Coin Pair Base Timeframe Indicators # --------------------------------------------------------------------------------------------- def base_tf_5m_indicators(self, metadata: dict, df: DataFrame) -> DataFrame: tik = time.perf_counter() # Indicators # base_tf_5m_indicators_pandas_ta = pta.Strategy( # name="base_tf_5m_indicators_pandas_ta", # ta=[ # # RSI # {"kind": "rsi", "length": 3}, # {"kind": "rsi", "length": 14}, # {"kind": "rsi", "length": 20}, # # EMA # {"kind": "ema", "length": 12}, # {"kind": "ema", "length": 16}, # {"kind": "ema", "length": 20}, # {"kind": "ema", "length": 26}, # {"kind": "ema", "length": 50}, # {"kind": "ema", "length": 100}, # {"kind": "ema", "length": 200}, # # SMA # {"kind": "sma", "length": 16}, # {"kind": "sma", "length": 30}, # {"kind": "sma", "length": 75}, # {"kind": "sma", "length": 200}, # # BB 20 - STD2 # {"kind": "bbands", "length": 20} # # BB 40 - STD2 # {"kind": "bbands", "length": 40} # # Williams %R # {"kind": "willr", "length": 14}, # {"kind": "willr", "length": 480}, # # CTI # {"kind": "cti", "length": 20}, # # CCI # {"kind": "cci", "length": 20}, # # Hull Moving Average # {"kind": "hma", "length": 55}, # {"kind": "hma", "length": 70}, # # ZL MA # {"kind": "zlma", "length": 50, "mamode":"linreg"}, # # Heiken Ashi # {"kind": "ha"}, # ] # ) # ----------------------------------------------------------------------------------------- # RSI df["rsi_3"] = pta.rsi(df["close"], length=3) df["rsi_14"] = pta.rsi(df["close"], length=14) df["rsi_20"] = pta.rsi(df["close"], length=20) # EMA df["ema_12"] = ta.EMA(df, timeperiod=12) df["ema_16"] = ta.EMA(df, timeperiod=16) df["ema_20"] = ta.EMA(df, timeperiod=20) df["ema_26"] = ta.EMA(df, timeperiod=26) df["ema_50"] = ta.EMA(df, timeperiod=50) df["ema_100"] = ta.EMA(df, timeperiod=100) df["ema_200"] = ta.EMA(df, timeperiod=200) df["ema_200_dec_24"] = (df["ema_200"].isnull()) | (df["ema_200"] <= df["ema_200"].shift(24)) df["ema_200_pct_change_144"] = (df["ema_200"] - df["ema_200"].shift(144)) / df["ema_200"].shift(144) df["ema_200_pct_change_288"] = (df["ema_200"] - df["ema_200"].shift(288)) / df["ema_200"].shift(288) # SMA df["sma_16"] = ta.SMA(df, timeperiod=16) df["sma_30"] = ta.SMA(df, timeperiod=30) df["sma_75"] = ta.SMA(df, timeperiod=75) df["sma_200"] = ta.SMA(df, timeperiod=200) # BB 20 - STD2 bb_20_std2 = qtpylib.bollinger_bands(qtpylib.typical_price(df), window=20, stds=2) df["bb20_2_low"] = bb_20_std2["lower"] df["bb20_2_mid"] = bb_20_std2["mid"] df["bb20_2_upp"] = bb_20_std2["upper"] # BB 40 - STD2 bb_40_std2 = qtpylib.bollinger_bands(df["close"], window=40, stds=2) df["bb40_2_low"] = bb_40_std2["lower"] df["bb40_2_mid"] = bb_40_std2["mid"] df["bb40_2_delta"] = (bb_40_std2["mid"] - df["bb40_2_low"]).abs() df["bb40_2_tail"] = (df["close"] - df["bb40_2_low"]).abs() # Williams %R df["r_14"] = pta.willr(df["high"], df["low"], df["close"], length=14) df["r_480"] = pta.willr(df["high"], df["low"], df["close"], length=480) # CTI df["cti_20"] = pta.cti(df["close"], length=20) # CCI df["cci_20"] = ta.CCI(df, source="hlc3", timeperiod=20) # EWO df["ewo_50_200"] = ewo(df, 50, 200) # Hull Moving Average df["hma_55"] = pta.hma(df["close"], length=55) df["hma_70"] = pta.hma(df["close"], length=70) df["hma_55_buy"] = (df["hma_55"] > df["hma_55"].shift(1)) & (df["hma_55"].shift(1) < df["hma_55"].shift(2)) df["hma_70_buy"] = (df["hma_70"] > df["hma_70"].shift(1)) & (df["hma_70"].shift(1) < df["hma_70"].shift(2)) # ZL MA df["zlma_50"] = pta.zlma(df["close"], length=50, mamode="ema", offset=0) # EverGet ChandelierExit high = df["high"] low = df["low"] close = df["close"] chandelier_atr = ta.ATR(high, low, close, 22) * 3.0 long_stop = (high.rolling(22).max() if True else high.rolling(22).apply(lambda x: x[:-1].max())) - chandelier_atr long_stop_prev = long_stop.shift(1).fillna(long_stop) long_stop = close.shift(1).where(close.shift(1) > long_stop_prev, long_stop) short_stop = (low.rolling(22).min() if True else low.rolling(22).apply(lambda x: x[:-1].min())) + chandelier_atr short_stop_prev = short_stop.shift(1).fillna(short_stop) short_stop = close.shift(1).where(close.shift(1) < short_stop_prev, short_stop) df["chandelier_dir"] = 1 df.loc[df["close"] <= long_stop_prev, "chandelier_dir"] = -1 df.loc[df["close"] > short_stop_prev, "chandelier_dir"] = 1 # Heiken Ashi heikinashi = qtpylib.heikinashi(df) df["ha_open"] = heikinashi["open"] df["ha_close"] = heikinashi["close"] df["ha_high"] = heikinashi["high"] df["ha_low"] = heikinashi["low"] # Dip protection df["tpct_change_0"] = top_percent_change(self, df, 0) df["tpct_change_2"] = top_percent_change(self, df, 2) # Candle change df["change_pct"] = (df["close"] - df["open"]) / df["open"] # Close max df["close_max_12"] = df["close"].rolling(12).max() df["close_max_24"] = df["close"].rolling(24).max() df["close_max_48"] = df["close"].rolling(48).max() # Open min df["open_min_6"] = df["open"].rolling(6).min() df["open_min_12"] = df["open"].rolling(12).min() # Close min df["close_min_12"] = df["close"].rolling(12).min() df["close_min_24"] = df["close"].rolling(24).min() df["close_min_48"] = df["close"].rolling(48).min() # Close delta df["close_delta"] = (df["close"] - df["close"].shift()).abs() # Number of empty candles in the last 288 df["num_empty_288"] = (df["volume"] <= 0).rolling(window=288, min_periods=288).sum() # For sell checks df["crossed_below_ema_12_26"] = qtpylib.crossed_below(df["ema_12"], df["ema_26"]) df["crossed_above_ema_12_26"] = qtpylib.crossed_above(df["ema_12"], df["ema_26"]) # Global protections # ----------------------------------------------------------------------------------------- if not self.config["runmode"].value in ("live", "dry_run"): # Backtest age filter df["bt_agefilter_ok"] = False df.loc[df.index > (12 * 24 * self.bt_min_age_days), "bt_agefilter_ok"] = True else: # Exchange downtime protection df["live_data_ok"] = df["volume"].rolling(window=72, min_periods=72).min() > 0 # Performance logging # ----------------------------------------------------------------------------------------- tok = time.perf_counter() log.debug(f"[{metadata['pair']}] base_tf_5m_indicators took: {tok - tik:0.4f} seconds.") return df # Coin Pair Indicator Switch Case # --------------------------------------------------------------------------------------------- def info_switcher(self, metadata: dict, info_timeframe) -> DataFrame: if info_timeframe == "1d": return self.informative_1d_indicators(metadata, info_timeframe) elif info_timeframe == "4h": return self.informative_4h_indicators(metadata, info_timeframe) elif info_timeframe == "1h": return self.informative_1h_indicators(metadata, info_timeframe) elif info_timeframe == "15m": return self.informative_15m_indicators(metadata, info_timeframe) else: raise RuntimeError(f"{info_timeframe} not supported as informative timeframe for BTC pair.") # BTC 1D Indicators # --------------------------------------------------------------------------------------------- def btc_info_1d_indicators(self, btc_info_pair, btc_info_timeframe, metadata: dict) -> DataFrame: tik = time.perf_counter() btc_info_1d = self.dp.get_pair_dataframe(btc_info_pair, btc_info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- btc_info_1d["rsi_14"] = pta.rsi(btc_info_1d["close"], length=14) # btc_info_1d['pivot'], btc_info_1d['res1'], btc_info_1d['res2'], btc_info_1d['res3'], btc_info_1d['sup1'], btc_info_1d['sup2'], btc_info_1d['sup3'] = pivot_points(btc_info_1d, mode='fibonacci') # Add prefix # ----------------------------------------------------------------------------------------- ignore_columns = ["date"] btc_info_1d.rename(columns=lambda s: f"btc_{s}" if s not in ignore_columns else s, inplace=True) tok = time.perf_counter() log.debug(f"[{metadata['pair']}] btc_info_1d_indicators took: {tok - tik:0.4f} seconds.") return btc_info_1d # BTC 4h Indicators # --------------------------------------------------------------------------------------------- def btc_info_4h_indicators(self, btc_info_pair, btc_info_timeframe, metadata: dict) -> DataFrame: tik = time.perf_counter() btc_info_4h = self.dp.get_pair_dataframe(btc_info_pair, btc_info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- # RSI btc_info_4h["rsi_14"] = pta.rsi(btc_info_4h["close"], length=14) # SMA btc_info_4h["sma_200"] = ta.SMA(btc_info_4h, timeperiod=200) # Bull market or not btc_info_4h["is_bull"] = btc_info_4h["close"] > btc_info_4h["sma_200"] # Add prefix # ----------------------------------------------------------------------------------------- ignore_columns = ["date"] btc_info_4h.rename(columns=lambda s: f"btc_{s}" if s not in ignore_columns else s, inplace=True) tok = time.perf_counter() log.debug(f"[{metadata['pair']}] btc_info_4h_indicators took: {tok - tik:0.4f} seconds.") return btc_info_4h # BTC 1h Indicators # --------------------------------------------------------------------------------------------- def btc_info_1h_indicators(self, btc_info_pair, btc_info_timeframe, metadata: dict) -> DataFrame: tik = time.perf_counter() btc_info_1h = self.dp.get_pair_dataframe(btc_info_pair, btc_info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- # RSI btc_info_1h["rsi_14"] = pta.rsi(btc_info_1h["close"], length=14) btc_info_1h["not_downtrend"] = (btc_info_1h["close"] > btc_info_1h["close"].shift(2)) | ( btc_info_1h["rsi_14"] > 50.0 ) # Add prefix # ----------------------------------------------------------------------------------------- ignore_columns = ["date"] btc_info_1h.rename(columns=lambda s: f"btc_{s}" if s not in ignore_columns else s, inplace=True) tok = time.perf_counter() log.debug(f"[{metadata['pair']}] btc_info_1h_indicators took: {tok - tik:0.4f} seconds.") return btc_info_1h # BTC 15m Indicators # --------------------------------------------------------------------------------------------- def btc_info_15m_indicators(self, btc_info_pair, btc_info_timeframe, metadata: dict) -> DataFrame: tik = time.perf_counter() btc_info_15m = self.dp.get_pair_dataframe(btc_info_pair, btc_info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- btc_info_15m["rsi_14"] = pta.rsi(btc_info_15m["close"], length=14) # Add prefix # ----------------------------------------------------------------------------------------- ignore_columns = ["date"] btc_info_15m.rename(columns=lambda s: f"btc_{s}" if s not in ignore_columns else s, inplace=True) tok = time.perf_counter() log.debug(f"[{metadata['pair']}] btc_info_15m_indicators took: {tok - tik:0.4f} seconds.") return btc_info_15m # BTC 5m Indicators # --------------------------------------------------------------------------------------------- def btc_info_5m_indicators(self, btc_info_pair, btc_info_timeframe, metadata: dict) -> DataFrame: tik = time.perf_counter() btc_info_5m = self.dp.get_pair_dataframe(btc_info_pair, btc_info_timeframe) # Indicators # ----------------------------------------------------------------------------------------- # RSI btc_info_5m["rsi_14"] = pta.rsi(btc_info_5m["close"], length=14) # Close max btc_info_5m["close_max_24"] = btc_info_5m["close"].rolling(24).max() btc_info_5m["close_max_72"] = btc_info_5m["close"].rolling(72).max() btc_info_5m["pct_close_max_24"] = (btc_info_5m["close_max_24"] - btc_info_5m["close"]) / btc_info_5m["close"] btc_info_5m["pct_close_max_72"] = (btc_info_5m["close_max_72"] - btc_info_5m["close"]) / btc_info_5m["close"] # Close min btc_info_5m["close_min_24"] = btc_info_5m["close"].rolling(24).min() btc_info_5m["close_min_72"] = btc_info_5m["close"].rolling(72).min() btc_info_5m["pct_close_min_24"] = (btc_info_5m["close_min_24"] - btc_info_5m["close"]) / btc_info_5m["close"] btc_info_5m["pct_close_min_72"] = (btc_info_5m["close_min_72"] - btc_info_5m["close"]) / btc_info_5m["close"] # Add prefix # ----------------------------------------------------------------------------------------- ignore_columns = ["date"] btc_info_5m.rename(columns=lambda s: f"btc_{s}" if s not in ignore_columns else s, inplace=True) tok = time.perf_counter() log.debug(f"[{metadata['pair']}] btc_info_5m_indicators took: {tok - tik:0.4f} seconds.") return btc_info_5m # BTC Indicator Switch Case # --------------------------------------------------------------------------------------------- def btc_info_switcher(self, btc_info_pair, btc_info_timeframe, metadata: dict) -> DataFrame: if btc_info_timeframe == "1d": return self.btc_info_1d_indicators(btc_info_pair, btc_info_timeframe, metadata) elif btc_info_timeframe == "4h": return self.btc_info_4h_indicators(btc_info_pair, btc_info_timeframe, metadata) elif btc_info_timeframe == "1h": return self.btc_info_1h_indicators(btc_info_pair, btc_info_timeframe, metadata) elif btc_info_timeframe == "15m": return self.btc_info_15m_indicators(btc_info_pair, btc_info_timeframe, metadata) elif btc_info_timeframe == "5m": return self.btc_info_5m_indicators(btc_info_pair, btc_info_timeframe, metadata) else: raise RuntimeError(f"{btc_info_timeframe} not supported as informative timeframe for BTC pair.") # Populate Indicators # --------------------------------------------------------------------------------------------- def populate_indicators(self, df: DataFrame, metadata: dict) -> DataFrame: tik = time.perf_counter() """ --> BTC informative indicators ___________________________________________________________________________________________ """ if self.config["stake_currency"] in [ "USDT", "BUSD", "USDC", "DAI", "TUSD", "FDUSD", "PAX", "USD", "EUR", "GBP", "TRY", ]: if ("trading_mode" in self.config) and (self.config["trading_mode"] in ["futures", "margin"]): btc_info_pair = f"BTC/{self.config['stake_currency']}:{self.config['stake_currency']}" else: btc_info_pair = f"BTC/{self.config['stake_currency']}" else: if ("trading_mode" in self.config) and (self.config["trading_mode"] in ["futures", "margin"]): btc_info_pair = "BTC/USDT:USDT" else: btc_info_pair = "BTC/USDT" for btc_info_timeframe in self.btc_info_timeframes: btc_informative = self.btc_info_switcher(btc_info_pair, btc_info_timeframe, metadata) df = merge_informative_pair(df, btc_informative, self.timeframe, btc_info_timeframe, ffill=True) # Customize what we drop - in case we need to maintain some BTC informative ohlcv data # Default drop all drop_columns = { "1d": [f"btc_{s}_{btc_info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], "4h": [f"btc_{s}_{btc_info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], "1h": [f"btc_{s}_{btc_info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], "15m": [f"btc_{s}_{btc_info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], "5m": [f"btc_{s}_{btc_info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], }.get( btc_info_timeframe, [f"{s}_{btc_info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], ) drop_columns.append(f"date_{btc_info_timeframe}") df.drop(columns=df.columns.intersection(drop_columns), inplace=True) """ --> Indicators on informative timeframes ___________________________________________________________________________________________ """ for info_timeframe in self.info_timeframes: info_indicators = self.info_switcher(metadata, info_timeframe) df = merge_informative_pair(df, info_indicators, self.timeframe, info_timeframe, ffill=True) # Customize what we drop - in case we need to maintain some informative timeframe ohlcv data # Default drop all except base timeframe ohlcv data drop_columns = { "1d": [f"{s}_{info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], "4h": [f"{s}_{info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], "1h": [f"{s}_{info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]], "15m": [f"{s}_{info_timeframe}" for s in ["date", "high", "low", "volume"]], }.get(info_timeframe, [f"{s}_{info_timeframe}" for s in ["date", "open", "high", "low", "close", "volume"]]) df.drop(columns=df.columns.intersection(drop_columns), inplace=True) """ --> The indicators for the base timeframe (5m) ___________________________________________________________________________________________ """ df = self.base_tf_5m_indicators(metadata, df) df["zlma_50_1h"] = df["zlma_50_1h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(0.0)) df["zlma_50_4h"] = df["zlma_50_4h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(0.0)) df["cti_20_1d"] = df["cti_20_1d"].astype(np.float64).replace(to_replace=[np.nan, None], value=(0.0)) df["r_480_1h"] = df["r_480_1h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(-50.0)) df["r_480_4h"] = df["r_480_4h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(-50.0)) df["rsi_14_1h"] = df["rsi_14_1h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(50.0)) df["rsi_14_4h"] = df["rsi_14_4h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(50.0)) df["rsi_14_1d"] = df["rsi_14_1d"].astype(np.float64).replace(to_replace=[np.nan, None], value=(50.0)) # Global protections df["protections_long_global"] = ( # current 4h red with top wick, previous 4h red, 4h overbought ( (df["change_pct_4h"] > -0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_4h"].shift(48) > -0.04) | (df["cti_20_4h"] < 0.8) ) & # current 1h red, current 4h green, 4h overbought ( (df["change_pct_1h"] > -0.04) | (df["change_pct_4h"] < 0.08) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) & # current 4h red, previous 4h green, 4h overbought ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) & # current 4h red, previous 4h red, 2nd previous 4h long green, 4h overbought ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) > -0.04) | (df["change_pct_4h"].shift(96) < 0.16) | (df["cti_20_4h"] < 0.5) ) & # current 4h red, overbought 4h, sudden rise 4h (and now coming down) ( (df["change_pct_4h"] > -0.01) | (df["rsi_14_max_6_4h"] < 80.0) | (df["cti_20_4h"] < 0.5) | (((df["ema_12_4h"] - df["ema_26_4h"]) / df["ema_26_4h"]) < 0.08) ) # current 4h red, previous 4h green with top wick, 4h overbought & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.08) | (df["top_wick_pct_4h"].shift(48) < 0.08) | (df["cti_20_4h"] < 0.5) ) # current 4h long red, previous 4h red, 2nd previous 4h long green, 4h overbought & ( (df["change_pct_4h"] > -0.08) | (df["change_pct_4h"].shift(48) > -0.01) | (df["change_pct_4h"].shift(96) < 0.08) | (df["cti_20_4h"] < 0.5) ) # current 1h red, current 4h long green with top wick, 1h overbought & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_4h"] < 0.08) | (df["top_wick_pct_4h"] < 0.04) | (df["cti_20_1h"] < 0.7) ) # current 1h red, 1h overbought, 1d overbought, 1h descending & ( (df["change_pct_1h"] > -0.04) | (df["cti_20_1h"] < 0.7) | (df["cti_20_1d"] < 0.8) | (df["ema_200_dec_48_1h"] == False) ) # 1h overbought, 1d overbought, 1h descending & ( (df["rsi_14_1h"] < 70.0) | (df["cti_20_1h"] < 0.7) | (df["cti_20_1d"] < 0.8) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green, 4h overbought, 4h descending & ( (df["change_pct_1d"] < 0.08) | (df["rsi_14_4h"] < 70.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) ) # current 4h red, previous 4h green, 1d overbought & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_14_1d"] < 70.0) | (df["cti_20_1d"] < 0.5) ) # 1h overbought, 4h overbought, 1d overbought & ((df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["rsi_14_1d"] < 80.0) | (df["cti_20_1d"] < 0.85)) # current 4h red, previous 4h red, 2nd previous 4h green with top wick, 4h overbought & ( (df["change_pct_4h"] > -0.0) | (df["change_pct_4h"].shift(48) > -0.0) | (df["change_pct_4h"].shift(96) < 0.06) | (df["top_wick_pct_4h"].shift(96) < 0.06) | (df["cti_20_4h"] < 0.7) ) # current 4h red, previous 4h red, 2nd previous 4h green, 4h overbought & ( (df["change_pct_4h"] > -0.0) | (df["change_pct_4h"].shift(48) > -0.0) | (df["change_pct_4h"].shift(96) < 0.06) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.5) ) # current 1d green with top wick, current & previous 4h red, 4h overbought & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.0) | (df["change_pct_4h"].shift(48) > -0.0) | (df["cti_20_4h"] < 0.7) ) # current 1h red, 1h downtrend, 15m move down, 1h move down, 1h downtrend, 4h downtrend & ( (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 16.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 4h downtrend, 4h move down, 1d overbought & ( (df["is_downtrend_3_4h"] == False) | (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 16.0) | (df["cti_20_1d"] < 0.7) ) # 4h red with top wick, 1h downtrend, 1d overbought & ( (df["change_pct_4h"] > -0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["is_downtrend_3_1h"] == False) | (df["rsi_14_1d"] < 70.0) ) # current 1h red, previous 1h red, 4h overbought & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) > -0.01) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_max_6_4h"] < 70.0) ) # current 1d long green, current 4h red, 1h high, 4h high, 1h downtrend, 4h downtrend & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 4h red, previous 4h red, 2nd previous 4h green with top wick, 4h overbought & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) > -0.01) | (df["change_pct_4h"].shift(96) < 0.04) | (df["top_wick_pct_4h"].shift(96) < 0.04) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_max_6_4h"] < 70.0) ) # 5m & 15m strond down move, 1h & 4h still high, 4h & 1d downtrend & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_15m"] < -0.8) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m downtrend, 5m & 15m strong down move, 1h & 4h downtrend & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 4.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 4h strong down move, 1h & 4h downtrend & ((df["rsi_3_4h"] > 4.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False)) # 1h downtrend, 1h strong down move, 1d overbought & ((df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_14_1d"] < 70.0) | (df["cti_20_1d"] < 0.8)) # 15m strong down move, 15m still dropping, 5m & 15m & 4h & 1d downtrend & ( (df["rsi_3_15m"] > 8.0) | (df["cti_20_15m"] < -0.8) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 15m still dropping, 1h & 4h down move, 5m & 15m & 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.7) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 1h & 4h downtrend, 5m & 15m strong down move, 1h & 4h still dropping, 5m & 15m & 1h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_48_1h"] == False) ) # current 4h long top wick, current 1h red, 15m down move, 1h & 4h still high & ( (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) ) # 1h down move, 1h & 4h still high, 5m downtrend & ( (df["rsi_3_1h"] > 16.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 70.0) | (df["ema_200_dec_24"] == False) ) # current 4h red, 1h & 4h still high, 1d overbought, 4h overbought & ( (df["change_pct_4h"] > -0.01) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["rsi_14_max_3_4h"] < 70.0) ) # current 1d long green, current 1h red, 1h still not low enough, 4h high & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_1h"] > -0.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_max_3_4h"] < 70.0) ) # current 1d red, 1h & 4h downtrend, 15m & 1h & 4h down move, 4h still dropping, 1d high & ( (df["change_pct_1d"] > -0.06) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < -0.8) | (df["rsi_3_4h"] > 26.0) | (df["cti_20_1d"] < 0.5) ) # current 4h long green, 1h downtrend, 15m down move, 1h still high & ( (df["change_pct_4h"] < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) ) # 15m & 1h downtrend, 15m & 1h strong down move, 15m & 1h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_48_1h"] == False) ) # currend 1d green, 4h & 1d overbought & ( (df["change_pct_1d"] < 0.08) | (df["cti_20_4h"] < 0.9) | (df["rsi_14_4h"] < 75.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) # current 1d long red, previous 1d green, 1h & 4h downtrend, 5m & 15m & 1h downtrend & ( (df["change_pct_1d"] > -0.16) | (df["change_pct_1d"].shift(288) < 0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_48_1h"] == False) ) # 15m & 1h & 4h downtrend, 15m & 1h & 4h down move & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_14_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 20.0) ) # current 5m strong down move, 1h & 1d high, 5m & 15m downtrend & ( (df["rsi_3"] > 8.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_1d"] < 0.9) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) ) # 15m & 1h downtrend, 4h high, 4h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.8) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 1h dropping, 4h still high, 5m & 15m downtrend & ( (df["not_downtrend_1h"]) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 10.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) ) # current 4h green with top wick, 15m still high, 4h overbought, 4h downtrend & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) ) # current 1d red, 1h downtrend, 15m down move, 4h down move & still high, 1d overbought & ( (df["change_pct_1d"] > -0.06) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_3_4h"] > 26.0) | (df["cti_20_1d"] < 0.7) ) # current 4h red, previous 4h green, 15m strong down move, 4h overbought & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["rsi_3_15m"] > 6.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_max_3_4h"] < 70.0) ) # current 1d green, 15m & 1h down move, 1d overbought & ((df["change_pct_1d"] < 0.08) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < 0.9)) # 15m & 1h downtrend, 15m strong down move, 4h overbought & ((df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 6.0) | (df["cti_20_4h"] < 0.8)) # current 4h green with top wick, 15m down move, 4h overbought & high & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_max_3_4h"] < 70.0) ) # 15m & 1h & 4h downtrend, 15m strong down move & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 3.0) | (df["cti_20_1h"] < -0.7) ) # 15m & 1h & 4h downtrend, 15m down move & still high, 1d overbought & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] < 26.0) | (df["cti_20_1d"] < 0.9) ) # 15m downtrend, 5m & 15m downmove, 15m still high, 1d overbought & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1d"] < 0.8) ) # current 4h red, 1h downtrend, 4h overbought & ( (df["change_pct_4h"] > -0.06) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_max_6_4h"] < 80.0) ) # 15m & 1h downtrend, 15m & 1h downmove, 1d high, 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) # 15m down move, 15m & 4h still high, 1d overbought, 5m & 15m downtrend, drop in last 48h & ( (df["rsi_3_15m"] > 10.0) | (df["cti_20_15m"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_1d"] < 65.0) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["high_max_48_1h"] < (df["close"] * 1.24)) ) # 1h & 4h downtrend, 5m & 15m downmove & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d green with top wick, 15m downtrend, 1h & 1d still high & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1h"] < 0.7) | (df["cti_20_1d"] < 0.7) ) # current 1h long red, 1h downtrend, 4h still high, 4h & 1d downtrend & ( (df["change_pct_1h"] > -0.08) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d downtrend, 1h & 4h still low, 1d still high, drop in last 6 days & ( (df["is_downtrend_3_1d"] == False) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 15m downtrend, 15m downmove, 1h & 4h & 1d still high & ( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) ) # current 4h red, previous 4h long green, 1h & 4h overbought & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.08) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_max_3_4h"] < 70.0) ) # current 1d red, 1d & 4h downtrend, 15m & 1h & 4h downmove & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 10.0) ) # current 4h red with top wick, 1h downtrend, 15m & 1h downmove, 4h & 1d still high & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) ) # current 1d green with top wick, 15m & 1h downtrend, 4h & 1d still high & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) ) # current 15m & 1h downtrend, 4h overbought & ((df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 70.0)) # current 1d red with top wick, previous 1d green with top wick, 1h & 4h & 1d still high, pump in last 6 days & ( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1d"].shift(288) < 0.04) | (df["top_wick_pct_1d"].shift(288) < 0.04) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_1d"] < 50.0) | (df["hl_pct_change_6_1d"] < 0.5) ) # 15m downtrend, 5m & 15m downmove, 1h & 4h downtrend, drop in last 6 days & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 15m downtrend, 15m stil high, 1d overbought & ( (df["not_downtrend_15m"]) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) ) # 15m downtrend, 15m stil high, 15m downmove, 1h & 4h overbought & ( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 6.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) ) # current 1d red, 1h downtrend, 15m downmove, 1h & 4h downtrend & ( (df["change_pct_1d"] > -0.12) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d green with top wick, current 4h red, 1h downtrend, 4h & 1d overbought & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.0) | (df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) ) # current 1d green with top witck, current 4h red, 4h overbought & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.01) | (df["rsi_14_max_3_4h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) ) # current 1d green with top wick, 15m downtrend, 15m downmove, 4h overbought & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) ) # 1h & 4h downtrend, 15m downmove, 4h * 1d still high, 1h downtrend, drop in last 48 hours & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_48_4h"] < (df["close"] * 1.4)) ) # current 1d long green, current 4h red, 1h downtrend, 4h & 1d overbought & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) # current 1d green with top wick, current 4h green, 15m & 1h & 4h still high & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_4h"] < 0.04) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.7) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) ) # current 1d red, 1h downtrend, 15m downmove, 1h & 1d still high & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < 0.25) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) ) # 1h downtrend, 15m & 1h downmove, 4h & 1d still high, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 5m & 15m & 1h & 4h downmove, 4h still high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 20.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 30.0) ) # 1h downtrend, 1h donwmove, 4h still high, 1d overbought & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) # 1h downtrend, 1d still high, strong pump in last 6 days & ((df["not_downtrend_1h"]) | (df["cti_20_1d"] < 0.5) | (df["hl_pct_change_6_1d"] < 3.0)) # current 5m red, 1h & 4h downtrend, 15m still high, 5m & 1h & 4h downmove, 1h downtrend & ( (df["change_pct"] > -0.02) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 20.0) | (df["ema_200_dec_48_1h"] == False) ) # 1d red, 1h downtrend, 15m & 1h & 4h still high & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) ) # current 1d red with top wick, previous 1d red, 14m downmove, 1h & 1d still high, pump in last 6 days & ( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1d"].shift(288) > -0.04) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.7) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["hl_pct_change_6_1d"] < 0.5) ) # current 1d red, 1h & 4h downtrend, 5m downmove, 15m still high, 4h downmove & ( (df["change_pct_1d"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_4h"] > 20.0) ) # current 4h red, 1h downtrend, 4m downmove, 15m & 1h & 4h * 1d still high, drop in last 6 days & ( (df["change_pct_4h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # current 1d long red, 5m downmove, 1h & 4h downtrend, drops in last 6 days & ( (df["change_pct_1d"] > -0.12) | (df["rsi_3"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.7)) ) # current 1d red, previous 1d long green, 4h overbought, 1d still high, pump in last 6 days & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_1d"].shift(288) < 0.12) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_max_3_4h"] < 70.0) | (df["rsi_14_1d"] < 60.0) | (df["hl_pct_change_6_1d"] < 0.5) ) # current 1d red, 1h downtrend, 15m & 1d still high, 1h downtrend & ( (df["change_pct_1d"] > -0.12) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # current 4h red, 1h & 4h downtrend, 15m & 1h & 4h downmove, 1d still high & ( (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 20.0) | (df["rsi_14_1d"] < 50.0) ) # current 1d red, previous 1d long green with long top wick, 1h donwtremd, 4h & 1d still high & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_1d"].shift(288) < 0.16) | (df["top_wick_pct_1d"].shift(288) < 0.16) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) ) # current 1d long green with long top wick, 15m downmove, 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 1h downtrend, drop in last 6 days & ( (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # current 1d green with top wick, 1h downtrend, 15m & 1h donwmove, 4h & 1d still high, 4h downtrend & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_24_4h"] == False) ) # 1h & 4h downtrend, 1h still high, 1h & 4h donwmove, 1d still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_1h"] < -0.7) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 26.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # 15m downtrend, 15m strong downmove, 1h & 4h high & ( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 6.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) ) # current 1d long red, 1h & 4h downtrend, 1h & 4h downmove & ( (df["change_pct_1d"] > -0.12) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 16.0) ) # current 1d red, 1d & 1h & 4h donwtrend, 5m downmove, 15m & 1d still high, 1h downtrend & ( (df["change_pct_1d"] > -0.04) | (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["rsi_14_15m"] < 26.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green with top wick, 1h & 4h & 1d still high, drop in last 6 days & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 15m & 1h & 4h downtrend, 15m & 1h & 4h downmove, 4h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 20.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m downtrend, 15m downmove, 1h & 4h high & ( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) ) # current 5m red, 5m strong downmove & ((df["change_pct"] > -0.03) | (df["rsi_3"] > 4.0)) # current 4h red, previous 4h green, 1h & 4h high, 4h downtrend & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) ) # current 1h red, 5m & 15 & 1h still high, 4h overbought, 4h downtrend & ( (df["change_pct_1h"] > -0.0) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 65.0) | (df["ema_200_dec_24_4h"] == False) ) # current 1d long green with long top wick, 4h red, 1h & 4h downtrend, 4h still high & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_4h"] < -0.0) ) # current 4h red with top wick, 1h downtrend, 15m downmove, 1h & 4h still high & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.06) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) ) # 5m downmove, 15m & 1h & 4h still high, drop in last 24 hours & ( (df["rsi_3"] > 6.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 50.0) | (df["high_max_24_1h"] < (df["close"] * 1.26)) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d high & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) ) # 1d very low, chance not finished drop, 1h & 4h & 1d downtrend & ( (df["cti_20_1d"] > -0.95) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green, previous 1d red with top wick, 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.06) | (df["change_pct_1d"].shift(288) > -0.04) | (df["top_wick_pct_1d"].shift(288) < 0.08) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # 5m downmove, 4h & 1d overbought, pump in last 6 days & ( (df["rsi_3"] > 10.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["hl_pct_change_6_1d"] < 0.5) ) # current 4h red, current 1h red, 15m downmove, 1h & 4h & 1d still high:w & ( (df["change_pct_4h"] > -0.03) | (df["change_pct_1h"] > -0.03) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) ) # current 1d long green, current 4h red, 1h downtrend, 15m downmove, 4h & 1d overbought & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # 1h downtred, 5m strong downmove, 15m & 4h & 1d stil high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 5.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) ) # 4h & 1h downtrend, 15m downmove, 1d overbought & ( (df["is_downtrend_3_4h"] == False) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) ) # current 4h red, current 1h red, 15m downmove, 1h & 4h still high & ( (df["change_pct_4h"] > -0.0) | (df["change_pct_1h"] > -0.0) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) ) # current 1d long top wick, current 4h red, current 1h red, 15m downmove, 1h & 4h still high, 1d overbought & ( (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.0) | (df["change_pct_1h"] > -0.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) ) # 15m downmove, 5m & 15m & 1h & 4h & 1d still high. 1h downtrend & ( (df["rsi_3_15m"] > 20.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green with top wick, current 4h red, 3 previous 4h green, 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["change_pct_4h"].shift(96) < 0.01) | (df["change_pct_4h"].shift(144) < 0.01) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # current 1d green with top wick, 1h downtrend, 15m & 1h downmove, 1h 4h still high, 4h & 1d downtrend & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 5m & 4h downmove, 1h & 4h downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_4h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m & 1h downtrend, 4h overbought & ((df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0)) # 1h downtrend, 15m downmove, 4h overbought & ((df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0)) # current 1d long green, 1h & 4h & 1d overbought & ( (df["change_pct_1d"] < 0.12) | (df["rsi_14_1h"] < 65.0) | (df["rsi_14_4h"] < 65.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) ) # current 4h long green with long top wick, 4h overbought, pump in last 24h & ( (df["change_pct_4h"] < 0.1) | (df["top_wick_pct_4h"] < 0.1) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["hl_pct_change_24_1h"] < 0.7) ) # 15m & 1h & 4h high, drop in last 2 hours & ( (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 50.0) | (df["close_max_24"] < (df["close"] * 1.08)) ) # current 4h red, 1h downtrend, 4h overbought & ( (df["change_pct_4h"] > -0.02) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) ) # 1h downtrend, 5m & 15m strong downmove, 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 60.0) ) # current 4h long red, 1h & 4h downtrend, 1h & 4h downmove, 4h downtrend & ( (df["change_pct_4h"] > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 26.0) | (df["ema_200_dec_24_4h"] == False) ) # current 1d green, 15m downmove, 1h & 4h still high, 1d overbought & ( (df["change_pct_1d"] < 0.08) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) ) # 4h downtrend, 15m & 1h & 4h still high, 1h & 4h downtrend, drop in last 2 hours & ( (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close_max_24"] < (df["close"] * 1.08)) ) # 15m & 4h downtrend, 4h strong down move, 4h very low, 1h & 4h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 16.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d long green, current 4h red, previous 4h red, 1h downtrend, 4h still high, 4h downtrend & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 15m & 1h downmove, 4h still high, 1d overbought & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) ) # 5m & 15m downmove, 4h overbought, 1d still high & ((df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 6.0) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_1d"] < 50.0)) # 1h downtrend, 15m & 1h downmove, 4h high & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) ) # current 4h red, 1h downtrend, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1h"] > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) ) # 15m & 1h & 4h downtrend, 5m & 4h strong downmove, 4h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_4h"] > 16.0) | (df["ema_200_dec_24_4h"] == False) ) # current 4h red, 4h downtrend, 15m & 4h downmove, 1d overbought & ( (df["change_pct_4h"] > -0.04) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_4h"] > 20.0) | (df["cti_20_1d"] < 0.7) ) # current 5m long red or green 4h downtrend, 1h still high, 1h downtrend & ( (abs(df["change_pct"]) < 0.05) | (df["not_downtrend_4h"]) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d long green, current 1h red, 1h still high, 1h downmove, 1h still high & ( (df["change_pct_1d"] < 0.26) | (df["change_pct_1h"] > -0.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_1d"] < 0.5) ) # current 1d long greem, 1h downtrend, 1h downmove, 1d still high & ((df["change_pct_1d"] < 0.26) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_1d"] < 0.5)) # current 5m red, current 4h red, 1h downtrend, 5m downmove, 1h still high, 1h downtrend & ( (df["change_pct_4h"] > -0.024) | (df["change_pct_4h"] > -0.0) | (df["is_downtrend_3_1h"] == False) | (df["rsi_3"] > 16.0) | (df["cti_20_1h"] < 0.8) | (df["ema_200_dec_48_1h"] == False) ) # current 1d red, 15m & 1h downtrend, 15m strong downmove, 1d still high, 1h downtrend & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 6.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) ) # current 4h green with long top wick, 1h still not low enough, 4h & 1d overbought & ( (df["change_pct_4h"] < 0.01) | (df["top_wick_pct_4h"] < 0.08) | (df["cti_20_1h"] < -0.7) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 60.0) ) # current 1d green with top wick, current 4h green with top wick, 15m & 1h downmove, 4h overbought & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) ) # 15m downmove, 4h & 1d overbought, 1d downtrend & ( (df["rsi_3_15m"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red, current 1h red, 1h & 4h downtrend, 1h & 4h downmove, 1h & 4h still not low enough & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_1h"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 26.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_4h"] < 36.0) ) # current 1d red, 1h downtrend, 5m & 1h downmove, 4 h stil high, 1d overbought & ( (df["change_pct_1d"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) ) # current 4h red, current 1h red, 1h & 4h downtrend, 1h & 4h strong downmove & ( (df["change_pct_4h"] > -0.06) | (df["change_pct_1h"] > -0.03) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 6.0) | (df["rsi_3_4h"] > 10.0) ) # current 1d long red, 1h & 4h downtrend, 15m still high, 1h & 4h downmove, 1d high & ( (df["change_pct_1d"] > -0.12) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 30.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) ) # 1h & 4h downtrend, 15m downmove, 15m still higher, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.7)) ) # current 4h red with top wick, 1h & 4h downtrend, 5m downmove, 1h & 4h still high & ( (df["change_pct_4h"] > -0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 16.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) ) # 15m & 1h downtrend, 5m & 15m & 1h strong downmove & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 6.0) ) # current 4h top wick, 15m & 1h still higher, 4h overbought & ( (df["top_wick_pct_4h"] < 0.03) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.9) | (df["rsi_14_4h"] < 70.0) ) # current 1d long green, current 4h red, current 1h red, 1h downmove, 1h & 4h still high, 4h overbought & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.03) | (df["change_pct_1h"] > -0.03) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_max_6_4h"] < 70.0) ) # 4h downtrend, 5m & 4h downmove, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 20.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red, previous 4h green with top wick, 15m still high, 1h & 4h still high & ( (df["change_pct_4h"] > -0.03) | (df["change_pct_4h"].shift(48) < 0.03) | (df["top_wick_pct_4h"].shift(48) < 0.03) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) ) # current 1d green, 15m strong downmove, 1h & 4h still higher, 1d overbought & ( (df["change_pct_1d"] < 0.12) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 65.0) ) # 1h downtrend, 5m & 15m & 1h downmove, 4h still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_4h"] < 46.0) ) # current 1d red with top wick, 4h downtrend, 5m & 15m & 1h & 4h downmove, 15m & 1h & 4h still high & ( (df["change_pct_1d"] > -0.03) | (df["top_wick_pct_1d"] < 0.03) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 30.0) ) # 5m downmove, 15m & 1h & 4h & 1d high & ( (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_1d"] < 50.0) ) # 1h downtrend, 5m & 15m & 1h downmove, 1d overbought & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1d"] < 0.85) | (df["rsi_14_1d"] < 60.0) ) # current 1d green with top wick, 1h downmove, 1h still high, 4h & 1d overbought & ( (df["change_pct_1d"] < 0.03) | (df["top_wick_pct_1d"] < 0.03) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_max_3_4h"] < 70.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) # current 1d top wick, 4h downtrend, 15m downmove, 15m & 1h & 4h still high, 1d overbought & ( (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 28.0) | (df["cti_20_1h"] < -0.7) | (df["cti_20_4h"] < -0.7) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 60.0) ) # current 1d green, 15m downmove, 1h still high, 4h & 1d overbought, drop in last 2 hours & ( (df["change_pct_1d"] < 0.04) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close_max_24"] < (df["close"] * 1.08)) ) # 1h downtrend, 5m & 15m & 1h strong downmove, 4h still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 5m downmove, 15m & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # 15m downtrend, 14m & 1h downmove, 1h & 4h & 1d still high & ( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 60.0) ) # current 1d bot & top wick, 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["bot_wick_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) ) # 1d downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 1h downtrend & ( (df["is_downtrend_3_1d"] == False) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 5m downmove, 15m & 1h & 4h & 1d stil high, drop in last 2 days, pump in last 6 days & ( (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.8) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["high_max_48_1h"] < (df["close"] * 1.26)) | (df["hl_pct_change_6_1d"] < 0.7) ) # current 1d top wick, 1h downtrend, 5m & 15m downmove, 1h & 4h still high, 4h downtrend & ( (df["top_wick_pct_1d"] < 0.1) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] > 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) ) # current 1d green with top wick, 5m & 15m downmove, 1h still high, 1h downtrend & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) ) # 1d downtrend, current 1d red, 5m & 15m & 4h downmove, 1h downtrend & ( (df["is_downtrend_3_1d"] == False) | (df["change_pct_1d"] > -0.08) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_4h"] > 12.0) | (df["ema_200_dec_48_1h"] == False) ) # current 4h green, current 1h red, 5m & 15m downmove, 15m 1h & 1d still high, 4h overbought & ( (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 46.0) ) # current 4h green, 1h downtrend, 5m & 15m & 1h strong downmove, 1h downtrend & ( (df["change_pct_4h"] < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green, current 4h & 1h red, 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 65.0) ) # current 4h & 1h red, 1h downtrend, 5m downmove, 15m & 1h & 4h & 1d still high, 1h downtrend, drop in last 6 days & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 30.0) | (df["rsi_14"] > 36.0) | (df["rsi_14_15m"] < 26.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.4)) ) # current 4h green, current 1h red, 1h downtrend, 15m & 1h & 4h still high & ( (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.7) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) ) # current 4h top wick, 5m & 15m downmove, 1h & 4h still high, drop in last 6 days & ( (df["top_wick_pct_4h"] < 0.04) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["high_max_6_1d"] < (df["close"] * 1.7)) ) # current 4h green, current 1h red, 5m downmove, 15m & 1h & 4h still high & ( (df["change_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 20.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.7) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) ) # current 4h long green, current 1h red, 15m & 1h & 4h still high & ( (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) ) # current 1h downtrend, 15m downmove, 15m & 1h & 4h still high, drop in last 2 hours & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.0) | (df["rsi_14_4h"] < 50.0) | (df["close_max_24"] < (df["close"] * 1.08)) ) # 15m & 1h & 4h downtrend, 15m & 1h & 4h downmove, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # current 4h red, 15m downtrend, 15m & 1h downmove, 4h overbought & ( (df["change_pct_4h"] > -0.03) | (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 16.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) ) # 5m & 15m downmove, 15m & 1h still high & ( (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) ) # current 1d green with top wick, 5m downmove, 15m & 1h & 4h still high & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) ) # current 4h red, current 1h red, 1h downtrend, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 36.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) ) # 15m downtrend, 15m strong downmove, 1h & 4h stil high & ( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 8.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) ) # current 1h red, 15m & 1h overbought, drop in last 6 days & ( (df["change_pct_1h"] > -0.01) | (df["cti_20_15m"] < 0.7) | (df["rsi_14_15m"] < 50.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 15m & 4h downtrend, 5m & 15m strong downmove, 4h still high, 4h downtrend, drop in the last 24 hours & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 12.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["high_max_24_1h"] < (df["close"] * 1.2)) ) # 5m strong downmove, 15m & 1h & 4h & 1d high & ( (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # 1h & 4h downtrend, 5m & 1h & 4h downmove, drop in last 48 hours & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["high_max_48_1h"] < (df["close"] * 1.4)) ) # current 1h red, 5m & 15m downmove, 15m still high, 1h & 4h downtrend, drop in last 6 days & ( (df["change_pct_1h"] > -0.03) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.4)) ) # current 4h green, current 1h red, 15m strong downmove, 1h & 4h still high & ( (df["change_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_15m"] > 6.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) ) # current 1h long red, 1h downtrend, 1h strong downmove, 1h & 4h downtrend & ( (df["change_pct_1h"] > -0.08) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1h long red, 1h downtrend, 4h overbought & ((df["change_pct_1h"] > -0.08) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0)) # 5m & 15m downmove, 15m & 1h & 4h downtrend, drop in last 6 days & ( (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 10.0) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # current 1h top wick, 5m downmove, 1h & 4h still high, 1h & 4h downtrend & ( (df["top_wick_pct_1h"] < 0.04) | (df["rsi_3"] > 16.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d long green with long top wick, current 4h red, 15m downmove, 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.01) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # current 4h green with top wick, 1h downtrend, 15m still high, 1h downmove, 1h & 4h still high & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 36.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) ) # current 1d red, 15m & 1h & 4h still high, pump in last 6 days, drop in last 6 days & ( (df["change_pct_1d"] > -0.08) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["hl_pct_change_6_1d"] < 0.7) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 5m & 15m downmove, 15m still high, 1h overbought, 4h stil high & ( (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) ) # 5h downtrend, 4h strong downmove, pump in last 6 days, drop in last 6 days & ( (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 10.0) | (df["hl_pct_change_6_1d"] < 0.7) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 15m strong downmove, 1h & 4h high, 1h & 4h & 1d downtrend & ( (df["rsi_3_15m"] > 12.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 15m & 1h downmove, 1h & 4h still high, 1d overbought & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) ) # 15m downmove, 15m & 1h & 4h & 1d still high, 1h downtrend, pump in last 24 hours, drop in last 4 hours & ( (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["hl_pct_change_12_1h"] < 0.24) | (df["close_max_48"] < (df["close"] * 1.08)) ) # current 1d long top wick, 5m & 15m strong downmove, 4h & 1d downtrend & ( (df["top_wick_pct_1d"] < 0.16) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 6.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h green with top wick, 1h downtrend, 5m & 15m downmove, 4h still high, 1d downtrend & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 1h downtrend, 15m downmove, 15m & 4h still high, 1d overbought, drop in last 2 days & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["high_max_48_1h"] < (df["close"] * 1.24)) ) # 1h & 4h downtrend, 1h downmove, 1h & 4h still high, 1d overbought & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 30.0) | (df["cti_20_1d"] < 0.9) | (df["rsi_14_1d"] < 70.0) ) # 1h downtrend, 15m & 1h strong downmove, 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 10.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 1h & 4h very down, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, previous 1d green with top wick, 15m downmove, 1h & 4h & 1d still high, drop in last 48 hours & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.04) | (df["top_wick_pct_1d"].shift(288) < 0.04) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["high_max_48_1h"] < (df["close"] * 1.2)) ) # 1h downtrend, 5m & 15m & 1h downmove, 1h & 4h & 1d still high, drop in last 48 hours & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["high_max_48_1h"] < (df["close"] * 1.3)) ) # current 4h long green, 5m & 15m downmove, 1h & 4h very down, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.08) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green with top wick, 1h downtrend, 5m & 1h downmove, 1h very down, 4h stil high, 1h downtrend & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 12.0) | (df["r_480_1h"] > -85.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green with top wick, current 4h red with top wick, 1h downtrend, 1h downmove, 4h still high, 1h downtrend & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_4h"] > -0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 12.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green with top wick, 1h & 4h downtrend, 5m & 15m & 1h downmove, 4h & 1d stil high & ( (df["change_pct_1d"] < 0.03) | (df["top_wick_pct_1d"] < 0.03) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) ) # 15m strond downmove, 1h & 4h & 1d high, 1h downtrend & ( (df["rsi_3_15m"] > 12.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 15m downmove, 15m & 1h & 4h & 1d high, drop in last 6 hours & ( (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["high_max_6_1h"] < (df["close"] * 1.2)) ) # current 4h red, previous 4h long green with long top wick, current 1h red, 10 downmove, 15m & 1h & 4h high & ( (df["change_pct_4h"] > -0.0) | (df["change_pct_4h"].shift(48) < 0.12) | (df["top_wick_pct_4h"].shift(48) < 0.12) | (df["change_pct_1h"] > -0.0) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 65.0) ) # 1h downtrend, 1h strong downmove, 4h still high, 1d overbought & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 8.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.9) | (df["rsi_14_1d"] < 60.0) ) # current 4h red, previous 4h top wick, 1h & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] > -0.03) | (df["top_wick_pct_4h"].shift(48) < 0.04) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["rsi_14_max_3_4h"] < 70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red, 5m & 15m downmove, 4h high, 1d overbought & ( (df["change_pct_4h"] > -0.03) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) ) # 1d & 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 1d overbought, drop in last 6 days & ( (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["high_max_6_1d"] < (df["close"] * 1.26)) ) # current 1d green, 15m strong downmove, 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.08) | (df["rsi_3_15m"] > 4.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) ) # current 1d green, current 4h red, 1h & 3h downmove, 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.03) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) ) # 15m & 1h downtrend, 5m & 15m & 1h downmove, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 1h downtrend, 15m & 1h downmove, 15m still high, 1h & 4h very low, 1h & 4h & 1d downtrend, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 30.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 15m & 1h & 4h downtrend, 5m & 15m downmove, 1h & 4h very low, 4h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 12.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 15m & 1h & 4h downmove, 1d high, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # current 1d long green, 1h downtrend, 1h downmove, 4h & 1d high & ( (df["change_pct_1d"] < 0.12) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 1d downtrend, drop in last 6 days & ( (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 1h downtrend, 5m downmove, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 5m & 15m & 1h & 4h downmove, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] > 36.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 16.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.24)) ) # current 4h green with top wick, 5m downmove, 15m & 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d long red, 5m & 15m downmove, 1h & 4h still high, drop in last 6 days & ( (df["change_pct_1d"] > -0.08) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["high_max_6_1d"] < (df["close"] * 1.24)) ) # 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # 15m downtrend, 5m & 15m strong downmove, 1h still high, 1h downtrend & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 1h downmove, 1h still high, 4h overbought, 4h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 65.0) | (df["ema_200_dec_24_4h"] == False) ) # 5m & 15m strong downmove, 1h & 4h still high, 1d overbought & ( (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 70.0) ) # 4h downtrend, 5m downmove, 15m & 1h still high, 4h downmove, 1h downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_3_4h"] > 16.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d red, 1h & 4h downtrend, 15m & 1h & 4h downmove, 1h & 4h & 1d still high, drop in last 48 hours & ( (df["change_pct_1d"] > -0.0) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["high_max_48_1h"] < (df["close"] * 1.26)) ) # 5m & 15m strong downmove, 1h & 4h downtrend & ( (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 4.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m downtrend, 5m & 15m strong downtrend, 1h & 4h still high & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) ) # 1h & 4h downtrend, 5m & 15m & 1h downmove, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m downtrend, 5m downmove, 15m & 1h & 4h still high, 4h downtrend & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) ) # current 1d long top wick, 1h & 4h still high, 1h & 4h very low, 1h & 4h & 1d downtrend & ( (df["top_wick_pct_1d"] < 0.12) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -85.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m downtrend, 5m & 15m & 1h downmove, 1h & 4h & 1d still high, 1h & 4h downtrend & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 1d downtrend, 15, & 1h downmove, 1h & 4h & 1d still high & ( (df["is_downtrend_3_1d"] == False) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) ) # current 1d long green, 5m & 15m downmove, 1h & 4h & 1d still high, 1h downtrend & ( (df["change_pct_1d"] < 0.16) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 15m downtrend, 5m & 15m downmove, 1d still high, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.3)) ) # 1h downtrend, 15m & 1h downmove, 1h & 4h still high, 4h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 5m & 15m & 1h downmove, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.7)) ) # 1h downtrend, 5m & 15m & 1h downmove, 4h still high, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 15m & 1h & 4h downmove, 1h & 4h & 1h downtrend, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 26.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_6_1d"] < (df["close"] * 1.5)) ) # 15m downtrend, 5m & 15m downmove, 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m & 1h downmove, 1h & 4h & 1d high, 1d downtrend & ( (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) # 1d & 1h downtrend, 15m & 1h downmove, 1h & 4h & 1d still high & ( (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) ) # 1h & 4h & 1d still high, 1d downtrend, big drop in last 12 days & ( (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 65.0) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_12_1d"] < (df["close"] * 2.5)) ) # 1h & 4h downtrend, 1d still high, big drop in last 12 days & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["high_max_12_1d"] < (df["close"] * 5.0)) ) # current 1d red, 1h downtrend, 5m & 15h downmove, 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) ) # current 4h green with top wick, 5m & 15m downmove, 1h & 4h high, 1h downtrend & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.08) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 5m & 15m strong downmove, 1h & 4h downtrend, drop in last 12 days & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 12.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["high_max_12_1d"] < (df["close"] * 1.9)) ) # 4h downtrend, 5m & 15m downmove, 1h & 4h very low, 1h & 4h & 1d downtrend, drop in last 12 days & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -85.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_12_1d"] < (df["close"] * 1.5)) ) # current 4h top wick, 5m & 15m downmove, 1h & 4h high, 4h & 1d downtrend & ( (df["top_wick_pct_4h"] < 0.06) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 4h downtrend, 5m & 15m downmove, 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 16.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtreend, 1h & 4h downmove, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 16.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -85.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, 1h & 4h downtrend, 15m downmove, 1h & 4h love, 1h & 4h & 1d downtrend & ( (df["change_pct_1d"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 26.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -85.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 1h & 4h downmove, 1h & 4h low, 1h & 4h * 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, current 4h red, previous 4h green, 15m downtrend, 5m & 15m downmove, 1h & 4h & 1d still high, 1d downtrend & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.06) | (df["not_downtrend_15m"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 1h & 4h still high, 4h low, 1h & 4h & 1d downtrend & ( (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 1h downmove, 4h still high, 1h & 4h low, 1h & 4h & 1d downtrend, drop in last 12 days & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_12_1d"] < (df["close"] * 1.7)) ) # current 4h green, 5m downmove, 1h & 4h still high, 4h low, 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.06) | (df["rsi_3"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green with top wick, 15m downtrend, 5m & 15m downmove, 1h & 4h stil high, 4h & 1d downtrend & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_15m"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d & 1hdowntrend, 5m & 15m & 1h downmove, 1h & 4h & 1d downtrend, drop in last 12 days & ( (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 26.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_12_1d"] < (df["close"] * 1.4)) ) # 4h downtrend, 5m & 4h downmove, 1h & 4h very low, 1h downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_1h"] > -97.0) | (df["r_480_4h"] > -97.0) | (df["ema_200_dec_48_1h"] == False) ) # current & previous 4h red, 2nd previous 4h long green, 1h % 4h high, 1d downtrend & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) > -0.01) | (df["change_pct_4h"].shift(96) < 0.16) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red, previous 4h green, 5m & 15m downmove, 1d overbought & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) ) # 1h downtrend, 5m & 15m & 1h downmove, 4h very low, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 20.0) | (df["r_480_4h"] > -97.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 1h downtrend, 5m & 15m downmove, 5h still high, 1d overbought & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) # current 4h long green, 5m strong downmove, 1h overbought, 4h still high & ( (df["change_pct_4h"] < 0.08) | (df["rsi_3"] > 4.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) ) # currend 1h red, current 4h top wick, current 1h red, 1h downtrend, 5m & 15m & 1h downmove, 4h & 1d still high & ( (df["change_pct_1d"] > -0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # current 1d green with top wick, current 4h red, 1h downtrend, 5m & 1h downmove, 4h stil high, 4h & 1d downmove & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.03) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 5m & 15m downmove, 1h stil high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green with top wick, current 4h red, previous 4h green with top wick, 1h downtrend, 4h overbought, 1d downtrend & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.04) | (df["top_wick_pct_4h"].shift(48) < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_14_max_3_4h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 5m & 15m & 1h & 4h downmove, 1d stil high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_1h"] > 12.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_1d"] < 46.0) ) # current 4h red, 15m & 1h & 4h & 1d still high, big drop in last 6 days & ( (df["change_pct_4h"] > -0.06) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["high_max_6_1d"] < (df["close"] * 4.0)) ) # current 1d red, previous 1d green with top wick, 5m & 15m downmove, 15m still high, 1d overbought & ( (df["change_pct_1d"] > -0.08) | (df["change_pct_1d"].shift(288) < 0.03) | (df["top_wick_pct_1d"].shift(288) < 0.03) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_1d"].shift(288) < 65.0) | (df["hl_pct_change_6_1d"] < 0.5) ) # 5m & 15m downmove, 1h & 4h & 1d still high, 1d downtrend, pump in last 6 days & ( (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.7) ) # current 1d long green, 5m strong downmove, 15m & 1h & 1d still high, 1d overbought, pump in last 12 days & ( (df["change_pct_1d"] < 0.18) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["high_max_12_1d"] < (df["close"] * 0.9)) ) # 1h downtrend, 5m downmove, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -85.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 15m & 1h & 4h downmove, 4h very low, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_4h"] > 36.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 1h downmove, 15m still high, 1h & 4h low, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 40.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, 5m downmove, 15m still high, 1h & 4h & 1d downtrend & ( (df["change_pct_1d"] > -0.08) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 1d downmove, 15m still high, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14_15m"] < 46.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 1h & 4h downmove, 15m stil high, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 1h downtrend, 5m & 15m downmove, 15m & 4h & 1d still high, 1h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d stil high, 1d downtrend & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < -0.8) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) # current 4h green with top wick, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # current 4h red with top wick, 5m & 1h downmove, 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3"] > 16.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 5m & 15m & 1h downmove, 1h & 4h & 1d still high, 1h * 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 30.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, previous 1d green, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) < 0.03) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 1h downmove, 15m & 1h & 4h & 1d still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # 4m & 15m downmove,15m & 1h & 4h & 1d still high & ( (df["rsi_3"] > 26.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.8) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) ) # 1h downtrend, 5m & 15m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) ) # 5m downmove, 15m 1h & 4h still high, 1h & 4h downtrend & ( (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 5m & 15m & 1h downmove, 1h & 4h & 1d still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 16.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.8) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 5m & 15m & 1h & 4h downmove, 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.8) | (df["rsi_14_4h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) ) # 1d top wick, 1h downtrend, 5m & 15m & 1h downmove, 1h & 4h & 1d still high, 1h downtrend & ( (df["top_wick_pct_1d"] < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 30.0) | (df["rsi_14_1d"] < 30.0) | (df["ema_200_dec_48_1h"] == False) ) # 5m & 1d downmove, 15m & 1h & 4h still high, 1h & 4h very low, 1h & 4h downtrend & ( (df["rsi_3"] > 10.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 36.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 1h & 4h downtrend, 5m & 15m & 1h & 4h downmove, 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 5m & 4h downmove, 15m & 1h & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, previous 1d green, 15m & 1h & 4h downtrend, 1d still high, 1h downtrend & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) < 0.03) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 5m & 1h downmove, 15m & 1h & 1d stil high, 1h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 30.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 44.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m % 15m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 50.0) ) # 1h & 4d downtrend, 5m & 15h & 1h downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 16.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m downtrend, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["rsi_3"] > 30.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 30.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d long green, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["change_pct_1d"] < 0.16) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h * 1d still high & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) ) # 1h & 4h downtrend, 5m & 1h & 4h downmove, 15m still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["ema_200_dec_48_1h"] == False) ) # 1h & 1d downtrend, 5m & 1d downmove, 15m still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["rsi_3_1d"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.6) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h green with top wick, 5m & 1d downmove, 15m & 1h still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_3"] > 20.0) | (df["rsi_3_1d"] > 10.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) ) # 1h & 4h & 1d downtrend, 5, & 1h & 1d downmove, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_1d"] > 16.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m & 1h downmove, 1h & 4h still high, 1h & 4h downtrend & ( (df["rsi_3"] > 10.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 5m downmove, 15m & 4h still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 1h & 4h still high, 4h & 1d downtrend & ( (df["rsi_3"] > 16.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green with top wick, 5m downmove, 15m still high, 1h & 4h downtrend & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["rsi_3"] > 12.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["rsi_14_15m"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 1h & 4h downtrend, 5m & 15m & 4h downmove, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_4h"] > 16.0) | (df["ema_200_dec_48_1h"] == False) ) # 1h & 4h downtrend, 5m & 15m & 1h & 4h downmove & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 10.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 30.0) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["rsi_3"] > 10.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 5m downmove, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 5m red, 5m & 15m downmove, 15m & 1d still high, 1h downtrend & ( (df["change_pct"] > -0.018) | (df["rsi_3"] > 10.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # current 4h red, 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.03) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 50.0) ) # 1h & 1d downtrend, 5m & 15m downmove, 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["r_480_4h"] > -85.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h & 1d downtrend, 5m & 15m & 1d downmove, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1d"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 1h downmove, 15m & 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 26.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_4_1d"] == False) ) # 4h & 1d downtrend, 5m & 15m & 1d downmove, 15m still high, 1h & dh downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1d"] > 16.0) | (df["rsi_14_15m"] < 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green, 5m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.06) | (df["rsi_3"] > 10.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 46.0) ) # 1h & 4h & 1d downtrend, 15m & 4h & 1d downmove, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d downtrend, 5m & 15m & 1d downmove, 15m sitll high, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 1h downtrend & ( (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # 4h & 1d downtrend, 15m & 1h & 4h still high, 5m low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green with top wick, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["change_pct_1d"] < 0.02) | (df["top_wick_pct_1d"] < 0.02) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 15m downmove, 15m & 4h & 1d still high, pump in last 6 days & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["hl_pct_change_6_1d"] < 0.7) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h green with top wick, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1h downtrend & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 15m downmove, 15m & 1h & 4h & 1d still high, 4h downtrend & ( (df["rsi_3_15m"] > 26.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_24_4h"] == False) ) # 5m downmove, 15m & 1h & 4h & 1d still high, 1h downtrend & ( (df["rsi_3"] > 30.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 50.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 1d red with top wick, previous 1d green, 1h downtrend, 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.01) | (df["top_wick_pct_1d"] < 0.02) | (df["change_pct_1d"].shift(288) < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) ) # 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["rsi_3"] > 26.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) ) # current 1d green, current 4h green, current 1h green, 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.04) | (df["change_pct_4h"] < 0.04) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] > 30.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) # current 1d green with top wick, current 4h red, 5m & 15m downmove, 1h & 4h & 1d high, 1d downtrend & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.01) | (df["rsi_3"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_3_4h"] < 70.0) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.01) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) ) # current 1d green with top wick, 15m downmove, 15m & 1h & 4h & 1d still high, drop in last 12 days & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["high_max_12_1d"] < (df["close"] * 0.9)) ) # 15m & 1d downtrend, 5m & 15m & 1d downmove, 15m & 1h & 4h still high & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1d"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) ) # current 1d red with top wick, previous 1d green, 1d downtrend, 5m downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["change_pct_1d"] > -0.02) | (df["top_wick_pct_1d"] < 0.02) | (df["change_pct_1d"].shift(288) < 0.04) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 1d downtrend & ( (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red with top wick, previous 1d green, 4h downtrend, 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.02) | (df["top_wick_pct_1d"] < 0.02) | (df["change_pct_1d"].shift(288) < 0.02) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.7) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.7) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) ) # 1d downtrend, 15m & 1h & 1d still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1d"]) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 36.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red with top wick, previous 1d green, 5m downmove, 15m & 1h & 4h & 1d stil high, 4h & 1d downtrend & ( (df["change_pct_1d"] > -0.02) | (df["top_wick_pct_1d"] < 0.02) | (df["change_pct_1d"].shift(288) < 0.02) | (df["rsi_3"] > 36.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green with top wick, 5m downmove, 15m & 1h & 4h still high, 1d overbought & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["rsi_3"] > 36.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) ) # current 4h red, previous 4h green, 15m downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.02) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 4h & 1d downtrend, 5m & 15m & 1d downmove, 1h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1d"] > 26.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red, 15m downmove, 15m & 1h & 4h & 1d still high, 4h downtrend & ( (df["change_pct_4h"] > -0.01) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_24_4h"] == False) ) # 1d downtrend, 5m & 15m downmove, 15m & 1h still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m downmove, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["rsi_3"] > 36.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h green with top wick, 1h & 4h & 1d high & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["cti_20_1h"] < 0.7) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["bb20_2_low_15m"]) ) # 15m downtrend, 5m & 15m downmove, 15m & 1h & 4d & 1d still high & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) ) # current 1d red, 15m & 1d downtrend, 1d downmove, 15m & 1h high, 1h downtrend & ( (df["change_pct_1d"] > -0.02) | (df["not_downtrend_15m"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1d"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.7) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 1d red, current 4h green, 15m downmove, 15m & 1h & 1d high & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_4h"] < 0.02) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 60.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) ) # current 1d green, 1h & 4h downtrend, 4h downmove, 15m & 1d still high & ( (df["change_pct_1d"] < 0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1d"] < 50.0) ) # current 1d green, current 4h green, 15m & 1h & 4h & 1d still high, pump in last 3 days & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_4h"] < 0.08) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["hl_pct_change_3_1d"] < 0.7) ) # current 4h green, 5m downmove, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.02) | (df["rsi_3"] > 26.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d downtrend, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["is_downtrend_3_1d"] == False) | (df["rsi_14_15m"] < 50.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1h green, 15m downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 24h downtrend & ( (df["change_pct_1h"] < 0.0) | (df["not_downtrend_15m"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) ) # cuerrent 5m red, previous 5m green, 15m downmove, 15m & 1h & 4h still high, 1h downtrend & ( (df["change_pct"] > -0.016) | (df["change_pct"].shift(1) < 0.016) | (df["rsi_3_15m"] > 36.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 36.0) | (df["ema_200_dec_48_1h"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 4h downtrend & ( (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_24_4h"] == False) ) # 15m & 1h & 4h high, 1h & 4h & 1d downtrend & ( (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 46.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d downtrend, 5m downmove, 15m & 1h & 4h & 1h still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 36.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1h green, 15m downmove, 15m & 1h & 4h & 1d high & ( (df["change_pct_1h"] < 0.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) ) # current 1d top wick, 4h downtrend, 15m & 1h & 4h & 1d high, 4h downtrend, 1d downtrend & ( (df["top_wick_pct_1d"] < 0.08) | (df["is_downtrend_3_4h"] == False) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m downmove, 15m & 1h & 4h high, 1h downtrend & ( (df["rsi_3"] > 30.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) ) # 15m downtrend, 15m downmove, 15m & 1h & 4h high & ( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0) ) # current 1d red, previous 1d green with top wick, current 4h green, current 1h green, 15m downmove, 15m & 1h & 4h & 1d syill high, 4h & 1d downtrend & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.02) | (df["top_wick_pct_1d"].shift(288) < 0.02) | (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] < 0.01) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 1h downtrend, 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) ) # 4h & 1d downtrend, 5m & 4h & 1d downmove, 15m still high, 1h & 4h low, 1h & 4h & 1d & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_3_1d"] > 36.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 40.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h & 1d downtrend, 5m & 4h & 1d downmove, 5m & 15m & 1d still high, 1h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 30.0) | (df["cti_20"] < -0.5) | (df["rsi_14"] < 33.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red, 1d downtrend, 5m & 1d downmove, 15m & 4h still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_1d"] > 12.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) ) # current 1d green with top wick, 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) ) # current 4h red, previous 4h green, 5m & 15m downmove, 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["rsi_14"] < 12.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrendm 5m & 15m & 1h downmove, 15m & 1h & 4h & 1d still high, 5m & 15m downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) ) # 1d & 1h downtrend, 5m downmove, 15m & 1h & 1d still high, 5m & 15m downtrend & ( (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) ) # current 4h top wick, 15m downmove, 15m & 1h & 4h & 1d still high, drop in last 12 days & ( (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3_15m"] > 50.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 60.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] < df["res_hlevel_1h"]) | (df["high_max_12_1d"] < (df["close"] * 0.9)) ) # 1h downtrend, 5m & 1h downmove, 15m & 1h & 4h still high, 4h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 5m & 15m & 1h downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_4_1d"] == False) ) # 4h & 1d downtrend, 5m & 15m & 1h downmove, 15m & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_1d"] < 36.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d high, pump in last 12 days & ( (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 36.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.9) | (df["rsi_14_1d"] < 70.0) ) # 5m downmove, 15m & 1h & 4h & 1d still high, 4h downtrend & ( (df["rsi_3"] > 10.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_24_4h"] == False) ) # current 4h green with top wick, 1d downtrend, 5m downmove, 15m & 1h & 4h stil high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 26.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 15m downmove, 15m & 1h & 4h & 1d still high, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 5m & 15h & 1d downmove, 15m & 1h still high, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, 15m downmove, 1h & 1d high, 1h downtrend & ( (df["change_pct_1d"] > -0.04) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 70.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # current 4m red, 4h downtrend, 5m & 4h downmove, 1d stil high, 1h & 4h downtrend & ( (df["change_pct"] > -0.018) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_4h"] > 20.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 4h red, previous 4h green, 5m downmove, 15m & 1h & 4h & 1d high & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.02) | (df["rsi_3"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) ) # 1h & 4h & 1d downtrend, 5m & 15m & 1d downmove, 1d stil high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1d"] > 20.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 4h green with top wick, 15m downmove, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.01) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 15m downmove, 15m & 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h & 1d downtrend, 5m & 4h downmove, 15m still high, 4h low, 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_4h"] > 20.0) | (df["rsi_14_15m"] < 46.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d & 4h green with top wick, 5m downmove, 15m & 1h & 4h & 1d high & ( (df["change_pct_1d"] < 0.02) | (df["top_wick_pct_1d"] < 0.02) | (df["change_pct_4h"] < 0.01) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 46.0) ) # current & previous 1d red, 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.0) | (df["change_pct_1d"].shift(288) > -0.08) | (df["rsi_3"] > 12.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) ) # current 4h top wick, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["top_wick_pct_4h"] < 0.06) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_4_1d"] == False) ) # current 4h red with top wick, 15m & 1h & 4h & 1d still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] > -0.01) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1h downtrend, drop in last 12 days & ( (df["change_pct_1d"] < 0.06) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.8)) ) # 1h downtrend, 5m & 1h downmove, 15m & 1h & 4h & 1d still high, 5m & 15m downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) ) # current 1d red, 15m & 1h & 4h downtrend, 5m & 15m & 4h downmove, 1d still high, 5m & 15m downtrend & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) ) # current 4h green, current 1h red, 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.04) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) ) # current 4h & current 1h green, 15m downmove, 15m & 1h & 4h still high, 1h & 4h downtrend & ( (df["change_pct_4h"] < 0.04) | (df["change_pct_1h"] < 0.01) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1h red, 5m downmove, 15m & 1h & 4h high & ( (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] < df["res_hlevel_1h"]) ) # current 4h red, 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) ) # current 1d green, 1h downtrend, 5m & 15m downmove, 4h & 1d overbought & ( (df["change_pct_1d"] < 0.06) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) ) # 15m & 1h & 4h downtrend, 15m downmove, 15m still high, 1d overbought, 1h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1d downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 1h & 4h downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m & 1h & 4h & 1d downtrend, 15m downmove, 15m & 1h & 4h & 1d still high, 1h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 30.0) | (df["rsi_14_1d"] < 30.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, 1d downtrend, 5m downmove, 15m still high, 1h & 4h downtrend & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 36.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m & 4h & 1d downtrend, 5m & 15m & 4h & 1d downmove, 1d still high, 1h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_4h"] > 20.0) | (df["rsi_3_1d"] > 20.0) | (df["cti_20_1d"] < -0.7) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 1d top wick, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["top_wick_pct_1d"] < 0.02) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) ) # 15m & 1h & 1d downtrend, 15m & 1h & 1d downmove, 1h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_1d"] > 26.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 1d red, 5m & 15m downmove, 1h & 4h & 1d still high, 1h downtrend & ( (df["change_pct_1d"] > -0.02) | (df["rsi_3"] > 36.0) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 4h green, 5m & 15m downmove, 15m & 1h & 4h & 1d high, pump in last 6 days & ( (df["change_pct_4h"] < 0.04) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 70.0) | (df["hl_pct_change_6_1d"] < 0.9) ) # current 1d red with top wick, 1h downtrend, 5m & 1h downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_4_1d"] == False) ) # 4h & 1d downtrend, 5m downmove, 15m & 1h & 4h & 1d still high, 4h & 1d downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 36.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, 4h downtrend, 5m & 15m & 1d downmove, 1h & 1d high, 1h downtrend & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1d"] > 20.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 5m downmove, 15m & 1h & 4h still high, 4h low, 1h & 1d downtrend & ( (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 5m downmove, 15m & 1h & 4h still high, 1h & 4h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d green, 1h downtrend, 15m & 1h downmove, 1h & 4h & 1d stil high, 4h low & ( (df["change_pct_1d"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["bb20_2_low_15m"]) ) # 1h & 4h & 1d downtrend, 1d downmove, 15m & 1h & 1d still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # 4h & 1d downtrend, 5m & 15m downmove, 15m & 1h still high, 1h & 4d downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_4h"] > 16.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d red, 5m & 15m downmove, 15m & 1h & 4h high & ( (df["change_pct_1d"] > -0.12) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 36.0) | (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) ) # current 1d & 4h red, 4h & 1d downtrend, 5m & 1h & 4h & 1d downmove, 1h downtrend & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] > -0.08) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_3_1d"] > 16.0) | (df["ema_200_dec_48_1h"] == False) ) # previous 5m red, 1d downtrend, 5m & 15m & 4h & 1d downmove, 1h low, 1h & 4h downtrend & ( (df["change_pct"].shift(1) > -0.02) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_4h"] > 36.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 4h green, current 1h red, 15m & 1h & 4h still high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.04) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1d"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 15m downmove, 1d still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 4h green with top wick, current 1d top wick, 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["top_wick_pct_1d"] < 0.06) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.7) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) ) # current 4h top wick, 15m & 1d downmove, 15m & 1h & 4h still high, 1h & 4h * 1d downtrend & ( (df["top_wick_pct_4h"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 5m red, 1h & 1d downtrend, 5m downmove, 15m & 1h & 4h & 1d stil high & ( (df["change_pct"] > -0.02) | (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_1d"] < 36.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) ) # 15m & 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 5m & 15m & 4h & 1d downmove, 1d high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 30.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 5m & 15m downmove, 1h & 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_4_1d"] == False) ) # current 4h green with top wick, 5m & 15m downmove, 15m & 1h & 4h high, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 5m & 1h & 4h downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 36.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 36.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) ) # current 1d green, 1h downtrend, 15m downmove, 1h & 4h & 1d high & ( (df["change_pct_1d"] < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["r_480_4h"] < -20.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d green, 5m & 15m downmove, 1h & 4h & 1d high, 1h downtrend & ( (df["change_pct_1d"] < 0.04) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green, 5m downmove, 5m & 1h & 4h & 1d high & ( (df["change_pct_1d"] < 0.04) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) ) # 1h downtrend, 1h & 4h downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 1h & 4h & 1d downtrend, 5m & 1h dowmove, 15m stil high, 1h & 4h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 5m & 15m downmove, 1d still high, 1d downtrend & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 4.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 15m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 15m downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 4h downtrend & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) # current 1d red, previous 1d green, 1h downtrend, 15m & 1h & 4h still high, 4h downtrend & ( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) < 0.12) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 15m & 1h & 4h downmove, 4h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 8.0) | (df["rsi_3_4h"] > 26.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) ) # 5m & 1h downmove, 1h & 4h & 1d high & ( (df["rsi_3"] > 10.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 1d downtrend, 5m & 15m & 1d downmove, 15m still high, 1h & 4h downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1d"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1h red, previous 1h green, 15m downmove, 1h & 4h high, 1h downtrend & ( (df["change_pct_1h"] > -0.06) | (df["change_pct_1h"].shift(12) < 0.06) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) ) # current 1d green with top wick, 5m downmove, 15m & 1h & 4h stil high, 4h low, 1h & 4h downtrend & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["rsi_3"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 1h & 4h & 1d downtrend, 5m & 1h downmove, 15m & 1h still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 1h & 4h red, 1h & 4h downtrend, 15m & 1h & 4h downmove, 1d stil high & ( (df["change_pct_1h"] > -0.04) | (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 4h downtrend, 5m & 15m & 1h & 4h downmove, 1d still high, 5m low, 5m & 15m downtrend, drop in last 12 hours & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["close"] > (df["high_max_12_1h"] * 0.86)) ) # 1h & 1d downtrend, 5m & 15m & 1d downmove, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1d"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green, current 4h red, 1h downtrend, 1h downmove, 5m & 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.04) | (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 33.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) ) # 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 4h downtrend, 4h & 1d downmove, 15m & 1d still high, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 26.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.6)) ) # current 4h red, 1h downtrend, 1h dowmove, 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 46.0) ) # current 4h green with top wick, 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.08) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 70.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 46.0) ) # 1h & 4h downtrend, 1h & 4h downmove, 4h & 1d stil high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d green, current 1h red, 15m & 1h & 4h & 1d still high, 4h high & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 65.0) | (df["r_480_4h"] < -16.0) ) # 1h & 4h & 1d downtrend, 15m & 1h & 4h & 1d downmove, 15m still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 5m & 15m downmove, 1h & 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) ) # 4h & 1d downtrend, 15m downmove, 15m & 1h & 4h & 1d still high, 1h & 4h downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m & 1d downtrend, 15m & 1d downmove, 1h high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1d"] > 10.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d long green, 1h downtrend, 15m & 1h downmove, 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.26) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d red, 15m downtrend, 15m downmove, 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.04) | (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 8.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h & 4h & 1d downtrend, 1h & 1d downmove, 5m & 15m still high, 5h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m downmove, 15m & 1h & 4h & 1d high & ( (df["rsi_3_15m"] > 26.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) ) # current 1d red, 1h & 4h downtrend, 1h & 4h downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) ) # 1h downtrend, 1h downmove, 5m & 15m & 1h & 4h & 1d still high, 4h high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -20.0) ) # current 4h red, previous 4h green, 15m & 1h downtrend, 15m & 1h downmove, 4h high, 1h downtrend & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.04) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 12.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # 5m & 15m downmove, 15m & 1h & 4h & 1d high & ( (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h & 4h downtrend, 1h & 4h downmove, 1h & 4h & 1d stil high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 36.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 5m & 15m downmove, 1h & 4h & 1d still high, 5m low, 1h downtrend & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["r_480"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 4h green, 1h downtrend, 15m & 1h downmove, 1h & 4h & 1d still high & ( (df["change_pct_4h"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 1h downtrend, 1h downmove, 5m & 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d green, 1h downtrend, 1h downmove, 1h & 4h still high, 4h & 1d downtrend & ( (df["change_pct_1d"] < 0.12) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 12.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 4h green, 15m downmove, 15m & 1h & 4h still high, 4h low, 1h & 4h & 1d downtrend & ( (df["change_pct_4h"] < 0.02) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green with top wick, 1h downmove, 15m & 1h & 4h & 1d still high, drop in last 6 days & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_6_1d"] * 0.8)) ) # 15m & 1h & 4h downtrend, 15m & 1h & 4h downmove, 1h downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 4.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # 4h & 1d downtrend, 5m downmove, 15m & 1h & 4h & 1d still high, 4h downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 5m downmove, 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h downtrend, 15m & 1h downmove, 4h & 1d stil high, 5m low & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["r_480"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h downtrend 15m & 1h downmove, 4h & 1d still high, 4h low, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green, 15m & 1h downmove, 5m & 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["change_pct_1d"] < 0.04) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 15m & 1h & 4h & 1d downmove, 1d still high, 5m & 15m & 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h & 1d downtrend, 15m & 1h & 4h & 1d downmove, 1h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 10.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h & 1d downtrend, 15m & 1h & 4h & 1d downmove, 1d still high, 5m & 15m & 1h downtrend, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_3_1d"] > 20.0) | (df["cti_20_1d"] < -0.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24"] == False) | (df["ema_200_dec_24_15m"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.6)) ) # current 4h red, previous 4h greem, 1h downtrend, 15m & 1h downmove, 1h & 4h & 1d still high, drop in last 6 days & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.75)) ) # 1h downtrend, 15m & 1h & 4h downmove, 1h & 4h & 1d still high, 1d downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) ) # 15m & 4h downtrend, 5m & 15m & 1h & 4h downmove, 4h & 1d still high & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 20.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d green with top wick, 1h downtrend, 1h downmove, 5m & 15m & 1h & 4h & 1d still high, 5m downtrend & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_24"] == False) ) # 1d downtrend, 5m & 15m & 1h & 4h & 1d still high, 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 30.0) | (df["rsi_14_1d"] < 30.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d red, previous 1d green, 1h & 4h downmove, 15m & 4h &1d still high & ( (df["change_pct_1d"] > -0.08) | (df["change_pct_1d"].shift(288) < 0.12) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 15m & 1h & 1d downtrend, 15m & 1h & 6h downmove & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_1d"] > 6.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h & 1d downtrend, 1d downmove, 15m stil high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1d"] > 6.0) | (df["rsi_14_15m"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # current 1d red with top wick, 1h & 4h downtrend, 15m & 1d downmove, 15m & 1h & 4h & 1d still high, 1h downtrend & ( (df["change_pct_1d"] > -0.01) | (df["top_wick_pct_1d"] < 0.02) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1d"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 1d red, current 4h red, previous 4h green, 5m & 15m & 1h & 4h downmove, 1h & 4h & 1d stil high & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) ) # 1h & 1d downtrend, 15m & 1h & 1d downmove, 4h low, 1h & 4h & 1d dowqntrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_1d"] > 16.0) | (df["r_480_4h"] > -90.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_1d"] < 36.0) | (df["close"] > df["sup_level_4h"]) ) # current 1d green with top wick, current 4h red, 5m & 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.02) | (df["top_wick_pct_1d"] < 0.02) | (df["change_pct_4h"] > -0.01) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d red, previous 1d green, 15m downmove, 5m & 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.12) | (df["change_pct_1d"].shift(288) < 0.12) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14"] < 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 1h downtrend, 5m & 15m downmove, 15m & 1d high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 4.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 4h green, current 1h red, 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] > -0.00) | (df["rsi_3"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d green, current 4h top wick, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, pump in last 6 days, drop in last 6 days & ( (df["change_pct_1d"] < 0.24) | (df["top_wick_pct_4h"] < 0.08) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["hl_pct_change_6_1d"] < 0.9) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) # 1h & 4h & 1d downtrend, 5m & 15m downmove, 1h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["rsi_14"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["r_480_1h"] > -75.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d green with top wick, current 1h red, previous 1h greem, 15m & 1h & 4h & 1d stil high & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.03) | (df["change_pct_1h"].shift(12) < 0.03) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d green with top wick, previous 4h red, 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 4h downtrend & ( (df["change_pct_1d"] < 0.03) | (df["top_wick_pct_1d"] < 0.03) | (df["change_pct_4h"].shift(48) > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrendm 5m & 1hm & 1h & 4h downmove, 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_1h"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h & 1d downtrendm 1h & 1d downmove, 5m & 15m & 1h & 4h satill high, 4h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m downmove, 5m & 1h & 4h & 1d still high, 4h low, 4h & 1d downtrend & ( (df["rsi_3_15m"] > 20.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < -0.5) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h & 1d downtrend, 1h & 4h & 1d downmove, 1h & 4h low, 1h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 16.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1d green, current 1h red, 15m & 1h downmove, 15m & 1h & 4h & 1d still high, 1d downtrend & ( (df["change_pct_1d"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_15m"] > 40.0) | (df["rsi_3_1h"] > 40.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 65.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 5m downmove, 15m & 1h still high, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 5m downmove, 15m & 1h & 4h & 1d still high, 4h high & ( (df["rsi_3"] > 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d red, 4h & 1d downtrend, 15m & 1d downmove, 5m & still high, 4h low, drop in last 6 days & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1d"] > 36.0) | (df["rsi_14"] < 26.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_6_1d"] * 0.75)) ) # current 1d red, previous 1d green, 15m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) < 0.08) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["sup_level_1h"]) ) # current 1d red, previous 1d green, 1h downtrend, 5m & 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_1d"].shift(288) < 0.06) | (df["not_downtrend_1h"]) | (df["rsi_14"] < 33.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 1h downtrend, 1h downmove, 5m & 15m & 1h & 4h & 1d stil high, 4h high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["bb20_2_low_15m"]) ) # 15m & 1h downtrend, 15m & 1h downmove, 5m & 15m & 1h & 4h still high, 4h & 1d downtrend & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 10.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 1d downtrend, 1d downmove, 5m & 15m & 1d still high, 1h low, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_3_1d"] > 30.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -75.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) # 1h & 1d downtrend, 15m & 1h & 1d downmove, 1h & 4h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_1d"] > 10.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 5m downmove, 15m & 1h & 4h still high, 4h love, 1h downtrend & ( (df["rsi_3"] > 4.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 1h downmove, 15m & 1h & 4h stil high, 4h low, 4h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) # current 4h green with top wick, 1d downtrend, 15m & 1d downmove, 5m & 15m & 1h & 4h still high, 1h downtrend & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1d"] > 10.0) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) ) # 1d downtrend, 5m & 15m & 1d downmove, 1h still high, 1h low, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1d"] > 20.0) | (df["rsi_14_1h"] < 36.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.75)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14"] < 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_24_4h"] == False) ) # current 4h green, 1d downtrend, 15m & 1h & 4h still high, 1h & 4h downtrend & ( (df["change_pct_4h"] < 0.03) | (df["not_downtrend_1d"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["r_14_1h"] < -20.0) | (df["r_14_4h"] < -20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m downtrend, 15m downmove, 5m & 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 5m downmove, 15m & 1h & 4h & 1d high & ( (df["rsi_3"] > 10.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) ) # current 4h red, previous 4h green, 5m & 1h downmove, 15m & 1h & 4h & 1d still high, drop in last 6 days & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["rsi_3"] > 12.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) # current 1d top wick, 1h downtrend, 5m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 5m & 15m downmove, 15m & 1h & 4h still high, 4h low, 1h downtrend & ( (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # 5m & 15m downmove, 1h & 4h & 1d still high, 1h high & ( (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["r_480_1h"] < -30.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h downtrend, 5m downmove, 15m & 1h still high, 1h low, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 36.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # 1h & 4h downtrend, 5m & 15m & 4h downmove, 15m & 1h & 4h still high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 30.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # 4h & 1d downtrend, 5m & 4h & 1d downmove, 1h downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 6.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # curent 1d red, previous 1d green, 1h downtrend, 15m & 1h & 4h downmove, 4h still high & ( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) < 0.06) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) # 1h downtrend, 1h downmove, 15m & 1h & 4h & 1d still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 12.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["ema_200_dec_48_1h"] == False) ) # 1d downtrend, 15m & 1d downmove, 15m & 1h & 4h still high, 1h downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1d"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 36.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # current 1h red, previous 1h red, 5m & 15m & 1h & 4h still high, 1h & 4h downtrend & ( (df["change_pct_1h"] > -0.04) | (df["change_pct_1h"].shift(12) < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 1d red, previous 1d green, current 4h green, 1h downtrend, 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_1d"].shift(288) < 0.01) | (df["change_pct_4h"] < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 4h downtrend, 15m & 4h & 1d downmove, 1h & 1d still high, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_4h"] > 20.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) # 1d downtrend, 1d downmove, 15m & 1h & 4h still high, 4h low, 1h & 4h downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3_1d"] > 30.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 4h red with top wick, 1h downtrend, 1h downmove, 15m & 1h & 4h & 1d stil high, 1d downtrend, drop in last 6 days & ( (df["change_pct_4h"] > -0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 36.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.60)) ) # current 1d green, 15m & 1g downmove, 1h & 4h still high, 1h & 4h downtrend & ( (df["change_pct_1d"] < 0.06) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 15m downmove, 1h & 4h & 1d high, 1h & 4h high & ( (df["rsi_3_15m"] > 40.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -20.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["bb20_2_low_15m"]) ) # 4h downtrend, 5m downmove, 15m & 1h & 4h & 1d still high, 1h downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # 1h downtrend, 5m & 15m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > 36.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) ) # 1h downtrend, 5m downmove, 5m & 15m & 1h still high, 1h low, 1h downtrend & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) # 1h & 4h downtrend, 5m & h downmove, 15m & 1h & 4h & 1d stil high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # current 1d red, previous 1d green, 1h & 4h downtrend, 15m & 1h downmove, 15m & 1n & 4h & 1d still high & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) < 0.02) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_4h"]) ) # 1h downtrend, 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 5m & 15m & 1h downmove, 5m & 1h & 4h & 1d still high, 1d downtrend & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 1h downmove, 1h & 4h & 1d still high, 1h & 4h high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) ) # 1h & 4h downtrend, 5m & 15m & 1h & 4h downmove, 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h downtrend, 1h downmove, 5m & 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 12.0) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) ) # 1h & 1d downtrend, 15m & 1h downmove, 15m & 1h & 4h still high, 1h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # current 4h green, 1h downtrend, 15m & 1h downmove, 15m & 1h & 4h still high & ( (df["change_pct_4h"] < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) ) # 1h & 1d downtrend, 15m & 1h downmove, 5m & 15m & 1h & 4h still high, 1h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["ema_200_dec_48_1h"] == False) ) # current 4h red, previous 4h green, 1h downtrend, 1h downmove, 5m & 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.03) | (df["change_pct_4h"].shift(48) < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 46.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) ) # 1h & 1d downtrend, 1h & 4h & 1d downmove, 15m still high, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_3_1d"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 5m & 1h & 4h & 1d still high, drop in last 6 days & ( (df["rsi_14"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 0.9) ) # 1h & 1d downtrend, 5m & 1h downmove, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # current 1h red with top wick, 1h downtrend, 15m & 1h downmove, 5m & 15m & 1h & 4h still high, 1h downtrend & ( (df["change_pct_1h"] > -0.01) | (df["top_wick_pct_1h"] < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) ) # 4h downtrend, 4h downmove, 5m & 15m & 1h & 4h & 1d still high, 1h high & ( (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -30.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h & qd downtrend, 5m & 15m & 1h downmove, 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 5m & 15m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) ) # current 1d red, current 4h green, 1d downtrend, 15m downmove, 15m & 1h still high, 1h downtrend, drop in last 6 days & ( (df["change_pct_1d"] > -0.06) | (df["change_pct_4h"] < 0.06) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.85)) ) # 5m downmove, 5m & 15m & 1h & 4h & 1d still high, pump in last 6 days & ( (df["rsi_3"] > 26.0) | (df["rsi_14"] < 30.0) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 0.5) ) # 1h & 4h & 1d downtrend, 5m & 15m & 1h downmove, 4h low, 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h & 1d still high, pump in last 6 days & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["hl_pct_change_6_1d"] < 0.8) ) # 15m & 1h downmove, 5m & 15m & 1h & 4h & 1d still high, 1h & 4h high & ( (df["rsi_3_15m"] > 40.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -15.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) ) # current 4h red, previous 4h green, 5m & 1hm downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.00) | (df["change_pct_4h"].shift(48) < 0.00) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # current & previous 1h red, 5m & 15m downmove, 15m & 1h & 4h still high, 4h high & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) > -0.01) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] < -30.0) ) # current 1h red, previous 1h green, 5m & 15m downmove, 5m & 15m still high, 1h pumped & ( (df["change_pct_1h"] > -0.02) | (df["change_pct_1h"].shift(12) < 0.02) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_1h"].shift(12) < 70.0) ) # current 4h green, current 1h red, 15m & 1h downmove, 4h & 1d still high, 4h high & ( (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 60.0) | (df["r_480_4h"] < -5.0) ) # 1h downtrend, 1h downmove, 4h & 1d still high, 4h high & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 60.0) | (df["r_480_4h"] < -5.0) ) # 1h downtrend, 1h downmove, 15m & 1h & 4h & 1d stil high, 4h high, pump in last 6 days & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["hl_pct_change_6_1d"] < 0.9) ) # current 4h red, previous 4h green, current 1h red, 15m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["change_pct_1h"] > -0.02) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["bb20_2_low_15m"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_4h"]) ) # current 1d red, current 1h red, previous 1h green, 5m & 15m downmove, 15m & 1h & 1d still high, 1d downtrend & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1h"] > -0.02) | (df["change_pct_1h"].shift(12) < 0.02) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_1d"] < 46.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) # 1h & 4h & 1d downtrend, 1h & 1d downmove, 1h low, 1h & 4h downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_1d"] > 26.0) | (df["r_480_1h"] > -95.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 4h downtrend, 5m & 15m downtrend, 1h & 4h still high, 1h & 4h downtrend & ( (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1h"] < 36.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # 1h downtrend, 15m & 1h downmove, 15m & 1h & 4h & 1d still high, 4h high & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -30.0) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) ) df["global_protections_long_pump"] = ( ((df["change_pct_4h"] < 0.12) | (df["top_wick_pct_4h"] < 0.12) | (df["rsi_14_1h"] < 70.0)) & ((df["change_pct_1h"] > -0.04) | (df["change_pct_1h"].shift(12) < 0.04) | (df["cti_20_4h"] < 0.8)) & ((df["change_pct_4h"] > -0.08) | (df["change_pct_4h"].shift(48) < 0.08) | (df["rsi_14_4h"].shift(48) < 70.0)) & ( (df["change_pct_1h"] > -0.04) | (df["change_pct_1h"].shift(12) < 0.01) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"].shift(12) < 70.0) ) & ( (df["change_pct_1h"].shift(12) > -0.04) | (df["change_pct_1h"].shift(24) < 0.02) | (df["rsi_14_1h"].shift(24) < 70.0) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) > -0.02) | (df["not_downtrend_4h"]) | (df["cti_20_1d"] < 0.8) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["cti_20_4h"].shift(48) < 0.8) | (df["rsi_14_4h"].shift(48) < 80.0) ) & ((df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.12) | (df["rsi_14_1d"].shift(288) < 80.0)) & ( (df["change_pct_1h"] > -0.02) | (df["top_wick_pct_1h"] < 0.02) | (df["change_pct_1h"].shift(12) < 0.02) | (df["rsi_14_1h"].shift(12) < 80.0) ) & ( (df["change_pct_1h"] < 0.04) | (df["top_wick_pct_1h"] < 0.04) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 70.0) ) & ( (df["top_wick_pct_1d"] < 0.08) | (df["cti_20_1h"] < 0.7) | (df["cti_20_4h"] < 0.7) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) ) & ( (df["change_pct_1d"] < 0.18) | (df["top_wick_pct_1d"] < 0.18) | (df["top_wick_pct_4h"] < 0.08) | (df["cti_20_4h"] < 0.7) ) & ( (df["change_pct_4h"] > -0.12) | (df["change_pct_4h"].shift(48) < 0.02) | (df["cti_20_4h"].shift(48) < 0.5) | (df["rsi_14_4h"].shift(48) < 70.0) ) & ( (df["top_wick_pct_1d"] < 0.04) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -10.0) | (df["r_480_4h"] < -10.0) ) & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_4h"].shift(48) < 0.02) | (df["rsi_14_4h"].shift(48) < 80.0) ) & ( (df["change_pct_1d"] < 0.26) | (df["change_pct_4h"] > -0.10) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["rsi_14_1d"] < 70.0) ) & ( (df["change_pct_1d"] < 0.26) | (df["top_wick_pct_1d"] < 0.12) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 70.0) ) & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.01) | (df["top_wick_pct_4h"].shift(48) < 0.06) | (df["change_pct_1h"] > -0.04) | (df["rsi_14_4h"].shift(48) < 60.0) ) & ( (df["change_pct_1d"] > -0.12) | (df["change_pct_1d"].shift(288) < 0.32) | (df["top_wick_pct_1d"].shift(288) < 0.22) | (df["rsi_14_1d"].shift(288) < 70.0) ) & ( (df["change_pct_4h"] < 0.12) | (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.03) | (df["change_pct_1h"].shift(12) < 0.03) | (df["rsi_14_4h"] < 70.0) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"].shift(48) < 0.12) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_4h"] < -30.0) ) & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["top_wick_pct_1h"] < 0.02) | (df["rsi_3"] > 20.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) ) & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_1d"].shift(288) < 0.01) | (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.00) | (df["rsi_14_1d"].shift(288) < 70.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) ) & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.03) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 60.0) ) & ((df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_14_4h"].shift(48) < 80.0)) & ( (df["change_pct_1d"] < 0.30) | (df["top_wick_pct_4h"] < 0.06) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) & ( (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] < 0.02) | (df["top_wick_pct_1h"] < 0.02) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_4h"] < 60.0) ) & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 20.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_1d"].shift(288) > -0.04) | (df["top_wick_pct_1d"].shift(288) < 0.04) | (df["change_pct_1d"].shift(576) < 0.16) | (df["top_wick_pct_1d"].shift(576) < 0.08) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] > -0.00) | (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_1d"].shift(288) < 0.32) | (df["change_pct_4h"] > -0.00) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 70.0) ) & ( (df["change_pct_1d"] < 0.04) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 80.0) | (df["r_480_4h"] < -30.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) < 0.24) | (df["top_wick_pct_1d"].shift(288) < 0.24) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.01) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 65.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.20) | (df["top_wick_pct_1d"] < 0.20) | (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 60.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_4h"] > -0.04) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1d"] < 60.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.20) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_4h"].shift(48) > -0.02) | (df["change_pct_4h"].shift(96) > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1d"] < 50.0) ) & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_1h"] > -0.02) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["close"] > (df["high_max_6_1d"] * 0.60)) | (df["hl_pct_change_6_1d"] < 4.0) ) & ( (df["change_pct_1d"] < 0.32) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.02) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 60.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.12) | (df["top_wick_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) > -0.01) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.12) | (df["change_pct_1h"] > -0.03) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 60.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 80.0) | (df["r_480_4h"] < -10.0) ) & ( (df["change_pct_1d"] < 0.24) | (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_4h"] < 75.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.12) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_1h"] < 65.0) | (df["rsi_14_4h"] < 65.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -25.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.08) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["close"] > (df["high_max_6_1h"] * 0.88)) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_4h"] < 65.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.08) | (df["change_pct_1h"].shift(12) < 0.02) | (df["rsi_14_4h"] < 65.0) | (df["r_480_4h"] < -15.0) ) & ( (df["change_pct_1h"] > -0.10) | (df["change_pct_1h"].shift(12) < 0.03) | (df["top_wick_pct_1h"].shift(12) < 0.03) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["r_480_1h"].shift(12) < -25.0) ) & ( (df["is_downtrend_3_4h"] == False) | (df["change_pct_4h"] > -0.01) | (df["cti_20_dec_3_1h"] == False) | (df["cti_40_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_max_6_4h"] < 80.0) | (df["close"] > (df["high_max_12_1h"] * 0.80)) | (df["hl_pct_change_24_1h"] < 0.5) ) & ( (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 80.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -25.0) | (df["hl_pct_change_6_1d"] < 0.75) ) & ( (df["is_downtrend_3_4h"] == False) | (df["change_pct_4h"] > -0.01) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_max_6_4h"] < 70.0) | (df["close"] > (df["high_max_24_1h"] * 0.80)) | (df["hl_pct_change_48_1h"] < 0.5) ) & ( (df["change_pct_1d"] < 0.24) | (df["top_wick_pct_1d"] < 0.24) | (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_1d"] < 65.0) ) & ( (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) > -0.02) | (df["top_wick_pct_1h"].shift(24) < 0.08) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) ) & ( (df["change_pct_4h"] > -0.06) | (df["change_pct_4h"].shift(48) < 0.02) | (df["top_wick_pct_4h"].shift(48) < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_14_4h"].shift(48) < 65.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 70.0) ) & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 75.0) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["top_wick_pct_4h"].shift(48) < 0.02) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -25.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["cti_20_1d"] < 0.5) | (df["r_480_4h"] < -30.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["close"] > (df["high_max_24_1h"] * 0.85)) | (df["hl_pct_change_48_1h"] < 0.7) ) & ( (df["top_wick_pct_1d"] < 0.20) | (df["change_pct_4h"] < 0.08) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_1h"] > -0.01) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["is_downtrend_3_4h"] == False) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["close"] > (df["high_max_12_1h"] * 0.85)) | (df["hl_pct_change_48_1h"] < 0.6) ) & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 75.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 75.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] > -0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["change_pct_1h"] > -0.02) | (df["cti_20_1h"] < 0.5) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -25.0) ) & ( (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] < 0.16) | (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 60.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["change_pct_4h"].shift(48) < 0.16) | (df["top_wick_pct_4h"].shift(48) < 0.08) | (df["change_pct_1h"] > -0.02) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 65.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_1h"] > -0.01) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -25.0) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.01) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 70.0) | (df["rsi_14_max_6_4h"] < 75.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) > -0.04) | (df["change_pct_4h"].shift(96) < 0.04) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 75.0) | (df["r_480_1h"] < -15.0) | (df["r_480_4h"] < -25.0) ) & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_12_1h"] * 0.88)) ) & ( (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["hl_pct_change_6_1d"] < 1.2) ) & ( (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["close"] > (df["high_max_6_1d"] * 0.80)) | (df["hl_pct_change_6_1d"] < 1.2) ) & ( (df["change_pct_4h"] < 0.16) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.03) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 75.0) | (df["close"] < df["res_hlevel_1h"]) | (df["hl_pct_change_6_1d"] < 0.5) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -15.0) | (df["r_480_4h"] < -15.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.03) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -30.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_15m"] > 16.0) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"] < 70.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_48_1h"] < 0.7) ) & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_1h"] > -0.01) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["rsi_14_1d"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.05) | (df["change_pct_1h"] > -0.05) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -10.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_48_1h"] < 0.7) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.12) | (df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) < 0.02) | (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.16) | (df["change_pct_1h"] > -0.12) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -30.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.18) | (df["change_pct_1h"] > -0.01) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["is_downtrend_3_4h"] == False) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["hl_pct_change_6_1d"] < 1.0) ) & ( (df["change_pct_1d"] < 0.08) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_12_1h"] * 0.85)) ) & ( (df["change_pct_4h"] > -0.02) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["hl_pct_change_6_1d"] < 1.6) ) & ( (df["change_pct_4h"] < 0.16) | (df["change_pct_1h"] > -0.08) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -15.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 0.75) ) & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.01) | (df["rsi_3"] > 6.0) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_4h"] < 65.0) | (df["r_480_1h"] < -10.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 12.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["rsi_14_max_6_4h"] < 70.0) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -15.0) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) ) & ( (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -10.0) ) & ( (df["change_pct_4h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -35.0) | (df["hl_pct_change_6_1d"] < 1.0) ) & ( (df["change_pct_1d"] < 0.02) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_4h"] > -0.00) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_4h"].shift(48) < 0.02) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_4h"].shift(48) < 70.0) ) & ( (df["change_pct_1d"] < 0.10) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["top_wick_pct_4h"].shift(48) < 0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_4h"] > -0.0) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_4h"].shift(48) < 0.0) | (df["top_wick_pct_4h"].shift(48) < 0.04) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.26) | (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 70.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.16) | (df["top_wick_pct_4h"].shift(48) < 0.08) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 70.0) ) & ( (df["change_pct_1d"] < 0.24) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.06) | (df["top_wick_pct_4h"].shift(48) < 0.02) | (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 12.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["close"] > (df["high_max_48_1h"] * 0.80)) | (df["hl_pct_change_6_1d"] < 1.0) ) & ( (df["change_pct_1d"] < 0.24) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] > (df["high_max_48_1h"] * 0.85)) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.8) ) & ( (df["change_pct_1h"] < 0.06) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -10.0) | (df["r_480_4h"] < -15.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1h"] > -0.06) | (df["change_pct_1h"].shift(12) < 0.06) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -15.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 10.0) | (df["cti_20_15m"] < 0.9) | (df["rsi_14_15m"] < 80.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 80.0) | (df["r_480_1h"] < -35.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 4.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1h"] * 0.75)) | (df["hl_pct_change_6_1d"] < 1.0) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 8.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_4h"] < -25.0) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1h"] > -0.02) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_3_1h"] < 75.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] < -35.0) ) & ( (df["top_wick_pct_1d"] < 0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 65.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1d"] < 0.12) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] > -0.12) | (df["change_pct_1d"].shift(288) < 0.12) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_4h"] < -35.0) | (df["hl_pct_change_6_1d"] < 0.9) ) & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["hl_pct_change_6_1d"] < 0.9) ) & ( (df["change_pct_min_3_4h"] > -0.16) | (df["change_pct_max_3_4h"] < 0.36) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["close"] > (df["high_max_12_1h"] * 0.75)) | (df["hl_pct_change_24_1h"] < 0.5) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["close"] > (df["high_max_12_1h"] * 0.75)) | (df["hl_pct_change_24_1h"] < 0.5) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1d"] < 0.01) | (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 60.0) | (df["r_480_4h"] < -15.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.04) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_3_4h"] < 75.0) | (df["rsi_14_1d"] < 75.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -35.0) | (df["hl_pct_change_6_1d"] < 1.0) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.02) | (df["rsi_14_15m"] > 40.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_3_4h"] < 80.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (df["hl_pct_change_6_1d"] < 0.9) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 80.0) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -35.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.26) | (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -25.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.08) | (df["change_pct_4h"] < 0.08) | (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 75.0) | (df["r_480_4h"] < -25.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -20.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -20.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 65.0) | (df["rsi_14_max_3_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 8.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -40.0) | (df["r_480_4h"] < -25.0) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 70.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.02) | (df["change_pct_1h"].shift(12) < 0.02) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.02) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -35.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 8.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_4h"] < -25.0) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 65.0) | (df["r_480_1h"] < -30.0) | (df["ema_200_dec_24_4h"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.08) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 2.5) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.04) | (df["top_wick_pct_4h"] < 0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["top_wick_pct_4h"].shift(48) < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["is_downtrend_3_1h"] == False) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_max_6_1h"] < 80.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_4h"] < -35.0) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.08) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -25.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_14"] > 30.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 32.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -40.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_12_1d"] * 0.80)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -30.0) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 32.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -15.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["hl_pct_change_6_1d"] < 1.2) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 1.2) ) & ( (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.12) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["close"] > (df["high_max_12_1d"] * 0.70)) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_48_1h"] * 0.80)) | (df["hl_pct_change_6_1d"] < 1.2) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_4h"]) | (df["hl_pct_change_6_1d"] < 1.2) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_4h"]) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_4h"] < -35.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 65.0) | (df["r_480_1h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.02) | (df["top_wick_pct_1d"] < 0.02) | (df["change_pct_1h"] > -0.00) | (df["change_pct_1h"].shift(12) < 0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -20.0) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.04) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 65.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.03) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_4h"] < 0.08) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.04) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_48_1h"] * 0.80)) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_max_6_1h"] < 80.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -35.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.01) | (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.08) | (df["change_pct_1h"] > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 16.0) | (df["close"] > df["sup_level_1h"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.04) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 8.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] < 0.08) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 8.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -3.0) | (df["r_480_4h"] < -3.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] > (df["close_max_12"] * 0.92)) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_1h"] < -15.0) | (df["close"] > (df["close_max_24"] * 0.94)) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_1h"] < -30.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["hl_pct_change_6_1d"] < 0.9) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.02) | (df["top_wick_pct_1h"] < 0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.7) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1h"] > -0.14) | (df["change_pct_1h"].shift(12) < 0.14) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 46.0) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) < 0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_max_6_1h"] < 80.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -25.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 80.0) | (df["r_480_1h"] < -20.0) | (df["close"] < df["res_hlevel_4h"]) | (df["hl_pct_change_6_1d"] < 1.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -25.0) | (df["hl_pct_change_6_1d"] < 0.5) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] < 0.03) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 36.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["r_480_1h"] < -16.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 80.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] < 0.18) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 0.9) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 80.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["hl_pct_change_12_1h"] < 0.20) ) & ( (df["change_pct_1h"] > -0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -30.0) | (df["r_480_1h"] < -25.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.06) | (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.01) | (df["rsi_3_1h"] > 40.0) | (df["rsi_3_4h"] > 40.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_dec_3_1h"] == False) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_4h"].shift(48) < 65.0) | (df["rsi_14_1d"] < 50.0) | (df["cti_20_dec_3_1d"] == False) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["top_wick_pct_1h"] < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.04) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] < -35.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.03) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.85)) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -30.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["top_wick_pct_1h"] < 0.01) | (df["change_pct_1h"].shift(12) < 0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > (df["high_max_12_1d"] * 0.70)) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) < 0.16) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 46.0) | (df["r_14_1h"] > -90.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) < 0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["sma_200_dec_48_1h"] == False) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.9) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 65.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 20.0) | (df["r_14"] < -80.0) | (df["rsi_14"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 70.0) | (df["r_14_4h"] < -35.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 1.2) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["hl_pct_change_6_1d"] < 1.2) | (df["close"] > (df["high_max_6_1d"] * 0.55)) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_max_6_4h"] < 65.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["r_14_1h"] > -80.0) | (df["r_480_1h"] < -40.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] < 0.9) | (df["close"] > (df["high_max_24_1h"] * 0.86)) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -20.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1d"] < 0.12) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["hl_pct_change_6_1d"] < 1.9) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.7) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["cti_20_1d"] < 0.7) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 45.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["cti_20_1d"] < 0.8) | (df["r_480_1h"] < -40.0) | (df["r_480_4h"] < -20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.7) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 65.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_1h"] < 20.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 60.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14"] < 25.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -10.0) | (df["close"] < df["res_hlevel_1h"]) ) & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) > -0.03) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["cti_20_1d"] < 0.8) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.9) ) & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 15.0) | (df["rsi_3_4h"] > 15.0) | (df["rsi_14_4h"] < 30.0) | (df["rsi_14_max_6_4h"] < 65.0) | (df["rsi_14_1d"] < 40.0) | (df["rsi_14_max_6_1d"] < 65.0) | (df["r_14_1h"] > -90.0) | (df["r_14_4h"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) ) df["global_protections_long_dump"] = ( ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["not_downtrend_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.04) | (df["cti_20_4h"] < 0.7) | (df["ema_200_dec_24_4h"] == False) ) & ((df["change_pct_1d"] > -0.12) | (df["cti_20_1d"] < 0.7) | (df["ema_200_dec_48_1h"] == False)) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.04) | (df["change_pct_1h"].shift(12) < 0.04) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] > -0.10) | (df["not_downtrend_1d"]) | (df["r_480_1h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.55)) ) & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 16.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_1h"] > -0.04) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_4h"].shift(48) < 60.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1d"].shift(288) < 0.12) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_1d"].shift(288) < 60.0) ) & ( (df["change_pct_1h"] > -0.02) | (df["change_pct_1h"].shift(12) < 0.01) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["rsi_3"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 6.0) | (df["rsi_3_1d"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_4h"] < 0.04) | (df["rsi_3_15m"] > 26.0) | (df["r_480_4h"] < -15.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["close_max_24"] * 0.94)) ) & ( (df["change_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.04) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_4h"] > 26.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1h"] > -0.06) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 10.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] > -0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_1d"].shift(288) < 0.32) | (df["change_pct_4h"] < 0.04) | (df["change_pct_4h"].shift(288) < 0.04) | (df["close"] > df["sup_level_1d"]) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] > -0.06) | (df["change_pct_4h"].shift(48) < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["cti_20_4h"] < 0.7) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_1d"] > 6.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_1d"] > 16.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -95.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1d"] > 30.0) | (df["r_480_1h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.75)) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.12) | (df["top_wick_pct_1d"].shift(288) < 0.06) | (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) ) & ( (df["change_pct_1d"] > -0.06) | (df["change_pct_1h"] > -0.02) | (df["change_pct_1h"].shift(12) < 0.04) | (df["not_downtrend_1d"]) | (df["rsi_3_1d"] > 16.0) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["top_wick_pct_1d"] < 0.12) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) & ( (df["change_pct_1h"] > -0.02) | (df["not_downtrend_15m"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 26.0) | (df["cti_20_1h"] < 0.7) | (df["r_480_4h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] > -0.03) | (df["change_pct_4h"].shift(48) < 0.12) | (df["change_pct_1h"] > -0.03) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["r_14_4h"].shift(48) < -5.0) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.04) | (df["not_downtrend_1d"]) | (df["rsi_3_1d"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_4h"] < 0.04) | (df["change_pct_1h"] > -0.04) | (df["cti_20_1h"] < 0.8) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 65.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 35.0) | (df["rsi_14_15m"] > 35.0) | (df["rsi_3_1h"] > 26.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_1d"]) | (df["close"] > (df["high_max_6_1h"] * 0.80)) ) & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.60)) ) & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_4h"].shift(48) < 0.04) | (df["top_wick_pct_4h"].shift(48) < 0.04) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["is_downtrend_3_1h"] == False) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"].shift(48) < 65.0) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["top_wick_pct_4h"] < 0.08) | (df["not_downtrend_1h"]) | (df["is_downtrend_3_1h"] == False) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["rsi_3_1d"] > 40.0) | (df["rsi_14_max_6_1d"].shift(288) < 70.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_12_4h"] > df["ema_26_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1d"] > 40.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] > -0.02) | (df["not_downtrend_1h"]) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_12_1h"] > df["ema_26_1h"]) | (df["ema_12_4h"] > df["ema_26_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_12_1h"] > df["ema_26_1h"]) ) & ( (df["top_wick_pct_1d"] < 0.10) | (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.60)) ) & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1d"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] < 0.08) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 60.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["r_480_4h"] > -70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_24_1h"] < 0.5) ) & ( (df["change_pct_4h"] > -0.06) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_max_6_4h"] < 65.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["hl_pct_change_6_1d"] < 0.5) ) & ( (df["change_pct_4h"] < 0.01) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.00) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["top_wick_pct_4h"].shift(48) < 0.08) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_24_1h"] * 0.90)) | (df["hl_pct_change_6_1d"] < 0.8) ) & ( (df["change_pct_4h"] > -0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_4h"].shift(48) < 0.06) | (df["change_pct_1h"] > -0.01) | (df["cti_20_1d"] < 0.8) ) & ( (df["change_pct_1d"] < 0.12) | (df["is_downtrend_3_4h"] == False) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_12_1h"] * 0.90)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) & ( (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] > -0.06) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 16.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 46.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] < 0.16) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_1h"] > -0.06) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.75)) ) & ( (df["not_downtrend_1h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["hl_pct_change_6_1d"] > 0.2) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_4h"].shift(48) < 65.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.65)) ) & ( (df["change_pct_4h"] < 0.16) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.70)) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_48_1h"] < 0.50) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] < 0.12) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.03) | (df["change_pct_4h"].shift(48) < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.06) | (df["change_pct_4h"].shift(48) < 0.06) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1d"] < 0.10) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.65)) ) & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_6_1d"] * 0.65)) ) & ( (df["change_pct_1h"] > -0.06) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.75)) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 12.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_4h"] > -65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_4h"] < 0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 6.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] < 0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 10.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_15m"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["close"] > df["sup_level_1d"]) | (df["close"] > (df["high_max_6_1d"] * 0.65)) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) & ( (df["change_pct_4h"] > -0.12) | (df["change_pct_1h"] > -0.04) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_48_1h"] * 0.80)) ) & ( (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_48_1h"] * 0.80)) ) & ( (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 65.0) | (df["r_480_4h"] > -70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 20.0) | (df["rsi_3_1d"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.80) ) & ( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_1h"] > -0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] < 0.08) | (df["top_wick_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.06) | (df["top_wick_pct_4h"].shift(48) < 0.06) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.9) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) < 0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 8.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1d"] > -0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_1d"].shift(288) < 0.12) | (df["not_downtrend_1h"]) | (df["rsi_14_1d"].shift(288) < 70.0) | (df["r_480_1h"] > -70.0) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_24_4h"] == False) | (df["hl_pct_change_6_1d"] < 1.0) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 35.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_4h"] < -35.0) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.10) | (df["change_pct_4h"].shift(48) < 0.04) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_1h"] > 10.0) | (df["rsi_14_4h"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] < 0.04) | (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] > -0.01) | (df["top_wick_pct_1h"] < 0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["bb20_2_low_15m"]) | (df["close"] > df["bb20_2_low_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] > (df["high_max_12_1d"] * 0.70)) ) & ( (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["close"] > (df["high_max_6_1d"] * 0.75)) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 75.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 10.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["close"] > (df["high_max_12_1d"] * 0.60)) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.06) | (df["is_downtrend_3_1d"] == False) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.65)) ) & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_14_1h"] < 65.0) | (df["rsi_14_4h"] < 70.0) | (df["r_480_4h"] > -70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_4h"] > -0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["change_pct_4h"].shift(48) < 0.06) | (df["top_wick_pct_4h"].shift(48) < 0.06) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) ) & ( (df["change_pct_4h"] > -0.02) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.70)) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1d"]) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 12.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] < 0.26) | (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["change_pct_4h"] < 0.16) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["change_pct_4h"].shift(48) < 0.08) | (df["top_wick_pct_4h"].shift(48) < 0.08) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1d"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] < 0.03) | (df["top_wick_pct_4h"] < 0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.8) ) & ( (df["change_pct_4h"] > -0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["change_pct_4h"].shift(48) < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_4h"] > 16.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_4h"] > 20.0) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_4h"] > 16.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -85.0) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["r_480_1h"] < -40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_4h"] > -0.08) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] > 30.0) | (df["rsi_3_4h"] > 16.0) | (df["rsi_14_4h"] > 30.0) | (df["r_480_1h"] > -70.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 12.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] > -65.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] > -0.04) | (df["change_pct_1h"].shift(12) < 0.04) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] > -0.08) | (df["change_pct_4h"].shift(48) < 0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_max_6_1h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] > -0.08) | (df["top_wick_pct_1d"] < 0.08) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 46.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.70)) ) & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 16.0) | (df["r_480_4h"] > -65.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_4h"] > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_4h"] > 16.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] > -0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) & ( (df["change_pct_1d"] < 0.16) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.85)) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 36.0) | (df["r_480_1h"] > -65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.75)) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.60)) ) & ( (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -15.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 32.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.85)) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["r_480_1h"] > -65.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] > -65.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] > -0.06) | (df["is_downtrend_3_1d"] == False) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14"] < 32.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -65.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["rsi_14_max_6_1d"] < 65.0) | (df["r_480_1h"] > -65.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) & ( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.02) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_1h"] > -65.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["r_480_1h"] > -65.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] < 0.04) | (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.65)) ) & ( (df["change_pct_1d"] > -0.12) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.70)) | (df["hl_pct_change_6_1d"] < 1.2) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_4h"] > 20.0) | (df["r_480_1h"] > -90.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.50)) ) & ( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_4h"] > -0.02) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_24_4h"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.02) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] > -80.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 10.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 10.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 50.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_3_1d"] > 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -75.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_4h"] > -0.04) | (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 2.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.12) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct"].rolling(18).min() > -0.12) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_1d"] > -0.04) | (df["not_downtrend_4h"]) | (df["is_downtrend_3_4h"] == False) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_4h"] > 16.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_6_1d"] * 0.50)) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 68.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] > -0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_14_15m"] < 44.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 65.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["close"] > (df["high_max_6_1d"] * 0.70)) | (df["hl_pct_change_6_1d"] < 1.2) ) & ( (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_4h"] > 20.0) | (df["rsi_14_1d"] < 65.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.70)) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_4h"] < 0.03) | (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] > -0.06) | (df["change_pct_1h"] > -0.04) | (df["change_pct_1h"].shift(12) < 0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 36.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_6_1d"] * 0.70)) | (df["hl_pct_change_6_1d"] < 1.2) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_min_3_4h"] > -0.16) | (df["not_downtrend_1d"]) | (df["rsi_3_4h"] > 20.0) | (df["rsi_14_1h"] > 30.0) | (df["rsi_14_4h"] > 30.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_24_1h"] * 0.76)) ) & ( (df["change_pct_1d"] > -0.16) | (df["change_pct_1d"].shift(288) < 0.16) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_24_1h"] * 0.75)) | (df["hl_pct_change_6_1d"] < 0.9) ) & ( (df["change_pct_4h"] < 0.01) | (df["change_pct_4h"].shift(48) < 0.04) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -65.0) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_4h"] > -0.12) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_4h"] > 20.0) | (df["r_480_1h"] > -60.0) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 6.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_1h"] < 46.0) | (df["r_480_4h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | ((df["zlma_50_1h"].ne(0.0)) & (df["close"] > df["zlma_50_1h"])) | ((df["zlma_50_4h"].ne(0.0)) & (df["close"] > df["zlma_50_4h"])) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14_max_6_1d"] < 65.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_6_1d"] * 0.40)) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 2.0) | (df["rsi_3_4h"] > 16.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_3_1d"] > 30.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["sma_200_dec_48_1h"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["is_downtrend_3_1h"] == False) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_14_1h"] > -99.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] > -60.0) ) & ( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.80)) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 8.0) | (df["rsi_3_1h"] > 8.0) | (df["rsi_3_4h"] > 8.0) | (df["r_480_1h"] > -90.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["is_downtrend_3_4h"] == False) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 12.0) | (df["rsi_3_4h"] > 16.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1d"] > -0.01) | (df["top_wick_pct_1d"] < 0.08) | (df["change_pct_1d"].shift(288) < 0.20) | (df["change_pct_1h"] < 0.06) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] > -60.0) | (df["r_480_4h"] > -60.0) | (((df["close"] - df["low_min_6_1d"]) / df["low_min_6_1d"]) < (df["hl_pct_change_6_1d"] * 0.38)) ) & ( (df["change_pct_1d"] < 0.16) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["r_480_4h"] > -70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) & ( (df["change_pct_1d"] > -0.16) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_4h"] > 16.0) | (df["r_480_1h"] > -90.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > (df["high_max_48_1h"] * 0.70)) ) & ( (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 36.0) | (df["r_14"] < -80.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_14_1h"] < -60.0) | (df["r_14_4h"] < -25.0) | (df["r_480_1h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct"].rolling(6).min() > -0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14"] < 20.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_14_1h"] < -35.0) | (df["r_14_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_4h"] > -0.02) | (df["change_pct_4h"].shift(48) < 0.02) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 8.0) | (df["rsi_3_1h"] > 30.0) | (df["r_14"] < -95.0) | (df["rsi_14_4h"] < 40.0) | (df["r_14_1h"] < -95.0) | (df["r_14_4h"] < -95.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 26.0) | (df["r_14_1h"] < -95.0) | (df["r_14_4h"] < -95.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] > -0.10) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14"] < 25.0) | (df["rsi_14_15m"] < 30.0) | (df["r_14_1h"] < -95.0) | (df["r_14_4h"] < -95.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] > -0.10) | (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_14_1h"] < -80.0) | (df["r_14_4h"] < -80.0) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_14_1h"] < -80.0) | (df["r_14_4h"] < -80.0) | (df["r_480_1h"] > -70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["change_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["change_pct_1h"].shift(12) < 0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_4h"]) | (df["is_downtrend_3_4h"] == False) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_4h"] > 10.0) | (df["r_14_1h"] > -80.0) | (df["r_14_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_12_1h"] > df["ema_26_1h"]) ) & ( (df["change_pct_4h"] < 0.04) | (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 6.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct_1d"] < 0.20) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] > 30.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_4h"] < 0.8) | (df["r_480_1h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["sma_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 4.0) | (df["rsi_3_1h"] > 12.0) | (df["rsi_3_4h"] > 16.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1d"].shift(288) < 0.24) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -65.0) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_4h"] > 30.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -75.0) | (df["close"] > df["sup_level_4h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) > -0.02) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 30.0) | (df["rsi_14_1d"] < 30.0) | (df["r_480_1h"] > -75.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["r_14_1h"] > -95.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_1d"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) < 0.08) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["cti_20_1d"] < 0.8) | (df["r_480_1h"] < -40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -65.0) | (df["r_480_4h"] > -75.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["change_pct"].rolling(12).min() > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 16.0) | (df["rsi_3_4h"] > 26.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14"] < 15.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["r_14_1h"] > -90.0) | (df["r_14_4h"] > -75.0) | (df["close"] > df["sup_level_1h"]) ) & ( (df["change_pct_1d"] > -0.05) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 25.0) | (df["r_14_1h"] > -90.0) | (df["r_14_4h"] > -75.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) ) ) # Global protections df["protections_long_rebuy"] = ( # 1h & 4h downtrend, 15m & 1h & 4h downmove ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_4h"] > 20.0) ) # current 1d red, 5m & 15m downmove, 1h & 4h & 1d still high, pump in last 6 days & ( (df["change_pct_1d"] > -0.01) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["hl_pct_change_6_1d"] < 0.5) ) # 1h & 1d downtrend, 5m & 1h & 1d downmove, 1h downtrend, drop in last 6 days & ( (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_1d"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.75)) ) # 5m & 15m downmove, 15m & 4h & 1d still high, 5m low, 1d downtrend & ( (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 26.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480"] > -90.0) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 15m & 1h downmove, 15m & 4h & 1d still high & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 60.0) ) # 15m downtrend, 5m & 15m & 1h downmove, 5m & 15m & 1h & 4h & 1d still high & ( (df["not_downtrend_15m"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14"] < 30.0) | (df["rsi_14_15m"] < 33.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 36.0) | (df["close"] > df["bb20_2_low_15m"]) ) # current 1d red, previous 1d green, 5m downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) < 0.03) | (df["rsi_3"] > 12.0) | (df["rsi_14_15m"] < 46.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 46.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) ) # current 1d green, current 1h red, 5m downmove, 15m & 1h & 4h & 1d high & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["rsi_14_1d"] < 46.0) ) # current 1d green with top wick, current 1h red, 5m & 1h downmove, 15m & 1h & 4h & 1d still high & ( (df["change_pct_1d"] < 0.03) | (df["top_wick_pct_1d"] < 0.03) | (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) ) # 15m & 1h downtrend, 15m & 1h downmove, 1h & 4h & 1d still high & ( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) # 1h & 4h downtrend, 5m & 1h downmove, 15m & 1h still high, 1h & 4h low, 1h & 4h & 1d downtrend & ( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 36.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # 1h downtrend, 5m & 15m downmove, 15m & 1h & 4h still high, 1h low & ( (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 46.0) | (df["r_480_1h"] > -75.0) | (df["close"] > df["sup_level_1h"]) ) # 4h & 1d downtrend, 5m & 15m & 4h downmove, 1d downtrend & ( (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_4h"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) & ( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) & ( (df["change_pct_1h"] > -0.01) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_24_4h"] == False) ) ) df["protections_short_global"] = True df["global_protections_short_pump"] = ( ( (df["change_pct_4h"] < 0.04) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 96.0) | (df["rsi_3_15m"] < 90.0) | (df["r_480_1h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == True) | (df["hl_pct_change_6_1d"] < 0.5) ) & ( (df["change_pct_1h"] < 0.02) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 94.0) | (df["rsi_3_15m"] < 86.0) | (df["r_480_1h"] < -10.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == True) | (df["hl_pct_change_6_1d"] < 1.2) ) & ( (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.04) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 74.0) | (df["rsi_3_1h"] < 74.0) | (df["r_480_1h"] < -12.0) | (df["r_480_4h"] < -22.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] < 0.06) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 84.0) | (df["rsi_3_1h"] < 84.0) | (df["rsi_3_4h"] < 84.0) | (df["r_480_1h"] < -12.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1h"] < 0.10) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 78.0) | (df["rsi_3_1h"] < 90.0) | (df["r_480_1h"] < -16.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.7) ) & ( (df["change_pct_1h"] < 0.03) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 94.0) | (df["rsi_3_15m"] < 84.0) | (df["cti_20_1h"] > 0.5) | (df["cti_20_4h"] > 0.5) | (df["rsi_14_4h"] > 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.9) ) & ( (df["change_pct_1d"] < 0.12) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 92.0) | (df["rsi_3_15m"] < 90.0) | (df["rsi_14_1h"] > 64.0) | (df["rsi_14_4h"] > 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.9) ) & ( (df["change_pct_1d"] < 0.30) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 85.0) | (df["rsi_3_15m"] < 90.0) | (df["rsi_3_4h"] < 90.0) | (df["rsi_14_1h"] > 90.0) | (df["rsi_14_4h"] > 90.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] < 0.20) | (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] < 0.04) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3_1h"] < 90.0) | (df["rsi_3_4h"] < 90.0) | (df["rsi_3_1d"] < 90.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.04) | (df["change_pct_1h"] < 0.03) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] > 70.0) | (df["rsi_3_1h"] < 70.0) | (df["rsi_3_4h"] < 70.0) | (df["r_480_1h"] > -65.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] < 0.01) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] < 90.0) | (df["rsi_3_1h"] < 85.0) | (df["rsi_3_4h"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.01) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] < 80.0) | (df["rsi_3_1h"] < 70.0) | (df["rsi_14_1h"] > 55.0) | (df["rsi_14_4h"] > 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["hl_pct_change_6_1d"] < 1.9) ) & ( (df["change_pct_1d"] > -0.24) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 60.0) | (df["hl_pct_change_6_1d"] < 4.0) ) & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_1h"] < 0.01) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_3_1d"] < 80.0) | (df["rsi_14_1h"] > 70.0) | (df["rsi_14_4h"] > 80.0) | (df["close"] < df["res_hlevel_1h"]) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -20.0) ) & ( (df["change_pct_1d"] < 0.04) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 70.0) | (df["rsi_3_1d"] < 75.0) | (df["rsi_14_1h"] > 75.0) | (df["rsi_14_4h"] > 70.0) | (df["rsi_14_1d"] > 65.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.30) | (df["rsi_3"] < 75.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_3_1h"] < 70.0) | (df["rsi_3_4h"] < 90.0) | (df["rsi_3_1d"] < 90.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.02) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_3_1h"] < 70.0) | (df["rsi_14_1h"] > 60.0) | (df["rsi_14_4h"] > 60.0) | (df["rsi_14_1d"] > 65.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.04) | (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] < 0.01) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_3_1d"] < 75.0) | (df["rsi_14_15m"] > 65.0) | (df["rsi_14_1h"] > 50.0) | (df["rsi_14_4h"] > 50.0) | (df["r_480_4h"] < -35.0) ) & ( (df["change_pct_1d"] < 0.20) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 70.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_3_1d"] < 80.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 65.0) | (df["r_480_1h"] < -40.0) | (df["r_480_4h"] < -40.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["bot_wick_pct_1d"] < 0.20) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_14_1h"] > 70.0) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] > -0.04) | (df["change_pct_1h"] < 0.01) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_14_15m"] > 60.0) | (df["rsi_14_1h"] > 45.0) | (df["rsi_14_4h"] > 45.0) | (df["rsi_14_1d"] > 65.0) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] > -0.02) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 65.0) | (df["rsi_3_1h"] < 65.0) | (df["rsi_3_4h"] < 65.0) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 70.0) | (df["rsi_14_4h"] > 70.0) | (df["r_480_1h"] < -10.0) | (df["r_480_4h"] < -15.0) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] > -0.06) | (df["bot_wick_pct_1d"] < 0.08) | (df["rsi_3"] < 70.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 70.0) | (df["rsi_14_4h"] > 70.0) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] > -0.04) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 75.0) | (df["rsi_3_15m"] < 65.0) | (df["rsi_14_15m"] > 65.0) | (df["rsi_14_1h"] > 55.0) | (df["rsi_14_4h"] > 55.0) | (df["r_480_1h"] < -40.0) | (df["r_480_4h"] < -35.0) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.04) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_3_1h"] < 65.0) | (df["rsi_3_4h"] < 75.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.12) | (df["rsi_3"] < 85.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_14_15m"] > 60.0) | (df["rsi_14_1h"] > 50.0) | (df["rsi_14_4h"] > 65.0) | (df["r_480_4h"] < -30.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 70.0) | (df["rsi_3_15m"] < 75.0) | (df["r_480_1h"] < -10.0) | (df["r_480_4h"] < -10.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.03) | (df["rsi_3"] < 70.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_3_1h"] < 75.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -25.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 80.0) | (df["rsi_3_1h"] < 70.0) | (df["rsi_3_4h"] < 70.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 75.0) | (df["rsi_14_4h"] > 80.0) | (df["r_480_1h"] < -10.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 65.0) | (df["rsi_3_1h"] < 75.0) | (df["rsi_3_4h"] < 70.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 80.0) | (df["rsi_14_4h"] > 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.06) | (df["change_pct_1h"] < 0.01) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 70.0) | (df["r_480_1h"] < -15.0) | (df["r_480_4h"] < -15.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1h"] < 0.01) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 90.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 65.0) | (df["rsi_3_1h"] < 75.0) | (df["rsi_14_15m"] > 65.0) | (df["rsi_14_1h"] > 55.0) | (df["rsi_14_4h"] > 70.0) | (df["r_480_1h"] < -30.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.26) | (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 85.0) | (df["rsi_3_15m"] < 85.0) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 60.0) | (df["rsi_14_4h"] > 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1h"] < 0.01) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 75.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_14_1h"] > 70.0) | (df["rsi_14_4h"] > 80.0) | (df["rsi_14_1d"] > 80.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -40.0) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) | (df["ema_200_dec_4_1d"] == True) ) & ( (df["change_pct_1d"] < 0.02) | (df["change_pct_1d"].shift(288) > -0.08) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 60.0) | (df["rsi_14_1d"] > 70.0) | (df["r_480_1h"] < -35.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.02) | (df["change_pct_4h"] < 0.02) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 75.0) | (df["rsi_14_4h"] > 75.0) | (df["rsi_14_1d"] > 70.0) | (df["r_480_1h"] < -35.0) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.16) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_3_1h"] < 65.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 70.0) | (df["rsi_14_1d"] > 70.0) | (df["r_480_1h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.02) | (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] < 0.01) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 60.0) | (df["r_480_1h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] > -0.12) | (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 85.0) | (df["rsi_3_15m"] < 85.0) | (df["rsi_14_1d"] > 70.0) | (df["r_480_1h"] < -30.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.16) | (df["change_pct_1h"] < 0.01) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 70.0) | (df["rsi_14_4h"] > 75.0) | (df["rsi_14_1d"] > 80.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_4h"] < 0.04) | (df["rsi_3"] < 85.0) | (df["rsi_3_1h"] < 80.0) | (df["rsi_3_4h"] < 80.0) | (df["rsi_14_4h"] > 70.0) | (df["rsi_14_1d"] > 60.0) | (df["r_480_1h"] < -30.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] < 0.04) | (df["rsi_14"] > 75.0) | (df["rsi_14_15m"] > 65.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 70.0) | (df["r_480_1h"] < -35.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) ) & ( (df["change_pct_1d"] < 0.34) | (df["change_pct_1h"] < 0.02) | (df["rsi_14"] > 80.0) | (df["rsi_14_15m"] > 65.0) | (df["rsi_14_1h"] > 75.0) | (df["rsi_14_4h"] > 75.0) | (df["r_480_1h"] < -15.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) ) & ( (df["change_pct_4h"] < 0.01) | (df["rsi_3"] < 85.0) | (df["rsi_14"] > 75.0) | (df["rsi_14_15m"] > 75.0) | (df["rsi_14_1h"] > 75.0) | (df["rsi_14_4h"] > 80.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_1d"].shift(288) > -0.02) | (df["rsi_14"] > 90.0) | (df["rsi_14_15m"] > 80.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] > -0.01) | (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] < 0.01) | (df["rsi_14"] > 85.0) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 60.0) | (df["rsi_14_4h"] > 55.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_48_1h"] == True) | (df["ema_200_dec_24_4h"] == True) ) & ( (df["change_pct_1d"] < 0.08) | (df["change_pct_1h"] < 0.01) | (df["rsi_3"] < 90.0) | (df["rsi_3_15m"] < 90.0) | (df["rsi_3_1h"] < 90.0) | (df["rsi_14_1h"] > 80.0) | (df["rsi_14_4h"] > 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_4h"] < 0.08) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_3_4h"] < 95.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.26) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_3_1h"] < 75.0) | (df["rsi_14"] > 80.0) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1d"] > 80.0) | (df["rsi_14_1d"].shift(288) > 45.0) | (df["r_480_1h"] < -20.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) & ( (df["change_pct_1d"] < 0.10) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_3_1h"] < 80.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) ) df["global_protections_short_dump"] = ( ( (df["change_pct_1d"] < 0.10) | (df["change_pct_1h"] < 0.02) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 74.0) | (df["rsi_3_1h"] < 86.0) | (df["rsi_14_1h"] > 70.0) | (df["rsi_14_4h"] > 60.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] < 0.12) | (df["change_pct_1d"].shift(288) > -0.12) | (df["rsi_14_4h"] > 64.0) | (df["rsi_14_1d"] > 40.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] < 0.01) | (df["not_downtrend_1d"]) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 74.0) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 45.0) | (df["rsi_14_4h"] > 35.0) | (df["r_480_1h"] > -85.0) | (df["r_480_4h"] > -90.0) ) & ( (df["change_pct_1d"] > -0.24) | (df["change_pct_1h"] < 0.01) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_3"] < 80.0) | (df["rsi_14_15m"] > 90.0) | (df["rsi_14_1h"] > 60.0) | (df["rsi_14_4h"] > 45.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -65.0) ) & ( (df["change_pct_1h"] < 0.16) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] < 75.0) | (df["rsi_14_1h"] > 45.0) | (df["rsi_14_4h"] > 45.0) ) & ( (df["change_pct_1d"] > -0.03) | (df["change_pct_1h"] < 0.01) | (df["not_downtrend_1d"]) | (df["rsi_14"] < df["rsi_14"].shift(12)) | (df["rsi_14_15m"] < df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] > 70.0) | (df["rsi_14_1h"] > 55.0) | (df["rsi_14_4h"] > 35.0) | (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -75.0) | (df["close"] > (df["high_max_6_1d"] * 0.60)) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] < 0.04) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] < 90.0) ) & ( (df["change_pct_1d"] < 0.04) | (df["change_pct_1d"].shift(288) > -0.04) | (df["rsi_3"] < 75.0) | (df["rsi_3_15m"] < 70.0) | (df["rsi_14_15m"] > 60.0) | (df["rsi_14_1h"] > 60.0) | (df["rsi_14_4h"] > 50.0) | (df["rsi_14_1d"] > 45.0) | (df["r_480_1h"] > -75.0) | (df["close"] < df["res_hlevel_1h"]) ) & ( (df["change_pct_1d"] > -0.24) | (df["bot_wick_pct_1d"] < 0.24) | (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] < 0.01) | (df["not_downtrend_1d"]) | (df["rsi_3"] < 85.0) | (df["rsi_3_15m"] < 65.0) | (df["rsi_14_15m"] > 60.0) | (df["rsi_14_1h"] > 50.0) | (df["rsi_14_4h"] > 35.0) | (df["close"] > (df["high_max_6_1d"] * 0.60)) ) & ( (df["change_pct_1d"] > -0.02) | (df["change_pct_4h"] > -0.02) | (df["bot_wick_pct_4h"] < 0.04) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_14"] > 75.0) | (df["rsi_14_15m"] > 60.0) | (df["rsi_14_1h"] > 45.0) | (df["rsi_14_4h"] > 30.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_4h"] > -0.02) | (df["bot_wick_pct_4h"] < 0.04) | (df["not_downtrend_1d"]) | (df["rsi_3"] < 85.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_14"] > 80.0) | (df["rsi_14_15m"] > 65.0) | (df["rsi_14_1h"] > 50.0) | (df["rsi_14_4h"] > 45.0) | (df["rsi_14_1d"] > 35.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1d"] > -0.04) | (df["change_pct_4h"] < 0.01) | (df["change_pct_1h"] < 0.01) | (df["not_downtrend_1d"]) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 75.0) | (df["rsi_14_15m"] > 80.0) | (df["rsi_14_1h"] > 60.0) | (df["rsi_14_4h"] > 35.0) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_1h"] < 0.04) | (df["not_downtrend_1d"]) | (df["rsi_14"] > 80.0) | (df["rsi_14_15m"] > 70.0) | (df["cti_20_15m"] > 0.9) | (df["rsi_14_1h"] > 50.0) | (df["rsi_14_4h"] > 35.0) | (df["r_480_1h"] > -80.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) & ( (df["change_pct_4h"] > -0.06) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_14"] > 85.0) | (df["rsi_14_15m"] > 65.0) | (df["cti_20_15m"] > 0.9) | (df["rsi_14_1h"] > 35.0) | (df["rsi_14_4h"] > 35.0) | (df["rsi_14_1d"] > 45.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["close"] > (df["high_max_6_1d"] * 0.55)) ) & ( (df["change_pct_1d"] > -0.12) | (df["change_pct_4h"] < 0.08) | (df["change_pct_1h"] < 0.02) | (df["rsi_3"] < 80.0) | (df["rsi_3_15m"] < 80.0) | (df["rsi_14"] > 80.0) | (df["rsi_14_15m"] > 80.0) | (df["rsi_14_1h"] > 65.0) | (df["rsi_14_4h"] > 55.0) | (df["rsi_14_1d"] > 50.0) ) ) df["protections_short_rebuy"] = True tok = time.perf_counter() log.debug(f"[{metadata['pair']}] Populate indicators took a total of: {tok - tik:0.4f} seconds.") return df # Confirm Trade Entry # --------------------------------------------------------------------------------------------- def confirm_trade_entry( self, pair: str, order_type: str, amount: float, rate: float, time_in_force: str, current_time: datetime, entry_tag: Optional[str], side: str, **kwargs, ) -> bool: # allow force entries if entry_tag == "force_entry": return True df, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) if len(df) < 1: return False df = df.iloc[-1].squeeze() # Grind mode entry_tags = entry_tag.split() if all(c in self.long_grind_mode_tags for c in entry_tags): is_pair_grind_mode = pair.split("/")[0] in self.grind_mode_coins if is_pair_grind_mode: num_open_grind_mode = 0 open_trades = Trade.get_trades_proxy(is_open=True) for open_trade in open_trades: enter_tag = open_trade.enter_tag enter_tags = enter_tag.split() if all(c in self.long_grind_mode_tags for c in enter_tags): num_open_grind_mode += 1 if num_open_grind_mode >= self.grind_mode_max_slots: # Reached the limit of grind mode open trades return False else: # The pair is not in the list of grind mode allowed return False if ("side" == "long" and rate > df["close"]) or ("side" == "short" and rate < df["close"]): slippage = (rate / df["close"]) - 1.0 if ("side" == "long" and slippage < self.max_slippage) or ("side" == "short" and slippage > -self.max_slippage): return True else: log.warning(f"Cancelling buy for {pair} due to slippage {(slippage * 100.0):.2f}%") return False return True # Confirm Trade Exit # --------------------------------------------------------------------------------------------- def confirm_trade_exit( self, pair: str, trade: Trade, order_type: str, amount: float, rate: float, time_in_force: str, exit_reason: str, current_time: datetime, **kwargs, ) -> bool: # Allow force exits if exit_reason != "force_exit": if self._should_hold_trade(trade, rate, exit_reason): return False if exit_reason == "stop_loss": return False if self.exit_profit_only: if self.exit_profit_only: profit = 0.0 if trade.realized_profit != 0.0: profit = ((rate - trade.open_rate) / trade.open_rate) * trade.stake_amount * (1 - trade.fee_close) profit = profit + trade.realized_profit profit = profit / trade.stake_amount else: profit = trade.calc_profit_ratio(rate) if profit < self.exit_profit_offset: return False self._remove_profit_target(pair) return True # Bot Loop Start # --------------------------------------------------------------------------------------------- def bot_loop_start(self, current_time: datetime, **kwargs) -> None: if self.config["runmode"].value not in ("live", "dry_run"): return super().bot_loop_start(datetime, **kwargs) if self.hold_support_enabled: self.load_hold_trades_config() return super().bot_loop_start(current_time, **kwargs) # Leverage # --------------------------------------------------------------------------------------------- def leverage( self, pair: str, current_time: datetime, current_rate: float, proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str, **kwargs, ) -> float: enter_tags = entry_tag.split() if all(c in self.long_rebuy_mode_tags for c in enter_tags): return self.futures_mode_leverage_rebuy_mode elif all(c in self.long_grind_mode_tags for c in enter_tags): return self.futures_mode_leverage_grind_mode return self.futures_mode_leverage # Correct Min Stake # --------------------------------------------------------------------------------------------- def correct_min_stake(self, min_stake: float) -> float: if self.config["exchange"]["name"] in ["bybit"]: if self.is_futures_mode: if min_stake < 5.0: min_stake = 5.0 return min_stake # Set Profit Target # --------------------------------------------------------------------------------------------- def _set_profit_target( self, pair: str, sell_reason: str, rate: float, current_profit: float, current_time: datetime ): self.target_profit_cache.data[pair] = { "rate": rate, "profit": current_profit, "sell_reason": sell_reason, "time_profit_reached": current_time.isoformat(), } self.target_profit_cache.save() # Remove Profit Target # --------------------------------------------------------------------------------------------- def _remove_profit_target(self, pair: str): if self.target_profit_cache is not None: self.target_profit_cache.data.pop(pair, None) self.target_profit_cache.save() # Get Hold Trades Config File # --------------------------------------------------------------------------------------------- def get_hold_trades_config_file(self): proper_holds_file_path = self.config["user_data_dir"].resolve() / "nfi-hold-trades.json" if proper_holds_file_path.is_file(): return proper_holds_file_path strat_file_path = pathlib.Path(__file__) hold_trades_config_file_resolve = strat_file_path.resolve().parent / "hold-trades.json" if hold_trades_config_file_resolve.is_file(): log.warning( "Please move %s to %s which is now the expected path for the holds file", hold_trades_config_file_resolve, proper_holds_file_path, ) return hold_trades_config_file_resolve # The resolved path does not exist, is it a symlink? hold_trades_config_file_absolute = strat_file_path.absolute().parent / "hold-trades.json" if hold_trades_config_file_absolute.is_file(): log.warning( "Please move %s to %s which is now the expected path for the holds file", hold_trades_config_file_absolute, proper_holds_file_path, ) return hold_trades_config_file_absolute # Load Hold Trades Config # --------------------------------------------------------------------------------------------- def load_hold_trades_config(self): if self.hold_trades_cache is None: hold_trades_config_file = self.get_hold_trades_config_file() if hold_trades_config_file: log.warning("Loading hold support data from %s", hold_trades_config_file) self.hold_trades_cache = HoldsCache(hold_trades_config_file) if self.hold_trades_cache: self.hold_trades_cache.load() # Should Hold Trade # --------------------------------------------------------------------------------------------- def _should_hold_trade(self, trade: "Trade", rate: float, sell_reason: str) -> bool: if self.config["runmode"].value not in ("live", "dry_run"): return False if not self.hold_support_enabled: return False # Just to be sure our hold data is loaded, should be a no-op call after the first bot loop self.load_hold_trades_config() if not self.hold_trades_cache: # Cache hasn't been setup, likely because the corresponding file does not exist, sell return False if not self.hold_trades_cache.data: # We have no pairs we want to hold until profit, sell return False # By default, no hold should be done hold_trade = False trade_ids: dict = self.hold_trades_cache.data.get("trade_ids") if trade_ids and trade.id in trade_ids: trade_profit_ratio = trade_ids[trade.id] profit = 0.0 if trade.realized_profit != 0.0: profit = ((rate - trade.open_rate) / trade.open_rate) * trade.stake_amount * (1 - trade.fee_close) profit = profit + trade.realized_profit profit = profit / trade.stake_amount else: profit = trade.calc_profit_ratio(rate) current_profit_ratio = profit if sell_reason == "force_sell": formatted_profit_ratio = f"{trade_profit_ratio * 100}%" formatted_current_profit_ratio = f"{current_profit_ratio * 100}%" log.warning( "Force selling %s even though the current profit of %s < %s", trade, formatted_current_profit_ratio, formatted_profit_ratio, ) return False elif current_profit_ratio >= trade_profit_ratio: # This pair is on the list to hold, and we reached minimum profit, sell formatted_profit_ratio = f"{trade_profit_ratio * 100}%" formatted_current_profit_ratio = f"{current_profit_ratio * 100}%" log.warning( "Selling %s because the current profit of %s >= %s", trade, formatted_current_profit_ratio, formatted_profit_ratio, ) return False # This pair is on the list to hold, and we haven't reached minimum profit, hold hold_trade = True trade_pairs: dict = self.hold_trades_cache.data.get("trade_pairs") if trade_pairs and trade.pair in trade_pairs: trade_profit_ratio = trade_pairs[trade.pair] profit = 0.0 if trade.realized_profit != 0.0: profit = ((rate - trade.open_rate) / trade.open_rate) * trade.stake_amount * (1 - trade.fee_close) profit = profit + trade.realized_profit profit = profit / trade.stake_amount else: profit = trade.calc_profit_ratio(rate) current_profit_ratio = profit if sell_reason == "force_sell": formatted_profit_ratio = f"{trade_profit_ratio * 100}%" formatted_current_profit_ratio = f"{current_profit_ratio * 100}%" log.warning( "Force selling %s even though the current profit of %s < %s", trade, formatted_current_profit_ratio, formatted_profit_ratio, ) return False elif current_profit_ratio >= trade_profit_ratio: # This pair is on the list to hold, and we reached minimum profit, sell formatted_profit_ratio = f"{trade_profit_ratio * 100}%" formatted_current_profit_ratio = f"{current_profit_ratio * 100}%" log.warning( "Selling %s because the current profit of %s >= %s", trade, formatted_current_profit_ratio, formatted_profit_ratio, ) return False # This pair is on the list to hold, and we haven't reached minimum profit, hold hold_trade = True return hold_trade # Populate Exit Trend # --------------------------------------------------------------------------------------------- def populate_exit_trend(self, df: DataFrame, metadata: dict) -> DataFrame: df.loc[:, "exit_long"] = 0 df.loc[:, "exit_short"] = 0 return df # # $$$$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$$\ $$\ $$\ # $$ _____|$$$\ $$ |\__$$ __|$$ __$$\\$$\ $$ | # $$ | $$$$\ $$ | $$ | $$ | $$ |\$$\ $$ / # $$$$$\ $$ $$\$$ | $$ | $$$$$$$ | \$$$$ / # $$ __| $$ \$$$$ | $$ | $$ __$$< \$$ / # $$ | $$ |\$$$ | $$ | $$ | $$ | $$ | # $$$$$$$$\ $$ | \$$ | $$ | $$ | $$ | $$ | # \________|\__| \__| \__| \__| \__| \__| # # # $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\ # $$ __$$\ $$ __$$\ $$$\ $$ |$$ __$$\ \_$$ _|\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |$$ __$$\ # $$ / \__|$$ / $$ |$$$$\ $$ |$$ | $$ | $$ | $$ | $$ | $$ / $$ |$$$$\ $$ |$$ / \__| # $$ | $$ | $$ |$$ $$\$$ |$$ | $$ | $$ | $$ | $$ | $$ | $$ |$$ $$\$$ |\$$$$$$\ # $$ | $$ | $$ |$$ \$$$$ |$$ | $$ | $$ | $$ | $$ | $$ | $$ |$$ \$$$$ | \____$$\ # $$ | $$\ $$ | $$ |$$ |\$$$ |$$ | $$ | $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |$$\ $$ | # \$$$$$$ | $$$$$$ |$$ | \$$ |$$$$$$$ |$$$$$$\ $$ | $$$$$$\ $$$$$$ |$$ | \$$ |\$$$$$$ | # \______/ \______/ \__| \__|\_______/ \______| \__| \______| \______/ \__| \__| \______/ # # Populate Entry Trend # --------------------------------------------------------------------------------------------- def populate_entry_trend(self, df: DataFrame, metadata: dict) -> DataFrame: long_entry_conditions = [] short_entry_conditions = [] df.loc[:, "enter_tag"] = "" is_backtest = self.dp.runmode.value in ["backtest", "hyperopt", "plot"] # the number of free slots current_free_slots = self.config["max_open_trades"] if not is_backtest: current_free_slots = self.config["max_open_trades"] - Trade.get_open_trade_count() # Grind mode num_open_grind_mode = 0 is_pair_grind_mode = metadata["pair"].split("/")[0] in self.grind_mode_coins if not is_backtest: open_trades = Trade.get_trades_proxy(is_open=True) for open_trade in open_trades: enter_tag = open_trade.enter_tag if enter_tag is not None: enter_tags = enter_tag.split() if all(c in self.long_grind_mode_tags for c in enter_tags): num_open_grind_mode += 1 # if BTC/ETH stake is_btc_stake = self.config["stake_currency"] in self.btc_stakes allowed_empty_candles = 144 if is_btc_stake else 60 # # /$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$$/$$ /$$/$$$$$$$$/$$$$$$$$/$$$$$$$ # | $$ /$$__ $| $$$ | $$/$$__ $$ | $$_____| $$$ | $|__ $$__| $$_____| $$__ $$ # | $$ | $$ \ $| $$$$| $| $$ \__/ | $$ | $$$$| $$ | $$ | $$ | $$ \ $$ # | $$ | $$ | $| $$ $$ $| $$ /$$$$ | $$$$$ | $$ $$ $$ | $$ | $$$$$ | $$$$$$$/ # | $$ | $$ | $| $$ $$$| $$|_ $$ | $$__/ | $$ $$$$ | $$ | $$__/ | $$__ $$ # | $$ | $$ | $| $$\ $$| $$ \ $$ | $$ | $$\ $$$ | $$ | $$ | $$ \ $$ # | $$$$$$$| $$$$$$| $$ \ $| $$$$$$/ | $$$$$$$| $$ \ $$ | $$ | $$$$$$$| $$ | $$ # |________/\______/|__/ \__/\______/ |________|__/ \__/ |__/ |________|__/ |__/ # for enabled_long_entry_signal in self.long_entry_signal_params: index = int(enabled_long_entry_signal.split("_")[3]) item_buy_protection_list = [True] if not self.config["runmode"].value in ("live", "dry_run"): if self.has_bt_agefilter: item_buy_protection_list.append(df["bt_agefilter_ok"]) else: if self.has_downtime_protection: item_buy_protection_list.append(df["live_data_ok"]) if self.long_entry_signal_params[f"{enabled_long_entry_signal}"]: # Long Entry Conditions Starts Here # ----------------------------------------------------------------------------------------- long_entry_logic = [] long_entry_logic.append(reduce(lambda x, y: x & y, item_buy_protection_list)) # Condition #1 - Long mode bull. Uptrend. if index == 1: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.3)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.9) long_entry_logic.append(df["rsi_14_1h"] < 85.0) long_entry_logic.append(df["cti_20_4h"] < 0.9) long_entry_logic.append(df["rsi_14_4h"] < 85.0) long_entry_logic.append(df["cti_20_1d"] < 0.9) long_entry_logic.append(df["rsi_14_1d"] < 85.0) long_entry_logic.append(df["r_14_1h"] < -25.0) long_entry_logic.append(df["r_14_4h"] < -25.0) # Logic long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.02)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.999)) # Condition #2 - Normal mode bull. if index == 2: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.16)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.3)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.9) long_entry_logic.append(df["rsi_14_1h"] < 85.0) long_entry_logic.append(df["cti_20_4h"] < 0.9) long_entry_logic.append(df["rsi_14_4h"] < 85.0) long_entry_logic.append(df["cti_20_1d"] < 0.9) long_entry_logic.append(df["rsi_14_1d"] < 85.0) long_entry_logic.append(df["r_14_1h"] < -25.0) long_entry_logic.append(df["r_14_4h"] < -25.0) long_entry_logic.append( ((df["not_downtrend_1h"]) & (df["not_downtrend_4h"])) | (df["high_max_24_4h"] < (df["close"] * 1.5)) ) # Logic long_entry_logic.append(df["bb40_2_delta"].gt(df["close"] * 0.06)) long_entry_logic.append(df["close_delta"].gt(df["close"] * 0.02)) long_entry_logic.append(df["bb40_2_tail"].lt(df["bb40_2_delta"] * 0.2)) long_entry_logic.append(df["close"].lt(df["bb40_2_low"].shift())) long_entry_logic.append(df["close"].le(df["close"].shift())) # Condition #3 - Normal mode bull. if index == 3: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.26)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["ema_12_1h"] > df["ema_200_1h"]) long_entry_logic.append(df["ema_12_4h"] > df["ema_200_4h"]) long_entry_logic.append(df["rsi_3_15m"] > 16.0) long_entry_logic.append(df["rsi_3_1h"] > 6.0) long_entry_logic.append(df["rsi_3_4h"] > 6.0) long_entry_logic.append(df["rsi_14_4h"] < 70.0) long_entry_logic.append(df["rsi_14_1d"] < 85.0) long_entry_logic.append((df["change_pct_4h"] > -0.04) | (df["change_pct_4h"].shift(48) < 0.04)) long_entry_logic.append((df["not_downtrend_1h"]) | (df["cti_20_1d"] < 0.85) | (df["r_480_4h"] < -30.0)) # Logic long_entry_logic.append(df["rsi_14"] < 36.0) long_entry_logic.append(df["ha_close"] > df["ha_open"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.020)) # Condition #4 - Normal mode (Long). if index == 4: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.9) long_entry_logic.append(df["rsi_14_1h"] < 85.0) long_entry_logic.append(df["cti_20_4h"] < 0.9) long_entry_logic.append(df["rsi_14_4h"] < 85.0) long_entry_logic.append(df["cti_20_1d"] < 0.9) long_entry_logic.append(df["rsi_14_1d"] < 85.0) # Logic long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.018)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.996)) # Condition #5 - Normal mode (Long). if index == 5: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) # Logic long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) long_entry_logic.append(df["rsi_14"] < 36.0) # Condition #6 - Normal mode (Long). if index == 6: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.5) long_entry_logic.append(df["cti_20_4h"] < 0.75) long_entry_logic.append(df["rsi_14_4h"] < 85.0) # Logic long_entry_logic.append(df["close"] < (df["ema_26"] * 0.94)) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.996)) # Condition #7 Normal mode (long). if index == 7: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append(df["cti_20_1d"] < 0.8) long_entry_logic.append(df["rsi_14_1d"] < 80.0) # Logic long_entry_logic.append(df["close"] < (df["ema_16"] * 0.974)) long_entry_logic.append(df["ewo_50_200"] > 2.0) long_entry_logic.append(df["rsi_14"] < 30.0) # Condition #8 Normal mode (Long). if index == 8: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append(df["cti_20_1d"] < 0.8) long_entry_logic.append(df["rsi_14_1d"] < 80.0) # Logic long_entry_logic.append(df["close"] < (df["ema_16"] * 0.944)) long_entry_logic.append(df["ewo_50_200"] < -4.0) long_entry_logic.append(df["rsi_14"] < 30.0) # Condition #9 - Normal mode (Long). if index == 9: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append(df["cti_20_1d"] < 0.8) long_entry_logic.append(df["rsi_14_1d"] < 80.0) # Logic long_entry_logic.append(df["ema_26_15m"] > df["ema_12_15m"]) long_entry_logic.append((df["ema_26_15m"] - df["ema_12_15m"]) > (df["open_15m"] * 0.020)) long_entry_logic.append((df["ema_26_15m"].shift(3) - df["ema_12_15m"].shift(3)) > (df["open_15m"] / 100.0)) long_entry_logic.append(df["close_15m"] < (df["bb20_2_low_15m"] * 0.99)) # Condition #10 - Normal mode (Long) if index == 10: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.75)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.70)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * 0.45)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.90) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.95) long_entry_logic.append(df["hl_pct_change_48_1h"] < 1.00) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 4.0) long_entry_logic.append(df["rsi_3"] <= 46.0) long_entry_logic.append(df["rsi_3_15m"] >= 6.0) long_entry_logic.append(df["rsi_3_1h"] >= 8.0) long_entry_logic.append(df["rsi_3_4h"] >= 8.0) long_entry_logic.append(df["rsi_3_1d"] >= 8.0) long_entry_logic.append(df["cti_20_1h"] <= 0.90) long_entry_logic.append(df["rsi_14_1h"] <= 80.0) long_entry_logic.append(df["cti_20_4h"] <= 0.90) long_entry_logic.append(df["rsi_14_4h"] <= 80.0) long_entry_logic.append(df["cti_20_1d"] <= 0.95) long_entry_logic.append(df["rsi_14_1d"] <= 80.0) long_entry_logic.append(df["r_14_1h"] <= -0.0) long_entry_logic.append(df["r_14_4h"] <= -0.0) long_entry_logic.append(df["r_480_1h"] <= -0.0) long_entry_logic.append(df["r_480_4h"] <= -0.0) # Logic long_entry_logic.append(df["rsi_14"] < 30.0) long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.0200)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100.0)) long_entry_logic.append(df["close"] < (df["ema_20"] * 0.952)) # Condition #11 - Normal mode (Long) if index == 11: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.75)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.70)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * 0.45)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.90) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.95) long_entry_logic.append(df["hl_pct_change_48_1h"] < 1.00) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 2.0) long_entry_logic.append(df["rsi_3"] <= 46.0) long_entry_logic.append(df["rsi_3_15m"] >= 16.0) long_entry_logic.append(df["rsi_3_1h"] >= 8.0) long_entry_logic.append(df["rsi_3_4h"] >= 8.0) long_entry_logic.append(df["rsi_3_1d"] >= 8.0) long_entry_logic.append(df["cti_20_1h"] <= 0.95) long_entry_logic.append(df["rsi_14_1h"] <= 85.0) long_entry_logic.append(df["cti_20_4h"] <= 0.95) long_entry_logic.append(df["rsi_14_4h"] <= 85.0) long_entry_logic.append(df["cti_20_1d"] <= 0.95) long_entry_logic.append(df["rsi_14_1d"] <= 85.0) long_entry_logic.append(df["r_14_1h"] <= -0.0) long_entry_logic.append(df["r_14_4h"] <= -0.0) long_entry_logic.append(df["r_480_1h"] <= -0.0) long_entry_logic.append(df["r_480_4h"] <= -0.0) long_entry_logic.append(df["ema_100"] > df["ema_200"]) long_entry_logic.append(df["ema_12_1h"] > df["ema_200_1h"]) # Logic long_entry_logic.append(df["rsi_14"] < 45.0) long_entry_logic.append(df["cti_20"] < -0.50) long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.0260)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100.0)) long_entry_logic.append(df["close"] < (df["sma_30"] * 0.978)) # Condition #12 - Normal mode (Long) if index == 12: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.75)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.70)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * 0.45)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.90) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.95) long_entry_logic.append(df["hl_pct_change_48_1h"] < 1.00) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 2.0) long_entry_logic.append(df["rsi_3"] <= 46.0) long_entry_logic.append(df["rsi_3_15m"] >= 12.0) long_entry_logic.append(df["rsi_3_1h"] >= 20.0) long_entry_logic.append(df["rsi_3_4h"] >= 20.0) long_entry_logic.append(df["rsi_3_1d"] >= 20.0) long_entry_logic.append(df["cti_20_1h"] <= 0.95) long_entry_logic.append(df["rsi_14_1h"] <= 90.0) long_entry_logic.append(df["cti_20_4h"] <= 0.95) long_entry_logic.append(df["rsi_14_4h"] <= 90.0) long_entry_logic.append(df["cti_20_1d"] <= 0.95) long_entry_logic.append(df["rsi_14_1d"] <= 90.0) long_entry_logic.append(df["r_14_1h"] >= -100.0) long_entry_logic.append(df["r_14_1h"] <= -0.0) long_entry_logic.append(df["r_14_4h"] >= -100.0) long_entry_logic.append(df["r_14_4h"] <= -0.0) long_entry_logic.append(df["r_480_1h"] >= -100.0) long_entry_logic.append(df["r_480_1h"] <= -0.0) long_entry_logic.append(df["r_480_4h"] >= -100.0) long_entry_logic.append(df["r_480_4h"] <= -0.0) long_entry_logic.append(df["ema_50_1h"] > df["ema_200_1h"]) # Logic long_entry_logic.append(df["r_14"] < -88.0) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.984)) long_entry_logic.append(df["close"] < (df["sma_30"] * 0.940)) # Condition #13 - Normal mode (Long) if index == 13: # Protections long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.06) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.06) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.84)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.75)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.50) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.80) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 6.0) long_entry_logic.append(df["rsi_3"] <= 50.0) long_entry_logic.append(df["rsi_3_15m"] >= 6.0) long_entry_logic.append(df["rsi_3_1h"] >= 6.0) long_entry_logic.append(df["rsi_3_4h"] >= 14.0) long_entry_logic.append(df["rsi_3_1d"] >= 14.0) long_entry_logic.append(df["cti_20_1h"] <= 0.90) long_entry_logic.append(df["rsi_14_1h"] <= 80.0) long_entry_logic.append(df["cti_20_4h"] <= 0.90) long_entry_logic.append(df["rsi_14_4h"] <= 80.0) long_entry_logic.append(df["cti_20_1d"] <= 0.90) long_entry_logic.append(df["rsi_14_1d"] <= 80.0) long_entry_logic.append(df["close"] > (df["sup_level_1h"] * 0.8)) long_entry_logic.append(df["close"] < (df["res3_1d"] * 1.6)) # long_entry_logic.append(df["sma_200_1h"] > df["sma_200_1h"].shift(48)) long_entry_logic.append( (df["r_480_4h"] > -75.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append((df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 70.0) | (df["r_480_4h"] < -30.0)) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 26.0) ) long_entry_logic.append( (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 26.0) | (df["ema_200_dec_24_4h"] == False) | (df["hl_pct_change_6_1d"] < 0.9) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_4h"] < -30.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 26.0) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append((df["not_downtrend_15m"]) | (df["rsi_3"] > 16.0) | (df["r_480_4h"] < -25.0)) long_entry_logic.append( (df["not_downtrend_1d"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.84)) ) long_entry_logic.append((df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 16.0) | (df["rsi_14_1d"] < 70.0)) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1d"] < 70.0) ) long_entry_logic.append( (df["sma_200_1h"] > df["sma_200_1h"].shift(48)) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["close"] > (df["high_max_6_1d"] * 0.70)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["close"] > (df["high_max_24_1h"] * 0.75)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["r_480_1h"] < -20.0) | (df["r_480_4h"] < -20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 12.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 65.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["close"] > (df["high_max_6_1d"] * 0.65)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_4h"] < 70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1h"] > -0.03) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1d"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.8) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_4h"] < 60.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["rsi_14_1d"] < 60.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 10.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_4h"].shift(48) < 70.0) | (df["r_480_4h"] < -25.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 10.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 12.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_4h"] > -0.02) | (df["change_pct_1h"] > -0.02) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_3_4h"] < 80.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.8) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 12.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 20.0) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["is_downtrend_3_1h"] == False) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 12.0) | (df["rsi_3_1h"] > 20.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.9) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_14_1h"] < -35.0) | (df["r_14_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.08) | (df["not_downtrend_1h"]) | (df["not_downtrend_1d"]) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_1d"] > 36.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) # Logic long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.0150)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.994)) # Condition #14 - Normal mode (Long) if index == 14: # Protections long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 2.0) long_entry_logic.append(df["rsi_3"] <= 46.0) long_entry_logic.append(df["rsi_3_15m"] >= 12.0) long_entry_logic.append(df["rsi_3_1h"] >= 12.0) long_entry_logic.append(df["rsi_3_4h"] >= 12.0) long_entry_logic.append(df["rsi_14_1d"] < 85.0) long_entry_logic.append(df["r_14_4h"] < -16.0) long_entry_logic.append( (df["rsi_14_4h"] < 75.0) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["not_downtrend_1h"]) ) long_entry_logic.append( (df["change_pct_1h"] > -0.02) | (df["not_downtrend_1d"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 30.0) | (df["rsi_3_1d"] > 26.0) | (df["rsi_14_1h"] < 33.0) | (df["rsi_14_4h"] < 33.0) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.20) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 26.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_1d"] < 0.20) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -30.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 26.0) | (df["close"] < (df["bb20_2_low"] * 0.992)) | (df["close"] < (df["ema_20"] * 0.954)) | (df["close_15m"] < (df["ema_12_15m"] * 0.974)) ) long_entry_logic.append( (df["change_pct_1h"] > -0.04) | (df["not_downtrend_1h"]) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -90.0) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_1d"] < 65.0) | (df["r_480_1h"] < -35.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.24) | (df["change_pct_1h"] > -0.01) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_max_6_1h"] < 65.0) | (df["rsi_14_4h"] < 65.0) | (df["cti_20_4h"] < 0.8) | (df["close"] < (df["bb20_2_low"] * 0.998)) | (df["close"] < (df["ema_20"] * 0.936)) | (df["close_15m"] < (df["ema_12_15m"] * 0.936)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.16) | (df["change_pct_1d"].shift(288) < 0.24) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) ) long_entry_logic.append( (df["change_pct_4h"] < 0.12) | (df["top_wick_pct_4h"] < 0.12) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_max_6_4h"] < 80.0) | (df["cti_20_4h"] < 0.8) ) long_entry_logic.append( (df["change_pct_1d"] > -0.12) | (df["change_pct_1d"].shift(288) < 0.24) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -80.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.16) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_1h"] < 60.0) | (df["cti_20_1h"] < 0.9) | (df["rsi_14_4h"] < 80.0) | (df["r_480_1h"] < -35.0) ) long_entry_logic.append( (df["change_pct_4h"] > -0.06) | (df["change_pct_4h"].shift(48) < 0.06) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_max_6_4h"] < 65.0) | (df["cti_20_4h"] < 0.7) | (df["r_480_1h"] > -70.0) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 80.0) | (df["close"] > (df["high_max_6_1h"] * 0.70)) ) long_entry_logic.append( (df["change_pct_4h"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_max_6_1d"] < 80.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -20.0) ) long_entry_logic.append( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["rsi_3"] > 16.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 70.0) | (df["r_480_1h"] < -25.0) | (df["close"] > df["sup_level_1h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.01) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["r_480_1h"] < -30.0) ) long_entry_logic.append( (df["change_pct_4h"] > -0.02) | (df["change_pct_1h"] > -0.02) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 20.0) | (df["r_480_1h"] > -95.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_1h"] > -65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1d"].shift(288) < 0.24) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -65.0) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.12) | (df["top_wick_pct_1d"] < 0.12) | (df["rsi_3"] > 8.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 16.0) | (df["rsi_14"] < 20.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 45.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 35.0) | (df["rsi_14_1h"] < 35.0) | (df["rsi_14_4h"] < 55.0) | (df["cti_20_4h"] < 0.5) | (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -30.0) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 70.0) | (df["rsi_14_max_6_1d"] < 80.0) | (df["cti_20_1d"] < 0.8) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["cti_20_1d"] < 0.8) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_1d"] < 0.12) | (df["change_pct_1h"] > -0.02) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 65.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["cti_20_4h"] < 0.7) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 65.0) | (df["cti_20_4h"] < 0.7) | (df["r_480_1h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_1d"].shift(288) > -0.04) | (df["change_pct_1h"] > -0.02) | (df["change_pct_1h"].shift(12) < 0.02) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 36.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 60.0) | (df["r_480_1h"] < -30.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 8.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 36.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 36.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1d"].shift(288) < 0.12) | (df["top_wick_pct_1d"].shift(288) < 0.04) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_3_4h"] > 36.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 36.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["sma_200_dec_48_1h"] == False) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_1h"] > -0.02) | (df["rsi_3"] > 30.0) | (df["rsi_3_15m"] > 36.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 70.0) | (df["rsi_14_max_6_1h"] < 85.0) | (df["rsi_14_4h"] < 80.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -20.0) | (df["close"] < df["res_hlevel_4h"]) ) long_entry_logic.append( (df["change_pct_4h"] > -0.01) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 16.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["cti_20_1d"] < 0.5) | (df["r_480_4h"] > -65.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_1d"] < 0.03) | (df["top_wick_pct_1d"] < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 26.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -20.0) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] < -35.0) ) long_entry_logic.append( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["change_pct_1h"] > -0.01) | (df["not_downtrend_1h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 26.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 36.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["not_downtrend_1d"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_1d"] > 16.0) | (df["r_480_1h"] > -85.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) ) long_entry_logic.append( (df["change_pct_1d"] > -0.03) | (df["top_wick_pct_1d"] < 0.03) | (df["rsi_3"] > 6.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14"] < 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["change_pct_4h"] < 0.02) | (df["change_pct_1h"] > -0.01) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 75.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) > -0.03) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["cti_20_1d"] < 0.8) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["hl_pct_change_6_1d"] < 0.9) ) long_entry_logic.append( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) > -0.03) | (df["change_pct_4h"] > -0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["not_downtrend_1h"]) | (df["rsi_14_max_6_1d"] < 70.0) | (df["cti_20_1d"] < 0.8) | (df["hl_pct_change_6_1d"] < 0.9) ) long_entry_logic.append( (df["change_pct_1d"] < 0.24) | (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_1h"] > -0.02) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 80.0) | (df["r_480_1h"] < -35.0) ) # Logic long_entry_logic.append(df["cti_20"] < -0.75) long_entry_logic.append(df["r_14"] < -90.0) long_entry_logic.append(df["close"] < (df["ema_20"] * 0.962)) long_entry_logic.append(df["close_15m"] < (df["ema_12_15m"] * 0.982)) # Condition #21 - Pump mode (Long). if index == 21: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.84)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.78)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3_15m"] > 1.0) long_entry_logic.append(df["ema_200_dec_48_1h"] == False) long_entry_logic.append(df["ema_200_dec_24_4h"] == False) # Logic long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.020)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) long_entry_logic.append(df["rsi_14"] < 36.0) # Condition #22 - Pump mode (Long). if index == 22: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.78)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["rsi_14_1h"] < 85.0) long_entry_logic.append(df["cti_20_4h"] < 0.9) long_entry_logic.append(df["rsi_14_4h"] < 85.0) long_entry_logic.append(df["rsi_14_1d"] < 85.0) long_entry_logic.append(df["ema_200_1h"] > df["ema_200_1h"].shift(96)) long_entry_logic.append(df["ema_200_dec_48_1h"] == False) long_entry_logic.append(df["sma_200_1h"] > df["sma_200_1h"].shift(24)) # Logic long_entry_logic.append(df["close"] < (df["ema_16"] * 0.968)) long_entry_logic.append(df["cti_20"] < -0.9) long_entry_logic.append(df["rsi_14"] < 50.0) # Condition #23 - Pump mode (Long). if index == 23: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.82)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.78)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.72)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.60)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.50)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.6) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.8) long_entry_logic.append(df["hl_pct_change_6_1d"] < 1.5) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) # Logic long_entry_logic.append(df["ewo_50_200_15m"] > 4.2) long_entry_logic.append(df["rsi_14_15m"].shift(1) < 30.0) long_entry_logic.append(df["rsi_14_15m"] < 30.0) long_entry_logic.append(df["rsi_14"] < 35.0) long_entry_logic.append(df["cti_20"] < -0.8) long_entry_logic.append(df["close"] < (df["ema_26_15m"] * 0.958)) # Condition #24 - Pump mode (Long) if index == 24: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_24_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_24_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_24_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_24_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_24_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_24_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_24_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_24_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_24_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_24_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= self.entry_24_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] <= self.entry_24_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] >= self.entry_24_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] >= self.entry_24_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] >= self.entry_24_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] >= self.entry_24_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] <= self.entry_24_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] <= self.entry_24_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] <= self.entry_24_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] <= self.entry_24_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] <= self.entry_24_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] <= self.entry_24_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_24_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_24_r_14_1h_max.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_24_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_24_r_480_1h_max.value) if self.entry_24_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_24_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_24_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_24_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_24_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_24_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_24_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_24_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_24_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_24_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_24_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_24_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_24_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) if self.entry_24_ema_50_over_ema_200_enabled.value: long_entry_logic.append(df["ema_50"] > df["ema_200"]) if self.entry_24_ema_12_1h_over_ema_200_1h_enabled.value: long_entry_logic.append(df["ema_12_1h"] > df["ema_200_1h"]) # Logic long_entry_logic.append(df["rsi_14"] > self.entry_24_rsi_14_min.value) long_entry_logic.append(df["rsi_14"] < self.entry_24_rsi_14_max.value) long_entry_logic.append(df["cti_20"] < self.entry_24_cti_20_max.value) long_entry_logic.append(df["r_14"] < self.entry_24_r_14_max.value) long_entry_logic.append(df["ewo_50_200"] > self.entry_24_ewo_50_200_min.value) long_entry_logic.append(df["ewo_50_200"] < self.entry_24_ewo_50_200_max.value) long_entry_logic.append(df["close"] < (df["sma_75"] * self.entry_24_sma_offset.value)) # Condition #25 - Pump mode (Long). if index == 25: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_25_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_25_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_25_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_25_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_25_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_25_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_25_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_25_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_25_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_25_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_25_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_25_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_25_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_25_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_25_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_25_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_25_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_25_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_25_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_25_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_25_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_25_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_25_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_25_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_25_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_25_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_25_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_25_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_25_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_25_r_480_4h_max.value) if self.entry_25_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_25_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_25_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_25_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_25_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_25_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_25_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_25_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_25_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_25_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_25_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_25_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_25_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) long_entry_logic.append((df["r_480_4h"] > -70.0) | (df["ema_200_dec_24_4h"] == False)) # Logic long_entry_logic.append(df["rsi_14"] < self.entry_25_rsi_14_max.value) long_entry_logic.append(df["cti_20"] < self.entry_25_cti_20_max.value) long_entry_logic.append(df["ewo_50_200"] > self.entry_25_ewo_50_200_min.value) long_entry_logic.append(df["close"] < (df["sma_30"] * self.entry_25_sma_offset.value)) # Condition #26 - Pump mode (Long). if index == 26: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_26_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_26_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_26_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_26_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_26_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_26_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_26_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_26_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_26_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_26_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_26_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_26_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_26_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_26_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_26_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_26_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_26_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_26_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_26_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_26_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_26_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_26_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_26_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_26_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_26_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_26_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_26_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_26_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_26_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_26_r_480_4h_max.value) if self.entry_26_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_26_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_26_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_26_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_26_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_26_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_26_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_26_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_26_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_26_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_26_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_26_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_26_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) long_entry_logic.append(df["ema_200_1h"] > df["ema_200_1h"].shift(12)) long_entry_logic.append(df["ema_200_1h"].shift(12) > df["ema_200_1h"].shift(24)) # Logic long_entry_logic.append(df["close"] < (df["bb20_2_low"] * self.entry_26_bb_offset.value)) long_entry_logic.append(df["ewo_50_200_1h"] > self.entry_26_ewo_50_200_1h_min.value) long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * self.entry_26_ema_open_offset.value)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100.0)) # Condition #41 - Quick mode bull. if index == 41: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.3)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) # pump and now started dumping, still high long_entry_logic.append( (df["change_pct_1d"] > -0.05) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["hl_pct_change_48_1h"] < 0.4) ) long_entry_logic.append( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.1) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] > -0.02) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_1d"].shift(288) < 0.12) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["change_pct_4h"] > -0.06) | (df["change_pct_4h"].shift(48) < 0.06) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["change_pct_4h"] > -0.02) | (df["cti_20_4h"] < 0.85) | (df["cti_20_4h"].shift(48) < 0.85) | (df["rsi_14_4h"].shift(48) < 70.0) ) long_entry_logic.append((df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.9) | (df["rsi_14_1d"] < 75.0)) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_3_1h"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.75) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.0) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.75) | (df["cti_20_1d"] < -0.8) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < -0.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1d"] < 0.75) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.75) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.75) | (df["cti_20_1d"] < -0.75) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 25.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.8) | (df["r_14_4h"] < -30.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < -0.0) ) long_entry_logic.append( (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["hl_pct_change_48_1h"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.75) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.75) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_48_1h"] < (df["close"] * 1.3)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.75) | (df["cti_20_4h"] < -0.8) | (df["high_max_48_1h"] < (df["close"] * 1.3)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.75) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.75) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.75) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.8) ) long_entry_logic.append( (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.75) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.8) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < 0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < 0.8) | (df["cti_20_1d"] < -0.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.75) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < 0.8) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.75) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close_max_12"] < (df["close"] * 1.12)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) > -0.06) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.75) | (df["close"] < (df["ema_200_4h"] * 1.1)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < -0.75) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["r_480_1h"] > -95.0) | (df["r_480_4h"] > -95.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 6.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["is_downtrend_3_1d"] == False) | (df["cti_20_1d"] < 0.5) | (df["high_max_6_1d"] < (df["close"] * 1.8)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_24_4h"] < (df["close"] * 1.5)) ) long_entry_logic.append( (df["is_downtrend_3_4h"] == False) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1d"] < 0.7) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_4h"] < 0.8) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) ) long_entry_logic.append( (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 25.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 30.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.01) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["hl_pct_change_6_1d"] < 0.7) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["rsi_14_1h"] < 30.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 10.0) | (df["rsi_3_4h"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.0) | (df["rsi_3"] > 20.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append((df["change_pct_4h"] > -0.03) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.7)) long_entry_logic.append( (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["high_max_24_4h"] < (df["close"] * 1.3)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # Logic long_entry_logic.append(df["bb40_2_delta"].gt(df["close"] * 0.036)) long_entry_logic.append(df["close_delta"].gt(df["close"] * 0.02)) long_entry_logic.append(df["bb40_2_tail"].lt(df["bb40_2_delta"] * 0.4)) long_entry_logic.append(df["close"].lt(df["bb40_2_low"].shift())) long_entry_logic.append(df["close"].le(df["close"].shift())) long_entry_logic.append(df["rsi_14"] < 36.0) # Condition #42 - Quick mode bull. if index == 42: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.3)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append( ((df["not_downtrend_1h"]) & (df["not_downtrend_4h"])) | (df["high_max_24_4h"] < (df["close"] * 1.5)) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 5.0)) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 5.0)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] < 0.1) | (df["top_wick_pct_1d"] < 0.05) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) long_entry_logic.append( (df["change_pct_4h"].shift(48) < 0.1) | (df["change_pct_4h"] > -0.04) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["top_wick_pct_1d"] < (abs(df["change_pct_1d"]) * 2.0)) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.75) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_1d"] < -0.0) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.05)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.16) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 20.0) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < -0.0) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.75) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 30.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.0) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.75) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.8) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_24_4h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.5) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.75) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < 0.5) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_24_4h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < 0.5) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["close_max_24"] < (df["close"] * 1.1)) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append((df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1d"] < 0.8)) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 8.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["top_wick_pct_1d"] < (abs(df["change_pct_1d"]) * 4.0)) | (df["not_downtrend_1h"]) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_4_1d"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["ema_200_dec_48_1h"] == False) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.03)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 3.0) | (df["high_max_12_1d"] < (df["close"] * 1.5)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.03) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] > -0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_1d"] < 0.5) | ((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.04)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.01) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["hl_pct_change_6_1d"] < 0.7) ) long_entry_logic.append( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) ) # Logic long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.018)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.996)) long_entry_logic.append(df["rsi_14"] < 40.0) # Condition #43 - Quick mode bull. if index == 43: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.3)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append( ((df["not_downtrend_1h"]) & (df["not_downtrend_4h"])) | (df["high_max_24_4h"] < (df["close"] * 1.5)) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 5.0)) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 5.0)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["change_pct_4h"] < 0.1) | (df["top_wick_pct_4h"] < 0.05) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["change_pct_4h"] < 0.16) | (df["top_wick_pct_4h"] < 0.08) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) < 0.1) | (df["top_wick_pct_1d"].shift(288) < 0.1) | (df["cti_20_1d"].shift(288) < 0.8) | (df["rsi_14_1d"].shift(288) < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] < 0.1) | (df["top_wick_pct_1d"] < 0.05) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) long_entry_logic.append( (df["change_pct_4h"].shift(48) < 0.1) | (df["change_pct_4h"] > -0.04) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["top_wick_pct_1d"] < (abs(df["change_pct_1d"]) * 2.0)) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.8) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["close_max_24"] < (df["close"] * 1.12)) | (df["close"] < (df["ema_26"] * 0.91)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.5) | (df["close"] < (df["ema_26"] * 0.9)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.91)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.9) | (df["cti_20_1d"] < 0.5) | (df["close_max_12"] < (df["close"] * 1.1)) | (df["close"] < (df["ema_26"] * 0.89)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["change_pct_4h"] < 0.16) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < -0.5) | (df["close"] < (df["ema_26"] * 0.91)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.75) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["change_pct_1d"] < 0.1) | (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.9) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["close"] < (df["ema_26"] * 0.93)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.91)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.5) | (df["close"] < (df["ema_26"] * 0.92)) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["close"] < (df["ema_26"] * 0.88)) ) long_entry_logic.append((df["rsi_3"] > 20.0) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1d"] < 0.8)) long_entry_logic.append( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["is_downtrend_3_1d"] == False) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 4.0)) | (df["change_pct_1h"] > -0.02) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) # Logic long_entry_logic.append(df["close"] < (df["ema_26"] * 0.938)) long_entry_logic.append(df["cti_20"] < -0.75) long_entry_logic.append(df["r_14"] < -94.0) # Condition #44 - Quick mode bull. if index == 44: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.3)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append(df["close_max_48"] > (df["close"] * 1.1)) # pump and now started dumping, still high long_entry_logic.append( (df["change_pct_1d"] > -0.05) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) | (df["hl_pct_change_48_1h"] < 0.4) ) long_entry_logic.append( (df["change_pct_1d"] < 0.1) | (df["top_wick_pct_1d"] < 0.1) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 70.0) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] > -0.02) | (df["top_wick_pct_1d"] < 0.06) | (df["change_pct_1d"].shift(288) < 0.12) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["change_pct_4h"] > -0.06) | (df["change_pct_4h"].shift(48) < 0.06) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["change_pct_4h"] > -0.02) | (df["cti_20_4h"] < 0.85) | (df["cti_20_4h"].shift(48) < 0.85) | (df["rsi_14_4h"].shift(48) < 70.0) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 5.0)) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 5.0)) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] < 0.1) | (df["top_wick_pct_1d"] < 0.05) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) long_entry_logic.append( (df["change_pct_4h"].shift(48) < 0.1) | (df["change_pct_4h"] > -0.04) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["top_wick_pct_1d"] < (abs(df["change_pct_1d"]) * 2.0)) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) long_entry_logic.append( (df["change_pct_4h"] < 0.16) | (df["top_wick_pct_4h"] < 0.08) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) < 0.1) | (df["top_wick_pct_1d"].shift(288) < 0.1) | (df["cti_20_1d"].shift(288) < 0.8) | (df["rsi_14_1d"].shift(288) < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] > -0.1) | (df["change_pct_1d"].shift(288) < 0.1) | (df["cti_20_1d"].shift(288) < 0.5) | (df["rsi_14_1d"].shift(288) < 70.0) ) long_entry_logic.append( (df["change_pct_1d"] < 0.1) | (df["top_wick_pct_1d"] < 0.05) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 80.0) ) long_entry_logic.append( (df["change_pct_1d"] < 0.2) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] > -0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["change_pct_4h"].shift(48) < 0.01) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"].shift(48) < 70.0) ) long_entry_logic.append( (df["top_wick_pct_1h"] < (abs(df["change_pct_1h"]) * 3.0)) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.0) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1h"] > -0.08) | (df["change_pct_1h"].shift(12) < 0.08) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.1) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 4.0)) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.9) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.08) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.05) | (df["top_wick_pct_1d"] < 0.05) | (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["is_downtrend_3_4h"] == False) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.75) | (df["close"] < (df["ema_200_4h"] * 1.1)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 10.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["is_downtrend_3_1h"] == False) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["cti_20_1d"] < -0.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 2.0)) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.1) | (df["top_wick_pct_4h"] < 0.03) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.8) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 30.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1h"] > -0.03) | (df["change_pct_1h"].shift(12) < 0.03) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 2.0)) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append((df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0)) long_entry_logic.append((df["change_pct_4h"] > -0.06) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < 0.5)) long_entry_logic.append( (df["change_pct_4h"].shift(48) < 0.04) | (df["top_wick_pct_4h"].shift(48) < 0.04) | (df["change_pct_4h"] > -0.02) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["change_pct_1d"] > -0.06) | (df["change_pct_1d"].shift(288) < 0.06) | (df["cti_20_1d"].shift(288) < 0.8) | (df["rsi_14_1d"].shift(288) < 70.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.0) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.04) | (df["top_wick_pct_4h"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) ) long_entry_logic.append( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_4h"] < -0.0) | (df["cti_20_1d"] < -0.5) ) long_entry_logic.append( (df["change_pct_1d"] < 0.16) | (df["top_wick_pct_1d"] < 0.16) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < 0.5) ) long_entry_logic.append( (df["change_pct_4h"] < 0.1) | (df["top_wick_pct_4h"] < 0.1) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 70.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < -0.9) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 10.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_1d"] < (abs(df["change_pct_1d"]) * 4.0)) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.08) | (df["top_wick_pct_4h"] < 0.04) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.8) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_24_4h"] < (df["close"] * 1.5)) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) ) long_entry_logic.append( (df["change_pct_1h"] > -0.02) | (df["change_pct_1h"].shift(12) < 0.04) | (df["top_wick_pct_1h"].shift(12) < 0.04) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["bb20_2_width_1h"] > 0.18) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 5.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] < 0.26) | (df["top_wick_pct_1d"] < 0.06) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.5) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_24_4h"] < (df["close"] * 1.5)) ) long_entry_logic.append( (df["change_pct_1h"] > -0.06) | (df["change_pct_1h"].shift(12) < 0.06) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_1d"] < (abs(df["change_pct_1d"]) * 3.0)) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["bb20_2_width_1h"] > 0.18) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_1d"] < 0.5) | (df["bb20_2_width_1h"] > 0.2) ) long_entry_logic.append( (df["change_pct_1d"] < 0.2) | (df["top_wick_pct_1d"] < 0.05) | (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1d"] < -0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["bb20_2_width_1h"] > 0.17) ) long_entry_logic.append( (df["change_pct_1d"] < 0.25) | (df["top_wick_pct_1d"] < 0.2) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < -0.0) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["r_14"] < -96.0) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < -0.8) | (df["rsi_3_1h"] > 25.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.9) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < 0.5) | (df["cti_20_1d"] < 0.5) | (df["bb20_2_width_1h"] > 0.16) ) long_entry_logic.append( (df["change_pct_4h"] < 0.05) | (df["top_wick_pct_4h"] < 0.05) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.0) | (df["cti_20_1d"] < -0.0) | (df["bb20_2_width_1h"] > 0.22) ) long_entry_logic.append( (df["change_pct_1d"] < 0.1) | (df["top_wick_pct_1d"] < 0.06) | (df["cti_20_15m"] < -0.8) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 70.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 10.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["bb20_2_width_1h"] > 0.17) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 10.0) | (df["cti_20_1h"] < -0.5) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_3_15m"] > 16.0) | (df["rsi_3_1h"] > 16.0) | (df["cti_20_1d"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["bb20_2_width_1h"] > 0.18) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1h"] < -0.8) | (df["cti_20_4h"] < -0.0) | (df["bb20_2_width_1h"] > 0.16) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 20.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["ema_200_dec_48_1h"] == False) | (df["bb20_2_width_1h"] > 0.19) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_3_15m"] > 30.0) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_4h"].shift(48) < 0.06) | (df["change_pct_4h"] > -0.06) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.0) | (df["rsi_3_1h"] > 12.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["bb20_2_width_1h"] > 0.23) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 25.0) | (df["rsi_3_1h"] > 10.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["cti_20_15m"] < -0.9) | (df["rsi_14_15m"] < 20.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] > 20.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 10.0) | (df["ema_200_dec_4_1d"] == False) | (df["high_max_24_4h"] < (df["close"] * 1.5)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 20.0) | (df["rsi_3_1h"] > 10.0) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_4_1d"] == False) | (df["bb20_2_width_1h"] > 0.22) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < -0.5) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_4_1d"] == False) | (df["bb20_2_width_1h"] > 0.22) ) long_entry_logic.append( (df["change_pct_4h"].shift(48) < 0.16) | (df["top_wick_pct_4h"].shift(48) < 0.04) | (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.04) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["is_downtrend_3_1d"] == False) | (df["cti_20_1d"] < 0.5) | (df["high_max_6_1d"] < (df["close"] * 1.8)) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 2.0)) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_1h"] < 0.5) | (df["rsi_3_1h"] > 25.0) | (df["cti_20_4h"] < -0.8) | (df["cti_20_1d"] < -0.8) | (df["ema_200_dec_48_1h"] == False) | (df["bb20_2_width_1h"] > 0.25) ) long_entry_logic.append( (df["rsi_3"] > 10.0) | (df["rsi_3_15m"] > 16.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_1h"] < (abs(df["change_pct_1h"]) * 4.0)) | (df["rsi_14_1h"] < 70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["is_downtrend_3_1d"] == False) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 30.0) | (df["ema_200_dec_48_1h"] == False) | (df["high_max_48_1h"] < (df["close"] * 1.25)) ) long_entry_logic.append( (df["is_downtrend_3_1d"] == False) | (df["r_480_1h"] > -90.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_3_1h"] > 20.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.8) | (df["rsi_3_15m"] > 25.0) | (df["rsi_14_15m"] < 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_3_1h"] > 25.0) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["cti_20_4h"] < -0.5) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 30.0) | (df["rsi_3_15m"] > 20.0) | (df["cti_20_1h"] < -0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_15m"] < 20.0) | (df["rsi_3_1h"] > 20.0) | (df["r_480_1h"] > -90.0) | (df["rsi_3_4h"] > 30.0) | (df["r_480_4h"] > -90.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["cti_20_4h"].shift(48) < 0.5) | (df["rsi_14_4h"].shift(48) < 70.0) ) long_entry_logic.append( (df["cti_20_15m"] < -0.5) | (df["rsi_14_15m"] < 30.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 60.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 2.0)) | (df["cti_20_1h"] < 0.5) | (df["cti_20_4h"] < -0.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["top_wick_pct_4h"] < (abs(df["change_pct_4h"]) * 4.0)) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["cti_20_1d"] < 0.5) ) long_entry_logic.append( (df["change_pct_4h"] < 0.06) | (df["top_wick_pct_4h"] < 0.06) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] > -0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["cti_20_1h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3_15m"] > 25.0) | (df["cti_20_4h"] < 0.5) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] < 0.5) ) long_entry_logic.append( (df["is_downtrend_3_4h"] == False) | (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_15m"] > 30.0) | (df["rsi_3_1h"] > 20.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 6.0) | (df["rsi_3_4h"] > 16.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["rsi_3"] > 12.0) | (df["cti_20_15m"] < -0.0) | (df["rsi_14_15m"] < 36.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 60.0) ) # Logic long_entry_logic.append(df["bb20_2_width_1h"] > 0.132) long_entry_logic.append(df["cti_20"] < -0.8) long_entry_logic.append(df["r_14"] < -90.0) # Condition #45 - Quick mode (Long). if index == 45: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_45_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_45_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_45_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_45_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_45_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_45_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_45_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_45_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_45_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_45_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_45_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_45_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_45_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_45_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_45_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_45_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_45_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_45_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_45_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_45_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_45_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_45_rsi_14_1d_max.value) long_entry_logic.append(df["r_480_1h"] < self.entry_45_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] < self.entry_45_r_480_1h_max.value) if self.entry_45_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_45_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_45_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_45_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_45_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_45_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) # Logic long_entry_logic.append(df["rsi_14"] > self.entry_45_rsi_14_min.value) long_entry_logic.append(df["rsi_14"] < self.entry_45_rsi_14_max.value) long_entry_logic.append(df["rsi_20"] < df["rsi_20"].shift(1)) long_entry_logic.append(df["cti_20"] < self.entry_45_cti_20_max.value) long_entry_logic.append(df["close"] < (df["sma_16"] * self.entry_45_sma_offset.value)) # Condition #46 - Quick mode (Long). if index == 46: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_46_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_46_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_46_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_46_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_46_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_46_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_46_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_46_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_46_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_46_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_46_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_46_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_46_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_46_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_46_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_46_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_46_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_46_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_46_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_46_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_46_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_46_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_46_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_46_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_46_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_46_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_46_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_46_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_46_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_46_r_480_4h_max.value) if self.entry_46_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_46_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_46_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_46_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_46_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_46_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_46_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_46_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_46_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_46_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_46_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_46_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_46_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -80.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["cti_20_1d"] < 0.75) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["r_480_1h"] > -80.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["cti_20_1d"] < 0.8) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["r_480_1h"] > -80.0) | (df["r_480_4h"] > -60.0) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["r_480_1h"] > -70.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) long_entry_logic.append( (df["cti_20_4h"] < 0.75) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.03) | (df["change_pct_1d"].shift(288) < 0.03) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["r_480_4h"] < -25.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 50.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -25.0) | (df["rsi_14_1d"] < 60.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -25.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] > 0.12) ) long_entry_logic.append( (df["rsi_14_4h"] < 40.0) | (df["r_480_4h"] > -65.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] > 0.20) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] > 0.25) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_1d"] < 40.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["r_480_1h"] < -40.0) | (df["r_480_4h"] < -30.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_4h"] < 40.0) | (df["cti_20_1d"] < 0.5) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.03) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -75.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > (df["high_max_12_1d"] * 0.60)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] > 0.20) ) long_entry_logic.append( (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] > 0.20) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] > (df["high_max_12_1d"] * 0.50)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["r_480_4h"] < -35.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.7) | (df["rsi_14_4h"] < 70.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -35.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -40.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] > 0.20) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["rsi_14_1h"] < 50.0) | (df["rsi_14_max_3_1h"] < 70.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_4_1d"] == False) | (df["hl_pct_change_6_1d"] > 0.20) ) long_entry_logic.append( (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["close"] > df["sup_level_1d"]) | (df["ema_200_dec_48_1h"] == False) | (df["hl_pct_change_6_1d"] > 0.20) ) long_entry_logic.append( (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.03) | (df["not_downtrend_1h"]) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_4h"] < -40.0) ) long_entry_logic.append( (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["r_480_1h"] > -70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["hl_pct_change_6_1d"] > 0.20) ) long_entry_logic.append( (df["change_pct_1d"] > -0.02) | (df["change_pct_1d"].shift(288) < 0.02) | (df["not_downtrend_1h"]) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_4h"] < 0.02) | (df["top_wick_pct_4h"] < 0.02) | (df["rsi_14_1h"] < 50.0) | (df["cti_20_4h"] < 0.8) | (df["rsi_14_4h"] < 60.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 40.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] < -35.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["rsi_14"] < 42.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) ) long_entry_logic.append( (df["rsi_14"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["r_480_4h"] < -35.0) | (df["close"] < df["res_hlevel_4h"]) ) long_entry_logic.append( (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_1h"] < -40.0) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_1d"] < 50.0) | (df["r_480_4h"] > -65.0) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -65.0) | (df["r_480_4h"] > -65.0) | (df["ema_200_dec_4_1d"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.60)) ) long_entry_logic.append( (df["change_pct_4h"] > -0.01) | (df["change_pct_4h"].shift(48) < 0.01) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 46.0) | (df["r_480_1h"] > -65.0) | (df["r_480_4h"] > -75.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_12_1d"] * 0.75)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["r_480_1h"] > -60.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_4h"]) | (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["change_pct_1d"].shift(288) < 0.04) | (df["not_downtrend_1h"]) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 50.0) | (df["rsi_14_max_6_1d"] < 70.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) ) long_entry_logic.append( (df["change_pct_1d"] < 0.06) | (df["top_wick_pct_1d"] < 0.06) | (df["rsi_14"] < 36.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_1h"].shift(12) > -0.02) | (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] < df["res_hlevel_4h"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 46.0) | (df["r_480_1h"] > -70.0) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 40.0) | (df["rsi_14_4h"] < 40.0) | (df["rsi_14_1d"] < 46.0) | (df["r_480_1h"] < -35.0) ) long_entry_logic.append( (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["cti_20_1h"] < 0.5) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] < df["res_hlevel_1h"]) ) long_entry_logic.append( (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["r_480_1h"] < -35.0) | (df["r_480_4h"] > -60.0) ) long_entry_logic.append( (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["is_downtrend_3_1d"] == False) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_max_6_1d"] < 65.0) | (df["r_480_1h"] < -35.0) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1d"] < 50.0) | (df["cti_20_1d"] < 0.7) | (df["rsi_14_max_6_1d"] < 75.0) ) long_entry_logic.append( (df["rsi_14"] < 40.0) | (df["rsi_14_15m"] < 46.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 46.0) | (df["rsi_14_1d"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_6_1d"] > 0.25) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["is_downtrend_3_1d"] == False) | (df["rsi_14"] < 46.0) | (df["rsi_14_15m"] < 46.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) ) # Logic long_entry_logic.append(df["rsi_14"] < self.entry_46_rsi_14_max.value) long_entry_logic.append(df["chandelier_dir_1h"].shift(1) < -0) long_entry_logic.append(df["chandelier_dir_1h"] > 0) long_entry_logic.append(df["close"] > df["zlma_50_1h"]) long_entry_logic.append(df["ema_12"] < df["ema_26"]) # Condition #47 - Quick mode (Long). if index == 47: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_47_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_47_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_47_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_47_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_47_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_47_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_47_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_47_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_47_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_47_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_47_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_47_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_47_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_47_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_47_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_47_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_47_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_47_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_47_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_47_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_47_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_47_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_47_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_47_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_47_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_47_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_47_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_47_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_47_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_47_r_480_4h_max.value) if self.entry_47_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_47_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_47_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_47_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_47_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_47_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_47_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_47_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_47_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_47_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_47_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_47_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_47_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) long_entry_logic.append( (df["not_downtrend_1d"]) | (df["r_480_1h"] > -80.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.75)) ) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3_1h"] > 30.0) | (df["rsi_3_4h"] > 36.0) | (df["close"] > df["sup_level_1h"]) | (df["close"] > (df["high_max_6_1d"] * 0.80)) ) long_entry_logic.append( (df["ema_200_dec_48_1h"] == False) | (df["close"] > (df["high_max_6_1d"] * 0.70)) | (df["close"] > (df["high_max_12_1d"] * 0.60)) ) long_entry_logic.append( (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 70.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) ) long_entry_logic.append( (df["rsi_3_1h"] > 30.0) | (df["cti_20_4h"] < 0.5) | (df["rsi_14_4h"] < 50.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_24_4h"] == False) ) # Logic long_entry_logic.append(df["rsi_14"] > self.entry_47_rsi_14_min.value) long_entry_logic.append(df["rsi_14"] < self.entry_47_rsi_14_max.value) long_entry_logic.append(df["rsi_20"] > self.entry_47_rsi_20_min.value) long_entry_logic.append(df["rsi_20"] < self.entry_47_rsi_20_max.value) long_entry_logic.append(df["cti_20"] < self.entry_47_cti_20_max.value) long_entry_logic.append(df["chandelier_dir"].shift(1) < -0) long_entry_logic.append(df["chandelier_dir"] > 0) long_entry_logic.append(df["ema_12"] < (df["ema_26"] * self.entry_47_ema_offset.value)) long_entry_logic.append(df["close"] < (df["high_max_12_1h"] * self.entry_47_high_max_12_1h_max.value)) # Condition #48 - Quick mode (Long). if index == 48: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_48_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_48_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_48_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_48_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_48_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_48_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_48_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_48_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_48_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_48_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_48_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_48_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_48_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_48_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_48_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_48_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_48_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_48_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_48_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_48_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_48_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_48_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_48_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_48_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_48_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_48_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_48_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_48_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_48_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_48_r_480_4h_max.value) if self.entry_48_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_48_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_48_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_48_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_48_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_48_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_48_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_48_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_48_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_48_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_48_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_48_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_48_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) if self.entry_48_ema_50_1h_over_ema_200_1h_enabled.value: long_entry_logic.append(df["ema_50_1h"] > df["ema_200_1h"]) # Logic long_entry_logic.append(df["rsi_14"] < self.entry_48_rsi_14_max.value) long_entry_logic.append(df["cci_20"] < self.entry_48_cci_20_max.value) long_entry_logic.append(df["close"] < (df["sma_30"] * self.entry_48_sma_offset.value)) long_entry_logic.append(((df["close"] - df["open_min_6"]) / df["open_min_6"]) > self.entry_48_inc_min.value) # Condition #49 - Quick mode (Long). if index == 49: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_49_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_49_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_49_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_49_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_49_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_49_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_49_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_49_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_49_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_49_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_49_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_49_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_49_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_49_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_49_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_49_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_49_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_49_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_49_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_49_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_49_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_49_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_49_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_49_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_49_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_49_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_49_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_49_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_49_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_49_r_480_4h_max.value) if self.entry_49_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_49_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_49_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_49_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_49_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_49_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_49_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_49_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_49_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_49_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_49_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_49_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_49_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) if self.entry_49_ema_12_1h_over_ema_200_1h_enabled.value: long_entry_logic.append(df["ema_12_1h"] > df["ema_200_1h"]) # Logic long_entry_logic.append(df["rsi_14"] < self.entry_49_rsi_14_max.value) # long_entry_logic.append(df["r_14"] < self.entry_49_r_14_max.value) # long_entry_logic.append(df["cci_20"] < self.entry_49_cci_20_max.value) # long_entry_logic.append(df["close"] < (df["sma_30"] * self.entry_49_sma_offset.value)) long_entry_logic.append( ((df["close"] - df["open_min_12"]) / df["open_min_12"]) > self.entry_49_inc_min.value ) # Condition #50 - Quick mode (Long) if index == 50: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_50_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_50_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_50_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_50_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_50_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_50_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_50_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_50_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_50_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_50_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= self.entry_50_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] <= self.entry_50_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] >= self.entry_50_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] >= self.entry_50_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] >= self.entry_50_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] >= self.entry_50_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] <= self.entry_50_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] <= self.entry_50_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] <= self.entry_50_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] <= self.entry_50_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] <= self.entry_50_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] <= self.entry_50_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_50_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_50_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_50_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_50_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_50_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_50_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_50_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_50_r_480_4h_max.value) if self.entry_50_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_50_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_50_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_50_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_50_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_50_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_50_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_50_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_50_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_50_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_50_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_50_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_50_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) if self.entry_50_ema_12_1h_over_ema_200_1h_enabled.value: long_entry_logic.append(df["ema_12_1h"] > df["ema_200_1h"]) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 4.0) ) # Logic long_entry_logic.append(df["close"] < (df["bb20_2_low"] * self.entry_50_bb_offset.value)) long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * self.entry_50_ema_open_offset.value)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100.0)) # Condition #51 - Quick mode (Long). if index == 51: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.94)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.92)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.90)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.88)) long_entry_logic.append(df["close"] > (df["high_max_48_1h"] * 0.86)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 6.0) long_entry_logic.append(df["rsi_3"] <= 50.0) long_entry_logic.append(df["rsi_3_15m"] >= 10.0) long_entry_logic.append(df["rsi_3_1h"] >= 10.0) long_entry_logic.append(df["rsi_3_4h"] >= 10.0) # long_entry_logic.append(df["rsi_3_1d"] >= 10.0) long_entry_logic.append(df["cti_20_1h"] <= 0.90) long_entry_logic.append(df["rsi_14_1h"] <= 80.0) long_entry_logic.append(df["cti_20_4h"] <= 0.90) long_entry_logic.append(df["rsi_14_4h"] <= 80.0) long_entry_logic.append(df["cti_20_1d"] <= 0.90) long_entry_logic.append(df["rsi_14_1d"] <= 80.0) long_entry_logic.append(df["zlma_50_dec_1h"] == False) # Logic long_entry_logic.append(df["rsi_14"] < 32.0) long_entry_logic.append(df["close"] < (df["ema_26"] * 0.968)) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.999)) # Condition #52 - Quick mode (Long). if index == 52: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3_15m"] >= 4.0) long_entry_logic.append(df["rsi_3_1h"] >= 4.0) long_entry_logic.append(df["rsi_14_1h"] <= 70.0) long_entry_logic.append(df["rsi_14_4h"] <= 70.0) long_entry_logic.append(df["rsi_14_1d"] <= 75.0) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["rsi_3"] > 4.0) | (df["rsi_3_15m"] > 6.0) | (df["r_480_1h"] > -80.0) | (df["ema_200_dec_24_4h"] == False) ) long_entry_logic.append( (df["change_pct_1d"] > -0.04) | (df["top_wick_pct_1d"] < 0.04) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 12.0) | (df["rsi_3_15m"] > 12.0) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3"] > 20.0) | (df["rsi_3_15m"] >= 20.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) # Logic long_entry_logic.append(df["rsi_14"] < 36.0) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.988)) long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.028)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100.0)) # Condition #53 - Quick mode (Long). if index == 53: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3_15m"] >= 4.0) long_entry_logic.append(df["rsi_3_1h"] >= 4.0) long_entry_logic.append(df["rsi_14_1h"] <= 70.0) long_entry_logic.append(df["rsi_14_4h"] <= 70.0) long_entry_logic.append(df["rsi_14_1d"] <= 75.0) long_entry_logic.append(df["r_480_1h"] <= -20.0) long_entry_logic.append(df["r_480_4h"] <= -20.0) long_entry_logic.append( (df["close"] > (df["high_max_6_1d"] * 0.70)) | (df["hl_pct_change_6_1d"] < 1.2) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["close"] > df["sup_level_1h"]) | (df["close"] > df["sup_level_4h"]) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_3"] >= 12.0) | (df["rsi_14_15m"] < 50.0) | (df["rsi_14_max_6_1h"] < 75.0) | (df["close"] < df["res_hlevel_1h"]) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1h"]) | (df["rsi_3_15m"] >= 16.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["close"] > df["sup_level_1h"]) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["not_downtrend_1d"]) | (df["rsi_3_15m"] >= 20.0) | (df["r_480_4h"] > -70.0) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] >= 20.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["rsi_14_max_6_4h"] < 70.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] >= 20.0) | (df["rsi_14_max_6_4h"] < 75.0) | (df["close"] > df["sup_level_1h"]) | (df["hl_pct_change_48_1h"] < 0.5) ) long_entry_logic.append( (df["not_downtrend_15m"]) | (df["rsi_3_15m"] >= 20.0) | (df["rsi_14_max_6_1h"] < 70.0) | (df["close"] < df["res_hlevel_1h"]) | (df["close"] < df["res_hlevel_4h"]) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["change_pct_1h"] > -0.08) | (df["change_pct_1h"].shift(12) < 0.08) | (df["rsi_14_1h"].shift(12) < 70.0) | (df["r_480_4h"] < -35.0) ) # Logic long_entry_logic.append(df["rsi_3"] < 46.0) long_entry_logic.append(df["rsi_14"] > 35.0) long_entry_logic.append(df["rsi_20"] < df["rsi_20"].shift(1)) long_entry_logic.append(df["cti_20"] < -0.60) long_entry_logic.append(df["close"] < (df["sma_16"] * 0.956)) # Condition #61 - Rebuy mode (Long). if index == 61: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["protections_long_rebuy"] == True) long_entry_logic.append(current_free_slots >= self.rebuy_mode_min_free_slots) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.24)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.3)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.75)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["rsi_3_15m"] > 6.0) long_entry_logic.append(df["rsi_3_1h"] > 6.0) long_entry_logic.append(df["rsi_3_4h"] > 6.0) long_entry_logic.append(df["cti_20_15m"] < 0.9) long_entry_logic.append(df["cti_20_1h"] < 0.9) long_entry_logic.append(df["cti_20_4h"] < 0.9) long_entry_logic.append(df["cti_20_1d"] < 0.9) long_entry_logic.append((df["change_pct_1h"] > -0.01) | (df["cti_20_1h"] < 0.7) | (df["rsi_14_1h"] < 50.0)) long_entry_logic.append( (df["not_downtrend_1h"]) | (df["not_downtrend_4h"]) | (df["rsi_3"] > 16.0) | (df["r_480_4h"] < -30.0) ) # Logic long_entry_logic.append(df["rsi_14"] < 40.0) long_entry_logic.append(df["bb40_2_delta"].gt(df["close"] * 0.03)) long_entry_logic.append(df["close_delta"].gt(df["close"] * 0.018)) long_entry_logic.append(df["bb40_2_tail"].lt(df["bb40_2_delta"] * 0.4)) long_entry_logic.append(df["close"].lt(df["bb40_2_low"].shift())) long_entry_logic.append(df["close"].le(df["close"].shift())) # Condition #62 - Rebuy mode (Long). if index == 62: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["protections_long_rebuy"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.94)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.92)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.90)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.88)) long_entry_logic.append(df["close"] > (df["high_max_48_1h"] * 0.86)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * 0.84)) long_entry_logic.append(df["close"] > (df["high_max_12_1d"] * 0.82)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 30.0) long_entry_logic.append(df["rsi_3"] <= 50.0) long_entry_logic.append(df["rsi_3_15m"] >= 30.0) long_entry_logic.append(df["rsi_3_1h"] >= 30.0) long_entry_logic.append(df["rsi_3_4h"] >= 30.0) long_entry_logic.append(df["rsi_3_1d"] >= 30.0) long_entry_logic.append(df["cti_20_1h"] <= 0.90) long_entry_logic.append(df["rsi_14_1h"] <= 80.0) long_entry_logic.append(df["cti_20_4h"] <= 0.90) long_entry_logic.append(df["rsi_14_4h"] <= 80.0) long_entry_logic.append(df["cti_20_1d"] <= 0.90) long_entry_logic.append(df["rsi_14_1d"] <= 80.0) long_entry_logic.append(df["r_480_1h"] <= -5.0) long_entry_logic.append(df["r_480_4h"] <= -5.0) long_entry_logic.append(df["close"] > df["ema_200_1h"]) long_entry_logic.append( (df["change_pct_1h"] > -0.01) | (df["ema_200_dec_24_4h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["r_480_1h"] < -30.0) | (df["r_480_4h"] < -25.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (df["ema_200_dec_4_1d"] == False) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["r_480_1h"] < -25.0) | (df["r_480_4h"] < -30.0) | (df["close"] < df["res_hlevel_4h"]) | (df["close"] < df["res_hlevel_1d"]) | (((df["close"] - df["low_min_48_1h"]) / df["low_min_48_1h"]) < (df["hl_pct_change_48_1h"] * 0.38)) ) long_entry_logic.append( (df["not_downtrend_1d"]) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 46.0) | (df["rsi_14_4h"] < 50.0) | (df["close"] > df["sup_level_1h"]) | (df["ema_200_dec_48_1h"] == False) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["rsi_14_4h"] < 50.0) | (df["r_480_1h"] < -35.0) | (df["ema_200_dec_4_1d"] == False) ) long_entry_logic.append( (df["rsi_14"] > df["rsi_14"].shift(12)) | (df["rsi_14_15m"] > df["rsi_14_15m"].shift(12)) | (df["rsi_14_15m"] < 40.0) | (df["rsi_14_1h"] < 60.0) | (df["rsi_14_4h"] < 60.0) | (df["r_14_1h"] < -25.0) | (df["r_14_4h"] < -25.0) | (df["ema_200_dec_24_4h"] == False) ) # Logic long_entry_logic.append(df["rsi_14"] < 36.0) long_entry_logic.append(df["close"] < (df["ema_26"] * 0.988)) # Condition #81 - High profit mode (log) if index == 81: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.06) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.06) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.78)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.76)) long_entry_logic.append(df["close"] > (df["high_max_12_1h"] * 0.74)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.72)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 6.0) long_entry_logic.append(df["rsi_3"] <= 50.0) long_entry_logic.append(df["rsi_3_15m"] >= 10.0) long_entry_logic.append(df["rsi_3_1h"] >= 10.0) long_entry_logic.append(df["rsi_3_4h"] >= 10.0) long_entry_logic.append(df["cti_20_1h"] <= 0.90) long_entry_logic.append(df["rsi_14_1h"] <= 80.0) long_entry_logic.append(df["cti_20_4h"] <= 0.90) long_entry_logic.append(df["rsi_14_4h"] <= 80.0) long_entry_logic.append(df["cti_20_1d"] <= 0.90) long_entry_logic.append(df["rsi_14_1d"] <= 80.0) long_entry_logic.append(df["ema_200_dec_48_1h"] == False) # Logic long_entry_logic.append(df["rsi_14"] < 32.0) long_entry_logic.append(df["bb40_2_delta"].gt(df["close"] * 0.036)) long_entry_logic.append(df["close_delta"].gt(df["close"] * 0.012)) long_entry_logic.append(df["bb40_2_tail"].lt(df["bb40_2_delta"] * 0.4)) long_entry_logic.append(df["close"].lt(df["bb40_2_low"].shift())) long_entry_logic.append(df["close"].le(df["close"].shift())) # Condition #82 - High profit mode (Long). if index == 82: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.06) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.06) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.78)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.76)) long_entry_logic.append(df["close"] > (df["high_max_12_1h"] * 0.74)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.72)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 4.0) long_entry_logic.append(df["rsi_3"] <= 50.0) long_entry_logic.append(df["rsi_3_15m"] >= 4.0) long_entry_logic.append(df["rsi_3_1h"] >= 10.0) long_entry_logic.append(df["rsi_3_4h"] >= 10.0) long_entry_logic.append(df["cti_20_1h"] <= 0.90) long_entry_logic.append(df["rsi_14_1h"] <= 80.0) long_entry_logic.append(df["cti_20_4h"] <= 0.90) long_entry_logic.append(df["rsi_14_4h"] <= 80.0) long_entry_logic.append(df["cti_20_1d"] <= 0.90) long_entry_logic.append(df["rsi_14_1d"] <= 80.0) long_entry_logic.append(df["ema_200_dec_48_1h"] == False) long_entry_logic.append(df["ema_26_1h"] > df["ema_200_1h"]) long_entry_logic.append(df["ema_50_1h"] > df["ema_200_1h"]) # Logic long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.024)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) # Condition #101 - Long mode rapid if index == 101: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close_max_12"] < (df["close"] * 1.18)) long_entry_logic.append(df["close_max_24"] < (df["close"] * 1.2)) long_entry_logic.append(df["close_max_48"] < (df["close"] * 1.22)) long_entry_logic.append(df["high_max_24_1h"] < (df["close"] * 1.24)) long_entry_logic.append(df["high_max_48_1h"] < (df["close"] * 1.26)) long_entry_logic.append(df["high_max_24_4h"] < (df["close"] * 1.5)) long_entry_logic.append(df["high_max_12_1d"] < (df["close"] * 1.6)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.4) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.8) long_entry_logic.append(df["hl_pct_change_6_1d"] < 0.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > 4.0) long_entry_logic.append(df["rsi_3_15m"] > 6.0) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.8) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append(df["cti_20_1d"] < 0.8) long_entry_logic.append(df["rsi_14_1d"] < 80.0) # Logic long_entry_logic.append(df["rsi_14"] < 36.0) long_entry_logic.append(df["rsi_14"] < df["rsi_14"].shift(1)) long_entry_logic.append(df["close"] < (df["sma_16"] * 0.956)) long_entry_logic.append(df["cti_20_15m"] < -0.5) # Condition #102 - Long mode rapid if index == 102: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_102_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_102_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_102_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_102_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_102_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_102_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_102_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_102_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_102_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_102_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_102_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_102_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_102_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_102_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_102_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_102_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_102_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_102_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_102_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_102_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_102_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_102_rsi_14_1d_max.value) long_entry_logic.append(df["r_480_1h"] < self.entry_102_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] < self.entry_102_r_480_4h_max.value) if self.entry_102_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_102_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_102_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_102_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_102_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_102_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_102_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_102_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_102_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_102_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_102_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_102_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_102_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) # Logic long_entry_logic.append(df["rsi_14"] < self.entry_102_rsi_14_max.value) long_entry_logic.append(df["close"] < (df["ema_16"] * self.entry_102_ema_offset.value)) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * self.entry_102_bb_offset.value)) # Condition #103 - Long mode rapid if index == 103: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_103_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_103_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_103_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_103_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_103_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_103_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_103_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_103_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_103_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_103_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_103_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_103_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_103_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_103_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_103_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_103_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_103_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_103_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_103_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_103_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_103_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_103_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_103_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_103_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_103_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_103_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_103_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_103_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_103_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_103_r_480_4h_max.value) if self.entry_103_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_103_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_103_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_103_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_103_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_103_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_103_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_103_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_103_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_103_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_103_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_103_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_103_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) # Logic long_entry_logic.append(df["rsi_14"] > self.entry_103_rsi_14_min.value) long_entry_logic.append(df["close"] < (df["sma_16"] * self.entry_103_sma_offset.value)) long_entry_logic.append(df["close"] < (df["bb20_2_mid"] * self.entry_103_bb_offset.value)) # Condition #104 - Long mode rapid if index == 104: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_104_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_104_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_104_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_104_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_104_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_104_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_104_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_104_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_104_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_104_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_104_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_104_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_104_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_104_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_104_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_104_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_104_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_104_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_104_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_104_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_104_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_104_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_104_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_104_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_104_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_104_r_480_4h_max.value) if self.entry_104_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_104_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_104_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_104_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_104_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_104_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_104_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_104_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_104_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_104_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_104_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_104_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_104_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) # Logic long_entry_logic.append(df["rsi_14"] > self.entry_104_rsi_14_min.value) long_entry_logic.append(df["rsi_14"] < self.entry_104_rsi_14_max.value) long_entry_logic.append(df["close"] < (df["sma_16"] * self.entry_104_sma_offset.value)) # Condition #105 - Long mode rapid if index == 105: # Protections long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["high_max_12_1d"] < (df["close"] * 1.6)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.5) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.75) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.8) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.9) long_entry_logic.append(df["hl_pct_change_6_1d"] < 1.9) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > 6.0) long_entry_logic.append(df["rsi_3_15m"] > 6.0) long_entry_logic.append(df["rsi_3_1h"] > 6.0) long_entry_logic.append(df["rsi_3_4h"] > 6.0) long_entry_logic.append(df["cti_20_1h"] < 0.8) long_entry_logic.append(df["rsi_14_1h"] < 80.0) long_entry_logic.append(df["cti_20_4h"] < 0.9) long_entry_logic.append(df["rsi_14_4h"] < 80.0) long_entry_logic.append(df["cti_20_1d"] < 0.8) long_entry_logic.append(df["rsi_14_1d"] < 80.0) long_entry_logic.append(df["close"] > df["sup_level_4h"]) long_entry_logic.append(df["close"] > df["sup_level_1d"]) # Logic long_entry_logic.append(df["rsi_3"] < 60.0) long_entry_logic.append(df["rsi_14"] < 46.0) long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * 0.018)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100)) # Condition #106 - Rapid mode (Long). if index == 106: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_106_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_106_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_106_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_106_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_106_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_106_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_106_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_106_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_106_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_106_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > self.entry_106_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] < self.entry_106_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] > self.entry_106_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] > self.entry_106_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] > self.entry_106_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] > self.entry_106_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] < self.entry_106_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] < self.entry_106_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] < self.entry_106_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] < self.entry_106_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] < self.entry_106_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] < self.entry_106_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_106_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_106_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_106_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_106_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_106_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_106_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_106_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_106_r_480_4h_max.value) if self.entry_106_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_106_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_106_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_106_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_106_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_106_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_106_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_106_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_106_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_106_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_106_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_106_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_106_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) # Logic long_entry_logic.append(df["cti_20"] < self.entry_106_cti_20_max.value) long_entry_logic.append(df["ewo_50_200"] < self.entry_106_ewo_50_200_max.value) long_entry_logic.append(df["close"] < (df["sma_30"] * self.entry_106_sma_offset.value)) # Condition #107 - Rapid mode (Long) if index == 107: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_107_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_107_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_107_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_107_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_107_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_107_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_107_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_107_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_107_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_107_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= self.entry_107_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] <= self.entry_107_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] >= self.entry_107_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] >= self.entry_107_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] >= self.entry_107_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] >= self.entry_107_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] >= self.entry_107_cti_20_1h_min.value) long_entry_logic.append(df["cti_20_1h"] <= self.entry_107_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] <= self.entry_107_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] <= self.entry_107_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] <= self.entry_107_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] <= self.entry_107_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] <= self.entry_107_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_107_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_107_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_107_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_107_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_107_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_107_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_107_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_107_r_480_4h_max.value) if self.entry_107_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_107_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_107_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_107_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_107_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_107_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_107_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_107_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_107_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_107_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_107_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_107_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_107_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) long_entry_logic.append(df["ema_200_1h"] > df["ema_200_1h"].shift(12)) long_entry_logic.append(df["ema_200_1h"].shift(12) > df["ema_200_1h"].shift(24)) # Logic long_entry_logic.append(df["bb40_2_low"].shift().gt(0.0)) long_entry_logic.append(df["bb40_2_delta"].gt(df["close"] * self.entry_107_bb40_bbdelta_close.value)) long_entry_logic.append(df["close_delta"].gt(df["close"] * self.entry_107_bb40_closedelta_close.value)) long_entry_logic.append(df["bb40_2_tail"].lt(df["bb40_2_delta"] * self.entry_107_bb40_tail_bbdelta.value)) long_entry_logic.append(df["close"].lt(df["bb40_2_low"].shift())) long_entry_logic.append(df["close"].le(df["close"].shift())) long_entry_logic.append(df["cti_20"] < self.entry_107_cti_20_max.value) long_entry_logic.append(df["r_480"] > self.entry_107_r_480_min.value) # Condition #108 - Rapid mode (Long) if index == 108: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * self.entry_108_close_max_12.value)) long_entry_logic.append(df["close"] > (df["close_max_24"] * self.entry_108_close_max_24.value)) long_entry_logic.append(df["close"] > (df["close_max_48"] * self.entry_108_close_max_48.value)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * self.entry_108_high_max_24_1h.value)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * self.entry_108_high_max_24_4h.value)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * self.entry_108_high_max_6_1d.value)) long_entry_logic.append(df["hl_pct_change_6_1h"] < self.entry_108_hl_pct_change_6_1h.value) long_entry_logic.append(df["hl_pct_change_12_1h"] < self.entry_108_hl_pct_change_12_1h.value) long_entry_logic.append(df["hl_pct_change_24_1h"] < self.entry_108_hl_pct_change_24_1h.value) long_entry_logic.append(df["hl_pct_change_48_1h"] < self.entry_108_hl_pct_change_48_1h.value) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= self.entry_108_rsi_3_min.value) long_entry_logic.append(df["rsi_3"] <= self.entry_108_rsi_3_max.value) long_entry_logic.append(df["rsi_3_15m"] >= self.entry_108_rsi_3_15m_min.value) long_entry_logic.append(df["rsi_3_1h"] >= self.entry_108_rsi_3_1h_min.value) long_entry_logic.append(df["rsi_3_4h"] >= self.entry_108_rsi_3_4h_min.value) long_entry_logic.append(df["rsi_3_1d"] >= self.entry_108_rsi_3_1d_min.value) long_entry_logic.append(df["cti_20_1h"] >= self.entry_108_cti_20_1h_min.value) long_entry_logic.append(df["cti_20_1h"] <= self.entry_108_cti_20_1h_max.value) long_entry_logic.append(df["rsi_14_1h"] <= self.entry_108_rsi_14_1h_max.value) long_entry_logic.append(df["cti_20_4h"] <= self.entry_108_cti_20_4h_max.value) long_entry_logic.append(df["rsi_14_4h"] <= self.entry_108_rsi_14_4h_max.value) long_entry_logic.append(df["cti_20_1d"] <= self.entry_108_cti_20_1d_max.value) long_entry_logic.append(df["rsi_14_1d"] <= self.entry_108_rsi_14_1d_max.value) long_entry_logic.append(df["r_14_1h"] >= self.entry_108_r_14_1h_min.value) long_entry_logic.append(df["r_14_1h"] <= self.entry_108_r_14_1h_max.value) long_entry_logic.append(df["r_14_4h"] >= self.entry_108_r_14_4h_min.value) long_entry_logic.append(df["r_14_4h"] <= self.entry_108_r_14_4h_max.value) long_entry_logic.append(df["r_480_1h"] >= self.entry_108_r_480_1h_min.value) long_entry_logic.append(df["r_480_1h"] <= self.entry_108_r_480_1h_max.value) long_entry_logic.append(df["r_480_4h"] >= self.entry_108_r_480_4h_min.value) long_entry_logic.append(df["r_480_4h"] <= self.entry_108_r_480_4h_max.value) if self.entry_108_sup_level_1h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1h"]) if self.entry_108_res_level_1h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_108_sup_level_4h_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_4h"]) if self.entry_108_res_level_4h_enabled.value: long_entry_logic.append(df["close"] < df["res_level_4h"]) if self.entry_108_sup_level_1d_enabled.value: long_entry_logic.append(df["close"] > df["sup_level_1d"]) if self.entry_108_res_level_1d_enabled.value: long_entry_logic.append(df["close"] < df["res_level_1h"]) if self.entry_108_ema_200_not_dec_1h_enabled.value: long_entry_logic.append(df["ema_200_dec_48_1h"] == False) if self.entry_108_ema_200_not_dec_4h_enabled.value: long_entry_logic.append(df["ema_200_dec_24_4h"] == False) if self.entry_108_ema_200_not_dec_1d_enabled.value: long_entry_logic.append(df["ema_200_dec_4_1d"] == False) if self.entry_108_not_downtrend_15m_enabled.value: long_entry_logic.append(df["not_downtrend_15m"]) if self.entry_108_not_downtrend_1h_enabled.value: long_entry_logic.append(df["not_downtrend_1h"]) if self.entry_108_not_downtrend_4h_enabled.value: long_entry_logic.append(df["not_downtrend_4h"]) if self.entry_108_not_downtrend_1d_enabled.value: long_entry_logic.append(df["not_downtrend_1d"]) # Logic long_entry_logic.append(df["rsi_14"] > self.entry_108_rsi_14_min.value) long_entry_logic.append(df["cti_20"] < self.entry_108_cti_20_max.value) long_entry_logic.append(df["r_14"] < self.entry_108_r_14_max.value) long_entry_logic.append(df["r_14"].shift(1) < self.entry_108_r_14_max.value) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * self.entry_108_bb_offset.value)) long_entry_logic.append(df["ema_26"] > df["ema_12"]) long_entry_logic.append((df["ema_26"] - df["ema_12"]) > (df["open"] * self.entry_108_ema_open_offset.value)) long_entry_logic.append((df["ema_26"].shift() - df["ema_12"].shift()) > (df["open"] / 100.0)) # Condition #109 - Rapid mode (Long) if index == 109: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.04) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.04) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 0.0) long_entry_logic.append(df["rsi_3"] <= 46.0) long_entry_logic.append(df["rsi_3_15m"] >= 6.0) long_entry_logic.append(df["rsi_3_1h"] >= 10.0) long_entry_logic.append(df["rsi_3_4h"] >= 10.0) # Logic long_entry_logic.append(df["cti_20"] < -0.75) long_entry_logic.append(df["r_14"] < -90.0) long_entry_logic.append(df["close"] < (df["bb20_2_low"] * 0.999)) long_entry_logic.append(df["close"] < (df["ema_20"] * 0.960)) # Condition #110 - Rapid mode (Long). if index == 110: # Protections long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.03) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.84)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.80)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.76)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.70)) long_entry_logic.append(df["close"] > (df["high_max_24_4h"] * 0.66)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * 0.60)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.60) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.70) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.80) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.90) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] > 2.0) long_entry_logic.append(df["rsi_3"] < 60.0) long_entry_logic.append(df["rsi_3_15m"] > 8.0) long_entry_logic.append(df["rsi_3_1h"] > 12.0) long_entry_logic.append(df["rsi_3_4h"] > 12.0) long_entry_logic.append(df["rsi_3_1d"] > 12.0) # Logic long_entry_logic.append(df["rsi_14"] < 36.0) long_entry_logic.append(df["cti_20"] < -0.75) long_entry_logic.append(df["ewo_50_200"] < -6.0) long_entry_logic.append(df["close"] < (df["ema_20"] * 0.988)) # Condition #120 - Grind mode (Long). if index == 120: # Protections long_entry_logic.append(num_open_grind_mode < self.grind_mode_max_slots) long_entry_logic.append(is_pair_grind_mode) long_entry_logic.append(df["protections_long_global"] == True) long_entry_logic.append(df["global_protections_long_pump"] == True) long_entry_logic.append(df["global_protections_long_dump"] == True) long_entry_logic.append(df["protections_long_rebuy"] == True) long_entry_logic.append(df["btc_pct_close_max_24_5m"] < 0.03) long_entry_logic.append(df["btc_pct_close_max_72_5m"] < 0.06) long_entry_logic.append(df["close"] > (df["close_max_12"] * 0.94)) long_entry_logic.append(df["close"] > (df["close_max_24"] * 0.92)) long_entry_logic.append(df["close"] > (df["close_max_48"] * 0.90)) long_entry_logic.append(df["close"] > (df["high_max_12_1h"] * 0.88)) long_entry_logic.append(df["close"] > (df["high_max_24_1h"] * 0.86)) long_entry_logic.append(df["close"] > (df["high_max_6_1d"] * 0.84)) long_entry_logic.append(df["close"] > (df["high_max_12_1d"] * 0.80)) long_entry_logic.append(df["hl_pct_change_6_1h"] < 0.30) long_entry_logic.append(df["hl_pct_change_12_1h"] < 0.40) long_entry_logic.append(df["hl_pct_change_24_1h"] < 0.50) long_entry_logic.append(df["hl_pct_change_48_1h"] < 0.60) long_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) long_entry_logic.append(df["rsi_3"] >= 30.0) long_entry_logic.append(df["rsi_3"] <= 60.0) long_entry_logic.append(df["rsi_3_15m"] >= 30.0) long_entry_logic.append(df["rsi_3_1h"] >= 30.0) long_entry_logic.append(df["rsi_3_4h"] >= 30.0) long_entry_logic.append(df["rsi_3_1d"] >= 30.0) long_entry_logic.append(df["cti_20_1h"] <= 0.70) long_entry_logic.append(df["rsi_14_1h"] <= 60.0) long_entry_logic.append(df["cti_20_4h"] <= 0.70) long_entry_logic.append(df["rsi_14_4h"] <= 60.0) long_entry_logic.append(df["cti_20_1d"] <= 0.70) long_entry_logic.append(df["rsi_14_1d"] <= 70.0) long_entry_logic.append(df["ema_200_dec_4_1d"] == False) # Logic long_entry_logic.append(df["rsi_14"] < 42.0) long_entry_logic.append(df["ema_12"] < df["ema_26"]) long_entry_logic.append(df["ha_close"] > df["ha_open"]) # Long Entry Conditions Ends Here long_entry_logic.append(df["volume"] > 0) item_long_entry = reduce(lambda x, y: x & y, long_entry_logic) df.loc[item_long_entry, "enter_tag"] += f"{index} " long_entry_conditions.append(item_long_entry) df.loc[:, "enter_long"] = item_long_entry if long_entry_conditions: df.loc[:, "enter_long"] = reduce(lambda x, y: x | y, long_entry_conditions) # ______ __ __ ______ _______ ________ ________ __ __ ________ ________ _______ # / \| \ | \/ \| | \ | | \ | | | | \ # | $$$$$$| $$ | $| $$$$$$| $$$$$$$\$$$$$$$$ | $$$$$$$| $$\ | $$\$$$$$$$| $$$$$$$| $$$$$$$\ # | $$___\$| $$__| $| $$ | $| $$__| $$ | $$ | $$__ | $$$\| $$ | $$ | $$__ | $$__| $$ # \$$ \| $$ $| $$ | $| $$ $$ | $$ | $$ \ | $$$$\ $$ | $$ | $$ \ | $$ $$ # _\$$$$$$| $$$$$$$| $$ | $| $$$$$$$\ | $$ | $$$$$ | $$\$$ $$ | $$ | $$$$$ | $$$$$$$\ # | \__| $| $$ | $| $$__/ $| $$ | $$ | $$ | $$_____| $$ \$$$$ | $$ | $$_____| $$ | $$ # \$$ $| $$ | $$\$$ $| $$ | $$ | $$ | $$ | $$ \$$$ | $$ | $$ | $$ | $$ # \$$$$$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$ \$$$$$$$$\$$ \$$ \$$ \$$$$$$$$\$$ \$$ # for enabled_short_entry_signal in self.short_entry_signal_params: short_index = int(enabled_short_entry_signal.split("_")[3]) item_short_buy_protection_list = [True] if not self.config["runmode"].value in ("live", "dry_run"): if self.has_bt_agefilter: item_short_buy_protection_list.append(df["bt_agefilter_ok"]) else: if self.has_downtime_protection: item_short_buy_protection_list.append(df["live_data_ok"]) if self.short_entry_signal_params[f"{enabled_short_entry_signal}"]: # Short Entry Conditions Starts Here # ----------------------------------------------------------------------------------------- short_entry_logic = [] short_entry_logic.append(reduce(lambda x, y: x & y, item_short_buy_protection_list)) # Condition #500 - Normal mode (Short). if short_index == 500: # Protections short_entry_logic.append(df["protections_short_global"] == True) short_entry_logic.append(df["global_protections_short_pump"] == True) short_entry_logic.append(df["global_protections_short_dump"] == True) short_entry_logic.append(df["hl_pct_change_6_1h"] < 0.90) short_entry_logic.append(df["hl_pct_change_12_1h"] < 1.00) short_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) short_entry_logic.append(df["rsi_3_15m"] <= 96.0) short_entry_logic.append(df["rsi_3_1h"] <= 96.0) # Logic short_entry_logic.append(df["ema_12"] > df["ema_26"]) short_entry_logic.append((df["ema_12"] - df["ema_26"]) > (df["open"] * 0.028)) short_entry_logic.append((df["ema_12"] - df["ema_26"]) > (df["open"] / 100.0)) short_entry_logic.append(df["close"] > (df["bb20_2_upp"] * 1.012)) short_entry_logic.append(df["rsi_14"] > 64.0) # Condition #501 - Normal mode (Short) if short_index == 501: # Protections short_entry_logic.append(df["protections_short_global"] == True) short_entry_logic.append(df["global_protections_short_pump"] == True) short_entry_logic.append(df["global_protections_short_dump"] == True) short_entry_logic.append(df["num_empty_288"] < allowed_empty_candles) short_entry_logic.append(df["rsi_3"] <= 98.0) short_entry_logic.append(df["rsi_3"] >= 54.0) short_entry_logic.append(df["rsi_3_15m"] <= 88.0) short_entry_logic.append(df["rsi_3_1h"] <= 88.0) short_entry_logic.append(df["rsi_3_4h"] <= 88.0) short_entry_logic.append(df["rsi_14_1d"] > 15.0) short_entry_logic.append(df["r_14_4h"] > -84.0) # Logic short_entry_logic.append(df["cti_20"] > 0.75) short_entry_logic.append(df["r_14"] > -10.0) short_entry_logic.append(df["close"] > (df["ema_20"] * 1.040)) short_entry_logic.append(df["close_15m"] > (df["ema_12_15m"] * 1.020)) # Short Entry Conditions Ends Here short_entry_logic.append(df["volume"] > 0) item_short_entry = reduce(lambda x, y: x & y, short_entry_logic) df.loc[item_short_entry, "enter_tag"] += f"{short_index} " short_entry_conditions.append(item_short_entry) df.loc[:, "enter_short"] = item_short_entry if short_entry_conditions: df.loc[:, "enter_short"] = reduce(lambda x, y: x | y, short_entry_conditions) return df ############################################################################################### # COMMON FUNCTIONS FOR BOTH LONG AND SHORT SIDE ENDS HERE ############################################################################################### # /$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$$$ # | $$ /$$__ $$| $$$ | $$ /$$__ $$ /$$__ $$|_ $$_/| $$__ $$| $$_____/ # | $$ | $$ \ $$| $$$$| $$| $$ \__/ | $$ \__/ | $$ | $$ \ $$| $$ # | $$ | $$ | $$| $$ $$ $$| $$ /$$$$ | $$$$$$ | $$ | $$ | $$| $$$$$ # | $$ | $$ | $$| $$ $$$$| $$|_ $$ \____ $$ | $$ | $$ | $$| $$__/ # | $$ | $$ | $$| $$\ $$$| $$ \ $$ /$$ \ $$ | $$ | $$ | $$| $$ # | $$$$$$$$| $$$$$$/| $$ \ $$| $$$$$$/ | $$$$$$/ /$$$$$$| $$$$$$$/| $$$$$$$$ # |________/ \______/ |__/ \__/ \______/ \______/ |______/|_______/ |________/ # Long Side Functions for handling long orders # --------------------------------------------------------------------------------------------- # # /$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$$ # | $$ /$$__ $$| $$$ | $$ /$$__ $$ | $$_____/| $$ / $$|_ $$_/|__ $$__/ # | $$ | $$ \ $$| $$$$| $$| $$ \__/ | $$ | $$/ $$/ | $$ | $$ # | $$ | $$ | $$| $$ $$ $$| $$ /$$$$ | $$$$$ \ $$$$/ | $$ | $$ # | $$ | $$ | $$| $$ $$$$| $$|_ $$ | $$__/ >$$ $$ | $$ | $$ # | $$ | $$ | $$| $$\ $$$| $$ \ $$ | $$ /$$/\ $$ | $$ | $$ # | $$$$$$$$| $$$$$$/| $$ \ $$| $$$$$$/ | $$$$$$$$| $$ \ $$ /$$$$$$ | $$ # |________/ \______/ |__/ \__/ \______/ |________/|__/ |__/|______/ |__/ # ############################################################################################### # LONG EXIT FUNCTIONS STARTS HERE ############################################################################################### # Long Exit Normal # --------------------------------------------------------------------------------------------- def long_exit_normal( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.long_exit_signals( self.long_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.long_exit_main( self.long_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.long_exit_williams_r( self.long_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.long_exit_dec( self.long_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.long_exit_stoploss( self.long_normal_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.long_normal_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.long_normal_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.long_normal_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.long_normal_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.long_normal_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.long_normal_mode_name}_stoploss_doom", f"exit_{self.long_normal_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.long_normal_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.long_normal_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[0]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.long_normal_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.long_normal_mode_name}_max", f"exit_{self.long_normal_mode_name}_stoploss_doom", f"exit_{self.long_normal_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Long Exit Pump # --------------------------------------------------------------------------------------------- def long_exit_pump( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.long_exit_signals( self.long_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.long_exit_main( self.long_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.long_exit_williams_r( self.long_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.long_exit_dec( self.long_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.long_exit_stoploss( self.long_pump_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.long_pump_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.long_pump_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.long_pump_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.long_pump_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.long_pump_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.long_pump_mode_name}_stoploss_doom", f"exit_{self.long_pump_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.long_pump_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.long_pump_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[2]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.long_pump_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.long_pump_mode_name}_max", f"exit_{self.long_pump_mode_name}_stoploss_doom", f"exit_{self.long_pump_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Long Exit Signals # --------------------------------------------------------------------------------------------- def long_exit_quick( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.long_exit_signals( self.long_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.long_exit_main( self.long_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.long_exit_williams_r( self.long_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.long_exit_dec( self.long_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.long_exit_stoploss( self.long_quick_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Extra sell logic if not sell: if (0.09 >= profit_init_ratio > 0.02) and (last_candle["rsi_14"] > 78.0): sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_1" if (0.09 >= profit_init_ratio > 0.02) and (last_candle["cti_20"] > 0.95): sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_2" if (0.09 >= profit_init_ratio > 0.02) and (last_candle["r_14"] >= -0.1): sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_3" # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.long_quick_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.long_quick_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.long_quick_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.long_quick_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.long_quick_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.long_quick_mode_name}_stoploss_doom", f"exit_{self.long_quick_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.long_quick_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.long_quick_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[4]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.long_quick_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.long_quick_mode_name}_max", f"exit_{self.long_quick_mode_name}_stoploss_doom", f"exit_{self.long_quick_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Long Exit Rebuy # --------------------------------------------------------------------------------------------- def long_exit_rebuy( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.long_exit_signals( self.long_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.long_exit_main( self.long_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.long_exit_williams_r( self.long_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.long_exit_dec( self.long_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: if profit_stake < -( filled_entries[0].cost * (self.stop_threshold_futures_rebuy if self.is_futures_mode else self.stop_threshold_spot_rebuy) / (trade.leverage if self.is_futures_mode else 1.0) ): sell, signal_name = True, f"exit_{self.long_rebuy_mode_name}_stoploss_doom" # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.long_rebuy_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.long_rebuy_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.long_rebuy_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.long_rebuy_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.long_rebuy_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.long_rebuy_mode_name}_stoploss_doom", f"exit_{self.long_rebuy_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.long_rebuy_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.long_rebuy_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[6]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.long_rebuy_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [f"exit_profit_{self.long_rebuy_mode_name}_max"]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Long Exit High Profit # --------------------------------------------------------------------------------------------- def long_exit_high_profit( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.long_exit_signals( self.long_high_profit_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.long_exit_main( self.long_high_profit_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.long_exit_williams_r( self.long_high_profit_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.long_exit_stoploss( self.long_high_profit_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.long_high_profit_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.long_high_profit_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.long_high_profit_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.long_high_profit_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.long_high_profit_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.long_high_profit_mode_name}_stoploss_doom", f"exit_{self.long_high_profit_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.long_high_profit_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.long_high_profit_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[8]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.long_high_profit_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.long_high_profit_mode_name}_max", f"exit_{self.long_high_profit_mode_name}_stoploss_doom", f"exit_{self.long_high_profit_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Long Exit Rapid # --------------------------------------------------------------------------------------------- def long_exit_rapid( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.long_exit_signals( self.long_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.long_exit_main( self.long_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.long_exit_williams_r( self.long_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.long_exit_dec( self.long_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.long_exit_stoploss( self.long_rapid_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Extra sell logic if not sell: if (0.09 >= profit_init_ratio > 0.01) and (last_candle["rsi_14"] > 78.0): sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_1" if (0.09 >= profit_init_ratio > 0.01) and (last_candle["cti_20"] > 0.95): sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_2" if (0.09 >= profit_init_ratio > 0.01) and (last_candle["r_14"] >= -0.1): sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_3" # Stoplosses if profit_stake < -( filled_entries[0].cost * (self.stop_threshold_futures_rapid if self.is_futures_mode else self.stop_threshold_spot_rapid) / (trade.leverage if self.is_futures_mode else 1.0) ): sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_stoploss_doom" # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.long_rapid_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.long_rapid_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.long_rapid_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.long_rapid_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.long_rapid_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.long_rapid_mode_name}_stoploss_doom", f"exit_{self.long_rapid_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.long_rapid_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.long_rapid_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= 0.01: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.long_rapid_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [f"exit_profit_{self.long_rapid_mode_name}_max"]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Long Exit Grind # --------------------------------------------------------------------------------------------- def long_exit_grind( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: if profit_init_ratio > 1.0: return True, f"exit_{self.long_grind_mode_name}_g" return False, None # Long Exit Signals # --------------------------------------------------------------------------------------------- def long_exit_signals( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: # Sell signal 1 if ( (last_candle["rsi_14"] > 79.0) and (last_candle["close"] > last_candle["bb20_2_upp"]) and (previous_candle_1["close"] > previous_candle_1["bb20_2_upp"]) and (previous_candle_2["close"] > previous_candle_2["bb20_2_upp"]) and (previous_candle_3["close"] > previous_candle_3["bb20_2_upp"]) and (previous_candle_4["close"] > previous_candle_4["bb20_2_upp"]) ): if last_candle["close"] > last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_1_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_1_2_1" # Sell signal 2 elif ( (last_candle["rsi_14"] > 80.0) and (last_candle["close"] > last_candle["bb20_2_upp"]) and (previous_candle_1["close"] > previous_candle_1["bb20_2_upp"]) and (previous_candle_2["close"] > previous_candle_2["bb20_2_upp"]) ): if last_candle["close"] > last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_2_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_2_2_1" # Sell signal 3 elif last_candle["rsi_14"] > 85.0: if last_candle["close"] > last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_3_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_3_2_1" # Sell signal 4 elif (last_candle["rsi_14"] > 80.0) and (last_candle["rsi_14_1h"] > 78.0): if last_candle["close"] > last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_4_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_4_2_1" # Sell signal 6 elif ( (last_candle["close"] < last_candle["ema_200"]) and (last_candle["close"] > last_candle["ema_50"]) and (last_candle["rsi_14"] > 79.0) ): if current_profit > 0.01: return True, f"exit_{mode_name}_6_1" # Sell signal 7 elif (last_candle["rsi_14_1h"] > 79.0) and (last_candle["crossed_below_ema_12_26"]): if last_candle["close"] > last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_7_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_7_2_1" # Sell signal 8 elif last_candle["close"] > last_candle["bb20_2_upp_1h"] * 1.08: if last_candle["close"] > last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_8_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_8_2_1" return False, None # Long Exit Main # --------------------------------------------------------------------------------------------- def long_exit_main( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: if last_candle["close"] > last_candle["sma_200"]: if 0.01 > current_profit >= 0.001: if last_candle["rsi_14"] < 10.0: return True, f"exit_{mode_name}_o_0" elif 0.02 > current_profit >= 0.01: if last_candle["rsi_14"] < 28.0: return True, f"exit_{mode_name}_o_1" elif 0.03 > current_profit >= 0.02: if last_candle["rsi_14"] < 30.0: return True, f"exit_{mode_name}_o_2" elif 0.04 > current_profit >= 0.03: if last_candle["rsi_14"] < 32.0: return True, f"exit_{mode_name}_o_3" elif 0.05 > current_profit >= 0.04: if last_candle["rsi_14"] < 34.0: return True, f"exit_{mode_name}_o_4" elif 0.06 > current_profit >= 0.05: if last_candle["rsi_14"] < 36.0: return True, f"exit_{mode_name}_o_5" elif 0.07 > current_profit >= 0.06: if last_candle["rsi_14"] < 38.0: return True, f"exit_{mode_name}_o_6" elif 0.08 > current_profit >= 0.07: if last_candle["rsi_14"] < 40.0: return True, f"exit_{mode_name}_o_7" elif 0.09 > current_profit >= 0.08: if last_candle["rsi_14"] < 42.0: return True, f"exit_{mode_name}_o_8" elif 0.1 > current_profit >= 0.09: if last_candle["rsi_14"] < 44.0: return True, f"exit_{mode_name}_o_9" elif 0.12 > current_profit >= 0.1: if last_candle["rsi_14"] < 46.0: return True, f"exit_{mode_name}_o_10" elif 0.2 > current_profit >= 0.12: if last_candle["rsi_14"] < 44.0: return True, f"exit_{mode_name}_o_11" elif current_profit >= 0.2: if last_candle["rsi_14"] < 42.0: return True, f"exit_{mode_name}_o_12" elif last_candle["close"] < last_candle["sma_200"]: if 0.01 > current_profit >= 0.001: if last_candle["rsi_14"] < 12.0: return True, f"exit_{mode_name}_u_0" elif 0.02 > current_profit >= 0.01: if last_candle["rsi_14"] < 30.0: return True, f"exit_{mode_name}_u_1" elif 0.03 > current_profit >= 0.02: if last_candle["rsi_14"] < 32.0: return True, f"exit_{mode_name}_u_2" elif 0.04 > current_profit >= 0.03: if last_candle["rsi_14"] < 34.0: return True, f"exit_{mode_name}_u_3" elif 0.05 > current_profit >= 0.04: if last_candle["rsi_14"] < 36.0: return True, f"exit_{mode_name}_u_4" elif 0.06 > current_profit >= 0.05: if last_candle["rsi_14"] < 38.0: return True, f"exit_{mode_name}_u_5" elif 0.07 > current_profit >= 0.06: if last_candle["rsi_14"] < 40.0: return True, f"exit_{mode_name}_u_6" elif 0.08 > current_profit >= 0.07: if last_candle["rsi_14"] < 42.0: return True, f"exit_{mode_name}_u_7" elif 0.09 > current_profit >= 0.08: if last_candle["rsi_14"] < 44.0: return True, f"exit_{mode_name}_u_8" elif 0.1 > current_profit >= 0.09: if last_candle["rsi_14"] < 46.0: return True, f"exit_{mode_name}_u_9" elif 0.12 > current_profit >= 0.1: if last_candle["rsi_14"] < 48.0: return True, f"exit_{mode_name}_u_10" elif 0.2 > current_profit >= 0.12: if last_candle["rsi_14"] < 46.0: return True, f"exit_{mode_name}_u_11" elif current_profit >= 0.2: if last_candle["rsi_14"] < 44.0: return True, f"exit_{mode_name}_u_12" return False, None # Long Exit Williams R # --------------------------------------------------------------------------------------------- def long_exit_williams_r( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: if 0.01 > current_profit >= 0.001: if (last_candle["r_480"] > -0.1) and (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0): return True, f"exit_{mode_name}_w_0_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 84.0): return True, f"exit_{mode_name}_w_0_2" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] < 40.0): return True, f"exit_{mode_name}_w_0_3" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 78.0) and (last_candle["r_480_1h"] > -20.0): return True, f"exit_{mode_name}_w_0_4" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0) and (last_candle["cti_20"] > 0.97): return True, f"exit_{mode_name}_w_0_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0) and (last_candle["r_480_1h"] > -5.0) and (last_candle["r_480_4h"] > -5.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_0_6" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_0_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_0_8" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 82.0) and (last_candle["rsi_14_15m"] >= 72.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_0_9" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_0_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 74.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_0_11" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_0_12" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_0_13" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_0_14" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_0_15" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_0_16" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_0_17" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_0_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_0_19" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_0_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_15m"] >= 75.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_0_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_15m"] >= 75.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_0_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 75.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_0_23" elif 0.02 > current_profit >= 0.01: if last_candle["r_480"] > -0.2: return True, f"exit_{mode_name}_w_1_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 78.0): return True, f"exit_{mode_name}_w_1_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 46.0): return True, f"exit_{mode_name}_w_1_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 74.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_1_4" elif (last_candle["r_14"] >= -2.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_1_5" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] > 70.0) and (last_candle["r_480_1h"] > -10.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_1_6" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_1_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_1_8" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_1_9" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_1_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_1_11" elif ( (last_candle["r_14"] >= -24.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_1_12" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_1_13" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_1_14" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_1_15" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_1_16" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_1_17" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_1_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_1_19" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_1_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_1_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_1_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_1_23" elif 0.03 > current_profit >= 0.02: if last_candle["r_480"] > -0.3: return True, f"exit_{mode_name}_w_2_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 77.0): return True, f"exit_{mode_name}_w_2_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 48.0): return True, f"exit_{mode_name}_w_2_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 73.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_2_4" elif (last_candle["r_14"] >= -3.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_2_5" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -20.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_2_6" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_2_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_2_8" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 68.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_2_9" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_2_10" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_2_11" elif ( (last_candle["r_14"] >= -24.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_2_12" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_2_13" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_2_14" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_2_15" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_2_16" elif ( (last_candle["r_14"] >= -18.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_2_17" elif ( (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_2_18" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_2_19" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_2_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_2_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_2_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_2_23" elif 0.04 > current_profit >= 0.03: if last_candle["r_480"] > -0.4: return True, f"exit_{mode_name}_w_3_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 76.0): return True, f"exit_{mode_name}_w_3_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 50.0): return True, f"exit_{mode_name}_w_3_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 72.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_3_4" elif (last_candle["r_14"] >= -4.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_3_5" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -20.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_3_6" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_3_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_3_8" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] >= 66.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_3_9" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_3_10" elif ( (last_candle["r_14"] >= -3.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_3_11" elif ( (last_candle["r_14"] >= -24.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_3_12" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_3_13" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_3_14" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_3_15" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_3_16" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_3_17" elif ( (last_candle["r_14"] >= -35.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_3_18" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_3_19" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_3_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_3_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_3_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_3_23" elif 0.05 > current_profit >= 0.04: if last_candle["r_480"] > -0.5: return True, f"exit_{mode_name}_w_4_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0): return True, f"exit_{mode_name}_w_4_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 52.0): return True, f"exit_{mode_name}_w_4_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 71.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_4_4" elif (last_candle["r_14"] >= -5.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_4_5" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -20.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_4_6" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_4_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_4_8" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 64.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_4_9" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_4_10" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_4_11" elif ( (last_candle["r_14"] >= -24.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_4_12" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_4_13" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_4_14" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_4_15" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_4_16" elif ( (last_candle["r_14"] >= -22.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_4_17" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_4_18" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_4_19" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_4_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_4_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_4_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_4_23" elif 0.06 > current_profit >= 0.05: if last_candle["r_480"] > -0.6: return True, f"exit_{mode_name}_w_5_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 74.0): return True, f"exit_{mode_name}_w_5_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 54.0): return True, f"exit_{mode_name}_w_5_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 70.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_5_4" elif (last_candle["r_14"] >= -6.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_5_5" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -20.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_5_6" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_5_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_5_8" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] >= 62.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_5_9" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_5_10" elif ( (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_5_11" elif ( (last_candle["r_14"] >= -24.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_5_12" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_5_13" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_5_14" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_5_15" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_5_16" elif ( (last_candle["r_14"] >= -24.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_5_17" elif ( (last_candle["r_14"] >= -45.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_5_18" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_5_19" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_5_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 62.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_5_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_5_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_5_23" elif 0.07 > current_profit >= 0.06: if last_candle["r_480"] > -0.7: return True, f"exit_{mode_name}_w_6_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0): return True, f"exit_{mode_name}_w_6_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 52.0): return True, f"exit_{mode_name}_w_6_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 71.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_6_4" elif (last_candle["r_14"] >= -5.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_6_5" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -20.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_6_6" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_6_7" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_6_8" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 64.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_6_9" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_6_10" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_6_11" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_6_12" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_6_13" elif ( (last_candle["r_14"] >= -18.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_6_14" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_6_15" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_6_16" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_6_17" elif ( (last_candle["r_14"] >= -35.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_6_18" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_6_19" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_6_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_6_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_6_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_6_23" elif 0.08 > current_profit >= 0.07: if last_candle["r_480"] > -0.8: return True, f"exit_{mode_name}_w_7_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 76.0): return True, f"exit_{mode_name}_w_7_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 50.0): return True, f"exit_{mode_name}_w_7_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 72.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_7_4" elif (last_candle["r_14"] >= -4.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_7_5" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -15.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_7_6" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_7_7" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_7_8" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] >= 66.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_7_9" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_7_10" elif ( (last_candle["r_14"] >= -3.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_7_11" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_7_12" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_7_13" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_7_14" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_7_15" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_7_16" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_7_17" elif ( (last_candle["r_14"] >= -25.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_7_18" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_7_19" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_7_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_7_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_7_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_7_23" elif 0.09 > current_profit >= 0.08: if last_candle["r_480"] > -0.9: return True, f"exit_{mode_name}_w_8_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 77.0): return True, f"exit_{mode_name}_w_8_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 48.0): return True, f"exit_{mode_name}_w_8_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 73.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_8_4" elif (last_candle["r_14"] >= -3.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_8_5" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -15.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_8_6" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_8_7" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_8_8" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 68.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_8_9" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_8_10" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_8_11" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_8_12" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_8_13" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_8_14" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_8_15" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_8_16" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_8_17" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_8_18" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_8_19" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_8_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_8_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_8_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_8_23" elif 0.1 > current_profit >= 0.09: if last_candle["r_480"] > -1.0: return True, f"exit_{mode_name}_w_9_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 78.0): return True, f"exit_{mode_name}_w_9_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 46.0): return True, f"exit_{mode_name}_w_9_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 74.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_9_4" elif (last_candle["r_14"] >= -2.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_9_5" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -15.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_9_6" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_9_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_9_8" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_9_9" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_9_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_9_11" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_9_12" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_9_13" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_9_14" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_9_15" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_9_16" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_9_17" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_9_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_9_19" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_9_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_9_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_9_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_9_23" elif 0.12 > current_profit >= 0.1: if last_candle["r_480"] > -1.1: return True, f"exit_{mode_name}_w_10_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 79.0): return True, f"exit_{mode_name}_w_10_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 44.0): return True, f"exit_{mode_name}_w_10_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 75.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_10_4" elif (last_candle["r_14"] >= -1.0) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_10_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 65.0) and (last_candle["r_480_1h"] > -10.0) and (last_candle["r_480_4h"] > -5.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_10_6" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 65.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_10_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 75.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_10_8" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_15m"] >= 72.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_10_9" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_10_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] >= 72.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_10_11" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_10_12" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_10_13" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_10_14" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_10_15" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_10_16" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_10_17" elif ( (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_10_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_10_19" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_10_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_10_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_10_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_10_23" elif 0.2 > current_profit >= 0.12: if last_candle["r_480"] > -0.4: return True, f"exit_{mode_name}_w_11_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 80.0): return True, f"exit_{mode_name}_w_11_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 42.0): return True, f"exit_{mode_name}_w_11_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 76.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_11_4" elif (last_candle["r_14"] >= -0.5) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_11_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 70.0) and (last_candle["r_480_1h"] > -10.0) and (last_candle["r_480_4h"] > -5.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_11_6" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 70.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_11_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_11_8" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_15m"] >= 74.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_11_9" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_11_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 74.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_11_11" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_11_12" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_11_13" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_11_14" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_11_15" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_11_16" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_11_17" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_11_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 65.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_11_19" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_11_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_11_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 75.0) and (last_candle["rsi_14_15m"] >= 65.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_11_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_11_23" elif current_profit >= 0.2: if last_candle["r_480"] > -0.2: return True, f"exit_{mode_name}_w_12_1" elif (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 81.0): return True, f"exit_{mode_name}_w_12_2" elif (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] < 40.0): return True, f"exit_{mode_name}_w_12_3" elif (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] > 77.0) and (last_candle["r_480_1h"] > -25.0): return True, f"exit_{mode_name}_w_12_4" elif (last_candle["r_14"] >= -0.1) and (last_candle["cti_20"] > 0.95): return True, f"exit_{mode_name}_w_12_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0) and (last_candle["r_480_1h"] > -5.0) and (last_candle["r_480_4h"] > -5.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_1d"] > 60.0) and (last_candle["cti_20_1d"] > 0.80) ): return True, f"exit_{mode_name}_w_12_6" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] > 75.0) and (last_candle["r_480_1h"] > -25.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["rsi_14_1h"] > 50.0) and (last_candle["rsi_14_4h"] > 50.0) and (last_candle["rsi_14_1d"] > 50.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_12_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["rsi_14_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.02) ): return True, f"exit_{mode_name}_w_12_8" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_15m"] >= 76.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["cti_20_1d"] >= 0.70) ): return True, f"exit_{mode_name}_w_12_9" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_12_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["rsi_14_15m"] >= 76.0) and (last_candle["rsi_14_1h"] >= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["r_480_1h"] > -30.0) ): return True, f"exit_{mode_name}_w_12_11" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] < -0.01) ): return True, f"exit_{mode_name}_w_12_12" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["rsi_14_4h"] >= 65.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.01) ): return True, f"exit_{mode_name}_w_12_13" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1h"] >= 70.0) and (last_candle["rsi_14_4h"] >= 75.0) ): return True, f"exit_{mode_name}_w_12_14" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_4h"] >= 75.0) and (last_candle["r_480_4h"] > -15.0) and (last_candle["change_pct_1h"] < -0.00) ): return True, f"exit_{mode_name}_w_12_15" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["top_wick_pct_1d"] > 0.16) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.80)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_12_16" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["r_480_1h"] > -30.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["top_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_12_17" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_12_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 80.0) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_12_19" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 70.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_12_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_15m"] >= 75.0) and (last_candle["cti_20_dec_3_1h"] == True) and (last_candle["r_480_4h"] < -50.0) ): return True, f"exit_{mode_name}_w_12_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_15m"] >= 75.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_w_12_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["change_pct_1d"] < -0.01) and (last_candle["close"] < (last_candle["high_max_12_1d"] * 0.85)) ): return True, f"exit_{mode_name}_w_12_23" return False, None # Long Exit Dec # --------------------------------------------------------------------------------------------- def long_exit_dec( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: if 0.01 > current_profit >= 0.001: if ( (last_candle["r_14"] > -1.0) and (last_candle["rsi_14"] > 70.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_0_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_0_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_0_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_0_4" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_0_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 95.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_0_6" elif ( (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_0_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_0_8" elif ( (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_0_9" elif ( (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_0_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_0_11" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_0_12" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_0_13" elif ( (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_0_14" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_0_15" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_0_16" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_0_17" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_0_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_0_19" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_0_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_0_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_0_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_0_23" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 95.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_0_24" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_0_25" elif 0.02 > current_profit >= 0.01: if ( (last_candle["r_14"] > -10.0) and (last_candle["rsi_14"] > 66.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_1_1" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_1_2" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_1_3" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_1_4" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_1_5" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_1_6" elif ( (last_candle["rsi_3"] >= 60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_1_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_1_8" elif ( (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_1_9" elif ( (last_candle["rsi_14"] <= 46.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_1_10" elif ( (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_1_11" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_1_12" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_1_13" elif ( (last_candle["rsi_14"] <= 46.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_1_14" elif ( (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_1_15" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_1_16" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_1_17" elif ( (last_candle["r_14"] >= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_1_18" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_1_19" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_1_20" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_1_21" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_1_22" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_1_23" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_1_24" elif ( (last_candle["r_14"] >= -25.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_1_25" elif 0.03 > current_profit >= 0.02: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 56.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_2_1" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_2_2" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_2_3" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_2_4" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_2_5" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.7) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_2_6" elif ( (last_candle["rsi_3"] >= 60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_2_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_2_8" elif ( (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_2_9" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_2_10" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_2_11" elif ( (last_candle["r_14"] >= -9.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_2_12" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_2_13" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_2_14" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_2_15" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_2_16" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_2_17" elif ( (last_candle["r_14"] >= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_2_18" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_2_19" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_2_20" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_2_21" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_2_22" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_2_23" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_2_24" elif ( (last_candle["r_14"] >= -25.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_2_25" elif 0.04 > current_profit >= 0.03: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 54.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_3_1" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_3_2" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_3_3" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_3_4" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_3_5" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_3_6" elif ( (last_candle["rsi_3"] >= 60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_3_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_3_8" elif ( (last_candle["rsi_14"] <= 42.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_3_9" elif ( (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_3_10" elif ( (last_candle["r_14"] >= -7.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_3_11" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_3_12" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_3_13" elif ( (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_3_14" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_3_15" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_3_16" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_3_17" elif ( (last_candle["r_14"] >= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_3_18" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_3_19" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_3_20" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_3_21" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_3_22" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_3_23" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_3_24" elif ( (last_candle["r_14"] >= -25.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_3_25" elif 0.05 > current_profit >= 0.04: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 52.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_4_1" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_4_2" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_4_3" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_4_4" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_4_5" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.7) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_4_6" elif ( (last_candle["rsi_3"] >= 60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_4_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 62.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_4_8" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_4_9" elif ( (last_candle["rsi_14"] <= 52.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_4_10" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_4_11" elif ( (last_candle["r_14"] >= -11.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_4_12" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_4_13" elif ( (last_candle["rsi_14"] <= 52.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_4_14" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_4_15" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_4_16" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_4_17" elif ( (last_candle["r_14"] >= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_4_18" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_4_19" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_4_20" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_4_21" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_4_22" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_4_23" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_4_24" elif ( (last_candle["r_14"] >= -25.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_4_25" elif 0.06 > current_profit >= 0.05: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_5_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_5_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_5_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_5_4" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_5_5" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_5_6" elif ( (last_candle["rsi_3"] >= 60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_5_7" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_5_8" elif ( (last_candle["rsi_14"] <= 46.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_5_9" elif ( (last_candle["rsi_14"] <= 54.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_5_10" elif ( (last_candle["r_14"] >= -9.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_5_11" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_5_12" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_5_13" elif ( (last_candle["rsi_14"] <= 54.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_5_14" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_5_15" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_5_16" elif ( (last_candle["r_14"] >= -24.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_5_17" elif ( (last_candle["r_14"] >= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_5_18" elif ( (last_candle["r_14"] >= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_5_19" elif ( (last_candle["r_14"] >= -30.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_5_20" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_5_21" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_5_22" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_5_23" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_5_24" elif ( (last_candle["r_14"] >= -25.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_5_25" elif 0.07 > current_profit >= 0.06: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_6_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_6_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_6_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_6_4" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_3"] >= 94.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_6_5" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.7) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_6_6" elif ( (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_6_7" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 62.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_6_8" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_6_9" elif ( (last_candle["rsi_14"] <= 52.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_6_10" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_6_11" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_6_12" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_6_13" elif ( (last_candle["rsi_14"] <= 52.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_6_14" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_6_15" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_6_16" elif ( (last_candle["r_14"] >= -22.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_6_17" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_6_18" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_6_19" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_6_20" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_6_21" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_6_22" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_6_23" elif ( (last_candle["r_14"] >= -16.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_6_24" elif ( (last_candle["r_14"] >= -20.0) and (last_candle["rsi_14"] >= 62.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_6_25" elif 0.08 > current_profit >= 0.07: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_7_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_7_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_7_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_7_4" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_3"] >= 96.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_7_5" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.7) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_7_6" elif ( (last_candle["rsi_3"] >= 95.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_7_7" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_7_8" elif ( (last_candle["rsi_14"] <= 42.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_7_9" elif ( (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_7_10" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_7_11" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_7_12" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_7_13" elif ( (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_7_14" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_7_15" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_7_16" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_14"] >= 62.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_7_17" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_7_18" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_7_19" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_7_20" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_7_21" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_7_22" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_7_23" elif ( (last_candle["r_14"] >= -14.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_7_24" elif ( (last_candle["r_14"] >= -15.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_7_25" elif 0.09 > current_profit >= 0.08: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_8_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_8_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_8_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_8_4" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_8_5" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_3"] >= 95.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.7) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_8_6" elif ( (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_8_7" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_8_8" elif ( (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_8_9" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_8_10" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_8_11" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_8_12" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_8_13" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_8_14" elif ( (last_candle["r_14"] >= -5.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_8_15" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_8_16" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_8_17" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_8_18" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_8_19" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_8_20" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_8_21" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_8_22" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_8_23" elif ( (last_candle["r_14"] >= -12.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_8_24" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_8_25" elif 0.1 > current_profit >= 0.09: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 52.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_9_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_9_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_9_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_9_4" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_9_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.70) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_9_6" elif ( (last_candle["rsi_3"] >= 99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_9_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_9_8" elif ( (last_candle["rsi_14"] <= 38.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_9_9" elif ( (last_candle["rsi_14"] <= 46.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_9_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 64.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_9_11" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_9_12" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_9_13" elif ( (last_candle["rsi_14"] <= 46.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_9_14" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_9_15" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_9_16" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_9_17" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_9_18" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_9_19" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_9_20" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_9_21" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_9_22" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_9_23" elif ( (last_candle["r_14"] >= -10.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_9_24" elif ( (last_candle["r_14"] >= -8.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_9_25" elif 0.12 > current_profit >= 0.1: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 54.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_10_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_10_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_10_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.5) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_10_4" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_10_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_10_6" elif ( (last_candle["rsi_3"] >= 99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_10_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_10_8" elif ( (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_10_9" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_10_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_10_11" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_10_12" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_10_13" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_10_14" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_10_15" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_10_16" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 68.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_10_17" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_10_18" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_10_19" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_10_20" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_10_21" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_10_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_10_23" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_10_24" elif ( (last_candle["r_14"] >= -6.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_10_25" elif 0.2 > current_profit >= 0.12: if ( (last_candle["r_14"] > -16.0) and (last_candle["rsi_14"] > 56.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_11_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_11_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_11_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 60.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_11_4" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_11_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_11_6" elif ( (last_candle["rsi_3"] >= 99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_11_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_11_8" elif ( (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_11_9" elif ( (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_11_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["cti_20_1d"] >= 0.80) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_11_11" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_11_12" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_11_13" elif ( (last_candle["rsi_14"] <= 42.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_11_14" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_11_15" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_11_16" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_11_17" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_11_18" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_11_19" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_11_20" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_11_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_11_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_11_23" elif ( (last_candle["r_14"] >= -4.0) and (last_candle["rsi_3"] >= 80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_11_24" elif ( (last_candle["r_14"] >= -2.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_11_25" elif current_profit >= 0.2: if ( (last_candle["r_14"] > -10.0) and (last_candle["rsi_14"] > 66.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_12_1" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["ema_200_dec_4_1d"] == True) and (last_candle["change_pct_4h"] < -0.03) ): return True, f"exit_{mode_name}_d_12_2" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_4h"] >= 50.0) and (last_candle["cti_20_1d"] >= 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_4h"] <= -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_12_3" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_1d"] > 0.50) and (last_candle["rsi_14_1d"] >= 70.0) and (last_candle["change_pct_1h"] < -0.03) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_12_4" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["change_pct_1d"] < -0.02) and (last_candle["change_pct_4h"] < -0.02) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_12_5" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 98.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.80) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_12_6" elif ( (last_candle["rsi_3"] >= 99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_24"] == True) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_12_7" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_12_8" elif ( (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_3_1h"] <= 10.0) and (last_candle["rsi_3_4h"] <= 6.0) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_12_9" elif ( (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["rsi_14_4h"] >= 60.0) and (last_candle["change_pct_1h"] < -0.04) ): return True, f"exit_{mode_name}_d_12_10" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["change_pct_1d"] < -0.10) and (last_candle["not_downtrend_4h"] == False) ): return True, f"exit_{mode_name}_d_12_11" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 80.0) and (last_candle["cti_20_1d"] >= 0.8) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["not_downtrend_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_12_12" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 74.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["change_pct_4h"] < -0.03) and (last_candle["top_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_12_13" elif ( (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_3_1d"] <= 6.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["ema_200_dec_48_1h"] == True) ): return True, f"exit_{mode_name}_d_12_14" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 76.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["r_480_4h"] >= -30.0) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_12_15" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["cti_20_1d"] >= 0.70) and (last_candle["change_pct_1d"] < -0.04) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_12_16" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 72.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_14_1h"] >= 60.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] < -0.04) ): return True, f"exit_{mode_name}_d_12_17" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_24_15m"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ): return True, f"exit_{mode_name}_d_12_18" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_max_6_1d"] >= 85.0) and (last_candle["change_pct_1h"] < -0.01) and (last_candle["change_pct_4h"] < -0.06) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_12_19" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_1d"] >= 70.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_12_20" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["cti_20_dec_3_1d"] == True) and (last_candle["not_downtrend_1h"] == False) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["close"] < (last_candle["high_max_48_1h"] * 0.75)) ): return True, f"exit_{mode_name}_d_12_21" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_max_6_4h"] >= 70.0) and (last_candle["change_pct_4h"] < -0.01) and (last_candle["not_downtrend_4h"] == False) and (last_candle["close"] < (last_candle["high_max_24_1h"] * 0.70)) ): return True, f"exit_{mode_name}_d_12_22" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 70.0) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_1d"] == False) and (last_candle["close"] < (last_candle["high_max_6_1d"] * 0.80)) ): return True, f"exit_{mode_name}_d_12_23" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_3"] >= 95.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_3_1h"] <= 20.0) and (last_candle["change_pct_1h"] < -0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_12_24" elif ( (last_candle["r_14"] >= -1.0) and (last_candle["rsi_14"] >= 78.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_1d"] >= 50.0) and (last_candle["rsi_3_1d"] <= 26.0) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_4_1d"] == True) ): return True, f"exit_{mode_name}_d_12_25" return False, None # Long Exit Stop Loss # --------------------------------------------------------------------------------------------- def long_exit_stoploss( self, mode_name: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: is_backtest = self.dp.runmode.value in ["backtest", "hyperopt"] # Stoploss doom if ( self.is_futures_mode is False and profit_stake < -(filled_entries[0].cost * self.stop_threshold / (trade.leverage if self.is_futures_mode else 1.0)) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 1) or is_backtest) ): return True, f"exit_{mode_name}_stoploss" if ( self.is_futures_mode is True and profit_stake < -(filled_entries[0].cost * self.stop_threshold_futures / (trade.leverage if self.is_futures_mode else 1.0)) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2023, 10, 17) or is_backtest) ): return True, f"exit_{mode_name}_stoploss" return False, None ############################################################################################### # LONG EXIT FUNCTIONS ENDS HERE ############################################################################################### # # /$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$/$$ /$$/$$$$$$$ # | $$ /$$__ $| $$$ | $$/$$__ $$ /$$__ $| $$__ $|_ $$_| $$$ | $| $$__ $$ # | $$ | $$ \ $| $$$$| $| $$ \__/ | $$ \__| $$ \ $$ | $$ | $$$$| $| $$ \ $$ # | $$ | $$ | $| $$ $$ $| $$ /$$$$ | $$ /$$$| $$$$$$$/ | $$ | $$ $$ $| $$ | $$ # | $$ | $$ | $| $$ $$$| $$|_ $$ | $$|_ $| $$__ $$ | $$ | $$ $$$| $$ | $$ # | $$ | $$ | $| $$\ $$| $$ \ $$ | $$ \ $| $$ \ $$ | $$ | $$\ $$| $$ | $$ # | $$$$$$$| $$$$$$| $$ \ $| $$$$$$/ | $$$$$$| $$ | $$/$$$$$| $$ \ $| $$$$$$$/ # |________/\______/|__/ \__/\______/ \______/|__/ |__|______|__/ \__|_______/ # # Long Grinding Adjust Trade Position # --------------------------------------------------------------------------------------------- def long_grind_adjust_trade_position( self, trade: Trade, enter_tags, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, **kwargs, ): is_backtest = self.dp.runmode.value in ["backtest", "hyperopt"] min_stake = self.correct_min_stake(min_stake) # min/max stakes include leverage. The return amounts is before leverage. min_stake /= trade.leverage max_stake /= trade.leverage df, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe) if len(df) < 2: return None last_candle = df.iloc[-1].squeeze() previous_candle = df.iloc[-2].squeeze() filled_orders = trade.select_filled_orders() filled_entries = trade.select_filled_orders(trade.entry_side) filled_exits = trade.select_filled_orders(trade.exit_side) count_of_entries = trade.nr_of_successful_entries count_of_exits = trade.nr_of_successful_exits if count_of_entries == 0: return None if len(filled_orders) < 1: return None has_order_tags = False if hasattr(filled_orders[0], "ft_order_tag"): has_order_tags = True exit_rate = current_rate if self.dp.runmode.value in ("live", "dry_run"): ticker = self.dp.ticker(trade.pair) if ("bid" in ticker) and ("ask" in ticker): if trade.is_short: if self.config["exit_pricing"]["price_side"] in ["ask", "other"]: if ticker["ask"] is not None: exit_rate = ticker["ask"] else: if self.config["exit_pricing"]["price_side"] in ["bid", "other"]: if ticker["bid"] is not None: exit_rate = ticker["bid"] profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio = self.calc_total_profit( trade, filled_entries, filled_exits, exit_rate ) slice_amount = filled_entries[0].cost slice_profit = (exit_rate - filled_orders[-1].safe_price) / filled_orders[-1].safe_price slice_profit_entry = (exit_rate - filled_entries[-1].safe_price) / filled_entries[-1].safe_price slice_profit_exit = ( ((exit_rate - filled_exits[-1].safe_price) / filled_exits[-1].safe_price) if count_of_exits > 0 else 0.0 ) current_stake_amount = trade.amount * current_rate is_derisk = trade.amount < (filled_entries[0].safe_filled * 0.95) is_derisk_calc = False is_rebuy_mode = all(c in self.long_rebuy_mode_tags for c in enter_tags) or ( any(c in self.long_rebuy_mode_tags for c in enter_tags) and all(c in (self.long_rebuy_mode_tags + self.long_grind_mode_tags) for c in enter_tags) ) is_grind_mode = all(c in self.long_grind_mode_tags for c in enter_tags) fee_open_rate = trade.fee_open if self.custom_fee_open_rate is None else self.custom_fee_open_rate fee_close_rate = trade.fee_close if self.custom_fee_close_rate is None else self.custom_fee_close_rate # Rebuy mode if is_rebuy_mode: slice_amount /= self.rebuy_mode_stake_multiplier # Grind mode elif is_grind_mode: slice_amount /= ( self.grind_mode_stake_multiplier_futures[0] if self.is_futures_mode else self.grind_mode_stake_multiplier_spot[0] ) elif not is_derisk and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 2, 5) or is_backtest): rebuy_stake, order_tag, is_derisk_calc = self.long_adjust_trade_position_no_derisk( trade, enter_tags, current_time, current_rate, current_profit, min_stake, max_stake, current_entry_rate, current_exit_rate, current_entry_profit, current_exit_profit, last_candle, previous_candle, filled_orders, filled_entries, filled_exits, exit_rate, slice_amount, slice_profit_entry, slice_profit, profit_ratio, profit_stake, profit_init_ratio, current_stake_amount, has_order_tags, ) if rebuy_stake is not None: if has_order_tags: return rebuy_stake, order_tag else: return rebuy_stake elif count_of_exits == 0: return None elif not is_derisk_calc: return None if not is_rebuy_mode and not is_grind_mode: # First entry is lower now, therefore the grinds must adjust if trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest: slice_amount /= ( self.regular_mode_stake_multiplier_futures[0] if self.is_futures_mode else self.regular_mode_stake_multiplier_spot[0] ) grind_derisk = self.grind_derisk_futures if self.is_futures_mode else self.grind_derisk_spot grind_1_max_sub_grinds = 0 grind_1_stakes = self.grind_1_stakes_futures.copy() if self.is_futures_mode else self.grind_1_stakes_spot.copy() grind_1_sub_thresholds = ( self.grind_1_sub_thresholds_futures if self.is_futures_mode else self.grind_1_sub_thresholds_spot ) if (slice_amount * grind_1_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_1_stakes[0] for i, _ in enumerate(grind_1_stakes): grind_1_stakes[i] *= multi grind_1_max_sub_grinds = len(grind_1_stakes) grind_1_stop_grinds = self.grind_1_stop_grinds_futures if self.is_futures_mode else self.grind_1_stop_grinds_spot grind_1_profit_threshold = ( self.grind_1_profit_threshold_futures if self.is_futures_mode else self.grind_1_profit_threshold_spot ) grind_2_max_sub_grinds = 0 grind_2_stakes = self.grind_2_stakes_futures.copy() if self.is_futures_mode else self.grind_2_stakes_spot.copy() grind_2_sub_thresholds = ( self.grind_2_sub_thresholds_futures if self.is_futures_mode else self.grind_2_sub_thresholds_spot ) if (slice_amount * grind_2_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_2_stakes[0] for i, _ in enumerate(grind_2_stakes): grind_2_stakes[i] *= multi grind_2_max_sub_grinds = len(grind_2_stakes) grind_2_stop_grinds = self.grind_2_stop_grinds_futures if self.is_futures_mode else self.grind_2_stop_grinds_spot grind_2_profit_threshold = ( self.grind_2_profit_threshold_futures if self.is_futures_mode else self.grind_2_profit_threshold_spot ) grind_3_max_sub_grinds = 0 grind_3_stakes = self.grind_3_stakes_futures.copy() if self.is_futures_mode else self.grind_3_stakes_spot.copy() grind_3_sub_thresholds = ( self.grind_3_sub_thresholds_futures if self.is_futures_mode else self.grind_3_sub_thresholds_spot ) if (slice_amount * grind_3_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_3_stakes[0] for i, _ in enumerate(grind_3_stakes): grind_3_stakes[i] *= multi grind_3_max_sub_grinds = len(grind_3_stakes) grind_3_stop_grinds = self.grind_3_stop_grinds_futures if self.is_futures_mode else self.grind_3_stop_grinds_spot grind_3_profit_threshold = ( self.grind_3_profit_threshold_futures if self.is_futures_mode else self.grind_3_profit_threshold_spot ) grind_4_max_sub_grinds = 0 grind_4_stakes = self.grind_4_stakes_futures.copy() if self.is_futures_mode else self.grind_4_stakes_spot.copy() grind_4_sub_thresholds = ( self.grind_4_sub_thresholds_futures if self.is_futures_mode else self.grind_4_sub_thresholds_spot ) if (slice_amount * grind_4_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_4_stakes[0] for i, _ in enumerate(grind_4_stakes): grind_4_stakes[i] *= multi grind_4_max_sub_grinds = len(grind_4_stakes) grind_4_stop_grinds = self.grind_4_stop_grinds_futures if self.is_futures_mode else self.grind_4_stop_grinds_spot grind_4_profit_threshold = ( self.grind_4_profit_threshold_futures if self.is_futures_mode else self.grind_4_profit_threshold_spot ) grind_5_max_sub_grinds = 0 grind_5_stakes = self.grind_5_stakes_futures.copy() if self.is_futures_mode else self.grind_5_stakes_spot.copy() grind_5_sub_thresholds = ( self.grind_5_sub_thresholds_futures if self.is_futures_mode else self.grind_5_sub_thresholds_spot ) if (slice_amount * grind_5_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_5_stakes[0] for i, _ in enumerate(grind_5_stakes): grind_5_stakes[i] *= multi grind_5_max_sub_grinds = len(grind_5_stakes) grind_5_stop_grinds = self.grind_5_stop_grinds_futures if self.is_futures_mode else self.grind_5_stop_grinds_spot grind_5_profit_threshold = ( self.grind_5_profit_threshold_futures if self.is_futures_mode else self.grind_5_profit_threshold_spot ) grind_6_max_sub_grinds = 0 grind_6_stakes = self.grind_6_stakes_futures.copy() if self.is_futures_mode else self.grind_6_stakes_spot.copy() grind_6_sub_thresholds = ( self.grind_6_sub_thresholds_futures if self.is_futures_mode else self.grind_6_sub_thresholds_spot ) if (slice_amount * grind_6_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_6_stakes[0] for i, _ in enumerate(grind_6_stakes): grind_6_stakes[i] *= multi grind_6_max_sub_grinds = len(grind_6_stakes) grind_6_stop_grinds = self.grind_6_stop_grinds_futures if self.is_futures_mode else self.grind_6_stop_grinds_spot grind_6_profit_threshold = ( self.grind_6_profit_threshold_futures if self.is_futures_mode else self.grind_6_profit_threshold_spot ) grind_1_derisk_1_max_sub_grinds = 0 grind_1_derisk_1_stakes = ( self.grind_1_derisk_1_stakes_futures.copy() if self.is_futures_mode else self.grind_1_derisk_1_stakes_spot.copy() ) grind_1_derisk_1_sub_thresholds = ( self.grind_1_derisk_1_sub_thresholds_futures if self.is_futures_mode else self.grind_1_derisk_1_sub_thresholds_spot ) if (slice_amount * grind_1_derisk_1_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_1_derisk_1_stakes[0] for i, _ in enumerate(grind_1_derisk_1_stakes): grind_1_derisk_1_stakes[i] *= multi grind_1_derisk_1_max_sub_grinds = len(grind_1_derisk_1_stakes) grind_1_derisk_1_stop_grinds = ( self.grind_1_derisk_1_stop_grinds_futures if self.is_futures_mode else self.grind_1_derisk_1_stop_grinds_spot ) grind_1_derisk_1_profit_threshold = ( self.grind_1_derisk_1_profit_threshold_futures if self.is_futures_mode else self.grind_1_derisk_1_profit_threshold_spot ) grind_2_derisk_1_max_sub_grinds = 0 grind_2_derisk_1_stakes = ( self.grind_2_derisk_1_stakes_futures.copy() if self.is_futures_mode else self.grind_2_derisk_1_stakes_spot.copy() ) grind_2_derisk_1_sub_thresholds = ( self.grind_2_derisk_1_sub_thresholds_futures if self.is_futures_mode else self.grind_2_derisk_1_sub_thresholds_spot ) if (slice_amount * grind_2_derisk_1_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_2_derisk_1_stakes[0] for i, _ in enumerate(grind_2_derisk_1_stakes): grind_2_derisk_1_stakes[i] *= multi grind_2_derisk_1_max_sub_grinds = len(grind_2_derisk_1_stakes) grind_2_derisk_1_stop_grinds = ( self.grind_2_derisk_1_stop_grinds_futures if self.is_futures_mode else self.grind_2_derisk_1_stop_grinds_spot ) grind_2_derisk_1_profit_threshold = ( self.grind_2_derisk_1_profit_threshold_futures if self.is_futures_mode else self.grind_2_derisk_1_profit_threshold_spot ) partial_sell = False is_derisk_found = False # d de-risk is_derisk_1 = False is_derisk_1_found = False # d1 de-risk exit derisk_1_order = None derisk_1_reentry_order = None derisk_1_sub_grind_count = 0 derisk_1_total_amount = 0.0 derisk_1_total_cost = 0.0 derisk_1_current_open_rate = 0.0 derisk_1_current_grind_stake = 0.0 derisk_1_current_grind_stake_profit = 0.0 derisk_1_is_sell_found = False derisk_1_reentry_found = False derisk_1_buy_orders = [] derisk_1_distance_ratio = 0.0 grind_1_sub_grind_count = 0 grind_1_total_amount = 0.0 grind_1_total_cost = 0.0 grind_1_current_open_rate = 0.0 grind_1_current_grind_stake = 0.0 grind_1_current_grind_stake_profit = 0.0 grind_1_is_sell_found = False grind_1_found = False grind_1_buy_orders = [] grind_1_distance_ratio = 0.0 grind_2_sub_grind_count = 0 grind_2_total_amount = 0.0 grind_2_total_cost = 0.0 grind_2_current_open_rate = 0.0 grind_2_current_grind_stake = 0.0 grind_2_current_grind_stake_profit = 0.0 grind_2_is_sell_found = False grind_2_found = False grind_2_buy_orders = [] grind_2_distance_ratio = 0.0 grind_3_sub_grind_count = 0 grind_3_total_amount = 0.0 grind_3_total_cost = 0.0 grind_3_current_open_rate = 0.0 grind_3_current_grind_stake = 0.0 grind_3_current_grind_stake_profit = 0.0 grind_3_is_sell_found = False grind_3_found = False grind_3_buy_orders = [] grind_3_distance_ratio = 0.0 grind_4_sub_grind_count = 0 grind_4_total_amount = 0.0 grind_4_total_cost = 0.0 grind_4_current_open_rate = 0.0 grind_4_current_grind_stake = 0.0 grind_4_current_grind_stake_profit = 0.0 grind_4_is_sell_found = False grind_4_found = False grind_4_buy_orders = [] grind_4_distance_ratio = 0.0 grind_5_sub_grind_count = 0 grind_5_total_amount = 0.0 grind_5_total_cost = 0.0 grind_5_current_open_rate = 0.0 grind_5_current_grind_stake = 0.0 grind_5_current_grind_stake_profit = 0.0 grind_5_is_sell_found = False grind_5_found = False grind_5_buy_orders = [] grind_5_distance_ratio = 0.0 grind_6_sub_grind_count = 0 grind_6_total_amount = 0.0 grind_6_total_cost = 0.0 grind_6_current_open_rate = 0.0 grind_6_current_grind_stake = 0.0 grind_6_current_grind_stake_profit = 0.0 grind_6_is_sell_found = False grind_6_found = False grind_6_buy_orders = [] grind_6_distance_ratio = 0.0 grind_1_derisk_1_sub_grind_count = 0 grind_1_derisk_1_total_amount = 0.0 grind_1_derisk_1_total_cost = 0.0 grind_1_derisk_1_current_open_rate = 0.0 grind_1_derisk_1_current_grind_stake = 0.0 grind_1_derisk_1_current_grind_stake_profit = 0.0 grind_1_derisk_1_is_sell_found = False grind_1_derisk_1_found = False grind_1_derisk_1_buy_orders = [] grind_1_derisk_1_distance_ratio = 0.0 grind_2_derisk_1_sub_grind_count = 0 grind_2_derisk_1_total_amount = 0.0 grind_2_derisk_1_total_cost = 0.0 grind_2_derisk_1_current_open_rate = 0.0 grind_2_derisk_1_current_grind_stake = 0.0 grind_2_derisk_1_current_grind_stake_profit = 0.0 grind_2_derisk_1_is_sell_found = False grind_2_derisk_1_found = False grind_2_derisk_1_buy_orders = [] grind_2_derisk_1_distance_ratio = 0.0 for order in reversed(filled_orders): if (order.ft_order_side == "buy") and (order is not filled_orders[0]): order_tag = "" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag if not is_derisk_1 and order_tag == "d1": derisk_1_sub_grind_count += 1 derisk_1_total_amount += order.safe_filled derisk_1_total_cost += order.safe_filled * order.safe_price derisk_1_buy_orders.append(order.id) if not derisk_1_reentry_found and not is_derisk_1: derisk_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price derisk_1_reentry_found = True derisk_1_reentry_order = order elif not grind_1_derisk_1_is_sell_found and order_tag == "dl1": grind_1_derisk_1_sub_grind_count += 1 grind_1_derisk_1_total_amount += order.safe_filled grind_1_derisk_1_total_cost += order.safe_filled * order.safe_price grind_1_derisk_1_buy_orders.append(order.id) if not grind_1_derisk_1_found: grind_1_derisk_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_1_derisk_1_found = True elif not grind_2_derisk_1_is_sell_found and order_tag == "dl2": grind_2_derisk_1_sub_grind_count += 1 grind_2_derisk_1_total_amount += order.safe_filled grind_2_derisk_1_total_cost += order.safe_filled * order.safe_price grind_2_derisk_1_buy_orders.append(order.id) if not grind_2_derisk_1_found: grind_2_derisk_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_2_derisk_1_found = True elif not grind_6_is_sell_found and order_tag == "gd6": grind_6_sub_grind_count += 1 grind_6_total_amount += order.safe_filled grind_6_total_cost += order.safe_filled * order.safe_price grind_6_buy_orders.append(order.id) if not grind_6_found: grind_6_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_6_found = True elif not grind_5_is_sell_found and order_tag == "gd5": grind_5_sub_grind_count += 1 grind_5_total_amount += order.safe_filled grind_5_total_cost += order.safe_filled * order.safe_price grind_5_buy_orders.append(order.id) if not grind_5_found: grind_5_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_5_found = True elif not grind_4_is_sell_found and order_tag == "gd4": grind_4_sub_grind_count += 1 grind_4_total_amount += order.safe_filled grind_4_total_cost += order.safe_filled * order.safe_price grind_4_buy_orders.append(order.id) if not grind_4_found: grind_4_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_4_found = True elif not grind_3_is_sell_found and order_tag == "gd3": grind_3_sub_grind_count += 1 grind_3_total_amount += order.safe_filled grind_3_total_cost += order.safe_filled * order.safe_price grind_3_buy_orders.append(order.id) if not grind_3_found: grind_3_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_3_found = True elif not grind_2_is_sell_found and order_tag == "gd2": grind_2_sub_grind_count += 1 grind_2_total_amount += order.safe_filled grind_2_total_cost += order.safe_filled * order.safe_price grind_2_buy_orders.append(order.id) if not grind_2_found: grind_2_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_2_found = True elif not grind_1_is_sell_found and order_tag not in [ "r", "d1", "dl1", "dl2", "g1", "g2", "g3", "g4", "g5", "g6", "sg1", "sg2", "sg3", "sg4", "sg5", "sg6", "gd2", "gd3", "gd4", "gd5", "gd6", "gm0", "gmd0", ]: grind_1_sub_grind_count += 1 grind_1_total_amount += order.safe_filled grind_1_total_cost += order.safe_filled * order.safe_price grind_1_buy_orders.append(order.id) if not grind_1_found: grind_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_1_found = True elif order.ft_order_side == "sell": if ( order is filled_exits[-1] and (order.safe_remaining * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) > min_stake ): partial_sell = True break order_tag = "" if has_order_tags: if order.ft_order_tag is not None: sell_order_tag = order.ft_order_tag order_mode = sell_order_tag.split(" ", 1) if len(order_mode) > 0: order_tag = order_mode[0] if order_tag in ["dl1", "ddl1"]: grind_1_derisk_1_is_sell_found = True elif order_tag in ["dl2", "ddl2"]: grind_2_derisk_1_is_sell_found = True elif order_tag in ["gd6", "dd6"]: grind_6_is_sell_found = True elif order_tag in ["gd5", "dd5"]: grind_5_is_sell_found = True if order_tag in ["gd4", "dd4"]: grind_4_is_sell_found = True elif order_tag in ["gd3", "dd3"]: grind_3_is_sell_found = True elif order_tag in ["gd2", "dd2"]: grind_2_is_sell_found = True elif order_tag in ["d1"]: if not is_derisk_1_found: is_derisk_1_found = True is_derisk_1 = True derisk_1_order = order elif order_tag in ["p", "r", "d", "dd0", "partial_exit", "force_exit", ""]: if order_tag in ["d"]: is_derisk_found = True is_derisk = True grind_1_is_sell_found = True grind_2_is_sell_found = True grind_3_is_sell_found = True grind_4_is_sell_found = True grind_5_is_sell_found = True grind_6_is_sell_found = True grind_1_derisk_1_is_sell_found = True grind_2_derisk_1_is_sell_found = True elif order_tag not in [ "dl1", "ddl1", "dl2", "ddl2", "g1", "g2", "g3", "g4", "g5", "g6", "sg1", "sg2", "sg3", "sg4", "sg5", "sg6", "gd2", "gd3", "gd4", "gd5", "gd6", "dd2", "dd3", "dd4", "dd5", "dd6", "gm0", "gmd0", ]: grind_1_is_sell_found = True if derisk_1_sub_grind_count > 0: derisk_1_current_open_rate = derisk_1_total_cost / derisk_1_total_amount derisk_1_current_grind_stake = derisk_1_total_amount * exit_rate * (1 - trade.fee_close) derisk_1_current_grind_stake_profit = derisk_1_current_grind_stake - derisk_1_total_cost if grind_1_sub_grind_count > 0: grind_1_current_open_rate = grind_1_total_cost / grind_1_total_amount grind_1_current_grind_stake = grind_1_total_amount * exit_rate * (1 - trade.fee_close) grind_1_current_grind_stake_profit = grind_1_current_grind_stake - grind_1_total_cost if grind_2_sub_grind_count > 0: grind_2_current_open_rate = grind_2_total_cost / grind_2_total_amount grind_2_current_grind_stake = grind_2_total_amount * exit_rate * (1 - trade.fee_close) grind_2_current_grind_stake_profit = grind_2_current_grind_stake - grind_2_total_cost if grind_3_sub_grind_count > 0: grind_3_current_open_rate = grind_3_total_cost / grind_3_total_amount grind_3_current_grind_stake = grind_3_total_amount * exit_rate * (1 - trade.fee_close) grind_3_current_grind_stake_profit = grind_3_current_grind_stake - grind_3_total_cost if grind_4_sub_grind_count > 0: grind_4_current_open_rate = grind_4_total_cost / grind_4_total_amount grind_4_current_grind_stake = grind_4_total_amount * exit_rate * (1 - trade.fee_close) grind_4_current_grind_stake_profit = grind_4_current_grind_stake - grind_4_total_cost if grind_5_sub_grind_count > 0: grind_5_current_open_rate = grind_5_total_cost / grind_5_total_amount grind_5_current_grind_stake = grind_5_total_amount * exit_rate * (1 - trade.fee_close) grind_5_current_grind_stake_profit = grind_5_current_grind_stake - grind_5_total_cost if grind_6_sub_grind_count > 0: grind_6_current_open_rate = grind_6_total_cost / grind_6_total_amount grind_6_current_grind_stake = grind_6_total_amount * exit_rate * (1 - trade.fee_close) grind_6_current_grind_stake_profit = grind_6_current_grind_stake - grind_6_total_cost if grind_1_derisk_1_sub_grind_count > 0: grind_1_derisk_1_current_open_rate = grind_1_derisk_1_total_cost / grind_1_derisk_1_total_amount grind_1_derisk_1_current_grind_stake = grind_1_derisk_1_total_amount * exit_rate * (1 - trade.fee_close) grind_1_derisk_1_current_grind_stake_profit = grind_1_derisk_1_current_grind_stake - grind_1_derisk_1_total_cost if grind_2_derisk_1_sub_grind_count > 0: grind_2_derisk_1_current_open_rate = grind_2_derisk_1_total_cost / grind_2_derisk_1_total_amount grind_2_derisk_1_current_grind_stake = grind_2_derisk_1_total_amount * exit_rate * (1 - trade.fee_close) grind_2_derisk_1_current_grind_stake_profit = grind_2_derisk_1_current_grind_stake - grind_2_derisk_1_total_cost num_open_grinds = ( grind_1_sub_grind_count + grind_2_sub_grind_count + grind_3_sub_grind_count + grind_4_sub_grind_count + grind_5_sub_grind_count + grind_6_sub_grind_count + grind_1_derisk_1_sub_grind_count + grind_2_derisk_1_sub_grind_count ) # Sell remaining if partial fill on exit if partial_sell: order = filled_exits[-1] sell_amount = order.safe_remaining * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Exit (remaining) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {order.safe_remaining} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) order_tag = "p" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount if is_grind_mode and ( (filled_entries[0].safe_filled * (trade.stake_amount / trade.amount) - (min_stake * 1.5)) > min_stake ): is_first_entry_exit_found = False for order in filled_orders: if order.ft_order_side == "sell": order_tag = "" if has_order_tags: if order.ft_order_tag is not None: sell_order_tag = order.ft_order_tag order_mode = sell_order_tag.split(" ", 1) if len(order_mode) > 0: order_tag = order_mode[0] else: # no order tag support, assume the first exit is for the first buy is_first_entry_exit_found = True if order_tag in ["gm0", "gmd0"]: is_first_entry_exit_found = True break if not is_first_entry_exit_found: first_entry = filled_entries[0] first_entry_distance_ratio = (exit_rate - first_entry.safe_price) / first_entry.safe_price # First entry exit if first_entry_distance_ratio > ( (self.grind_mode_first_entry_profit_threshold_spot + fee_open_rate + fee_close_rate) if self.is_futures_mode else (self.grind_mode_first_entry_profit_threshold_spot + fee_open_rate + fee_close_rate) ): sell_amount = first_entry.safe_filled * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = (exit_rate - first_entry.safe_price) / first_entry.safe_price coin_amount = sell_amount / exit_rate self.dp.send_msg( f"Grinding exit (gm0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gm0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gm0" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # First entry de-risk if first_entry_distance_ratio < ( self.grind_mode_first_entry_stop_threshold_spot if self.is_futures_mode else self.grind_mode_first_entry_stop_threshold_spot ): sell_amount = first_entry.safe_filled * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = (exit_rate - first_entry.safe_price) / first_entry.safe_price coin_amount = sell_amount / exit_rate self.dp.send_msg( f"Grinding de-risk (gmd0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding de-risk (gmd0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gmd0" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount is_long_grind_buy = self.long_grind_buy(last_candle, previous_candle, slice_profit) # Grinding derisk 1 # Buy if ( has_order_tags and is_derisk_1 and not derisk_1_reentry_found and (not partial_sell) and (grind_1_derisk_1_sub_grind_count < grind_1_derisk_1_max_sub_grinds) ): if ( ( ( (grind_1_derisk_1_sub_grind_count > 0) and grind_1_derisk_1_distance_ratio < grind_1_derisk_1_sub_thresholds[grind_1_derisk_1_sub_grind_count] ) or ((is_derisk or is_derisk_calc) and grind_1_derisk_1_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( (last_candle["close"] > (last_candle["close_max_12"] * 0.94)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.92)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.90)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.88)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.86)) and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.84)) and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.82)) ) and ( (last_candle["zlma_50_dec_15m"] == False) and (last_candle["zlma_50_dec_1h"] == False) and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 16.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) ) ) ): buy_amount = ( slice_amount * grind_1_derisk_1_stakes[grind_1_derisk_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_derisk_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_derisk_1_current_open_rate) / grind_1_derisk_1_current_open_rate grind_profit_stake = grind_1_derisk_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (dl1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (dl1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "dl1" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_1_derisk_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_derisk_1_current_open_rate) / grind_1_derisk_1_current_open_rate if grind_profit > (grind_1_derisk_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_1_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (dl1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (dl1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "dl1" for grind_entry_id in grind_1_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if (grind_1_derisk_1_distance_ratio < grind_1_derisk_1_stop_grinds) and (is_derisk or is_derisk_calc): sell_amount = grind_1_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_1_derisk_1_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_1_derisk_1_current_open_rate) / grind_1_derisk_1_current_open_rate) if grind_1_derisk_1_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (ddl1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (ddl1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "ddl1" for grind_entry_id in grind_1_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding derisk 2 # Buy if ( has_order_tags and is_derisk_1 and not derisk_1_reentry_found and (not partial_sell) and (grind_2_derisk_1_sub_grind_count < grind_2_derisk_1_max_sub_grinds) ): if ( ( ( (grind_2_derisk_1_sub_grind_count > 0) and grind_2_derisk_1_distance_ratio < grind_2_derisk_1_sub_thresholds[grind_2_derisk_1_sub_grind_count] ) or ((is_derisk or is_derisk_calc) and grind_2_derisk_1_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( (last_candle["close"] > (last_candle["close_max_12"] * 0.94)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.92)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.90)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.88)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.86)) ) and ( ( (grind_2_derisk_1_sub_grind_count == 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 16.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 20.0) and (last_candle["rsi_3_4h"] > 20.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) and (last_candle["zlma_50_dec_1h"] == False) and (last_candle["zlma_50_dec_4h"] == False) ) ) ) or ( (grind_2_derisk_1_sub_grind_count > 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 42.0) ) ) ) ) ): buy_amount = ( slice_amount * grind_2_derisk_1_stakes[grind_2_derisk_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_2_derisk_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate grind_profit_stake = grind_2_derisk_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (dl2) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (dl2) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "dl2" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_2_derisk_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate if grind_profit > (grind_2_derisk_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_2_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (dl2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (dl2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "dl2" for grind_entry_id in grind_2_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( (grind_2_derisk_1_sub_grind_count > 0) and ( ((exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate) < grind_2_derisk_1_stop_grinds ) and (is_derisk or is_derisk_calc) ): sell_amount = grind_2_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_2_derisk_1_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate) if grind_2_derisk_1_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (ddl2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (ddl2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "ddl2" for grind_entry_id in grind_2_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 1 # Buy if (not partial_sell) and (grind_1_sub_grind_count < grind_1_max_sub_grinds): if ( ( ((grind_1_sub_grind_count > 0) and grind_1_distance_ratio < grind_1_sub_thresholds[grind_1_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_1_sub_grind_count == 0) or (is_grind_mode and grind_1_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) ) and ( ( (grind_1_sub_grind_count == 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.988)) ) ) ) or ( (grind_1_sub_grind_count > 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 12.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd1" if has_order_tags: return buy_amount, order_tag else: return buy_amount if ( self.is_futures_mode and has_order_tags and (not partial_sell) and slice_profit < (-0.65 / trade.leverage) and (is_derisk or is_derisk_calc or is_grind_mode) and (grind_1_sub_grind_count < grind_1_max_sub_grinds) ): buy_amount = ( slice_amount * grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd1" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate if grind_profit > (grind_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd1" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_1_sub_grind_count > 0) and (((exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate) < grind_1_stop_grinds) # ( # grind_1_current_grind_stake_profit # < (slice_amount * grind_1_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_1_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate) if grind_1_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd1" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 2 # Buy if has_order_tags and (not partial_sell) and (grind_2_sub_grind_count < grind_2_max_sub_grinds): if ( ( ((grind_2_sub_grind_count > 0) and grind_2_distance_ratio < grind_2_sub_thresholds[grind_2_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_2_sub_grind_count == 0) or (is_grind_mode and grind_2_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) ) and ( ( (grind_2_sub_grind_count == 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.988)) ) ) ) or ( (grind_2_sub_grind_count > 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 12.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * grind_2_stakes[grind_2_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_2_sub_grind_count > 0: grind_profit = (exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate grind_profit_stake = grind_2_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd2) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd2) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd2" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_2_sub_grind_count > 0: grind_profit = (exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate if grind_profit > (grind_2_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_2_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd2" for grind_entry_id in grind_2_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_2_sub_grind_count > 0) and (((exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate) < grind_2_stop_grinds) # ( # grind_2_current_grind_stake_profit # < (slice_amount * grind_2_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_2_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_2_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate) if grind_2_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd2" for grind_entry_id in grind_2_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 3 # Buy if has_order_tags and (not partial_sell) and (grind_3_sub_grind_count < grind_3_max_sub_grinds): if ( ( ((grind_3_sub_grind_count > 0) and grind_3_distance_ratio < grind_3_sub_thresholds[grind_3_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_3_sub_grind_count == 0) or (is_grind_mode and grind_3_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) ) and ( ( (grind_3_sub_grind_count == 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.988)) ) ) ) or ( (grind_3_sub_grind_count > 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 12.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * grind_3_stakes[grind_3_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_3_sub_grind_count > 0: grind_profit = (exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate grind_profit_stake = grind_3_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd3) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd3) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd3" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_3_sub_grind_count > 0: grind_profit = (exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate if grind_profit > (grind_3_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_3_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd3) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd3) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd3" for grind_entry_id in grind_3_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_3_sub_grind_count > 0) and (((exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate) < grind_3_stop_grinds) # ( # grind_3_current_grind_stake_profit # < (slice_amount * grind_3_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_3_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_3_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate) if grind_3_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd3) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd3) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd3" for grind_entry_id in grind_3_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 4 # Buy if has_order_tags and (not partial_sell) and (grind_4_sub_grind_count < grind_4_max_sub_grinds): if ( ( ((grind_4_sub_grind_count > 0) and grind_4_distance_ratio < grind_4_sub_thresholds[grind_4_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_4_sub_grind_count == 0) or (is_grind_mode and grind_4_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) ) and ( ( (grind_4_sub_grind_count == 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.988)) ) ) ) or ( (grind_4_sub_grind_count > 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 12.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * grind_4_stakes[grind_4_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_4_sub_grind_count > 0: grind_profit = (exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate grind_profit_stake = grind_4_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd4) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd4) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd4" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_4_sub_grind_count > 0: grind_profit = (exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate if grind_profit > (grind_4_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_4_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd4) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd4) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd4" for grind_entry_id in grind_4_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_4_sub_grind_count > 0) and (((exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate) < grind_4_stop_grinds) # ( # grind_4_current_grind_stake_profit # < (slice_amount * grind_4_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_4_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_4_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate) if grind_4_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd4) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd4) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd4" for grind_entry_id in grind_4_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 5 # Buy if has_order_tags and (not partial_sell) and (grind_5_sub_grind_count < grind_5_max_sub_grinds): if ( ( ((grind_5_sub_grind_count > 0) and grind_5_distance_ratio < grind_5_sub_thresholds[grind_5_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_5_sub_grind_count == 0) or (is_grind_mode and grind_5_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) ) and ( ( (grind_5_sub_grind_count == 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.988)) ) ) ) or ( (grind_5_sub_grind_count > 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 12.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * grind_5_stakes[grind_5_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_5_sub_grind_count > 0: grind_profit = (exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate grind_profit_stake = grind_5_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd5) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd5) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd5" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_5_sub_grind_count > 0: grind_profit = (exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate if grind_profit > (grind_5_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_5_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd5) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd5) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd5" for grind_entry_id in grind_5_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_5_sub_grind_count > 0) and (((exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate) < grind_5_stop_grinds) # ( # grind_5_current_grind_stake_profit # < (slice_amount * grind_5_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_5_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_5_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate) if grind_5_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd5) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd5) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd5" for grind_entry_id in grind_5_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 6 # Buy if has_order_tags and (not partial_sell) and (grind_6_sub_grind_count < grind_6_max_sub_grinds): if ( ( ((grind_6_sub_grind_count > 0) and grind_6_distance_ratio < grind_6_sub_thresholds[grind_6_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_6_sub_grind_count == 0) or (is_grind_mode and grind_6_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) ) and ( ( (grind_6_sub_grind_count == 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.988)) ) ) ) or ( (grind_6_sub_grind_count > 0) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 12.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ) or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) # and (last_candle["rsi_3_1h"] > 16.0) # and (last_candle["rsi_3_4h"] > 16.0) # and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) and (last_candle["close"] < last_candle["bb20_2_mid"]) and (previous_candle["close"] < previous_candle["bb20_2_mid"]) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * grind_6_stakes[grind_6_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_6_sub_grind_count > 0: grind_profit = (exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate grind_profit_stake = grind_6_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd6) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd6) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd6" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_6_sub_grind_count > 0: grind_profit = (exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate if grind_profit > (grind_6_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_6_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd6) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd6) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd6" for grind_entry_id in grind_6_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_6_sub_grind_count > 0) and (((exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate) < grind_6_stop_grinds) # ( # grind_6_current_grind_stake_profit # < (slice_amount * grind_6_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_6_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_6_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate) if grind_6_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd6) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd6) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd6" for grind_entry_id in grind_6_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # De-risk 1 reentry if ( is_derisk_1 and not derisk_1_reentry_found and derisk_1_order is not None and ( ((current_rate - derisk_1_order.safe_price) / derisk_1_order.safe_price) < ( self.regular_mode_derisk_1_reentry_futures if self.is_futures_mode else self.regular_mode_derisk_1_reentry_spot ) ) ): if ( (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( (last_candle["close"] > (last_candle["close_max_12"] * 0.94)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.92)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.90)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.88)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.86)) and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.84)) and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.82)) ) and ( (last_candle["zlma_50_dec_15m"] == False) and (last_candle["zlma_50_dec_1h"] == False) and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 30.0) and (last_candle["rsi_3_15m"] > 30.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["rsi_14"] < 42.0) ) ) ): buy_amount = derisk_1_order.safe_filled * derisk_1_order.safe_price if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if derisk_1_sub_grind_count > 0: grind_profit = (exit_rate - derisk_1_current_open_rate) / derisk_1_current_open_rate grind_profit_stake = derisk_1_current_grind_stake_profit self.dp.send_msg( f"Re-entry (d1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Re-entry (d1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "d1" if has_order_tags: return buy_amount, order_tag else: return buy_amount # De-risk level 1 if ( has_order_tags # and not is_derisk_1 and derisk_1_reentry_found and derisk_1_reentry_order is not None # and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 5) or is_backtest) and derisk_1_distance_ratio < ( ( self.regular_mode_derisk_1_reentry_futures if self.is_futures_mode else self.regular_mode_derisk_1_reentry_spot ) / (trade.leverage if self.is_futures_mode else 1.0) ) ): sell_amount = derisk_1_reentry_order.safe_filled * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk (d1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk (d1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d1" # De-risk if ( not is_derisk_found and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 2, 5) or is_backtest) and profit_stake < ( slice_amount * ( (self.regular_mode_derisk_futures if self.is_futures_mode else self.regular_mode_derisk_spot) if (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) else (self.regular_mode_derisk_futures_old if self.is_futures_mode else self.regular_mode_derisk_spot_old) ) / (trade.leverage if self.is_futures_mode else 1.0) ) ): sell_amount = trade.amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d", is_derisk # De-risk # if ( # ( # (profit_stake < (slice_amount * grind_derisk / (trade.leverage if self.is_futures_mode else 1.0))) # and ( # ( # (trade.amount * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) # - ( # ( # derisk_1_total_amount # + grind_1_derisk_1_total_amount # + grind_2_derisk_1_total_amount # + grind_1_total_amount # + grind_2_total_amount # + grind_3_total_amount # + grind_4_total_amount # + grind_5_total_amount # + grind_6_total_amount # ) # * exit_rate # / (trade.leverage if self.is_futures_mode else 1.0) # ) # ) # > (min_stake * 3.0) # ) # # temporary # and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2023, 12, 19) or is_backtest) # ) # # temporary # and ( # (trade.open_date_utc.replace(tzinfo=None) >= datetime(2023, 8, 28) or is_backtest) # or (filled_entries[-1].order_date_utc.replace(tzinfo=None) >= datetime(2023, 8, 28) or is_backtest) # ) # ): # sell_amount = trade.amount * exit_rate / trade.leverage # if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): # sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) # ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate # if sell_amount > min_stake and ft_sell_amount > min_stake: # self.dp.send_msg( # f"De-risk (dd0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" # ) # log.info( # f"De-risk (dd0) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" # ) # order_tag = "dd0" # for grind_entry_id in ( # grind_1_buy_orders # + grind_2_buy_orders # + grind_3_buy_orders # + grind_4_buy_orders # + grind_5_buy_orders # + grind_6_buy_orders # + grind_1_derisk_1_buy_orders # + grind_2_derisk_1_buy_orders # ): # order_tag += " " + str(grind_entry_id) # if has_order_tags: # return -ft_sell_amount, order_tag # else: # return -ft_sell_amount return None # Long Grinding Buy # --------------------------------------------------------------------------------------------- def long_grind_buy(self, last_candle: Series, previous_candle: Series, slice_profit: float) -> float: if ( (last_candle["protections_long_global"] == True) and (last_candle["protections_long_rebuy"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) and ( (last_candle["close"] > (last_candle["close_max_12"] * 0.88)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.82)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["btc_pct_close_max_72_5m"] < 0.03) and (last_candle["btc_pct_close_max_24_5m"] < 0.03) ) and ( (last_candle["enter_long"] == True) or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 20.0) and (last_candle["rsi_3_1h"] > 20.0) and (last_candle["rsi_3_4h"] > 20.0) and (last_candle["rsi_14"] < 44.0) and (last_candle["ha_close"] > last_candle["ha_open"]) and (last_candle["ema_12"] < (last_candle["ema_26"] * 0.990)) and (last_candle["cti_20_1h"] < 0.8) and (last_candle["rsi_14_1h"] < 80.0) ) or ( (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.994)) and (last_candle["rsi_3"] > 16.0) and (last_candle["rsi_3_15m"] > 30.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["zlma_50_dec_1h"] == False) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 6.0) and (last_candle["ema_26"] > last_candle["ema_12"]) and ((last_candle["ema_26"] - last_candle["ema_12"]) > (last_candle["open"] * 0.010)) and ((previous_candle["ema_26"] - previous_candle["ema_12"]) > (last_candle["open"] / 100.0)) and (last_candle["rsi_3_1h"] > 20.0) and (last_candle["rsi_3_4h"] > 20.0) and (last_candle["cti_20_1h"] < 0.8) and (last_candle["rsi_14_1h"] < 80.0) ) or ( (last_candle["rsi_14"] > 30.0) and (last_candle["rsi_14"] < 60.0) and (last_candle["hma_70_buy"]) and (last_candle["close"] < (last_candle["high_max_12_1h"] * 0.90)) and (last_candle["cti_20_15m"] < 0.5) and (last_candle["rsi_14_15m"] < 50.0) and (last_candle["cti_20_1h"] < 0.8) and (last_candle["rsi_14_1h"] < 80.0) and (last_candle["zlma_50_dec_1h"] == False) and (last_candle["zlma_50_dec_4h"] == False) ) or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 20.0) and (last_candle["rsi_3_1h"] > 20.0) and (last_candle["rsi_3_4h"] > 20.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["zlma_50_dec_15m"] == False) and (last_candle["zlma_50_dec_1h"] == False) ) or ( (last_candle["rsi_14"] < 40.0) and (last_candle["rsi_14_15m"] < 40.0) and (last_candle["rsi_3"] > 6.0) and (last_candle["ema_26_15m"] > last_candle["ema_12_15m"]) and ((last_candle["ema_26_15m"] - last_candle["ema_12_15m"]) > (last_candle["open_15m"] * 0.006)) and ((previous_candle["ema_26_15m"] - previous_candle["ema_12_15m"]) > (last_candle["open_15m"] / 100.0)) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 26.0) and (last_candle["rsi_3_4h"] > 26.0) and (last_candle["cti_20_1h"] < 0.8) and (last_candle["rsi_14_1h"] < 80.0) ) or ( (last_candle["rsi_14"] > 35.0) and (last_candle["rsi_3"] > 4.0) and (last_candle["rsi_3"] < 46.0) and (last_candle["rsi_14"] < previous_candle["rsi_14"]) and (last_candle["close"] < (last_candle["sma_16"] * 0.982)) and (last_candle["cti_20"] < -0.6) and (last_candle["rsi_3_1h"] > 20.0) and (last_candle["rsi_3_4h"] > 20.0) and (last_candle["not_downtrend_1d"] == True) and (last_candle["zlma_50_dec_1h"] == False) ) or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 26.0) and (last_candle["rsi_3_1h"] > 26.0) and (last_candle["rsi_3_4h"] > 26.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["ema_12"] < (last_candle["ema_26"] * 0.994)) and (last_candle["cti_20_1h"] < 0.8) and (last_candle["rsi_14_1h"] < 80.0) and (last_candle["cti_20_4h"] < 0.8) and (last_candle["rsi_14_4h"] < 80.0) and (last_candle["ema_200_dec_48_1h"] == False) ) or ( (last_candle["rsi_14"] < 60.0) and (last_candle["hma_55_buy"]) and (last_candle["rsi_3_1h"] > 4.0) and (last_candle["rsi_3_4h"] > 4.0) and (last_candle["cti_20_15m"] < 0.8) and (last_candle["cti_20_1h"] < 0.8) and (last_candle["cti_20_4h"] < 0.8) and (last_candle["rsi_14_1h"] < 80.0) and (last_candle["close"] < (last_candle["high_max_12_1h"] * 0.90)) and (last_candle["zlma_50_dec_1h"] == False) and (last_candle["zlma_50_dec_4h"] == False) ) or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 30.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["cti_20_15m"] < 0.8) and (last_candle["rsi_14_15m"] < 70.0) and (last_candle["cti_20_1h"] < 0.8) and (last_candle["rsi_14_1h"] < 80.0) and (last_candle["cti_20_4h"] < 0.8) and (last_candle["rsi_14_4h"] < 80.0) and (last_candle["r_14_1h"] > -80.0) and (last_candle["ema_12"] < (last_candle["ema_26"] * 0.995)) and (last_candle["zlma_50_dec_1h"] == False) ) or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 30.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["rsi_14_1d"] < 70.0) and (last_candle["close"] > last_candle["sup_level_1h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) and (last_candle["close"] > last_candle["sup_level_1d"]) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) ) or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 30.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["ha_close"] > last_candle["ha_open"]) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) and (last_candle["close"] < last_candle["res_hlevel_1d"]) and (last_candle["close"] > last_candle["sup_level_1d"]) and (last_candle["close"] < last_candle["res3_1d"]) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.85)) and (last_candle["hl_pct_change_24_1h"] < 0.35) ) or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 30.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["rsi_14"] < 46.0) and (previous_candle["chandelier_dir"] < -0) and (last_candle["chandelier_dir"] > 0) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) and (last_candle["close"] < last_candle["res_hlevel_1d"]) and (last_candle["close"] > last_candle["sup_level_1d"]) ) ) ): return True return False # Long Grinding Adjust Trade Position No De-Risk # --------------------------------------------------------------------------------------------- def long_adjust_trade_position_no_derisk( self, trade: Trade, enter_tags, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, last_candle: Series, previous_candle: Series, filled_orders: "Orders", filled_entries: "Orders", filled_exits: "Orders", exit_rate: float, slice_amount: float, slice_profit_entry: float, slice_profit: float, profit_ratio: float, profit_stake: float, profit_init_ratio: float, current_stake_amount: float, has_order_tags: bool, **kwargs, ) -> tuple[Optional[float], str, bool]: is_backtest = self.dp.runmode.value in ["backtest", "hyperopt"] max_rebuy_sub_grinds = 0 regular_mode_rebuy_stakes = ( self.regular_mode_rebuy_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_rebuy_stakes_spot.copy() ) regular_mode_rebuy_sub_thresholds = ( self.regular_mode_rebuy_thresholds_futures if self.is_futures_mode else self.regular_mode_rebuy_thresholds_spot ) if (slice_amount * regular_mode_rebuy_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_rebuy_stakes[0] for i, _ in enumerate(regular_mode_rebuy_stakes): regular_mode_rebuy_stakes[i] *= multi max_rebuy_sub_grinds = len(regular_mode_rebuy_stakes) max_grind_1_sub_grinds = 0 regular_mode_grind_1_stakes = ( self.regular_mode_grind_1_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_1_stakes_spot.copy() ) regular_mode_grind_1_sub_thresholds = ( self.regular_mode_grind_1_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_1_thresholds_spot ) if (slice_amount * regular_mode_grind_1_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_1_stakes[0] for i, _ in enumerate(regular_mode_grind_1_stakes): regular_mode_grind_1_stakes[i] *= multi max_grind_1_sub_grinds = len(regular_mode_grind_1_stakes) regular_mode_grind_1_stop_grinds = ( self.regular_mode_grind_1_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_1_stop_grinds_spot ) regular_mode_grind_1_profit_threshold = ( self.regular_mode_grind_1_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_1_profit_threshold_spot ) max_grind_2_sub_grinds = 0 regular_mode_grind_2_stakes = ( self.regular_mode_grind_2_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_2_stakes_spot.copy() ) regular_mode_grind_2_sub_thresholds = ( self.regular_mode_grind_2_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_2_thresholds_spot ) if (slice_amount * regular_mode_grind_2_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_2_stakes[0] for i, _ in enumerate(regular_mode_grind_2_stakes): regular_mode_grind_2_stakes[i] *= multi max_grind_2_sub_grinds = len(regular_mode_grind_2_stakes) regular_mode_grind_2_stop_grinds = ( self.regular_mode_grind_2_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_2_stop_grinds_spot ) regular_mode_grind_2_profit_threshold = ( self.regular_mode_grind_2_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_2_profit_threshold_spot ) max_grind_3_sub_grinds = 0 regular_mode_grind_3_stakes = ( self.regular_mode_grind_3_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_3_stakes_spot.copy() ) regular_mode_grind_3_sub_thresholds = ( self.regular_mode_grind_3_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_3_thresholds_spot ) if (slice_amount * regular_mode_grind_3_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_3_stakes[0] for i, _ in enumerate(regular_mode_grind_3_stakes): regular_mode_grind_3_stakes[i] *= multi max_grind_3_sub_grinds = len(regular_mode_grind_3_stakes) regular_mode_grind_3_stop_grinds = ( self.regular_mode_grind_3_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_3_stop_grinds_spot ) regular_mode_grind_3_profit_threshold = ( self.regular_mode_grind_3_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_3_profit_threshold_spot ) max_grind_4_sub_grinds = 0 regular_mode_grind_4_stakes = ( self.regular_mode_grind_4_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_4_stakes_spot.copy() ) regular_mode_grind_4_sub_thresholds = ( self.regular_mode_grind_4_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_4_thresholds_spot ) if (slice_amount * regular_mode_grind_4_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_4_stakes[0] for i, _ in enumerate(regular_mode_grind_4_stakes): regular_mode_grind_4_stakes[i] *= multi max_grind_4_sub_grinds = len(regular_mode_grind_4_stakes) regular_mode_grind_4_stop_grinds = ( self.regular_mode_grind_4_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_4_stop_grinds_spot ) regular_mode_grind_4_profit_threshold = ( self.regular_mode_grind_4_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_4_profit_threshold_spot ) max_grind_5_sub_grinds = 0 regular_mode_grind_5_stakes = ( self.regular_mode_grind_5_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_5_stakes_spot.copy() ) regular_mode_grind_5_sub_thresholds = ( self.regular_mode_grind_5_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_5_thresholds_spot ) if (slice_amount * regular_mode_grind_5_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_5_stakes[0] for i, _ in enumerate(regular_mode_grind_5_stakes): regular_mode_grind_5_stakes[i] *= multi max_grind_5_sub_grinds = len(regular_mode_grind_5_stakes) regular_mode_grind_5_stop_grinds = ( self.regular_mode_grind_5_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_5_stop_grinds_spot ) regular_mode_grind_5_profit_threshold = ( self.regular_mode_grind_5_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_5_profit_threshold_spot ) max_grind_6_sub_grinds = 0 regular_mode_grind_6_stakes = ( self.regular_mode_grind_6_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_6_stakes_spot.copy() ) regular_mode_grind_6_sub_thresholds = ( self.regular_mode_grind_6_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_6_thresholds_spot ) if (slice_amount * regular_mode_grind_6_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_6_stakes[0] for i, _ in enumerate(regular_mode_grind_6_stakes): regular_mode_grind_6_stakes[i] *= multi max_grind_6_sub_grinds = len(regular_mode_grind_6_stakes) regular_mode_grind_6_stop_grinds = ( self.regular_mode_grind_6_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_6_stop_grinds_spot ) regular_mode_grind_6_profit_threshold = ( self.regular_mode_grind_6_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_6_profit_threshold_spot ) partial_sell = False is_derisk = False is_derisk_1 = False rebuy_sub_grind_count = 0 rebuy_total_amount = 0.0 rebuy_total_cost = 0.0 rebuy_current_open_rate = 0.0 rebuy_current_grind_stake = 0.0 rebuy_current_grind_stake_profit = 0.0 rebuy_is_sell_found = False rebuy_found = False rebuy_buy_orders = [] rebuy_distance_ratio = 0.0 grind_1_sub_grind_count = 0 grind_1_total_amount = 0.0 grind_1_total_cost = 0.0 grind_1_current_open_rate = 0.0 grind_1_current_grind_stake = 0.0 grind_1_current_grind_stake_profit = 0.0 grind_1_is_sell_found = False grind_1_found = False grind_1_buy_orders = [] grind_1_distance_ratio = 0.0 grind_2_sub_grind_count = 0 grind_2_total_amount = 0.0 grind_2_total_cost = 0.0 grind_2_current_open_rate = 0.0 grind_2_current_grind_stake = 0.0 grind_2_current_grind_stake_profit = 0.0 grind_2_is_sell_found = False grind_2_found = False grind_2_buy_orders = [] grind_2_distance_ratio = 0.0 grind_3_sub_grind_count = 0 grind_3_total_amount = 0.0 grind_3_total_cost = 0.0 grind_3_current_open_rate = 0.0 grind_3_current_grind_stake = 0.0 grind_3_current_grind_stake_profit = 0.0 grind_3_is_sell_found = False grind_3_found = False grind_3_buy_orders = [] grind_3_distance_ratio = 0.0 grind_4_sub_grind_count = 0 grind_4_total_amount = 0.0 grind_4_total_cost = 0.0 grind_4_current_open_rate = 0.0 grind_4_current_grind_stake = 0.0 grind_4_current_grind_stake_profit = 0.0 grind_4_is_sell_found = False grind_4_found = False grind_4_buy_orders = [] grind_4_distance_ratio = 0.0 grind_5_sub_grind_count = 0 grind_5_total_amount = 0.0 grind_5_total_cost = 0.0 grind_5_current_open_rate = 0.0 grind_5_current_grind_stake = 0.0 grind_5_current_grind_stake_profit = 0.0 grind_5_is_sell_found = False grind_5_found = False grind_5_buy_orders = [] grind_5_distance_ratio = 0.0 grind_6_sub_grind_count = 0 grind_6_total_amount = 0.0 grind_6_total_cost = 0.0 grind_6_current_open_rate = 0.0 grind_6_current_grind_stake = 0.0 grind_6_current_grind_stake_profit = 0.0 grind_6_is_sell_found = False grind_6_found = False grind_6_buy_orders = [] grind_6_distance_ratio = 0.0 for order in reversed(filled_orders): if (order.ft_order_side == "buy") and (order is not filled_orders[0]): order_tag = "" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag if not grind_1_is_sell_found and order_tag == "g1": grind_1_sub_grind_count += 1 grind_1_total_amount += order.safe_filled grind_1_total_cost += order.safe_filled * order.safe_price grind_1_buy_orders.append(order.id) if not grind_1_found: grind_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_1_found = True elif not grind_2_is_sell_found and order_tag == "g2": grind_2_sub_grind_count += 1 grind_2_total_amount += order.safe_filled grind_2_total_cost += order.safe_filled * order.safe_price grind_2_buy_orders.append(order.id) if not grind_2_found: grind_2_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_2_found = True elif not grind_3_is_sell_found and order_tag == "g3": grind_3_sub_grind_count += 1 grind_3_total_amount += order.safe_filled grind_3_total_cost += order.safe_filled * order.safe_price grind_3_buy_orders.append(order.id) if not grind_3_found: grind_3_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_3_found = True elif not grind_4_is_sell_found and order_tag == "g4": grind_4_sub_grind_count += 1 grind_4_total_amount += order.safe_filled grind_4_total_cost += order.safe_filled * order.safe_price grind_4_buy_orders.append(order.id) if not grind_4_found: grind_4_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_4_found = True elif not grind_5_is_sell_found and order_tag == "g5": grind_5_sub_grind_count += 1 grind_5_total_amount += order.safe_filled grind_5_total_cost += order.safe_filled * order.safe_price grind_5_buy_orders.append(order.id) if not grind_5_found: grind_5_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_5_found = True elif not grind_6_is_sell_found and order_tag == "g6": grind_6_sub_grind_count += 1 grind_6_total_amount += order.safe_filled grind_6_total_cost += order.safe_filled * order.safe_price grind_6_buy_orders.append(order.id) if not grind_6_found: grind_6_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_6_found = True elif not rebuy_is_sell_found and order_tag not in [ "g1", "g2", "g3", "g4", "g5", "g6", "sg1", "sg2", "sg3", "sg4", "sg5", "sg6", "dl1", "dl2", "gd1", "gd2", "gd3", "gd4", "gd5", "gd6", "gm0", "gmd0", ]: rebuy_sub_grind_count += 1 rebuy_total_amount += order.safe_filled rebuy_total_cost += order.safe_filled * order.safe_price rebuy_buy_orders.append(order.id) if not rebuy_found: rebuy_distance_ratio = (exit_rate - order.safe_price) / order.safe_price rebuy_found = True elif order.ft_order_side == "sell": if ( order is filled_exits[-1] and (order.safe_remaining * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) > min_stake ): partial_sell = True break order_tag = "" if has_order_tags: if order.ft_order_tag is not None: sell_order_tag = order.ft_order_tag order_mode = sell_order_tag.split(" ", 1) if len(order_mode) > 0: order_tag = order_mode[0] if order_tag in ["g1", "sg1"]: grind_1_is_sell_found = True elif order_tag in ["g2", "sg2"]: grind_2_is_sell_found = True elif order_tag in ["g3", "sg3"]: grind_3_is_sell_found = True elif order_tag in ["g4", "sg4"]: grind_4_is_sell_found = True elif order_tag in ["g5", "sg5"]: grind_5_is_sell_found = True elif order_tag in ["g6", "sg6"]: grind_6_is_sell_found = True elif order_tag in ["d", "d1", "dd0", "ddl1", "ddl2", "dd1", "dd2", "dd3", "dd4", "dd5", "dd6"]: is_derisk = True if order_tag in ["d1"]: is_derisk_1 = True grind_1_is_sell_found = True grind_2_is_sell_found = True grind_3_is_sell_found = True grind_4_is_sell_found = True grind_5_is_sell_found = True grind_6_is_sell_found = True rebuy_is_sell_found = True elif order_tag not in [ "p", "g1", "g2", "g3", "g4", "g5", "g6", "sg1", "sg2", "sg3", "sg4", "sg5", "sg6", "dl1", "dl2", "gd1", "gd2", "gd3", "gd4", "gd5", "gd6", "gm0", "gmd0", ]: rebuy_is_sell_found = True if not is_derisk: start_amount = filled_orders[0].safe_filled current_amount = 0.0 for order2 in filled_orders: if order2.ft_order_side == "buy": current_amount += order2.safe_filled elif order2.ft_order_side == "sell": current_amount -= order2.safe_filled if order2 is order: if current_amount < (start_amount * 0.95): is_derisk = True # found sells for all modes if ( rebuy_is_sell_found and grind_1_is_sell_found and grind_2_is_sell_found and grind_3_is_sell_found and grind_4_is_sell_found and grind_5_is_sell_found and grind_6_is_sell_found ): break # The trade already de-risked if is_derisk: return None, "", is_derisk if not has_order_tags and len(filled_exits) > 0: return None, "", is_derisk if rebuy_sub_grind_count > 0: rebuy_current_open_rate = rebuy_total_cost / rebuy_total_amount rebuy_current_grind_stake = rebuy_total_amount * exit_rate * (1 - trade.fee_close) rebuy_current_grind_stake_profit = rebuy_current_grind_stake - rebuy_total_cost if grind_1_sub_grind_count > 0: grind_1_current_open_rate = grind_1_total_cost / grind_1_total_amount grind_1_current_grind_stake = grind_1_total_amount * exit_rate * (1 - trade.fee_close) grind_1_current_grind_stake_profit = grind_1_current_grind_stake - grind_1_total_cost if grind_2_sub_grind_count > 0: grind_2_current_open_rate = grind_2_total_cost / grind_2_total_amount grind_2_current_grind_stake = grind_2_total_amount * exit_rate * (1 - trade.fee_close) grind_2_current_grind_stake_profit = grind_2_current_grind_stake - grind_2_total_cost if grind_3_sub_grind_count > 0: grind_3_current_open_rate = grind_3_total_cost / grind_3_total_amount grind_3_current_grind_stake = grind_3_total_amount * exit_rate * (1 - trade.fee_close) grind_3_current_grind_stake_profit = grind_3_current_grind_stake - grind_3_total_cost if grind_4_sub_grind_count > 0: grind_4_current_open_rate = grind_4_total_cost / grind_4_total_amount grind_4_current_grind_stake = grind_4_total_amount * exit_rate * (1 - trade.fee_close) grind_4_current_grind_stake_profit = grind_4_current_grind_stake - grind_4_total_cost if grind_5_sub_grind_count > 0: grind_5_current_open_rate = grind_5_total_cost / grind_5_total_amount grind_5_current_grind_stake = grind_5_total_amount * exit_rate * (1 - trade.fee_close) grind_5_current_grind_stake_profit = grind_5_current_grind_stake - grind_5_total_cost if grind_6_sub_grind_count > 0: grind_6_current_open_rate = grind_6_total_cost / grind_6_total_amount grind_6_current_grind_stake = grind_6_total_amount * exit_rate * (1 - trade.fee_close) grind_6_current_grind_stake_profit = grind_6_current_grind_stake - grind_6_total_cost num_open_grinds = ( grind_1_sub_grind_count + grind_2_sub_grind_count + grind_3_sub_grind_count + grind_4_sub_grind_count + grind_5_sub_grind_count + grind_6_sub_grind_count ) fee_open_rate = trade.fee_open if self.custom_fee_open_rate is None else self.custom_fee_open_rate fee_close_rate = trade.fee_close if self.custom_fee_close_rate is None else self.custom_fee_close_rate # Sell remaining if partial fill on exit if partial_sell: order = filled_exits[-1] sell_amount = order.safe_remaining * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Exit (remaining) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {order.safe_remaining} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) order_tag = "p" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag return -ft_sell_amount, order_tag, is_derisk is_long_grind_buy = self.long_grind_buy(last_candle, previous_candle, slice_profit) # Rebuy if (not partial_sell) and (not rebuy_is_sell_found) and (rebuy_sub_grind_count < max_rebuy_sub_grinds): if ( (0 <= rebuy_sub_grind_count < max_rebuy_sub_grinds) and (slice_profit_entry < regular_mode_rebuy_sub_thresholds[rebuy_sub_grind_count]) and ( (rebuy_distance_ratio if (rebuy_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_rebuy_sub_thresholds[rebuy_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=12) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( (last_candle["close"] > (last_candle["close_max_12"] * 0.94)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.92)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.90)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.88)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.86)) and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.84)) and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.82)) and (last_candle["btc_pct_close_max_72_5m"] < 0.03) and (last_candle["btc_pct_close_max_24_5m"] < 0.03) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 30.0) and (last_candle["rsi_3_15m"] > 30.0) and (last_candle["rsi_3_1h"] > 30.0) and (last_candle["rsi_3_4h"] > 30.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) and (last_candle["zlma_50_dec_1h"] == False) and (last_candle["zlma_50_dec_4h"] == False) ) ) ): buy_amount = ( slice_amount * regular_mode_rebuy_stakes[rebuy_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount > max_stake: buy_amount = max_stake if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk self.dp.send_msg( f"Rebuy (r) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"Rebuy (r) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) order_tag = "r" return buy_amount, order_tag, is_derisk # Grinding g1 # Grinding entry if has_order_tags and (not partial_sell) and (grind_1_sub_grind_count < max_grind_1_sub_grinds): if ( ( (grind_1_distance_ratio if (grind_1_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_1_sub_thresholds[grind_1_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) # and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.76)) # and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.70)) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 16.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 20.0) and (last_candle["rsi_3_4h"] > 20.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.986)) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) # and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g1" return buy_amount, order_tag, is_derisk if ( self.is_futures_mode and has_order_tags and (not partial_sell) and slice_profit < (-0.65 / trade.leverage) and (grind_1_sub_grind_count < max_grind_1_sub_grinds) ): buy_amount = ( slice_amount * regular_mode_grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g1" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_1_sub_grind_count > 0: grind_profit = (exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate if grind_profit > (regular_mode_grind_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g1" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grind stop if ( ( (grind_1_sub_grind_count > 0) and self.regular_mode_use_grind_stops and (((exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate) < regular_mode_grind_1_stop_grinds) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) ): sell_amount = grind_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_1_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate) if grind_1_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (sg1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (sg1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "sg1" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g2 # Grinding entry if has_order_tags and (not partial_sell) and (grind_2_sub_grind_count < max_grind_2_sub_grinds): if ( ( (grind_2_distance_ratio if (grind_2_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_2_sub_thresholds[grind_2_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) # and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.76)) # and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.70)) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 16.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 20.0) and (last_candle["rsi_3_4h"] > 20.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_15m"] == False) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.986)) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) # and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_2_stakes[grind_2_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_2_sub_grind_count > 0: grind_profit = (exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate grind_profit_stake = grind_2_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g2) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g2) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g2" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_2_sub_grind_count > 0: grind_profit = (exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate if grind_profit > (regular_mode_grind_2_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_2_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g2" for grind_entry_id in grind_2_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grind stop if ( ( (grind_2_sub_grind_count > 0) and self.regular_mode_use_grind_stops and (((exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate) < regular_mode_grind_2_stop_grinds) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) ): sell_amount = grind_2_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_2_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate) if grind_2_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (sg2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (sg2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "sg2" for grind_entry_id in grind_2_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g3 # Grinding entry if has_order_tags and (not partial_sell) and (grind_3_sub_grind_count < max_grind_3_sub_grinds): if ( ( (grind_3_distance_ratio if (grind_3_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_3_sub_thresholds[grind_3_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) # and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.76)) # and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.70)) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.986)) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) # and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (num_open_grinds == 0) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14_15m"] < 40.0) and (previous_candle["chandelier_dir"] < -0) and (last_candle["chandelier_dir"] > 0) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_3_stakes[grind_3_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_3_sub_grind_count > 0: grind_profit = (exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate grind_profit_stake = grind_3_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g3) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g3) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g3" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_3_sub_grind_count > 0: grind_profit = (exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate if grind_profit > (regular_mode_grind_3_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_3_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g3) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g3) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g3" for grind_entry_id in grind_3_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grind stop if ( ( (grind_3_sub_grind_count > 0) and self.regular_mode_use_grind_stops and (((exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate) < regular_mode_grind_3_stop_grinds) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) ): sell_amount = grind_3_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_3_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate) if grind_3_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (sg3) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (sg3) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "sg3" for grind_entry_id in grind_3_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g4 # Grinding entry if has_order_tags and (not partial_sell) and (grind_4_sub_grind_count < max_grind_4_sub_grinds): if ( ( (grind_4_distance_ratio if (grind_4_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_4_sub_thresholds[grind_4_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) # and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.76)) # and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.70)) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.986)) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) # and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_4_stakes[grind_4_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_4_sub_grind_count > 0: grind_profit = (exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate grind_profit_stake = grind_4_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g4) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g4) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g4" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_4_sub_grind_count > 0: grind_profit = (exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate if grind_profit > (regular_mode_grind_4_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_4_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g4) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g4) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g4" for grind_entry_id in grind_4_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grind stop if ( ( (grind_4_sub_grind_count > 0) and self.regular_mode_use_grind_stops and (((exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate) < regular_mode_grind_4_stop_grinds) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) ): sell_amount = grind_4_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_4_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate) if grind_4_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (sg4) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (sg4) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "sg4" for grind_entry_id in grind_4_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g5 # Grinding entry if has_order_tags and (not partial_sell) and (grind_5_sub_grind_count < max_grind_5_sub_grinds): if ( ( (grind_5_distance_ratio if (grind_5_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_5_sub_thresholds[grind_5_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) and ( (last_candle["protections_long_rebuy"] == True) and (last_candle["protections_long_global"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) # and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.76)) # and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.70)) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.986)) ) ) ) or ( (slice_profit < -0.06) and (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) # and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_5_stakes[grind_5_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_5_sub_grind_count > 0: grind_profit = (exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate grind_profit_stake = grind_5_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g5) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g5) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g5" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_5_sub_grind_count > 0: grind_profit = (exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate if grind_profit > (regular_mode_grind_5_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_5_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g5) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g5) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g5" for grind_entry_id in grind_5_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grind stop if ( ( (grind_5_sub_grind_count > 0) and self.regular_mode_use_grind_stops and (((exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate) < regular_mode_grind_5_stop_grinds) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) ): sell_amount = grind_5_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_5_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate) if grind_5_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (sg5) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (sg5) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "sg5" for grind_entry_id in grind_5_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g6 # Grinding entry if has_order_tags and (not partial_sell) and (grind_6_sub_grind_count < max_grind_6_sub_grinds): if ( ( (grind_6_distance_ratio if (grind_6_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_6_sub_thresholds[grind_6_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit < -0.06) ) # and ((num_open_grinds == 0) or (slice_profit < -0.03)) # and ( # (last_candle["protections_long_rebuy"] == True) # and (last_candle["protections_long_global"] == True) # and (last_candle["global_protections_long_pump"] == True) # and (last_candle["global_protections_long_dump"] == True) # ) and ( ( ( (last_candle["close"] > (last_candle["close_max_12"] * 0.84)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.80)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.76)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.74)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.70)) # and (last_candle["close"] > (last_candle["high_max_6_1d"] * 0.76)) # and (last_candle["close"] > (last_candle["high_max_12_1d"] * 0.70)) ) and ( is_long_grind_buy or ( (last_candle["rsi_3"] > 12.0) and (last_candle["rsi_3_15m"] > 16.0) and (last_candle["rsi_3_1h"] > 16.0) and (last_candle["rsi_3_4h"] > 16.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) or ( (last_candle["rsi_14"] < 36.0) and (previous_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["close"] < (last_candle["sma_16"] * 0.986)) ) ) ) or ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) # and (last_candle["rsi_3_1h"] > 16.0) # and (last_candle["rsi_3_4h"] > 16.0) # and (last_candle["rsi_14"] > 28.0) and (last_candle["rsi_14"] < 36.0) # and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) and (last_candle["close"] < last_candle["bb20_2_mid"]) and (previous_candle["close"] < previous_candle["bb20_2_mid"]) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_6_stakes[grind_6_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_6_sub_grind_count > 0: grind_profit = (exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate grind_profit_stake = grind_6_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g6) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g6) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g6" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_6_sub_grind_count > 0: grind_profit = (exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate if grind_profit > (regular_mode_grind_6_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_6_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g6) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g6) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g6" for grind_entry_id in grind_6_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grind stop if ( ( (grind_6_sub_grind_count > 0) and self.regular_mode_use_grind_stops and (((exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate) < regular_mode_grind_6_stop_grinds) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) ): sell_amount = grind_6_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_6_current_open_rate > 0.0: grind_profit = ( ((exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate) if grind_6_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (sg6) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (sg6) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "sg6" for grind_entry_id in grind_6_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # De-risk if profit_stake < ( slice_amount * ( (self.regular_mode_derisk_futures if self.is_futures_mode else self.regular_mode_derisk_spot) if (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 3, 19) or is_backtest) else (self.regular_mode_derisk_futures_old if self.is_futures_mode else self.regular_mode_derisk_spot_old) ) / (trade.leverage if self.is_futures_mode else 1.0) ): sell_amount = trade.amount * exit_rate / trade.leverage - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d", is_derisk # De-risk level 1 if ( has_order_tags and not is_derisk_1 and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 5) or is_backtest) and profit_stake < ( slice_amount * ( (self.regular_mode_derisk_1_futures if self.is_futures_mode else self.regular_mode_derisk_1_spot) if (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 16) or is_backtest) else ( self.regular_mode_derisk_1_futures_old if self.is_futures_mode else self.regular_mode_derisk_1_spot_old ) ) / (trade.leverage if self.is_futures_mode else 1.0) ) ): sell_amount = trade.amount * exit_rate / trade.leverage - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk (d1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk (d1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d1", is_derisk return None, "", is_derisk # Long Rebuy Adjust Trade Position # --------------------------------------------------------------------------------------------- def long_rebuy_adjust_trade_position( self, trade: Trade, enter_tags, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, **kwargs, ) -> Optional[float]: min_stake = self.correct_min_stake(min_stake) # min/max stakes include leverage. The return amounts is before leverage. min_stake /= trade.leverage max_stake /= trade.leverage df, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe) if len(df) < 2: return None last_candle = df.iloc[-1].squeeze() previous_candle = df.iloc[-2].squeeze() filled_orders = trade.select_filled_orders() filled_entries = trade.select_filled_orders(trade.entry_side) filled_exits = trade.select_filled_orders(trade.exit_side) count_of_entries = trade.nr_of_successful_entries count_of_exits = trade.nr_of_successful_exits if count_of_entries == 0: return None has_order_tags = False if hasattr(filled_orders[0], "ft_order_tag"): has_order_tags = True # The first exit is de-risk (providing the trade is still open) if count_of_exits > 0: return self.long_grind_adjust_trade_position( trade, enter_tags, current_time, current_rate, current_profit, min_stake, max_stake, current_entry_rate, current_exit_rate, current_entry_profit, current_exit_profit, ) exit_rate = current_rate if self.dp.runmode.value in ("live", "dry_run"): ticker = self.dp.ticker(trade.pair) if ("bid" in ticker) and ("ask" in ticker): if trade.is_short: if self.config["exit_pricing"]["price_side"] in ["ask", "other"]: if ticker["ask"] is not None: exit_rate = ticker["ask"] else: if self.config["exit_pricing"]["price_side"] in ["bid", "other"]: if ticker["bid"] is not None: exit_rate = ticker["bid"] profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio = self.calc_total_profit( trade, filled_entries, filled_exits, exit_rate ) slice_amount = filled_entries[0].cost slice_profit = (exit_rate - filled_orders[-1].safe_price) / filled_orders[-1].safe_price slice_profit_entry = (exit_rate - filled_entries[-1].safe_price) / filled_entries[-1].safe_price slice_profit_exit = ( ((exit_rate - filled_exits[-1].safe_price) / filled_exits[-1].safe_price) if count_of_exits > 0 else 0.0 ) current_stake_amount = trade.amount * current_rate is_rebuy = False rebuy_mode_stakes = self.rebuy_mode_stakes_futures if self.is_futures_mode else self.rebuy_mode_stakes_spot max_sub_grinds = len(rebuy_mode_stakes) rebuy_mode_sub_thresholds = ( self.rebuy_mode_thresholds_futures if self.is_futures_mode else self.rebuy_mode_thresholds_spot ) partial_sell = False sub_grind_count = 0 total_amount = 0.0 total_cost = 0.0 current_open_rate = 0.0 current_grind_stake = 0.0 current_grind_stake_profit = 0.0 for order in reversed(filled_orders): if (order.ft_order_side == "buy") and (order is not filled_orders[0]): sub_grind_count += 1 total_amount += order.safe_filled total_cost += order.safe_filled * order.safe_price elif order.ft_order_side == "sell": if (order.safe_remaining * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) > min_stake: partial_sell = True break if sub_grind_count > 0: current_open_rate = total_cost / total_amount current_grind_stake = total_amount * exit_rate * (1 - trade.fee_close) current_grind_stake_profit = current_grind_stake - total_cost if (not partial_sell) and (sub_grind_count < max_sub_grinds): if ( ((0 <= sub_grind_count < max_sub_grinds) and (slice_profit_entry < rebuy_mode_sub_thresholds[sub_grind_count])) and (last_candle["protections_long_global"] == True) and (last_candle["protections_long_rebuy"] == True) and (last_candle["global_protections_long_pump"] == True) and (last_candle["global_protections_long_dump"] == True) and ( (last_candle["close"] > (last_candle["close_max_12"] * 0.94)) and (last_candle["close"] > (last_candle["close_max_24"] * 0.92)) and (last_candle["close"] > (last_candle["close_max_48"] * 0.90)) and (last_candle["close"] > (last_candle["high_max_24_1h"] * 0.88)) and (last_candle["close"] > (last_candle["high_max_48_1h"] * 0.86)) and (last_candle["btc_pct_close_max_72_5m"] < 0.03) and (last_candle["btc_pct_close_max_24_5m"] < 0.03) ) and ( (last_candle["rsi_3"] > 10.0) and (last_candle["rsi_3_15m"] > 10.0) and (last_candle["rsi_3_1h"] > 10.0) and (last_candle["rsi_3_4h"] > 10.0) and (last_candle["rsi_14"] < 36.0) and (last_candle["close"] < (last_candle["ema_26"] * 0.988)) ) ): buy_amount = ( slice_amount * rebuy_mode_stakes[sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount > max_stake: buy_amount = max_stake if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 self.dp.send_msg( f"Rebuy (r) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"Rebuy (r) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) if has_order_tags: return buy_amount, "r" else: return buy_amount if profit_stake < ( slice_amount * (self.rebuy_mode_derisk_futures if self.is_futures_mode else self.rebuy_mode_derisk_spot) / (trade.leverage if self.is_futures_mode else 1.0) ): sell_amount = trade.amount * exit_rate / trade.leverage - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"Rebuy de-risk (d1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"Rebuy de-risk (d1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) if has_order_tags: return -ft_sell_amount, "d1" else: return -ft_sell_amount return None ############################################################################################### # LONG EXIT FUNCTIONS ENDS HERE ############################################################################################### # ______ __ __ ______ _______ ________ ______ ______ _______ ________ # / \ | \ | \ / \ | \| \ / \ | \| \ | \ # | $$$$$$\| $$ | $$| $$$$$$\| $$$$$$$\\$$$$$$$$ | $$$$$$\ \$$$$$$| $$$$$$$\| $$$$$$$$ # | $$___\$$| $$__| $$| $$ | $$| $$__| $$ | $$ | $$___\$$ | $$ | $$ | $$| $$__ # \$$ \ | $$ $$| $$ | $$| $$ $$ | $$ \$$ \ | $$ | $$ | $$| $$ \ # _\$$$$$$\| $$$$$$$$| $$ | $$| $$$$$$$\ | $$ _\$$$$$$\ | $$ | $$ | $$| $$$$$ # | \__| $$| $$ | $$| $$__/ $$| $$ | $$ | $$ | \__| $$ _| $$_ | $$__/ $$| $$_____ # \$$ $$| $$ | $$ \$$ $$| $$ | $$ | $$ \$$ $$| $$ \| $$ $$| $$ \ # \$$$$$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$ \$$$$$$ \$$$$$$ \$$$$$$$ \$$$$$$$$ # # Short Side Functions for handling short orders # --------------------------------------------------------------------------------------------- # ______ __ __ ______ _______ ________ ________ __ __ ______ ________ # / \| \ | \/ \| | \ | | \ | | | \ # | $$$$$$| $$ | $| $$$$$$| $$$$$$$\$$$$$$$$ | $$$$$$$| $$ | $$\$$$$$$\$$$$$$$$ # | $$___\$| $$__| $| $$ | $| $$__| $$ | $$ | $$__ \$$\/ $$ | $$ | $$ # \$$ \| $$ $| $$ | $| $$ $$ | $$ | $$ \ >$$ $$ | $$ | $$ # _\$$$$$$| $$$$$$$| $$ | $| $$$$$$$\ | $$ | $$$$$ / $$$$\ | $$ | $$ # | \__| $| $$ | $| $$__/ $| $$ | $$ | $$ | $$_____| $$ \$$\_| $$_ | $$ # \$$ $| $$ | $$\$$ $| $$ | $$ | $$ | $$ | $$ | $| $$ \ | $$ # \$$$$$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$ \$$$$$$$$\$$ \$$\$$$$$$ \$$ # ############################################################################################### # SHORT EXIT FUNCTIONS STARTS HERE ############################################################################################### # Short Exit Normal # --------------------------------------------------------------------------------------------- def short_exit_normal( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.short_exit_signals( self.short_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.short_exit_main( self.short_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.short_exit_williams_r( self.short_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.short_exit_dec( self.short_normal_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.short_exit_stoploss( self.short_normal_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.short_normal_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.short_normal_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.short_normal_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.short_normal_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.short_normal_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.short_normal_mode_name}_stoploss_doom", f"exit_{self.short_normal_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.short_normal_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.short_normal_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[0]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.short_normal_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.short_normal_mode_name}_max", f"exit_{self.short_normal_mode_name}_stoploss_doom", f"exit_{self.short_normal_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Short Exit Pump # --------------------------------------------------------------------------------------------- def short_exit_pump( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.short_exit_signals( self.short_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.short_exit_main( self.short_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.short_exit_williams_r( self.short_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.short_exit_dec( self.short_pump_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.short_exit_stoploss( self.short_pump_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.short_pump_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.short_pump_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.short_pump_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.short_pump_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.short_pump_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.short_pump_mode_name}_stoploss_doom", f"exit_{self.short_pump_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.short_pump_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.short_pump_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[2]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.short_pump_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.short_pump_mode_name}_max", f"exit_{self.short_pump_mode_name}_stoploss_doom", f"exit_{self.short_pump_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Short Exit Quick # --------------------------------------------------------------------------------------------- def short_exit_quick( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.short_exit_signals( self.short_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.short_exit_main( self.short_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.short_exit_williams_r( self.short_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.short_exit_dec( self.short_quick_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.short_exit_stoploss( self.short_quick_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Extra sell logic if not sell: if (0.09 >= profit_init_ratio > 0.02) and (last_candle["rsi_14"] < 22.0): sell, signal_name = True, f"exit_{self.short_quick_mode_name}_q_1" if (0.09 >= profit_init_ratio > 0.02) and (last_candle["cti_20"] < -0.95): sell, signal_name = True, f"exit_{self.short_quick_mode_name}_q_2" if (0.09 >= profit_init_ratio > 0.02) and (last_candle["r_14"] <= -0.99): sell, signal_name = True, f"exit_{self.short_quick_mode_name}_q_3" # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.short_quick_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.short_quick_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.short_quick_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.short_quick_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.short_quick_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.short_quick_mode_name}_stoploss_doom", f"exit_{self.short_quick_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.short_quick_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.short_quick_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[4]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.short_quick_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.short_quick_mode_name}_max", f"exit_{self.short_quick_mode_name}_stoploss_doom", f"exit_{self.short_quick_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Short Exit Rebuy # --------------------------------------------------------------------------------------------- def short_exit_rebuy( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.short_exit_signals( self.short_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.short_exit_main( self.short_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.short_exit_williams_r( self.short_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.short_exit_dec( self.short_rebuy_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: if profit_stake < -( filled_entries[0].cost * (self.stop_threshold_futures_rebuy if self.is_futures_mode else self.stop_threshold_spot_rebuy) / (trade.leverage if self.is_futures_mode else 1.0) ): sell, signal_name = True, f"exit_{self.short_rebuy_mode_name}_stoploss_doom" # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.short_rebuy_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.short_rebuy_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.short_rebuy_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.short_rebuy_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.short_rebuy_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.short_rebuy_mode_name}_stoploss_doom", f"exit_{self.short_rebuy_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.short_rebuy_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.short_rebuy_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[6]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.short_rebuy_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [f"exit_profit_{self.short_rebuy_mode_name}_max"]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Short Exit High Profit # --------------------------------------------------------------------------------------------- def short_exit_high_profit( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.short_exit_signals( self.short_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.short_exit_main( self.short_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.short_exit_williams_r( self.short_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.short_exit_stoploss( self.short_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.short_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.short_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.short_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.short_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.short_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.short_mode_name}_stoploss_doom", f"exit_{self.short_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.short_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.short_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= self.profit_max_thresholds[8]: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.short_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [ f"exit_profit_{self.short_mode_name}_max", f"exit_{self.short_mode_name}_stoploss_doom", f"exit_{self.short_mode_name}_stoploss_u_e", ]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Short Exit Rapid # --------------------------------------------------------------------------------------------- def short_exit_rapid( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: sell = False # Original sell signals sell, signal_name = self.short_exit_signals( self.short_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Main sell signals if not sell: sell, signal_name = self.short_exit_main( self.short_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Williams %R based sells if not sell: sell, signal_name = self.short_exit_williams_r( self.short_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Downtrend/descending based sells if not sell: sell, signal_name = self.short_exit_dec( self.short_rapid_mode_name, profit_init_ratio, max_profit, max_loss, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Stoplosses if not sell: sell, signal_name = self.short_exit_stoploss( self.short_rapid_mode_name, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, max_profit, max_loss, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade, current_time, enter_tags, ) # Extra sell logic if not sell: if (0.09 >= profit_init_ratio > 0.01) and (last_candle["rsi_14"] < 22.0): sell, signal_name = True, f"exit_{self.short_rapid_mode_name}_rpd_1" if (0.09 >= profit_init_ratio > 0.01) and (last_candle["cti_20"] < -0.95): sell, signal_name = True, f"exit_{self.short_rapid_mode_name}_rpd_2" if (0.09 >= profit_init_ratio > 0.01) and (last_candle["r_14"] <= -0.99): sell, signal_name = True, f"exit_{self.short_rapid_mode_name}_rpd_3" # Stoplosses if profit_stake < -( filled_entries[0].cost * (self.stop_threshold_futures_rapid if self.is_futures_mode else self.stop_threshold_spot_rapid) / (trade.leverage if self.is_futures_mode else 1.0) ): sell, signal_name = True, f"exit_{self.short_rapid_mode_name}_stoploss_doom" # Profit Target Signal # Check if pair exist on target_profit_cache if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_rate = self.target_profit_cache.data[pair]["rate"] previous_profit = self.target_profit_cache.data[pair]["profit"] previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] previous_time_profit_reached = datetime.fromisoformat(self.target_profit_cache.data[pair]["time_profit_reached"]) sell_max, signal_name_max = self.exit_profit_target( self.short_rapid_mode_name, pair, trade, current_time, current_rate, profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio, last_candle, previous_candle_1, previous_rate, previous_profit, previous_sell_reason, previous_time_profit_reached, enter_tags, ) if sell_max and signal_name_max is not None: return True, f"{signal_name_max}_m" if previous_sell_reason in [f"exit_{self.short_rapid_mode_name}_stoploss_u_e"]: if profit_ratio > (previous_profit + 0.005): mark_pair, mark_signal = self.mark_profit_target( self.short_rapid_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) elif (profit_init_ratio > (previous_profit + 0.001)) and ( previous_sell_reason not in [f"exit_{self.short_rapid_mode_name}_stoploss_doom"] ): # Update the target, raise it. mark_pair, mark_signal = self.mark_profit_target( self.short_rapid_mode_name, pair, True, previous_sell_reason, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) # Add the pair to the list, if a sell triggered and conditions met if sell and signal_name is not None: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if signal_name in [ f"exit_{self.short_rapid_mode_name}_stoploss_doom", f"exit_{self.short_rapid_mode_name}_stoploss_u_e", ]: mark_pair, mark_signal = self.mark_profit_target( self.short_rapid_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" elif (previous_profit is None) or (previous_profit < profit_init_ratio): mark_pair, mark_signal = self.mark_profit_target( self.short_rapid_mode_name, pair, sell, signal_name, trade, current_time, current_rate, profit_init_ratio, last_candle, previous_candle_1, ) if mark_pair: self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) else: # Just sell it, without maximize return True, f"{signal_name}" else: if profit_init_ratio >= 0.01: previous_profit = None if self.target_profit_cache is not None and pair in self.target_profit_cache.data: previous_profit = self.target_profit_cache.data[pair]["profit"] if (previous_profit is None) or (previous_profit < profit_init_ratio): mark_signal = f"exit_profit_{self.short_rapid_mode_name}_max" self._set_profit_target(pair, mark_signal, current_rate, profit_init_ratio, current_time) if signal_name not in [f"exit_profit_{self.short_rapid_mode_name}_max"]: if sell and (signal_name is not None): return True, f"{signal_name}" return False, None # Short Exit Grind # --------------------------------------------------------------------------------------------- def short_exit_grind( self, pair: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", enter_tags, ) -> tuple: if len(filled_exits) > 30 and profit_init_ratio > 1.0: return True, f"exit_{self.short_grind_mode_name}_g" return False, None # Short Exit Signals # --------------------------------------------------------------------------------------------- def short_exit_signals( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: # Sell signal 1 if ( (last_candle["rsi_14"] < 30.0) and (last_candle["close"] < last_candle["bb20_2_low"]) and (previous_candle_1["close"] < previous_candle_1["bb20_2_low"]) and (previous_candle_2["close"] < previous_candle_2["bb20_2_low"]) and (previous_candle_3["close"] < previous_candle_3["bb20_2_low"]) and (previous_candle_4["close"] < previous_candle_4["bb20_2_low"]) ): if last_candle["close"] < last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_1_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_1_2_1" # Sell signal 2 elif ( (last_candle["rsi_14"] < 20.0) and (last_candle["close"] < last_candle["bb20_2_low"]) and (previous_candle_1["close"] < previous_candle_1["bb20_2_low"]) and (previous_candle_2["close"] < previous_candle_2["bb20_2_low"]) ): if last_candle["close"] < last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_2_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_2_2_1" # Sell signal 3 elif last_candle["rsi_14"] < 15.0: if last_candle["close"] < last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_3_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_3_2_1" # Sell signal 4 elif (last_candle["rsi_14"] < 20.0) and (last_candle["rsi_14_1h"] < 22.0): if last_candle["close"] < last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_4_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_4_2_1" # Sell signal 6 elif ( (last_candle["close"] > last_candle["ema_200"]) and (last_candle["close"] < last_candle["ema_50"]) and (last_candle["rsi_14"] < 21.0) ): if current_profit > 0.01: return True, f"exit_{mode_name}_6_1" # Sell signal 7 elif (last_candle["rsi_14_1h"] < 21.0) and (last_candle["crossed_above_ema_12_26"]): if last_candle["close"] < last_candle["ema_200"]: if current_profit > 0.01: return True, f"exit_{mode_name}_7_1_1" else: if current_profit > 0.01: return True, f"exit_{mode_name}_7_2_1" # # Sell signal 8 # elif last_candle["close"] < last_candle["bb20_2_low_1h"] * 1.08: # if last_candle["close"] < last_candle["ema_200"]: # if current_profit > 0.01: # return True, f"exit_{mode_name}_8_1_1" # else: # if current_profit > 0.01: # return True, f"exit_{mode_name}_8_2_1" return False, None # Short Exit Main # --------------------------------------------------------------------------------------------- def short_exit_main( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: if last_candle["close"] < last_candle["sma_200"]: if 0.01 > current_profit >= 0.001: if last_candle["rsi_14"] > 90.0: return True, f"exit_{mode_name}_o_0" elif 0.02 > current_profit >= 0.01: if last_candle["rsi_14"] > 72.0: return True, f"exit_{mode_name}_o_1" elif 0.03 > current_profit >= 0.02: if last_candle["rsi_14"] > 70.0: return True, f"exit_{mode_name}_o_2" elif 0.04 > current_profit >= 0.03: if last_candle["rsi_14"] > 68.0: return True, f"exit_{mode_name}_o_3" elif 0.05 > current_profit >= 0.04: if last_candle["rsi_14"] > 66.0: return True, f"exit_{mode_name}_o_4" elif 0.06 > current_profit >= 0.05: if last_candle["rsi_14"] > 64.0: return True, f"exit_{mode_name}_o_5" elif 0.07 > current_profit >= 0.06: if last_candle["rsi_14"] > 62.0: return True, f"exit_{mode_name}_o_6" elif 0.08 > current_profit >= 0.07: if last_candle["rsi_14"] > 60.0: return True, f"exit_{mode_name}_o_7" elif 0.09 > current_profit >= 0.08: if last_candle["rsi_14"] > 58.0: return True, f"exit_{mode_name}_o_8" elif 0.1 > current_profit >= 0.09: if last_candle["rsi_14"] > 56.0: return True, f"exit_{mode_name}_o_9" elif 0.12 > current_profit >= 0.1: if last_candle["rsi_14"] > 54.0: return True, f"exit_{mode_name}_o_10" elif 0.2 > current_profit >= 0.12: if last_candle["rsi_14"] > 56.0: return True, f"exit_{mode_name}_o_11" elif current_profit >= 0.2: if last_candle["rsi_14"] > 58.0: return True, f"exit_{mode_name}_o_12" elif last_candle["close"] > last_candle["sma_200"]: if 0.01 > current_profit >= 0.001: if last_candle["rsi_14"] > 88.0: return True, f"exit_{mode_name}_u_0" elif 0.02 > current_profit >= 0.01: if last_candle["rsi_14"] > 70.0: return True, f"exit_{mode_name}_u_1" elif 0.03 > current_profit >= 0.02: if last_candle["rsi_14"] > 68.0: return True, f"exit_{mode_name}_u_2" elif 0.04 > current_profit >= 0.03: if last_candle["rsi_14"] > 66.0: return True, f"exit_{mode_name}_u_3" elif 0.05 > current_profit >= 0.04: if last_candle["rsi_14"] > 64.0: return True, f"exit_{mode_name}_u_4" elif 0.06 > current_profit >= 0.05: if last_candle["rsi_14"] > 62.0: return True, f"exit_{mode_name}_u_5" elif 0.07 > current_profit >= 0.06: if last_candle["rsi_14"] > 60.0: return True, f"exit_{mode_name}_u_6" elif 0.08 > current_profit >= 0.07: if last_candle["rsi_14"] > 58.0: return True, f"exit_{mode_name}_u_7" elif 0.09 > current_profit >= 0.08: if last_candle["rsi_14"] > 56.0: return True, f"exit_{mode_name}_u_8" elif 0.1 > current_profit >= 0.09: if last_candle["rsi_14"] > 54.0: return True, f"exit_{mode_name}_u_9" elif 0.12 > current_profit >= 0.1: if last_candle["rsi_14"] > 52.0: return True, f"exit_{mode_name}_u_10" elif 0.2 > current_profit >= 0.12: if last_candle["rsi_14"] > 54.0: return True, f"exit_{mode_name}_u_11" elif current_profit >= 0.2: if last_candle["rsi_14"] > 56.0: return True, f"exit_{mode_name}_u_12" return False, None # Short Exit Based on Williams R # --------------------------------------------------------------------------------------------- def short_exit_williams_r( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: if 0.01 > current_profit >= 0.001: if (last_candle["r_480"] < -99.9) and (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0): return True, f"exit_{mode_name}_w_0_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 16.0): return True, f"exit_{mode_name}_w_0_2" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] > 60.0): return True, f"exit_{mode_name}_w_0_3" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 22.0) and (last_candle["r_480_1h"] < -80.0): return True, f"exit_{mode_name}_w_0_4" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0) and (last_candle["cti_20"] < -0.97): return True, f"exit_{mode_name}_w_0_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0) and (last_candle["r_480_1h"] < -95.0) and (last_candle["r_480_4h"] < -95.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_0_6" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_0_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_0_8" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 18.0) and (last_candle["rsi_14_15m"] <= 28.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_0_9" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_0_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 26.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_0_11" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_0_12" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_0_13" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_0_14" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_0_15" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_0_16" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_0_17" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_0_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_0_19" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_0_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_14_15m"] <= 25.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_0_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_14_15m"] <= 25.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_0_22" elif 0.02 > current_profit >= 0.01: if last_candle["r_480"] < -99.8: return True, f"exit_{mode_name}_w_1_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 22.0): return True, f"exit_{mode_name}_w_1_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 54.0): return True, f"exit_{mode_name}_w_1_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 26.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_1_4" elif (last_candle["r_14"] <= -98.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_1_5" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] < 30.0) and (last_candle["r_480_1h"] < -90.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_1_6" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_1_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_1_8" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_1_9" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_1_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_1_11" elif ( (last_candle["r_14"] <= -76.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_1_12" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_1_13" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_1_14" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_1_15" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_1_16" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_1_17" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_1_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_1_19" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_1_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_1_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_1_22" elif 0.03 > current_profit >= 0.02: if last_candle["r_480"] < -99.7: return True, f"exit_{mode_name}_w_2_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 23.0): return True, f"exit_{mode_name}_w_2_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 52.0): return True, f"exit_{mode_name}_w_2_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 27.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_2_4" elif (last_candle["r_14"] <= -97.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_2_5" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -80.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_2_6" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_2_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_2_8" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 32.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_2_9" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_2_10" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_2_11" elif ( (last_candle["r_14"] <= -76.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_2_12" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_2_13" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_2_14" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_2_15" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_2_16" elif ( (last_candle["r_14"] <= -82.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_2_17" elif ( (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_2_18" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_2_19" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_2_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_2_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_2_22" elif 0.04 > current_profit >= 0.03: if last_candle["r_480"] < -99.6: return True, f"exit_{mode_name}_w_3_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 24.0): return True, f"exit_{mode_name}_w_3_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 50.0): return True, f"exit_{mode_name}_w_3_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 28.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_3_4" elif (last_candle["r_14"] <= -96.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_3_5" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -80.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_3_6" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_3_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_3_8" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] <= 34.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_3_9" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_3_10" elif ( (last_candle["r_14"] <= -97.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_3_11" elif ( (last_candle["r_14"] <= -76.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_3_12" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_3_13" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_3_14" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_3_15" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_3_16" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_3_17" elif ( (last_candle["r_14"] <= -65.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_3_18" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_3_19" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_3_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_3_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_3_22" elif 0.05 > current_profit >= 0.04: if last_candle["r_480"] < -99.5: return True, f"exit_{mode_name}_w_4_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0): return True, f"exit_{mode_name}_w_4_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 48.0): return True, f"exit_{mode_name}_w_4_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 29.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_4_4" elif (last_candle["r_14"] <= -95.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_4_5" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -80.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_4_6" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_4_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_4_8" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 36.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_4_9" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_4_10" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_4_11" elif ( (last_candle["r_14"] <= -76.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_4_12" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_4_13" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_4_14" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_4_15" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_4_16" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_4_17" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_4_18" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_4_19" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_4_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_4_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_4_22" elif 0.06 > current_profit >= 0.05: if last_candle["r_480"] < -99.4: return True, f"exit_{mode_name}_w_5_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 26.0): return True, f"exit_{mode_name}_w_5_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 46.0): return True, f"exit_{mode_name}_w_5_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 30.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_5_4" elif (last_candle["r_14"] <= -94.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_5_5" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -80.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_5_6" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_5_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_5_8" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] <= 38.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_5_9" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_5_10" elif ( (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_5_11" elif ( (last_candle["r_14"] <= -76.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_5_12" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_5_13" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_5_14" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_5_15" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_5_16" elif ( (last_candle["r_14"] <= -76.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_5_17" elif ( (last_candle["r_14"] <= -55.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_5_18" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_5_19" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_5_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 38.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_5_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_5_22" elif 0.07 > current_profit >= 0.06: if last_candle["r_480"] < -99.3: return True, f"exit_{mode_name}_w_6_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0): return True, f"exit_{mode_name}_w_6_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 48.0): return True, f"exit_{mode_name}_w_6_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 29.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_6_4" elif (last_candle["r_14"] <= -95.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_6_5" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -80.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_6_6" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_6_7" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_6_8" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 36.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_6_9" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_6_10" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_6_11" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_6_12" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_6_13" elif ( (last_candle["r_14"] <= -82.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_6_14" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_6_15" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_6_16" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_6_17" elif ( (last_candle["r_14"] <= -65.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_6_18" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_6_19" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_6_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_6_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_6_22" elif 0.08 > current_profit >= 0.07: if last_candle["r_480"] < -99.5: return True, f"exit_{mode_name}_w_7_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 24.0): return True, f"exit_{mode_name}_w_7_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 50.0): return True, f"exit_{mode_name}_w_7_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 28.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_7_4" elif (last_candle["r_14"] <= -96.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_7_5" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -85.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_7_6" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_7_7" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_7_8" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] <= 34.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_7_9" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_7_10" elif ( (last_candle["r_14"] <= -97.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_7_11" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_7_12" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_7_13" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_7_14" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_7_15" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_7_16" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_7_17" elif ( (last_candle["r_14"] <= -75.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_7_18" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_7_19" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_7_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_7_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_7_22" elif 0.09 > current_profit >= 0.08: if last_candle["r_480"] < -99.6: return True, f"exit_{mode_name}_w_8_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 23.0): return True, f"exit_{mode_name}_w_8_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 52.0): return True, f"exit_{mode_name}_w_8_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 27.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_8_4" elif (last_candle["r_14"] <= -97.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_8_5" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -85.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_8_6" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_8_7" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_8_8" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 32.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_8_9" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_8_10" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_8_11" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_8_12" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_8_13" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_8_14" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_8_15" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_8_16" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_8_17" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_8_18" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_8_19" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_8_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_8_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_8_22" elif 0.1 > current_profit >= 0.09: if last_candle["r_480"] < -99.7: return True, f"exit_{mode_name}_w_9_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 22.0): return True, f"exit_{mode_name}_w_9_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 54.0): return True, f"exit_{mode_name}_w_9_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 26.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_9_4" elif (last_candle["r_14"] <= -98.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_9_5" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -85.0) and (last_candle["r_480_4h"] < -90.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_9_6" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] < 40.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_9_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_9_8" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_9_9" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_9_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_9_11" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_9_12" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_9_13" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_9_14" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_9_15" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_9_16" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_9_17" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_9_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_9_19" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_9_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_9_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_9_22" elif 0.12 > current_profit >= 0.1: if last_candle["r_480"] > -99.8: return True, f"exit_{mode_name}_w_10_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] > 79.0): return True, f"exit_{mode_name}_w_10_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] < 44.0): return True, f"exit_{mode_name}_w_10_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 25.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_10_4" elif (last_candle["r_14"] <= -99.0) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_10_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 35.0) and (last_candle["r_480_1h"] < -90.0) and (last_candle["r_480_4h"] < -95.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_10_6" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 35.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_10_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 25.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_10_8" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["rsi_14_15m"] <= 28.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_10_9" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_10_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] <= 28.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_10_11" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_10_12" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_10_13" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_10_14" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_10_15" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_10_16" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_10_17" elif ( (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_10_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_10_19" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_10_20" elif ( (last_candle["r_14"] >= -99.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_10_21" elif ( (last_candle["r_14"] >= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_10_22" elif 0.2 > current_profit >= 0.12: if last_candle["r_480"] < -99.6: return True, f"exit_{mode_name}_w_11_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 20.0): return True, f"exit_{mode_name}_w_11_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 58.0): return True, f"exit_{mode_name}_w_11_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 24.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_11_4" elif (last_candle["r_14"] <= -99.5) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_11_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 30.0) and (last_candle["r_480_1h"] < -90.0) and (last_candle["r_480_4h"] < -95.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_11_6" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 30.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_11_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_11_8" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["rsi_14_15m"] <= 26.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_11_9" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_11_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 26.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_11_11" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_11_12" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_11_13" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_11_14" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_11_15" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_11_16" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_11_17" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_11_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 35.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_11_19" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_11_20" elif ( (last_candle["r_14"] >= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_11_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 25.0) and (last_candle["rsi_14_15m"] <= 35.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_11_22" elif current_profit >= 0.2: if last_candle["r_480"] < -99.8: return True, f"exit_{mode_name}_w_12_1" elif (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 19.0): return True, f"exit_{mode_name}_w_12_2" elif (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] > 60.0): return True, f"exit_{mode_name}_w_12_3" elif (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] < 23.0) and (last_candle["r_480_1h"] < -75.0): return True, f"exit_{mode_name}_w_12_4" elif (last_candle["r_14"] <= -0.99) and (last_candle["cti_20"] < -0.95): return True, f"exit_{mode_name}_w_12_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0) and (last_candle["r_480_1h"] < -95.0) and (last_candle["r_480_4h"] < -95.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_1d"] < 40.0) and (last_candle["cti_20_1d"] < -0.80) ): return True, f"exit_{mode_name}_w_12_6" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] < 25.0) and (last_candle["r_480_1h"] < -75.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["rsi_14_1h"] < 50.0) and (last_candle["rsi_14_4h"] < 50.0) and (last_candle["rsi_14_1d"] < 50.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_12_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["rsi_14_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.02) ): return True, f"exit_{mode_name}_w_12_8" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_14_15m"] <= 24.0) and (last_candle["cti_20_4h"] >= 0.50) and (last_candle["cti_20_1d"] <= -0.70) ): return True, f"exit_{mode_name}_w_12_9" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_12_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["rsi_14_15m"] <= 24.0) and (last_candle["rsi_14_1h"] <= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["r_480_1h"] < -70.0) ): return True, f"exit_{mode_name}_w_12_11" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["change_pct_1d"] > 0.01) ): return True, f"exit_{mode_name}_w_12_12" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["rsi_14_4h"] <= 35.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.01) ): return True, f"exit_{mode_name}_w_12_13" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_1h"] <= 30.0) and (last_candle["rsi_14_4h"] <= 25.0) ): return True, f"exit_{mode_name}_w_12_14" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_4h"] <= 25.0) and (last_candle["r_480_4h"] < -85.0) and (last_candle["change_pct_1h"] > 0.00) ): return True, f"exit_{mode_name}_w_12_15" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["bot_wick_pct_1d"] > 0.16) and (last_candle["close"] > (last_candle["low_min_24_1h"] * 1.20)) and (last_candle["hl_pct_change_6_1d"] > 0.75) ): return True, f"exit_{mode_name}_w_12_16" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["r_480_1h"] < -70.0) and (last_candle["r_480_4h"] < -75.0) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["bot_wick_pct_1d"] > 0.08) ): return True, f"exit_{mode_name}_w_12_17" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.90) ): return True, f"exit_{mode_name}_w_12_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 20.0) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["hl_pct_change_48_1h"] > 0.50) ): return True, f"exit_{mode_name}_w_12_19" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 30.0) and (last_candle["r_480_4h"] < -70.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_12_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_14_15m"] <= 25.0) and (last_candle["cti_20_dec_3_1h"] == False) and (last_candle["r_480_4h"] > -50.0) ): return True, f"exit_{mode_name}_w_12_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["rsi_14_15m"] <= 25.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_w_12_22" return False, None # Short Exit Dec # --------------------------------------------------------------------------------------------- def short_exit_dec( self, mode_name: str, current_profit: float, max_profit: float, max_loss: float, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: if 0.01 > current_profit >= 0.001: if ( (last_candle["r_14"] < -99.0) and (last_candle["rsi_14"] < 30.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_0_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_0_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_0_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_0_4" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_0_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 5.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_0_6" elif ( (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_0_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_0_8" elif ( (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_0_9" elif ( (last_candle["rsi_14"] >= 80.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_0_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_0_11" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_0_12" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_0_13" elif ( (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_0_14" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_0_15" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_0_16" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_0_17" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_0_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_0_19" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_0_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_0_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_0_22" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_0_23" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 5.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] <= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_0_24" elif ( (last_candle["r_14"] >= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_0_25" elif 0.02 > current_profit >= 0.01: if ( (last_candle["r_14"] < -90.0) and (last_candle["rsi_14"] < 34.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_1_1" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_1_2" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_1_3" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_1_4" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_1_5" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_1_6" elif ( (last_candle["rsi_3"] <= 40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_1_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_1_8" elif ( (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_1_9" elif ( (last_candle["rsi_14"] >= 54.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_1_10" elif ( (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_1_11" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_1_12" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_1_13" elif ( (last_candle["rsi_14"] >= 54.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_1_14" elif ( (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_1_15" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_1_16" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_1_17" elif ( (last_candle["r_14"] <= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_1_18" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_1_19" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_1_20" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_1_21" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_1_22" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_1_23" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_1_24" elif ( (last_candle["r_14"] <= -75.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_1_25" elif 0.03 > current_profit >= 0.02: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 44.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_2_1" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_2_2" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_2_3" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_2_4" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_2_5" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_2_6" elif ( (last_candle["rsi_3"] <= 40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_2_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_2_8" elif ( (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_2_9" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_2_10" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_2_11" elif ( (last_candle["r_14"] <= -91.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_2_12" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_2_13" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_2_14" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_2_15" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_2_16" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_2_17" elif ( (last_candle["r_14"] <= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_2_18" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_2_19" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_2_20" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_2_21" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_2_22" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_2_23" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == False) ): return True, f"exit_{mode_name}_d_2_24" elif ( (last_candle["r_14"] <= -75.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_2_25" elif 0.04 > current_profit >= 0.03: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 46.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_3_1" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_3_2" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_3_3" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_3_4" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_3_5" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_3_6" elif ( (last_candle["rsi_3"] <= 40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_3_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_3_8" elif ( (last_candle["rsi_14"] >= 58.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_3_9" elif ( (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_3_10" elif ( (last_candle["r_14"] <= -93.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_3_11" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_3_12" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_3_13" elif ( (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_3_14" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_3_15" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_3_16" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_3_17" elif ( (last_candle["r_14"] <= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_3_18" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_3_19" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_3_20" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_3_21" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_3_22" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_3_23" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 20.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_3_24" elif ( (last_candle["r_14"] <= -75.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_3_25" elif 0.05 > current_profit >= 0.04: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 48.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_4_1" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_4_2" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_4_3" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_4_4" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_4_5" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_4_6" elif ( (last_candle["rsi_3"] <= 40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_4_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 38.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_4_8" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_4_9" elif ( (last_candle["rsi_14"] >= 48.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_4_10" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_4_11" elif ( (last_candle["r_14"] >= -11.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_4_12" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_4_13" elif ( (last_candle["rsi_14"] >= 48.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_4_14" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_4_15" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_4_16" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_4_17" elif ( (last_candle["r_14"] <= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_4_18" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_4_19" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_4_20" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_4_21" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_4_22" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_4_23" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_4_24" elif ( (last_candle["r_14"] <= -75.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_4_25" elif 0.06 > current_profit >= 0.05: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_5_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_5_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_5_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_5_4" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_5_5" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_5_6" elif ( (last_candle["rsi_3"] <= 40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_5_7" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_5_8" elif ( (last_candle["rsi_14"] >= 54.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_5_9" elif ( (last_candle["rsi_14"] >= 46.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_5_10" elif ( (last_candle["r_14"] <= -91.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_5_11" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_5_12" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_5_13" elif ( (last_candle["rsi_14"] >= 46.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_5_14" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_5_15" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_5_16" elif ( (last_candle["r_14"] <= -76.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_5_17" elif ( (last_candle["r_14"] <= -40.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_5_18" elif ( (last_candle["r_14"] <= -60.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_5_19" elif ( (last_candle["r_14"] <= -70.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_5_20" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_5_21" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_5_22" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_5_23" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_5_24" elif ( (last_candle["r_14"] <= -75.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_5_25" elif 0.07 > current_profit >= 0.06: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_6_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_6_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_6_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_6_4" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_3"] <= 6.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_6_5" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_6_6" elif ( (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_6_7" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 38.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_6_8" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_6_9" elif ( (last_candle["rsi_14"] >= 48.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_6_10" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_6_11" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_6_12" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_6_13" elif ( (last_candle["rsi_14"] >= 48.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_6_14" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_6_15" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_6_16" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_6_17" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_6_18" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_6_19" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_6_20" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_6_21" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_6_22" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_6_23" elif ( (last_candle["r_14"] <= -84.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_6_24" elif ( (last_candle["r_14"] <= -80.0) and (last_candle["rsi_14"] <= 38.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 26.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_6_25" elif 0.08 > current_profit >= 0.07: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_7_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_7_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_7_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_7_4" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_3"] <= 4.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_7_5" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_7_6" elif ( (last_candle["rsi_3"] <= 5.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_7_7" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_7_8" elif ( (last_candle["rsi_14"] <= 42.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_7_9" elif ( (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_7_10" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_7_11" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_7_12" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_7_13" elif ( (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_7_14" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_7_15" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_7_16" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_14"] <= 38.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_7_17" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_7_18" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_7_19" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_7_20" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_7_21" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_7_22" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_7_23" elif ( (last_candle["r_14"] <= -86.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_7_24" elif ( (last_candle["r_14"] <= -85.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_7_25" elif 0.09 > current_profit >= 0.08: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_8_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_8_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_8_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_8_4" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_8_5" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_3"] <= 5.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_8_6" elif ( (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_8_7" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_8_8" elif ( (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_8_9" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_8_10" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_8_11" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_8_12" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_8_13" elif ( (last_candle["rsi_14"] <= 48.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_8_14" elif ( (last_candle["r_14"] <= -95.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_8_15" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_8_16" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_8_17" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_8_18" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_8_19" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_8_20" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_8_21" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_8_22" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_8_23" elif ( (last_candle["r_14"] <= -88.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_8_24" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_8_25" elif 0.1 > current_profit >= 0.09: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 48.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_9_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_9_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_9_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_9_4" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_9_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.70) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_9_6" elif ( (last_candle["rsi_3"] >= 99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_9_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_9_8" elif ( (last_candle["rsi_14"] <= 38.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_9_9" elif ( (last_candle["rsi_14"] >= 54.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_9_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 36.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_9_11" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_9_12" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_9_13" elif ( (last_candle["rsi_14"] >= 54.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_9_14" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_9_15" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_9_16" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 34.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_9_17" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_9_18" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_9_19" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_9_20" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_9_21" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_9_22" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_9_23" elif ( (last_candle["r_14"] <= -90.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_9_24" elif ( (last_candle["r_14"] <= -92.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_9_25" elif 0.12 > current_profit >= 0.1: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 46.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_10_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_10_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_10_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_10_4" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_10_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_10_6" elif ( (last_candle["rsi_3"] >= 99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_10_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_10_8" elif ( (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_10_9" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_10_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_10_11" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_10_12" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_10_13" elif ( (last_candle["rsi_14"] <= 44.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_10_14" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_10_15" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_10_16" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 32.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_10_17" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_10_18" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_10_19" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_10_20" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_10_21" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_10_22" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_10_23" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_10_24" elif ( (last_candle["r_14"] <= -94.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_10_25" elif 0.2 > current_profit >= 0.12: if ( (last_candle["r_14"] < -84.0) and (last_candle["rsi_14"] < 44.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_11_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_11_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_11_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_11_4" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_11_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_11_6" elif ( (last_candle["rsi_3"] <= 1.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_11_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_11_8" elif ( (last_candle["rsi_14"] >= 66.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_11_9" elif ( (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_11_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_11_11" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_11_12" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_11_13" elif ( (last_candle["rsi_14"] <= 42.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_11_14" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_11_15" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_11_16" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_11_17" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_11_18" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_11_19" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_11_20" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_11_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_11_22" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_11_23" elif ( (last_candle["r_14"] <= -96.0) and (last_candle["rsi_3"] <= 20.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_11_24" elif ( (last_candle["r_14"] <= -98.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_11_25" elif current_profit >= 0.2: if ( (last_candle["r_14"] < -90.0) and (last_candle["rsi_14"] < 34.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_12_1" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["ema_200_dec_4_1d"] == False) and (last_candle["change_pct_4h"] > 0.03) ): return True, f"exit_{mode_name}_d_12_2" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_14_4h"] <= 50.0) and (last_candle["cti_20_1d"] <= -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_4h"] >= 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_12_3" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 10.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] > -25.0) and (last_candle["cti_20_1d"] < -0.50) and (last_candle["rsi_14_1d"] <= 30.0) and (last_candle["change_pct_1h"] > 0.03) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_12_4" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["change_pct_1d"] > 0.02) and (last_candle["change_pct_4h"] > 0.02) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_12_5" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 2.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.80) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_12_6" elif ( (last_candle["rsi_3"] >= 99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_4h"] <= -0.50) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_24"] == False) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_12_7" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["r_480_4h"] > -10.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_12_8" elif ( (last_candle["rsi_14"] >= 70.0) and (last_candle["rsi_3_1h"] >= 90.0) and (last_candle["rsi_3_4h"] >= 94.0) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_12_9" elif ( (last_candle["rsi_14"] >= 64.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["rsi_14_4h"] <= 40.0) and (last_candle["change_pct_1h"] > 0.04) ): return True, f"exit_{mode_name}_d_12_10" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["change_pct_1d"] > 0.10) and (last_candle["not_downtrend_4h"] == True) ): return True, f"exit_{mode_name}_d_12_11" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 20.0) and (last_candle["cti_20_1d"] <= -0.80) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["not_downtrend_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_12_12" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 26.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["change_pct_4h"] > 0.03) and (last_candle["bot_wick_pct_4h"] > 0.03) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_12_13" elif ( (last_candle["rsi_14"] >= 60.0) and (last_candle["rsi_14_15m"] >= 60.0) and (last_candle["rsi_3_1d"] >= 94.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_4h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["ema_200_dec_48_1h"] == False) ): return True, f"exit_{mode_name}_d_12_14" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 24.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["r_480_4h"] <= -70.0) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_12_15" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["cti_20_1d"] <= -0.70) and (last_candle["change_pct_1d"] > 0.04) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_12_16" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 28.0) and (last_candle["rsi_14_15m"] <= 40.0) and (last_candle["rsi_14_1h"] <= 40.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["r_480_4h"] > -30.0) and (last_candle["change_pct_1d"] > 0.04) ): return True, f"exit_{mode_name}_d_12_17" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_24_15m"] == False) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_24_4h"] == False) ): return True, f"exit_{mode_name}_d_12_18" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_max_6_1d"] <= 15.0) and (last_candle["change_pct_1h"] > 0.01) and (last_candle["change_pct_4h"] > 0.06) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_12_19" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_1d"] <= 30.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_12_20" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 50.0) and (last_candle["cti_20_dec_3_1d"] == False) and (last_candle["not_downtrend_1h"] == True) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["close"] > (last_candle["low_min_48_1h"] * 1.25)) ): return True, f"exit_{mode_name}_d_12_21" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 40.0) and (last_candle["rsi_14_max_6_4h"] <= 30.0) and (last_candle["change_pct_4h"] > 0.01) and (last_candle["not_downtrend_4h"] == True) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.30)) ): return True, f"exit_{mode_name}_d_12_22" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 30.0) and (last_candle["not_downtrend_1h"] == True) and (last_candle["not_downtrend_1d"] == True) and (last_candle["close"] > (last_candle["low_min_6_1d"] * 1.20)) ): return True, f"exit_{mode_name}_d_12_23" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_3"] <= 5.0) and (last_candle["rsi_14"] >= 50.0) and (last_candle["rsi_14_15m"] >= 50.0) and (last_candle["rsi_3_1h"] >= 80.0) and (last_candle["change_pct_1h"] > 0.02) and (last_candle["not_downtrend_1h"] == True) ): return True, f"exit_{mode_name}_d_12_24" elif ( (last_candle["r_14"] <= -99.0) and (last_candle["rsi_14"] <= 22.0) and (last_candle["rsi_14_15m"] <= 50.0) and (last_candle["rsi_14_1d"] <= 50.0) and (last_candle["rsi_3_1d"] >= 74.0) and (last_candle["ema_200_dec_48_1h"] == False) and (last_candle["ema_200_dec_4_1d"] == False) ): return True, f"exit_{mode_name}_d_12_25" return False, None # Short Exit Stop Loss # --------------------------------------------------------------------------------------------- def short_exit_stoploss( self, mode_name: str, current_rate: float, profit_stake: float, profit_ratio: float, profit_current_stake_ratio: float, profit_init_ratio: float, max_profit: float, max_loss: float, filled_entries, filled_exits, last_candle, previous_candle_1, previous_candle_2, previous_candle_3, previous_candle_4, previous_candle_5, trade: "Trade", current_time: "datetime", buy_tag, ) -> tuple: is_backtest = self.dp.runmode.value in ["backtest", "hyperopt"] # Stoploss doom if ( self.is_futures_mode is False and profit_stake < -(filled_entries[0].cost * self.stop_threshold / (trade.leverage if self.is_futures_mode else 1.0)) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2023, 6, 13) or is_backtest) ): return True, f"exit_{mode_name}_stoploss" if ( self.is_futures_mode is True and profit_stake < -(filled_entries[0].cost * self.stop_threshold_futures / (trade.leverage if self.is_futures_mode else 1.0)) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2023, 10, 17) or is_backtest) ): return True, f"exit_{mode_name}_stoploss" return False, None ############################################################################################### # SHORT EXIT FUNCTIONS ENDS HERE ############################################################################################### # ______ __ __ ______ _______ ________ ______ _______ ______ __ __ _______ # / \| \ | \/ \| | \ / \| \| | \ | | \ # | $$$$$$| $$ | $| $$$$$$| $$$$$$$\$$$$$$$$ | $$$$$$| $$$$$$$\\$$$$$| $$\ | $| $$$$$$$\ # | $$___\$| $$__| $| $$ | $| $$__| $$ | $$ | $$ __\$| $$__| $$ | $$ | $$$\| $| $$ | $$ # \$$ \| $$ $| $$ | $| $$ $$ | $$ | $$| | $$ $$ | $$ | $$$$\ $| $$ | $$ # _\$$$$$$| $$$$$$$| $$ | $| $$$$$$$\ | $$ | $$ \$$$| $$$$$$$\ | $$ | $$\$$ $| $$ | $$ # | \__| $| $$ | $| $$__/ $| $$ | $$ | $$ | $$__| $| $$ | $$_| $$_| $$ \$$$| $$__/ $$ # \$$ $| $$ | $$\$$ $| $$ | $$ | $$ \$$ $| $$ | $| $$ | $$ \$$| $$ $$ # \$$$$$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$ \$$$$$$ \$$ \$$\$$$$$$\$$ \$$\$$$$$$$ # ############################################################################################### # SHORT GRIND FUNCTIONS STARTS HERE ############################################################################################### # Short Grinding Adjust Trade Position # --------------------------------------------------------------------------------------------- def short_grind_adjust_trade_position( self, trade: Trade, enter_tags, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, **kwargs, ): is_backtest = self.dp.runmode.value in ["backtest", "hyperopt"] min_stake = self.correct_min_stake(min_stake) # min/max stakes include leverage. The return amounts is before leverage. min_stake /= trade.leverage max_stake /= trade.leverage df, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe) if len(df) < 2: return None last_candle = df.iloc[-1].squeeze() previous_candle = df.iloc[-2].squeeze() filled_orders = trade.select_filled_orders() filled_entries = trade.select_filled_orders(trade.entry_side) filled_exits = trade.select_filled_orders(trade.exit_side) count_of_entries = trade.nr_of_successful_entries count_of_exits = trade.nr_of_successful_exits if count_of_entries == 0: return None if len(filled_orders) < 1: return None has_order_tags = False if hasattr(filled_orders[0], "ft_order_tag"): has_order_tags = True exit_rate = current_rate if self.dp.runmode.value in ("live", "dry_run"): ticker = self.dp.ticker(trade.pair) if ("bid" in ticker) and ("ask" in ticker): if trade.is_short: if self.config["exit_pricing"]["price_side"] in ["ask", "other"]: if ticker["ask"] is not None: exit_rate = ticker["ask"] else: if self.config["exit_pricing"]["price_side"] in ["bid", "other"]: if ticker["bid"] is not None: exit_rate = ticker["bid"] profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio = self.calc_total_profit( trade, filled_entries, filled_exits, exit_rate ) slice_amount = filled_entries[0].cost slice_profit = (exit_rate - filled_orders[-1].safe_price) / filled_orders[-1].safe_price slice_profit_entry = (exit_rate - filled_entries[-1].safe_price) / filled_entries[-1].safe_price slice_profit_exit = ( ((exit_rate - filled_exits[-1].safe_price) / filled_exits[-1].safe_price) if count_of_exits > 0 else 0.0 ) current_stake_amount = trade.amount * current_rate is_derisk = trade.amount < (filled_entries[0].safe_filled * 0.95) is_derisk_calc = False is_rebuy_mode = all(c in self.short_rebuy_mode_tags for c in enter_tags) or ( any(c in self.short_rebuy_mode_tags for c in enter_tags) and all(c in (self.short_rebuy_mode_tags + self.short_grind_mode_tags) for c in enter_tags) ) is_grind_mode = all(c in self.short_grind_mode_tags for c in enter_tags) fee_open_rate = trade.fee_open if self.custom_fee_open_rate is None else self.custom_fee_open_rate fee_close_rate = trade.fee_close if self.custom_fee_close_rate is None else self.custom_fee_close_rate # Rebuy mode if is_rebuy_mode: slice_amount /= self.rebuy_mode_stake_multiplier # Grind mode elif is_grind_mode: slice_amount /= ( self.grind_mode_stake_multiplier_futures[0] if self.is_futures_mode else self.grind_mode_stake_multiplier_spot[0] ) elif not is_derisk and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 2, 5) or is_backtest): rebuy_stake, order_tag, is_derisk_calc = self.short_adjust_trade_position_no_derisk( trade, enter_tags, current_time, current_rate, current_profit, min_stake, max_stake, current_entry_rate, current_exit_rate, current_entry_profit, current_exit_profit, last_candle, previous_candle, filled_orders, filled_entries, filled_exits, exit_rate, slice_amount, slice_profit_entry, slice_profit, profit_ratio, profit_stake, profit_init_ratio, current_stake_amount, has_order_tags, ) if rebuy_stake is not None: if has_order_tags: return rebuy_stake, order_tag else: return rebuy_stake elif count_of_exits == 0: return None elif not is_derisk_calc: return None if not is_rebuy_mode and not is_grind_mode: # First entry is lower now, therefore the grinds must adjust if trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 2, 5) or is_backtest: slice_amount /= ( self.regular_mode_stake_multiplier_futures[0] if self.is_futures_mode else self.regular_mode_stake_multiplier_spot[0] ) grind_derisk = self.grind_derisk_futures if self.is_futures_mode else self.grind_derisk_spot grind_1_max_sub_grinds = 0 grind_1_stakes = self.grind_1_stakes_futures.copy() if self.is_futures_mode else self.grind_1_stakes_spot.copy() grind_1_sub_thresholds = ( self.grind_1_sub_thresholds_futures if self.is_futures_mode else self.grind_1_sub_thresholds_spot ) if (slice_amount * grind_1_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_1_stakes[0] for i, _ in enumerate(grind_1_stakes): grind_1_stakes[i] *= multi grind_1_max_sub_grinds = len(grind_1_stakes) grind_1_stop_grinds = self.grind_1_stop_grinds_futures if self.is_futures_mode else self.grind_1_stop_grinds_spot grind_1_profit_threshold = ( self.grind_1_profit_threshold_futures if self.is_futures_mode else self.grind_1_profit_threshold_spot ) grind_2_max_sub_grinds = 0 grind_2_stakes = self.grind_2_stakes_futures.copy() if self.is_futures_mode else self.grind_2_stakes_spot.copy() grind_2_sub_thresholds = ( self.grind_2_sub_thresholds_futures if self.is_futures_mode else self.grind_2_sub_thresholds_spot ) if (slice_amount * grind_2_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_2_stakes[0] for i, _ in enumerate(grind_2_stakes): grind_2_stakes[i] *= multi grind_2_max_sub_grinds = len(grind_2_stakes) grind_2_stop_grinds = self.grind_2_stop_grinds_futures if self.is_futures_mode else self.grind_2_stop_grinds_spot grind_2_profit_threshold = ( self.grind_2_profit_threshold_futures if self.is_futures_mode else self.grind_2_profit_threshold_spot ) grind_3_max_sub_grinds = 0 grind_3_stakes = self.grind_3_stakes_futures.copy() if self.is_futures_mode else self.grind_3_stakes_spot.copy() grind_3_sub_thresholds = ( self.grind_3_sub_thresholds_futures if self.is_futures_mode else self.grind_3_sub_thresholds_spot ) if (slice_amount * grind_3_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_3_stakes[0] for i, _ in enumerate(grind_3_stakes): grind_3_stakes[i] *= multi grind_3_max_sub_grinds = len(grind_3_stakes) grind_3_stop_grinds = self.grind_3_stop_grinds_futures if self.is_futures_mode else self.grind_3_stop_grinds_spot grind_3_profit_threshold = ( self.grind_3_profit_threshold_futures if self.is_futures_mode else self.grind_3_profit_threshold_spot ) grind_4_max_sub_grinds = 0 grind_4_stakes = self.grind_4_stakes_futures.copy() if self.is_futures_mode else self.grind_4_stakes_spot.copy() grind_4_sub_thresholds = ( self.grind_4_sub_thresholds_futures if self.is_futures_mode else self.grind_4_sub_thresholds_spot ) if (slice_amount * grind_4_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_4_stakes[0] for i, _ in enumerate(grind_4_stakes): grind_4_stakes[i] *= multi grind_4_max_sub_grinds = len(grind_4_stakes) grind_4_stop_grinds = self.grind_4_stop_grinds_futures if self.is_futures_mode else self.grind_4_stop_grinds_spot grind_4_profit_threshold = ( self.grind_4_profit_threshold_futures if self.is_futures_mode else self.grind_4_profit_threshold_spot ) grind_5_max_sub_grinds = 0 grind_5_stakes = self.grind_5_stakes_futures.copy() if self.is_futures_mode else self.grind_5_stakes_spot.copy() grind_5_sub_thresholds = ( self.grind_5_sub_thresholds_futures if self.is_futures_mode else self.grind_5_sub_thresholds_spot ) if (slice_amount * grind_5_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_5_stakes[0] for i, _ in enumerate(grind_5_stakes): grind_5_stakes[i] *= multi grind_5_max_sub_grinds = len(grind_5_stakes) grind_5_stop_grinds = self.grind_5_stop_grinds_futures if self.is_futures_mode else self.grind_5_stop_grinds_spot grind_5_profit_threshold = ( self.grind_5_profit_threshold_futures if self.is_futures_mode else self.grind_5_profit_threshold_spot ) grind_6_max_sub_grinds = 0 grind_6_stakes = self.grind_6_stakes_futures.copy() if self.is_futures_mode else self.grind_6_stakes_spot.copy() grind_6_sub_thresholds = ( self.grind_6_sub_thresholds_futures if self.is_futures_mode else self.grind_6_sub_thresholds_spot ) if (slice_amount * grind_6_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_6_stakes[0] for i, _ in enumerate(grind_6_stakes): grind_6_stakes[i] *= multi grind_6_max_sub_grinds = len(grind_6_stakes) grind_6_stop_grinds = self.grind_6_stop_grinds_futures if self.is_futures_mode else self.grind_6_stop_grinds_spot grind_6_profit_threshold = ( self.grind_6_profit_threshold_futures if self.is_futures_mode else self.grind_6_profit_threshold_spot ) grind_1_derisk_1_max_sub_grinds = 0 grind_1_derisk_1_stakes = ( self.grind_1_derisk_1_stakes_futures.copy() if self.is_futures_mode else self.grind_1_derisk_1_stakes_spot.copy() ) grind_1_derisk_1_sub_thresholds = ( self.grind_1_derisk_1_sub_thresholds_futures if self.is_futures_mode else self.grind_1_derisk_1_sub_thresholds_spot ) if (slice_amount * grind_1_derisk_1_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_1_derisk_1_stakes[0] for i, _ in enumerate(grind_1_derisk_1_stakes): grind_1_derisk_1_stakes[i] *= multi grind_1_derisk_1_max_sub_grinds = len(grind_1_derisk_1_stakes) grind_1_derisk_1_stop_grinds = ( self.grind_1_derisk_1_stop_grinds_futures if self.is_futures_mode else self.grind_1_derisk_1_stop_grinds_spot ) grind_1_derisk_1_profit_threshold = ( self.grind_1_derisk_1_profit_threshold_futures if self.is_futures_mode else self.grind_1_derisk_1_profit_threshold_spot ) grind_2_derisk_1_max_sub_grinds = 0 grind_2_derisk_1_stakes = ( self.grind_2_derisk_1_stakes_futures.copy() if self.is_futures_mode else self.grind_2_derisk_1_stakes_spot.copy() ) grind_2_derisk_1_sub_thresholds = ( self.grind_2_derisk_1_sub_thresholds_futures if self.is_futures_mode else self.grind_2_derisk_1_sub_thresholds_spot ) if (slice_amount * grind_2_derisk_1_stakes[0] / (trade.leverage if self.is_futures_mode else 1.0)) < min_stake: multi = min_stake / slice_amount / grind_2_derisk_1_stakes[0] for i, _ in enumerate(grind_2_derisk_1_stakes): grind_2_derisk_1_stakes[i] *= multi grind_2_derisk_1_max_sub_grinds = len(grind_2_derisk_1_stakes) grind_2_derisk_1_stop_grinds = ( self.grind_2_derisk_1_stop_grinds_futures if self.is_futures_mode else self.grind_2_derisk_1_stop_grinds_spot ) grind_2_derisk_1_profit_threshold = ( self.grind_2_derisk_1_profit_threshold_futures if self.is_futures_mode else self.grind_2_derisk_1_profit_threshold_spot ) partial_sell = False is_derisk_found = False # d de-risk is_derisk_1 = False is_derisk_1_found = False # d1 de-risk exit derisk_1_order = None derisk_1_reentry_order = None derisk_1_sub_grind_count = 0 derisk_1_total_amount = 0.0 derisk_1_total_cost = 0.0 derisk_1_current_open_rate = 0.0 derisk_1_current_grind_stake = 0.0 derisk_1_current_grind_stake_profit = 0.0 derisk_1_is_sell_found = False derisk_1_reentry_found = False derisk_1_buy_orders = [] derisk_1_distance_ratio = 0.0 grind_1_sub_grind_count = 0 grind_1_total_amount = 0.0 grind_1_total_cost = 0.0 grind_1_current_open_rate = 0.0 grind_1_current_grind_stake = 0.0 grind_1_current_grind_stake_profit = 0.0 grind_1_is_sell_found = False grind_1_found = False grind_1_buy_orders = [] grind_1_distance_ratio = 0.0 grind_2_sub_grind_count = 0 grind_2_total_amount = 0.0 grind_2_total_cost = 0.0 grind_2_current_open_rate = 0.0 grind_2_current_grind_stake = 0.0 grind_2_current_grind_stake_profit = 0.0 grind_2_is_sell_found = False grind_2_found = False grind_2_buy_orders = [] grind_2_distance_ratio = 0.0 grind_3_sub_grind_count = 0 grind_3_total_amount = 0.0 grind_3_total_cost = 0.0 grind_3_current_open_rate = 0.0 grind_3_current_grind_stake = 0.0 grind_3_current_grind_stake_profit = 0.0 grind_3_is_sell_found = False grind_3_found = False grind_3_buy_orders = [] grind_3_distance_ratio = 0.0 grind_4_sub_grind_count = 0 grind_4_total_amount = 0.0 grind_4_total_cost = 0.0 grind_4_current_open_rate = 0.0 grind_4_current_grind_stake = 0.0 grind_4_current_grind_stake_profit = 0.0 grind_4_is_sell_found = False grind_4_found = False grind_4_buy_orders = [] grind_4_distance_ratio = 0.0 grind_5_sub_grind_count = 0 grind_5_total_amount = 0.0 grind_5_total_cost = 0.0 grind_5_current_open_rate = 0.0 grind_5_current_grind_stake = 0.0 grind_5_current_grind_stake_profit = 0.0 grind_5_is_sell_found = False grind_5_found = False grind_5_buy_orders = [] grind_5_distance_ratio = 0.0 grind_6_sub_grind_count = 0 grind_6_total_amount = 0.0 grind_6_total_cost = 0.0 grind_6_current_open_rate = 0.0 grind_6_current_grind_stake = 0.0 grind_6_current_grind_stake_profit = 0.0 grind_6_is_sell_found = False grind_6_found = False grind_6_buy_orders = [] grind_6_distance_ratio = 0.0 grind_1_derisk_1_sub_grind_count = 0 grind_1_derisk_1_total_amount = 0.0 grind_1_derisk_1_total_cost = 0.0 grind_1_derisk_1_current_open_rate = 0.0 grind_1_derisk_1_current_grind_stake = 0.0 grind_1_derisk_1_current_grind_stake_profit = 0.0 grind_1_derisk_1_is_sell_found = False grind_1_derisk_1_found = False grind_1_derisk_1_buy_orders = [] grind_1_derisk_1_distance_ratio = 0.0 grind_2_derisk_1_sub_grind_count = 0 grind_2_derisk_1_total_amount = 0.0 grind_2_derisk_1_total_cost = 0.0 grind_2_derisk_1_current_open_rate = 0.0 grind_2_derisk_1_current_grind_stake = 0.0 grind_2_derisk_1_current_grind_stake_profit = 0.0 grind_2_derisk_1_is_sell_found = False grind_2_derisk_1_found = False grind_2_derisk_1_buy_orders = [] grind_2_derisk_1_distance_ratio = 0.0 for order in reversed(filled_orders): if (order.ft_order_side == "sell") and (order is not filled_orders[0]): order_tag = "" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag if not is_derisk_1 and order_tag == "d1": derisk_1_sub_grind_count += 1 derisk_1_total_amount += order.safe_filled derisk_1_total_cost += order.safe_filled * order.safe_price derisk_1_buy_orders.append(order.id) if not derisk_1_reentry_found and not is_derisk_1: derisk_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price derisk_1_reentry_found = True derisk_1_reentry_order = order elif not grind_1_derisk_1_is_sell_found and order_tag == "dl1": grind_1_derisk_1_sub_grind_count += 1 grind_1_derisk_1_total_amount += order.safe_filled grind_1_derisk_1_total_cost += order.safe_filled * order.safe_price grind_1_derisk_1_buy_orders.append(order.id) if not grind_1_derisk_1_found: grind_1_derisk_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_1_derisk_1_found = True elif not grind_2_derisk_1_is_sell_found and order_tag == "dl2": grind_2_derisk_1_sub_grind_count += 1 grind_2_derisk_1_total_amount += order.safe_filled grind_2_derisk_1_total_cost += order.safe_filled * order.safe_price grind_2_derisk_1_buy_orders.append(order.id) if not grind_2_derisk_1_found: grind_2_derisk_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_2_derisk_1_found = True elif not grind_6_is_sell_found and order_tag == "gd6": grind_6_sub_grind_count += 1 grind_6_total_amount += order.safe_filled grind_6_total_cost += order.safe_filled * order.safe_price grind_6_buy_orders.append(order.id) if not grind_6_found: grind_6_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_6_found = True elif not grind_5_is_sell_found and order_tag == "gd5": grind_5_sub_grind_count += 1 grind_5_total_amount += order.safe_filled grind_5_total_cost += order.safe_filled * order.safe_price grind_5_buy_orders.append(order.id) if not grind_5_found: grind_5_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_5_found = True elif not grind_4_is_sell_found and order_tag == "gd4": grind_4_sub_grind_count += 1 grind_4_total_amount += order.safe_filled grind_4_total_cost += order.safe_filled * order.safe_price grind_4_buy_orders.append(order.id) if not grind_4_found: grind_4_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_4_found = True elif not grind_3_is_sell_found and order_tag == "gd3": grind_3_sub_grind_count += 1 grind_3_total_amount += order.safe_filled grind_3_total_cost += order.safe_filled * order.safe_price grind_3_buy_orders.append(order.id) if not grind_3_found: grind_3_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_3_found = True elif not grind_2_is_sell_found and order_tag == "gd2": grind_2_sub_grind_count += 1 grind_2_total_amount += order.safe_filled grind_2_total_cost += order.safe_filled * order.safe_price grind_2_buy_orders.append(order.id) if not grind_2_found: grind_2_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_2_found = True elif not grind_1_is_sell_found and order_tag not in [ "r", "d1", "dl1", "dl2", "g1", "g2", "g3", "g4", "g5", "g6", "gd2", "gd3", "gd4", "gd5", "gd6", "gm0", "gmd0", ]: grind_1_sub_grind_count += 1 grind_1_total_amount += order.safe_filled grind_1_total_cost += order.safe_filled * order.safe_price grind_1_buy_orders.append(order.id) if not grind_1_found: grind_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_1_found = True elif order.ft_order_side == "buy": if ( order is filled_exits[-1] and (order.safe_remaining * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) > min_stake ): partial_sell = True break order_tag = "" if has_order_tags: if order.ft_order_tag is not None: sell_order_tag = order.ft_order_tag order_mode = sell_order_tag.split(" ", 1) if len(order_mode) > 0: order_tag = order_mode[0] if order_tag in ["dl1", "ddl1"]: grind_1_derisk_1_is_sell_found = True elif order_tag in ["dl2", "ddl2"]: grind_2_derisk_1_is_sell_found = True elif order_tag in ["gd6", "dd6"]: grind_6_is_sell_found = True elif order_tag in ["gd5", "dd5"]: grind_5_is_sell_found = True if order_tag in ["gd4", "dd4"]: grind_4_is_sell_found = True elif order_tag in ["gd3", "dd3"]: grind_3_is_sell_found = True elif order_tag in ["gd2", "dd2"]: grind_2_is_sell_found = True elif order_tag in ["d1"]: if not is_derisk_1_found: is_derisk_1_found = True is_derisk_1 = True derisk_1_order = order elif order_tag in ["p", "r", "d", "dd0", "partial_exit", "force_exit", ""]: if order_tag in ["d"]: is_derisk_found = True is_derisk = True grind_1_is_sell_found = True grind_2_is_sell_found = True grind_3_is_sell_found = True grind_4_is_sell_found = True grind_5_is_sell_found = True grind_1_derisk_1_is_sell_found = True grind_2_derisk_1_is_sell_found = True elif order_tag not in [ "dl1", "ddl1", "dl2", "ddl2", "g1", "g2", "g3", "g4", "g5", "g6", "gd2", "gd3", "gd4", "gd5", "gd6", "dd2", "dd3", "dd4", "dd5", "dd6", "gm0", "gmd0", ]: grind_1_is_sell_found = True if derisk_1_sub_grind_count > 0: derisk_1_current_open_rate = derisk_1_total_cost / derisk_1_total_amount derisk_1_current_grind_stake = derisk_1_total_amount * exit_rate * (1 + trade.fee_close) derisk_1_current_grind_stake_profit = derisk_1_total_cost - derisk_1_current_grind_stake if grind_1_sub_grind_count > 0: grind_1_current_open_rate = grind_1_total_cost / grind_1_total_amount grind_1_current_grind_stake = grind_1_total_amount * exit_rate * (1 + trade.fee_close) grind_1_current_grind_stake_profit = grind_1_total_cost - grind_1_current_grind_stake if grind_2_sub_grind_count > 0: grind_2_current_open_rate = grind_2_total_cost / grind_2_total_amount grind_2_current_grind_stake = grind_2_total_amount * exit_rate * (1 + trade.fee_close) grind_2_current_grind_stake_profit = grind_2_total_cost - grind_2_current_grind_stake if grind_3_sub_grind_count > 0: grind_3_current_open_rate = grind_3_total_cost / grind_3_total_amount grind_3_current_grind_stake = grind_3_total_amount * exit_rate * (1 + trade.fee_close) grind_3_current_grind_stake_profit = grind_3_total_cost - grind_3_current_grind_stake if grind_4_sub_grind_count > 0: grind_4_current_open_rate = grind_4_total_cost / grind_4_total_amount grind_4_current_grind_stake = grind_4_total_amount * exit_rate * (1 + trade.fee_close) grind_4_current_grind_stake_profit = grind_4_total_cost - grind_4_current_grind_stake if grind_5_sub_grind_count > 0: grind_5_current_open_rate = grind_5_total_cost / grind_5_total_amount grind_5_current_grind_stake = grind_5_total_amount * exit_rate * (1 + trade.fee_close) grind_5_current_grind_stake_profit = grind_5_total_cost - grind_5_current_grind_stake if grind_6_sub_grind_count > 0: grind_6_current_open_rate = grind_6_total_cost / grind_6_total_amount grind_6_current_grind_stake = grind_6_total_amount * exit_rate * (1 + trade.fee_close) grind_6_current_grind_stake_profit = grind_6_total_cost - grind_6_current_grind_stake if grind_1_derisk_1_sub_grind_count > 0: grind_1_derisk_1_current_open_rate = grind_1_derisk_1_total_cost / grind_1_derisk_1_total_amount grind_1_derisk_1_current_grind_stake = grind_1_derisk_1_total_amount * exit_rate * (1 + trade.fee_close) grind_1_derisk_1_current_grind_stake_profit = grind_1_derisk_1_total_cost - grind_1_derisk_1_current_grind_stake if grind_2_derisk_1_sub_grind_count > 0: grind_2_derisk_1_current_open_rate = grind_2_derisk_1_total_cost / grind_2_derisk_1_total_amount grind_2_derisk_1_current_grind_stake = grind_2_derisk_1_total_amount * exit_rate * (1 + trade.fee_close) grind_2_derisk_1_current_grind_stake_profit = grind_2_derisk_1_total_cost - grind_2_derisk_1_current_grind_stake num_open_grinds = ( grind_1_sub_grind_count + grind_2_sub_grind_count + grind_3_sub_grind_count + grind_4_sub_grind_count + grind_5_sub_grind_count + grind_6_sub_grind_count + grind_1_derisk_1_sub_grind_count + grind_2_derisk_1_sub_grind_count ) # Sell remaining if partial fill on exit if partial_sell: order = filled_exits[-1] sell_amount = order.safe_remaining * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Exit (remaining) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {order.safe_remaining} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) order_tag = "p" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount if is_grind_mode and ( (filled_entries[0].safe_filled * (trade.stake_amount / trade.amount) - (min_stake * 1.5)) > min_stake ): is_first_entry_exit_found = False for order in filled_orders: if order.ft_order_side == "sell": order_tag = "" if has_order_tags: if order.ft_order_tag is not None: sell_order_tag = order.ft_order_tag order_mode = sell_order_tag.split(" ", 1) if len(order_mode) > 0: order_tag = order_mode[0] else: # no order tag support, assume the first exit is for the first buy is_first_entry_exit_found = True if order_tag in ["gm0", "gmd0"]: is_first_entry_exit_found = True break if not is_first_entry_exit_found: first_entry = filled_entries[0] first_entry_distance_ratio = -(exit_rate - first_entry.safe_price) / first_entry.safe_price # First entry exit if first_entry_distance_ratio > ( (self.grind_mode_first_entry_profit_threshold_spot + fee_open_rate + fee_close_rate) if self.is_futures_mode else (self.grind_mode_first_entry_profit_threshold_spot + fee_open_rate + fee_close_rate) ): sell_amount = first_entry.safe_filled * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = -(exit_rate - first_entry.safe_price) / first_entry.safe_price coin_amount = sell_amount / exit_rate self.dp.send_msg( f"Grinding exit (gm0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gm0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gm0" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # First entry de-risk if first_entry_distance_ratio < ( self.grind_mode_first_entry_stop_threshold_spot if self.is_futures_mode else self.grind_mode_first_entry_stop_threshold_spot ): sell_amount = first_entry.safe_filled * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = -(exit_rate - first_entry.safe_price) / first_entry.safe_price coin_amount = sell_amount / exit_rate self.dp.send_msg( f"Grinding de-risk (gmd0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding de-risk (gmd0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {coin_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gmd0" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount is_short_grind_buy = self.short_grind_buy(last_candle, previous_candle, slice_profit) # Grinding derisk 1 # Buy if ( has_order_tags and is_derisk_1 and not derisk_1_reentry_found and (not partial_sell) and (grind_1_derisk_1_sub_grind_count < grind_1_derisk_1_max_sub_grinds) ): if ( ( ( (grind_1_derisk_1_sub_grind_count > 0) and -grind_1_derisk_1_distance_ratio < grind_1_derisk_1_sub_thresholds[grind_1_derisk_1_sub_grind_count] ) or ((is_derisk or is_derisk_calc) and grind_1_derisk_1_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( (last_candle["close"] < (last_candle["close_min_12"] * 1.06)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.08)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.10)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.12)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.14)) and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.16)) and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.18)) ) and ( (last_candle["zlma_50_dec_15m"] == True) and (last_candle["zlma_50_dec_1h"] == True) and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 84.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) ) ) ): buy_amount = ( slice_amount * grind_1_derisk_1_stakes[grind_1_derisk_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_derisk_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_derisk_1_current_open_rate) / grind_1_derisk_1_current_open_rate grind_profit_stake = grind_1_derisk_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (dl1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (dl1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "dl1" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_1_derisk_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_derisk_1_current_open_rate) / grind_1_derisk_1_current_open_rate if grind_profit > (grind_1_derisk_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_1_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (dl1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (dl1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "dl1" for grind_entry_id in grind_1_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if (-grind_1_derisk_1_distance_ratio < grind_1_derisk_1_stop_grinds) and (is_derisk or is_derisk_calc): sell_amount = grind_1_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_1_derisk_1_current_open_rate > 0.0: grind_profit = ( -((exit_rate - grind_1_derisk_1_current_open_rate) / grind_1_derisk_1_current_open_rate) if grind_1_derisk_1_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (ddl1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (ddl1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "ddl1" for grind_entry_id in grind_1_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding derisk 2 # Buy if ( has_order_tags and is_derisk_1 and not derisk_1_reentry_found and (not partial_sell) and (grind_2_derisk_1_sub_grind_count < grind_2_derisk_1_max_sub_grinds) ): if ( ( ( (grind_2_derisk_1_sub_grind_count > 0) and -grind_2_derisk_1_distance_ratio < grind_2_derisk_1_sub_thresholds[grind_2_derisk_1_sub_grind_count] ) or ((is_derisk or is_derisk_calc) and grind_2_derisk_1_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( (last_candle["close"] < (last_candle["close_min_12"] * 1.06)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.08)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.10)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.12)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.14)) ) and ( ( (grind_2_derisk_1_sub_grind_count == 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 84.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 80.0) and (last_candle["rsi_3_4h"] < 80.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_15m"] == True) and (last_candle["zlma_50_dec_1h"] == True) and (last_candle["zlma_50_dec_4h"] == True) ) ) ) or ( (grind_2_derisk_1_sub_grind_count > 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 84.0) and (last_candle["rsi_3_4h"] < 84.0) and (last_candle["rsi_14"] > 54.0) ) ) ) ) ): buy_amount = ( slice_amount * grind_2_derisk_1_stakes[grind_2_derisk_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_2_derisk_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate grind_profit_stake = grind_2_derisk_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (dl2) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (dl2) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "dl2" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_2_derisk_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate if grind_profit > (grind_2_derisk_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_2_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (dl2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (dl2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "dl2" for grind_entry_id in grind_2_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( (grind_2_derisk_1_sub_grind_count > 0) and ( (-(exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate) < grind_2_derisk_1_stop_grinds ) and (is_derisk or is_derisk_calc) ): sell_amount = grind_2_derisk_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_2_derisk_1_current_open_rate > 0.0: grind_profit = ( (-(exit_rate - grind_2_derisk_1_current_open_rate) / grind_2_derisk_1_current_open_rate) if grind_2_derisk_1_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (ddl2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (ddl2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_derisk_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "ddl2" for grind_entry_id in grind_2_derisk_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 1 # Buy if (not partial_sell) and (grind_1_sub_grind_count < grind_1_max_sub_grinds): if ( ( ((grind_1_sub_grind_count > 0) and -grind_1_distance_ratio < grind_1_sub_thresholds[grind_1_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_1_sub_grind_count == 0) or (is_grind_mode and grind_1_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) ) and ( ( (grind_1_sub_grind_count == 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_15m"] == True) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.012)) ) ) ) or ( (grind_1_sub_grind_count > 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 88.0) # and (last_candle["rsi_3_1h"] < 88.0) # and (last_candle["rsi_3_4h"] < 88.0) and (last_candle["rsi_14"] > 58.0) ) ) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd1" if has_order_tags: return buy_amount, order_tag else: return buy_amount if ( self.is_futures_mode and has_order_tags and (not partial_sell) and slice_profit > (0.65 / trade.leverage) and (is_derisk or is_derisk_calc or is_grind_mode) and (grind_1_sub_grind_count < grind_1_max_sub_grinds) ): buy_amount = ( slice_amount * grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd1" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate if grind_profit > (grind_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd1" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_1_sub_grind_count > 0) and ((-(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate) < grind_1_stop_grinds) # ( # grind_1_current_grind_stake_profit # < (slice_amount * grind_1_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_1_current_open_rate > 0.0: grind_profit = ( (-(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate) if grind_1_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd1" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 2 # Buy if has_order_tags and (not partial_sell) and (grind_2_sub_grind_count < grind_2_max_sub_grinds): if ( ( ((grind_2_sub_grind_count > 0) and -grind_2_distance_ratio < grind_2_sub_thresholds[grind_2_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_2_sub_grind_count == 0) or (is_grind_mode and grind_2_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) ) and ( ( (grind_2_sub_grind_count == 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_15m"] == True) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.012)) ) ) ) or ( (grind_2_sub_grind_count > 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 88.0) # and (last_candle["rsi_3_1h"] < 88.0) # and (last_candle["rsi_3_4h"] < 88.0) and (last_candle["rsi_14"] > 58.0) ) ) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * grind_2_stakes[grind_2_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_2_sub_grind_count > 0: grind_profit = -(exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate grind_profit_stake = grind_2_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd2) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd2) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd2" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_2_sub_grind_count > 0: grind_profit = -(exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate if grind_profit > (grind_2_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_2_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd2" for grind_entry_id in grind_2_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_2_sub_grind_count > 0) and ((-(exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate) < grind_2_stop_grinds) # ( # grind_2_current_grind_stake_profit # < (slice_amount * grind_2_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_2_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_2_current_open_rate > 0.0: grind_profit = ( (-(exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate) if grind_2_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd2" for grind_entry_id in grind_2_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 3 # Buy if has_order_tags and (not partial_sell) and (grind_3_sub_grind_count < grind_3_max_sub_grinds): if ( ( ((grind_3_sub_grind_count > 0) and -grind_3_distance_ratio < grind_3_sub_thresholds[grind_3_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_3_sub_grind_count == 0) or (is_grind_mode and grind_3_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) ) and ( ( (grind_3_sub_grind_count == 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_15m"] == True) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.012)) ) ) ) or ( (grind_3_sub_grind_count > 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 88.0) # and (last_candle["rsi_3_1h"] < 88.0) # and (last_candle["rsi_3_4h"] < 88.0) and (last_candle["rsi_14"] > 58.0) ) ) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * grind_3_stakes[grind_3_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_3_sub_grind_count > 0: grind_profit = -(exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate grind_profit_stake = grind_3_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd3) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd3) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd3" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_3_sub_grind_count > 0: grind_profit = -(exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate if grind_profit > (grind_3_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_3_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd3) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd3) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd3" for grind_entry_id in grind_3_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_3_sub_grind_count > 0) and ((-(exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate) < grind_3_stop_grinds) # ( # grind_3_current_grind_stake_profit # < (slice_amount * grind_3_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_3_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_3_current_open_rate > 0.0: grind_profit = ( (-(exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate) if grind_3_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd3) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd3) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd3" for grind_entry_id in grind_3_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 4 # Buy if has_order_tags and (not partial_sell) and (grind_4_sub_grind_count < grind_4_max_sub_grinds): if ( ( ((grind_4_sub_grind_count > 0) and -grind_4_distance_ratio < grind_4_sub_thresholds[grind_4_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_4_sub_grind_count == 0) or (is_grind_mode and grind_4_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) ) and ( ( (grind_4_sub_grind_count == 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_15m"] == True) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.012)) ) ) ) or ( (grind_4_sub_grind_count > 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 88.0) # and (last_candle["rsi_3_1h"] < 88.0) # and (last_candle["rsi_3_4h"] < 88.0) and (last_candle["rsi_14"] > 58.0) ) ) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * grind_4_stakes[grind_4_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_4_sub_grind_count > 0: grind_profit = -(exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate grind_profit_stake = grind_4_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd4) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd4) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd4" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_4_sub_grind_count > 0: grind_profit = -(exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate if grind_profit > (grind_4_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_4_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd4) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd4) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd4" for grind_entry_id in grind_4_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_4_sub_grind_count > 0) and ((-(exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate) < grind_4_stop_grinds) # ( # grind_4_current_grind_stake_profit # < (slice_amount * grind_4_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_4_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_4_current_open_rate > 0.0: grind_profit = ( (-(exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate) if grind_4_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd4) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd4) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd4" for grind_entry_id in grind_4_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 5 # Buy if has_order_tags and (not partial_sell) and (grind_5_sub_grind_count < grind_5_max_sub_grinds): if ( ( ((grind_5_sub_grind_count > 0) and -grind_5_distance_ratio < grind_5_sub_thresholds[grind_5_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_5_sub_grind_count == 0) or (is_grind_mode and grind_5_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) ) and ( ( (grind_5_sub_grind_count == 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_15m"] == True) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.012)) ) ) ) or ( (grind_5_sub_grind_count > 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 88.0) # and (last_candle["rsi_3_1h"] < 88.0) # and (last_candle["rsi_3_4h"] < 88.0) and (last_candle["rsi_14"] > 58.0) ) ) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * grind_5_stakes[grind_5_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_5_sub_grind_count > 0: grind_profit = -(exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate grind_profit_stake = grind_5_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd5) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd5) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd5" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_5_sub_grind_count > 0: grind_profit = -(exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate if grind_profit > (grind_5_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_5_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd5) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd5) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd5" for grind_entry_id in grind_5_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_5_sub_grind_count > 0) and ((-(exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate) < grind_5_stop_grinds) # ( # grind_5_current_grind_stake_profit # < (slice_amount * grind_5_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_5_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_5_current_open_rate > 0.0: grind_profit = ( (-(exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate) if grind_5_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd5) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd5) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd5" for grind_entry_id in grind_5_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grinding 6 # Buy if has_order_tags and (not partial_sell) and (grind_6_sub_grind_count < grind_6_max_sub_grinds): if ( ( ((grind_6_sub_grind_count > 0) and -grind_6_distance_ratio < grind_6_sub_thresholds[grind_6_sub_grind_count]) or ((is_derisk or is_derisk_calc) and grind_6_sub_grind_count == 0) or (is_grind_mode and grind_6_sub_grind_count == 0) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) ) and ( ( (grind_6_sub_grind_count == 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_15m"] == True) # and (last_candle["zlma_50_dec_1h"] == False) # and (last_candle["zlma_50_dec_4h"] == False) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.012)) ) ) ) or ( (grind_6_sub_grind_count > 0) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 88.0) # and (last_candle["rsi_3_1h"] < 88.0) # and (last_candle["rsi_3_4h"] < 88.0) and (last_candle["rsi_14"] > 58.0) ) ) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 58.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.006)) ) or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > last_candle["bb20_2_mid"]) and (previous_candle["close"] > previous_candle["bb20_2_mid"]) ) ) ): buy_amount = ( slice_amount * grind_6_stakes[grind_6_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if grind_6_sub_grind_count > 0: grind_profit = -(exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate grind_profit_stake = grind_6_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (gd6) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (gd6) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "gd6" if has_order_tags: return buy_amount, order_tag else: return buy_amount # Sell if grind_6_sub_grind_count > 0: grind_profit = -(exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate if grind_profit > (grind_6_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_6_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (gd6) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (gd6) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "gd6" for grind_entry_id in grind_6_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # Grind stop if ( ( (grind_6_sub_grind_count > 0) and ((-(exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate) < grind_6_stop_grinds) # ( # grind_6_current_grind_stake_profit # < (slice_amount * grind_6_stop_grinds / (trade.leverage if self.is_futures_mode else 1.0)) # ) and (is_derisk or is_derisk_calc or is_grind_mode) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 14) or is_backtest) ): sell_amount = grind_6_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 if grind_6_current_open_rate > 0.0: grind_profit = ( (-(exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate) if grind_6_is_sell_found else profit_ratio ) self.dp.send_msg( f"Grinding stop exit (dd6) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) log.info( f"Grinding stop exit (dd6) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}%" ) order_tag = "dd6" for grind_entry_id in grind_6_buy_orders: order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount # De-risk 1 reentry if ( is_derisk_1 and not derisk_1_reentry_found and derisk_1_order is not None and ( (-(current_rate - derisk_1_order.safe_price) / derisk_1_order.safe_price) < ( self.regular_mode_derisk_1_reentry_futures if self.is_futures_mode else self.regular_mode_derisk_1_reentry_spot ) ) ): if ( (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( (last_candle["close"] < (last_candle["close_min_12"] * 1.06)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.08)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.10)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.12)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.14)) and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.16)) and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.18)) ) and ( (last_candle["zlma_50_dec_15m"] == True) and (last_candle["zlma_50_dec_1h"] == True) and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["ema_200_dec_48_1h"] == True) and (last_candle["ema_200_dec_24_4h"] == True) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 70.0) and (last_candle["rsi_3_15m"] < 70.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["rsi_14"] > 58.0) ) ) ): buy_amount = derisk_1_order.safe_filled * derisk_1_order.safe_price if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None grind_profit = 0.0 grind_profit_stake = 0.0 if derisk_1_sub_grind_count > 0: grind_profit = -(exit_rate - derisk_1_current_open_rate) / derisk_1_current_open_rate grind_profit_stake = derisk_1_current_grind_stake_profit self.dp.send_msg( f"Re-entry (d1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Re-entry (d1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({derisk_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "d1" if has_order_tags: return buy_amount, order_tag else: return buy_amount # De-risk level 1 if ( has_order_tags # and not is_derisk_1 and derisk_1_reentry_found and derisk_1_reentry_order is not None # and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 5) or is_backtest) and -derisk_1_distance_ratio < ( (self.regular_mode_derisk_1_futures if self.is_futures_mode else self.regular_mode_derisk_1_spot) / (trade.leverage if self.is_futures_mode else 1.0) ) ): sell_amount = derisk_1_reentry_order.safe_filled * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk (d1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk (d1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d1" # De-risk if ( not is_derisk_found and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 2, 5) or is_backtest) and profit_stake < ( slice_amount * ( (self.regular_mode_derisk_futures if self.is_futures_mode else self.regular_mode_derisk_spot) if (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 5) or is_backtest) else (self.regular_mode_derisk_futures_old if self.is_futures_mode else self.regular_mode_derisk_spot_old) ) / (trade.leverage if self.is_futures_mode else 1.0) ) ): sell_amount = trade.amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d", is_derisk # De-risk if ( ( (profit_stake < (slice_amount * grind_derisk / (trade.leverage if self.is_futures_mode else 1.0))) and ( ( (trade.amount * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) - ( ( derisk_1_total_amount + grind_1_derisk_1_total_amount + grind_2_derisk_1_total_amount + grind_1_total_amount + grind_2_total_amount + grind_3_total_amount + grind_4_total_amount + grind_5_total_amount + grind_6_total_amount ) * exit_rate / (trade.leverage if self.is_futures_mode else 1.0) ) ) > (min_stake * 3.0) ) # temporary and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2023, 12, 19) or is_backtest) ) # temporary and ( (trade.open_date_utc.replace(tzinfo=None) >= datetime(2023, 8, 28) or is_backtest) or (filled_entries[-1].order_date_utc.replace(tzinfo=None) >= datetime(2023, 8, 28) or is_backtest) ) ): sell_amount = trade.amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"De-risk (dd0) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk (dd0) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) order_tag = "dd0" for grind_entry_id in ( grind_1_buy_orders + grind_2_buy_orders + grind_3_buy_orders + grind_4_buy_orders + grind_5_buy_orders + grind_6_buy_orders + grind_1_derisk_1_buy_orders + grind_2_derisk_1_buy_orders ): order_tag += " " + str(grind_entry_id) if has_order_tags: return -ft_sell_amount, order_tag else: return -ft_sell_amount return None # Short Grinding Buy # --------------------------------------------------------------------------------------------- def short_grind_buy(self, last_candle: Series, previous_candle: Series, slice_profit: float) -> float: if ( (last_candle["protections_short_global"] == True) and (last_candle["protections_short_rebuy"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) and ( (last_candle["close"] < (last_candle["close_min_12"] * 1.12)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.18)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["btc_pct_close_min_72_5m"] < -0.03) and (last_candle["btc_pct_close_min_24_5m"] < -0.03) ) and ( (last_candle["enter_short"] == True) or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 80.0) and (last_candle["rsi_3_1h"] < 80.0) and (last_candle["rsi_3_4h"] < 80.0) and (last_candle["rsi_14"] > 56.0) and (last_candle["ha_close"] < last_candle["ha_open"]) and (last_candle["ema_12"] > (last_candle["ema_26"] * 1.010)) and (last_candle["cti_20_1h"] > -0.80) and (last_candle["rsi_14_1h"] < 80.0) ) or ( (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.006)) and (last_candle["rsi_3"] < 86.0) and (last_candle["rsi_3_15m"] < 70.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["zlma_50_dec_1h"] == True) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 94.0) and (last_candle["ema_26"] < last_candle["ema_12"]) and ((last_candle["ema_26"] - last_candle["ema_12"]) > (last_candle["open"] * 0.010)) and ((previous_candle["ema_26"] - previous_candle["ema_12"]) > (last_candle["open"] / 100.0)) and (last_candle["rsi_3_1h"] < 80.0) and (last_candle["rsi_3_4h"] < 80.0) and (last_candle["cti_20_1h"] > -0.80) and (last_candle["rsi_14_1h"] > 20.0) ) or ( (last_candle["rsi_14"] < 70.0) and (last_candle["rsi_14"] > 40.0) and (last_candle["hma_70_buy"] == False) and (last_candle["close"] < (last_candle["low_min_12_1h"] * 0.90)) and (last_candle["cti_20_15m"] > -0.50) and (last_candle["rsi_14_15m"] > 50.0) and (last_candle["cti_20_1h"] > -0.80) and (last_candle["rsi_14_1h"] > 20.0) and (last_candle["zlma_50_dec_1h"] == True) and (last_candle["zlma_50_dec_4h"] == True) ) or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 80.0) and (last_candle["rsi_3_1h"] < 80.0) and (last_candle["rsi_3_4h"] < 80.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["zlma_50_dec_15m"] == True) and (last_candle["zlma_50_dec_1h"] == True) ) or ( (last_candle["rsi_14"] > 60.0) and (last_candle["rsi_14_15m"] > 60.0) and (last_candle["rsi_3"] < 94.0) and (last_candle["ema_26_15m"] < last_candle["ema_12_15m"]) and ((last_candle["ema_12_15m"] - last_candle["ema_26_15m"]) > (last_candle["open_15m"] * 0.006)) and ((previous_candle["ema_12_15m"] - previous_candle["ema_26_15m"]) > (last_candle["open_15m"] / 100.0)) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 74.0) and (last_candle["rsi_3_4h"] < 74.0) and (last_candle["cti_20_1h"] > -0.80) and (last_candle["rsi_14_1h"] > 20.0) ) or ( (last_candle["rsi_14"] < 65.0) and (last_candle["rsi_3"] < 96.0) and (last_candle["rsi_3"] > 54.0) and (last_candle["rsi_14"] > previous_candle["rsi_14"]) and (last_candle["close"] > (last_candle["sma_16"] * 1.018)) and (last_candle["cti_20"] > 0.60) and (last_candle["rsi_3_1h"] < 80.0) and (last_candle["rsi_3_4h"] < 80.0) and (last_candle["not_downtrend_1d"] == False) and (last_candle["zlma_50_dec_1h"] == True) ) or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 74.0) and (last_candle["rsi_3_1h"] < 74.0) and (last_candle["rsi_3_4h"] < 74.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["ema_12"] > (last_candle["ema_26"] * 1.006)) and (last_candle["cti_20_1h"] > -0.80) and (last_candle["rsi_14_1h"] > 20.0) and (last_candle["cti_20_4h"] > -0.80) and (last_candle["rsi_14_4h"] > 20.0) and (last_candle["ema_200_dec_48_1h"] == True) ) or ( (last_candle["rsi_14"] > 40.0) and (last_candle["hma_55_buy"] == False) and (last_candle["rsi_3_1h"] < 96.0) and (last_candle["rsi_3_4h"] < 96.0) and (last_candle["cti_20_15m"] > -0.80) and (last_candle["cti_20_1h"] > -0.80) and (last_candle["cti_20_4h"] > -0.80) and (last_candle["rsi_14_1h"] > 20.0) and (last_candle["close"] > (last_candle["low_min_12_1h"] * 1.10)) and (last_candle["zlma_50_dec_1h"] == True) and (last_candle["zlma_50_dec_4h"] == True) ) or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 70.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["cti_20_15m"] > -0.80) and (last_candle["rsi_14_15m"] > 30.0) and (last_candle["cti_20_1h"] > -0.80) and (last_candle["rsi_14_1h"] > 20.0) and (last_candle["cti_20_4h"] > -0.80) and (last_candle["rsi_14_4h"] > 20.0) and (last_candle["r_14_1h"] < -20.0) and (last_candle["ema_12"] > (last_candle["ema_26"] * 1.005)) and (last_candle["zlma_50_dec_1h"] == True) ) or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 70.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["rsi_14_1d"] > 30.0) and (last_candle["close"] > last_candle["sup_level_1h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) and (last_candle["close"] > last_candle["sup_level_1d"]) and (last_candle["not_downtrend_1h"] == False) and (last_candle["not_downtrend_4h"] == False) and (last_candle["not_downtrend_1d"] == False) ) or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 70.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["rsi_14"] > 60.0) and (last_candle["ha_close"] < last_candle["ha_open"]) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) and (last_candle["close"] < last_candle["res_hlevel_1d"]) and (last_candle["close"] > last_candle["sup_level_1d"]) and (last_candle["close"] > last_candle["sup3_1d"]) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.15)) and (last_candle["hl_pct_change_24_1h"] > -0.35) ) or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 70.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["rsi_14"] > 54.0) and (previous_candle["chandelier_dir"] > 0) and (last_candle["chandelier_dir"] < -0) and (last_candle["close"] < last_candle["res_hlevel_4h"]) and (last_candle["close"] > last_candle["sup_level_4h"]) and (last_candle["close"] < last_candle["res_hlevel_1d"]) and (last_candle["close"] > last_candle["sup_level_1d"]) ) ) ): return True return False # Short Grinding Adjust Trade Position No De-Risk # --------------------------------------------------------------------------------------------- def short_adjust_trade_position_no_derisk( self, trade: Trade, enter_tags, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, last_candle: Series, previous_candle: Series, filled_orders: "Orders", filled_entries: "Orders", filled_exits: "Orders", exit_rate: float, slice_amount: float, slice_profit_entry: float, slice_profit: float, profit_ratio: float, profit_stake: float, profit_init_ratio: float, current_stake_amount: float, has_order_tags: bool, **kwargs, ) -> tuple[Optional[float], str, bool]: is_backtest = self.dp.runmode.value in ["backtest", "hyperopt"] max_rebuy_sub_grinds = 0 regular_mode_rebuy_stakes = ( self.regular_mode_rebuy_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_rebuy_stakes_spot.copy() ) regular_mode_rebuy_sub_thresholds = ( self.regular_mode_rebuy_thresholds_futures if self.is_futures_mode else self.regular_mode_rebuy_thresholds_spot ) if (slice_amount * regular_mode_rebuy_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_rebuy_stakes[0] for i, _ in enumerate(regular_mode_rebuy_stakes): regular_mode_rebuy_stakes[i] *= multi max_rebuy_sub_grinds = len(regular_mode_rebuy_stakes) max_grind_1_sub_grinds = 0 regular_mode_grind_1_stakes = ( self.regular_mode_grind_1_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_1_stakes_spot.copy() ) regular_mode_grind_1_sub_thresholds = ( self.regular_mode_grind_1_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_1_thresholds_spot ) if (slice_amount * regular_mode_grind_1_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_1_stakes[0] for i, _ in enumerate(regular_mode_grind_1_stakes): regular_mode_grind_1_stakes[i] *= multi max_grind_1_sub_grinds = len(regular_mode_grind_1_stakes) regular_mode_grind_1_stop_grinds = ( self.regular_mode_grind_1_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_1_stop_grinds_spot ) regular_mode_grind_1_profit_threshold = ( self.regular_mode_grind_1_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_1_profit_threshold_spot ) max_grind_2_sub_grinds = 0 regular_mode_grind_2_stakes = ( self.regular_mode_grind_2_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_2_stakes_spot.copy() ) regular_mode_grind_2_sub_thresholds = ( self.regular_mode_grind_2_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_2_thresholds_spot ) if (slice_amount * regular_mode_grind_2_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_2_stakes[0] for i, _ in enumerate(regular_mode_grind_2_stakes): regular_mode_grind_2_stakes[i] *= multi max_grind_2_sub_grinds = len(regular_mode_grind_2_stakes) regular_mode_grind_2_stop_grinds = ( self.regular_mode_grind_2_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_2_stop_grinds_spot ) regular_mode_grind_2_profit_threshold = ( self.regular_mode_grind_2_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_2_profit_threshold_spot ) max_grind_3_sub_grinds = 0 regular_mode_grind_3_stakes = ( self.regular_mode_grind_3_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_3_stakes_spot.copy() ) regular_mode_grind_3_sub_thresholds = ( self.regular_mode_grind_3_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_3_thresholds_spot ) if (slice_amount * regular_mode_grind_3_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_3_stakes[0] for i, _ in enumerate(regular_mode_grind_3_stakes): regular_mode_grind_3_stakes[i] *= multi max_grind_3_sub_grinds = len(regular_mode_grind_3_stakes) regular_mode_grind_3_stop_grinds = ( self.regular_mode_grind_3_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_3_stop_grinds_spot ) regular_mode_grind_3_profit_threshold = ( self.regular_mode_grind_3_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_3_profit_threshold_spot ) max_grind_4_sub_grinds = 0 regular_mode_grind_4_stakes = ( self.regular_mode_grind_4_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_4_stakes_spot.copy() ) regular_mode_grind_4_sub_thresholds = ( self.regular_mode_grind_4_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_4_thresholds_spot ) if (slice_amount * regular_mode_grind_4_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_4_stakes[0] for i, _ in enumerate(regular_mode_grind_4_stakes): regular_mode_grind_4_stakes[i] *= multi max_grind_4_sub_grinds = len(regular_mode_grind_4_stakes) regular_mode_grind_4_stop_grinds = ( self.regular_mode_grind_4_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_4_stop_grinds_spot ) regular_mode_grind_4_profit_threshold = ( self.regular_mode_grind_4_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_4_profit_threshold_spot ) max_grind_5_sub_grinds = 0 regular_mode_grind_5_stakes = ( self.regular_mode_grind_5_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_5_stakes_spot.copy() ) regular_mode_grind_5_sub_thresholds = ( self.regular_mode_grind_5_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_5_thresholds_spot ) if (slice_amount * regular_mode_grind_5_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_5_stakes[0] for i, _ in enumerate(regular_mode_grind_5_stakes): regular_mode_grind_5_stakes[i] *= multi max_grind_5_sub_grinds = len(regular_mode_grind_5_stakes) regular_mode_grind_5_stop_grinds = ( self.regular_mode_grind_5_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_5_stop_grinds_spot ) regular_mode_grind_5_profit_threshold = ( self.regular_mode_grind_5_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_5_profit_threshold_spot ) max_grind_6_sub_grinds = 0 regular_mode_grind_6_stakes = ( self.regular_mode_grind_6_stakes_futures.copy() if self.is_futures_mode else self.regular_mode_grind_6_stakes_spot.copy() ) regular_mode_grind_6_sub_thresholds = ( self.regular_mode_grind_6_thresholds_futures if self.is_futures_mode else self.regular_mode_grind_6_thresholds_spot ) if (slice_amount * regular_mode_grind_6_stakes[0] / trade.leverage) < min_stake: multi = min_stake / slice_amount / regular_mode_grind_6_stakes[0] for i, _ in enumerate(regular_mode_grind_6_stakes): regular_mode_grind_6_stakes[i] *= multi max_grind_6_sub_grinds = len(regular_mode_grind_6_stakes) regular_mode_grind_6_stop_grinds = ( self.regular_mode_grind_6_stop_grinds_futures if self.is_futures_mode else self.regular_mode_grind_6_stop_grinds_spot ) regular_mode_grind_6_profit_threshold = ( self.regular_mode_grind_6_profit_threshold_futures if self.is_futures_mode else self.regular_mode_grind_6_profit_threshold_spot ) partial_sell = False is_derisk = False is_derisk_1 = False rebuy_sub_grind_count = 0 rebuy_total_amount = 0.0 rebuy_total_cost = 0.0 rebuy_current_open_rate = 0.0 rebuy_current_grind_stake = 0.0 rebuy_current_grind_stake_profit = 0.0 rebuy_is_sell_found = False rebuy_found = False rebuy_buy_orders = [] rebuy_distance_ratio = 0.0 grind_1_sub_grind_count = 0 grind_1_total_amount = 0.0 grind_1_total_cost = 0.0 grind_1_current_open_rate = 0.0 grind_1_current_grind_stake = 0.0 grind_1_current_grind_stake_profit = 0.0 grind_1_is_sell_found = False grind_1_found = False grind_1_buy_orders = [] grind_1_distance_ratio = 0.0 grind_2_sub_grind_count = 0 grind_2_total_amount = 0.0 grind_2_total_cost = 0.0 grind_2_current_open_rate = 0.0 grind_2_current_grind_stake = 0.0 grind_2_current_grind_stake_profit = 0.0 grind_2_is_sell_found = False grind_2_found = False grind_2_buy_orders = [] grind_2_distance_ratio = 0.0 grind_3_sub_grind_count = 0 grind_3_total_amount = 0.0 grind_3_total_cost = 0.0 grind_3_current_open_rate = 0.0 grind_3_current_grind_stake = 0.0 grind_3_current_grind_stake_profit = 0.0 grind_3_is_sell_found = False grind_3_found = False grind_3_buy_orders = [] grind_3_distance_ratio = 0.0 grind_4_sub_grind_count = 0 grind_4_total_amount = 0.0 grind_4_total_cost = 0.0 grind_4_current_open_rate = 0.0 grind_4_current_grind_stake = 0.0 grind_4_current_grind_stake_profit = 0.0 grind_4_is_sell_found = False grind_4_found = False grind_4_buy_orders = [] grind_4_distance_ratio = 0.0 grind_5_sub_grind_count = 0 grind_5_total_amount = 0.0 grind_5_total_cost = 0.0 grind_5_current_open_rate = 0.0 grind_5_current_grind_stake = 0.0 grind_5_current_grind_stake_profit = 0.0 grind_5_is_sell_found = False grind_5_found = False grind_5_buy_orders = [] grind_5_distance_ratio = 0.0 grind_6_sub_grind_count = 0 grind_6_total_amount = 0.0 grind_6_total_cost = 0.0 grind_6_current_open_rate = 0.0 grind_6_current_grind_stake = 0.0 grind_6_current_grind_stake_profit = 0.0 grind_6_is_sell_found = False grind_6_found = False grind_6_buy_orders = [] grind_6_distance_ratio = 0.0 for order in reversed(filled_orders): if (order.ft_order_side == "sell") and (order is not filled_orders[0]): order_tag = "" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag if not grind_1_is_sell_found and order_tag == "g1": grind_1_sub_grind_count += 1 grind_1_total_amount += order.safe_filled grind_1_total_cost += order.safe_filled * order.safe_price grind_1_buy_orders.append(order.id) if not grind_1_found: grind_1_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_1_found = True elif not grind_2_is_sell_found and order_tag == "g2": grind_2_sub_grind_count += 1 grind_2_total_amount += order.safe_filled grind_2_total_cost += order.safe_filled * order.safe_price grind_2_buy_orders.append(order.id) if not grind_2_found: grind_2_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_2_found = True elif not grind_3_is_sell_found and order_tag == "g3": grind_3_sub_grind_count += 1 grind_3_total_amount += order.safe_filled grind_3_total_cost += order.safe_filled * order.safe_price grind_3_buy_orders.append(order.id) if not grind_3_found: grind_3_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_3_found = True elif not grind_4_is_sell_found and order_tag == "g4": grind_4_sub_grind_count += 1 grind_4_total_amount += order.safe_filled grind_4_total_cost += order.safe_filled * order.safe_price grind_4_buy_orders.append(order.id) if not grind_4_found: grind_4_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_4_found = True elif not grind_5_is_sell_found and order_tag == "g5": grind_5_sub_grind_count += 1 grind_5_total_amount += order.safe_filled grind_5_total_cost += order.safe_filled * order.safe_price grind_5_buy_orders.append(order.id) if not grind_5_found: grind_5_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_5_found = True elif not grind_6_is_sell_found and order_tag == "g6": grind_6_sub_grind_count += 1 grind_6_total_amount += order.safe_filled grind_6_total_cost += order.safe_filled * order.safe_price grind_6_buy_orders.append(order.id) if not grind_6_found: grind_6_distance_ratio = (exit_rate - order.safe_price) / order.safe_price grind_6_found = True elif not rebuy_is_sell_found and order_tag not in [ "g1", "g2", "g3", "g4", "g5", "g6", "dl1", "dl2", "gd1", "gd2", "gd3", "gd4", "gd5", "gd6", "gm0", "gmd0", ]: rebuy_sub_grind_count += 1 rebuy_total_amount += order.safe_filled rebuy_total_cost += order.safe_filled * order.safe_price rebuy_buy_orders.append(order.id) if not rebuy_found: rebuy_distance_ratio = (exit_rate - order.safe_price) / order.safe_price rebuy_found = True elif order.ft_order_side == "buy": if ( order is filled_exits[-1] and (order.safe_remaining * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) > min_stake ): partial_sell = True break order_tag = "" if has_order_tags: if order.ft_order_tag is not None: sell_order_tag = order.ft_order_tag order_mode = sell_order_tag.split(" ", 1) if len(order_mode) > 0: order_tag = order_mode[0] if order_tag == "g1": grind_1_is_sell_found = True elif order_tag == "g2": grind_2_is_sell_found = True elif order_tag == "g3": grind_3_is_sell_found = True elif order_tag == "g4": grind_4_is_sell_found = True elif order_tag == "g5": grind_5_is_sell_found = True elif order_tag == "g6": grind_6_is_sell_found = True elif order_tag in ["d", "d1", "dd0", "ddl1", "ddl2", "dd1", "dd2", "dd3", "dd4", "dd5", "dd6"]: is_derisk = True if order_tag in ["d1"]: is_derisk_1 = True grind_1_is_sell_found = True grind_2_is_sell_found = True grind_3_is_sell_found = True grind_4_is_sell_found = True grind_5_is_sell_found = True grind_6_is_sell_found = True rebuy_is_sell_found = True elif order_tag not in [ "p", "g1", "g2", "g3", "g4", "g5", "g6", "dl1", "dl2", "gd1", "gd2", "gd3", "gd4", "gd5", "gd6", "gm0", "gmd0", ]: rebuy_is_sell_found = True if not is_derisk: start_amount = filled_orders[0].safe_filled current_amount = 0.0 for order2 in filled_orders: if order2.ft_order_side == "sell": current_amount += order2.safe_filled elif order2.ft_order_side == "buy": current_amount -= order2.safe_filled if order2 is order: if current_amount < (start_amount * 0.95): is_derisk = True # found sells for all modes if ( rebuy_is_sell_found and grind_1_is_sell_found and grind_2_is_sell_found and grind_3_is_sell_found and grind_4_is_sell_found and grind_5_is_sell_found and grind_6_is_sell_found ): break # The trade already de-risked if is_derisk: return None, "", is_derisk if not has_order_tags and len(filled_exits) > 0: return None, "", is_derisk if rebuy_sub_grind_count > 0: rebuy_current_open_rate = rebuy_total_cost / rebuy_total_amount rebuy_current_grind_stake = rebuy_total_amount * exit_rate * (1 + trade.fee_close) rebuy_current_grind_stake_profit = rebuy_total_cost - rebuy_current_grind_stake if grind_1_sub_grind_count > 0: grind_1_current_open_rate = grind_1_total_cost / grind_1_total_amount grind_1_current_grind_stake = grind_1_total_amount * exit_rate * (1 + trade.fee_close) grind_1_current_grind_stake_profit = grind_1_total_cost - grind_1_current_grind_stake if grind_2_sub_grind_count > 0: grind_2_current_open_rate = grind_2_total_cost / grind_2_total_amount grind_2_current_grind_stake = grind_2_total_amount * exit_rate * (1 + trade.fee_close) grind_2_current_grind_stake_profit = grind_2_total_cost - grind_2_current_grind_stake if grind_3_sub_grind_count > 0: grind_3_current_open_rate = grind_3_total_cost / grind_3_total_amount grind_3_current_grind_stake = grind_3_total_amount * exit_rate * (1 + trade.fee_close) grind_3_current_grind_stake_profit = grind_3_total_cost - grind_3_current_grind_stake if grind_4_sub_grind_count > 0: grind_4_current_open_rate = grind_4_total_cost / grind_4_total_amount grind_4_current_grind_stake = grind_4_total_amount * exit_rate * (1 + trade.fee_close) grind_4_current_grind_stake_profit = grind_4_total_cost - grind_4_current_grind_stake if grind_5_sub_grind_count > 0: grind_5_current_open_rate = grind_5_total_cost / grind_5_total_amount grind_5_current_grind_stake = grind_5_total_amount * exit_rate * (1 + trade.fee_close) grind_5_current_grind_stake_profit = grind_5_total_cost - grind_5_current_grind_stake if grind_6_sub_grind_count > 0: grind_6_current_open_rate = grind_6_total_cost / grind_6_total_amount grind_6_current_grind_stake = grind_6_total_amount * exit_rate * (1 + trade.fee_close) grind_6_current_grind_stake_profit = grind_6_total_cost - grind_6_current_grind_stake num_open_grinds = ( grind_1_sub_grind_count + grind_2_sub_grind_count + grind_3_sub_grind_count + grind_4_sub_grind_count + grind_5_sub_grind_count + grind_6_sub_grind_count ) fee_open_rate = trade.fee_open if self.custom_fee_open_rate is None else self.custom_fee_open_rate fee_close_rate = trade.fee_close if self.custom_fee_close_rate is None else self.custom_fee_close_rate # Sell remaining if partial fill on exit if partial_sell: order = filled_exits[-1] sell_amount = order.safe_remaining * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Exit (remaining) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {order.safe_remaining} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) order_tag = "p" if has_order_tags: if order.ft_order_tag is not None: order_tag = order.ft_order_tag return -ft_sell_amount, order_tag, is_derisk is_short_grind_buy = self.short_grind_buy(last_candle, previous_candle, slice_profit) # Rebuy if (not partial_sell) and (not rebuy_is_sell_found) and (rebuy_sub_grind_count < max_rebuy_sub_grinds): if ( (0 <= rebuy_sub_grind_count < max_rebuy_sub_grinds) and (slice_profit_entry < regular_mode_rebuy_sub_thresholds[rebuy_sub_grind_count]) and ( (-rebuy_distance_ratio if (rebuy_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_rebuy_sub_thresholds[rebuy_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=12) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( (last_candle["close"] < (last_candle["close_min_12"] * 1.06)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.08)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.10)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.12)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.14)) and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.16)) and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.18)) and (last_candle["btc_pct_close_min_72_5m"] > -0.03) and (last_candle["btc_pct_close_min_24_5m"] > -0.03) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 70.0) and (last_candle["rsi_3_15m"] < 70.0) and (last_candle["rsi_3_1h"] < 70.0) and (last_candle["rsi_3_4h"] < 70.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["zlma_50_dec_1h"] == True) and (last_candle["zlma_50_dec_4h"] == True) ) ) ): buy_amount = ( slice_amount * regular_mode_rebuy_stakes[rebuy_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount > max_stake: buy_amount = max_stake if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk self.dp.send_msg( f"Rebuy (r) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"Rebuy (r) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) order_tag = "r" return buy_amount, order_tag, is_derisk # Grinding g1 # Grinding entry if has_order_tags and (not partial_sell) and (grind_1_sub_grind_count < max_grind_1_sub_grinds): if ( ( (-grind_1_distance_ratio if (grind_1_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_1_sub_thresholds[grind_1_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) # and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.24)) # and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.30)) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 84.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 80.0) and (last_candle["rsi_3_4h"] < 80.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_1h"] == True) # and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.014)) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) # and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g1" return buy_amount, order_tag, is_derisk if ( self.is_futures_mode and has_order_tags and (not partial_sell) and slice_profit > (0.65 / trade.leverage) and (grind_1_sub_grind_count < max_grind_1_sub_grinds) ): buy_amount = ( slice_amount * regular_mode_grind_1_stakes[grind_1_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate grind_profit_stake = grind_1_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g1) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g1) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_1_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g1" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_1_sub_grind_count > 0: grind_profit = -(exit_rate - grind_1_current_open_rate) / grind_1_current_open_rate if grind_profit > (regular_mode_grind_1_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_1_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_1_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g1" for grind_entry_id in grind_1_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g2 # Grinding entry if has_order_tags and (not partial_sell) and (grind_2_sub_grind_count < max_grind_2_sub_grinds): if ( ( (-grind_2_distance_ratio if (grind_2_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_2_sub_thresholds[grind_2_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) # and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.24)) # and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.30)) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 84.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 80.0) and (last_candle["rsi_3_4h"] < 80.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_1h"] == True) # and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.014)) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) # and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_2_stakes[grind_2_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_2_sub_grind_count > 0: grind_profit = -(exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate grind_profit_stake = grind_2_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g2) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g2) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_2_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g2" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_2_sub_grind_count > 0: grind_profit = -(exit_rate - grind_2_current_open_rate) / grind_2_current_open_rate if grind_profit > (regular_mode_grind_2_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_2_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g2) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g2) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_2_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g2" for grind_entry_id in grind_2_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g3 # Grinding entry if has_order_tags and (not partial_sell) and (grind_3_sub_grind_count < max_grind_3_sub_grinds): if ( ( (-grind_3_distance_ratio if (grind_3_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_3_sub_thresholds[grind_3_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) # and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.24)) # and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.30)) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 84.0) and (last_candle["rsi_3_4h"] < 84.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_1h"] == True) # and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.014)) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) # and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (num_open_grinds == 0) and (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 84.0) and (last_candle["rsi_3_4h"] < 84.0) and (last_candle["rsi_14_15m"] > 60.0) and (previous_candle["chandelier_dir"] > 0) and (last_candle["chandelier_dir"] < -0) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_3_stakes[grind_3_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_3_sub_grind_count > 0: grind_profit = -(exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate grind_profit_stake = grind_3_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g3) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g3) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_3_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g3" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_3_sub_grind_count > 0: grind_profit = -(exit_rate - grind_3_current_open_rate) / grind_3_current_open_rate if grind_profit > (regular_mode_grind_3_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_3_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g3) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g3) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_3_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g3" for grind_entry_id in grind_3_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g4 # Grinding entry if has_order_tags and (not partial_sell) and (grind_4_sub_grind_count < max_grind_4_sub_grinds): if ( ( (-grind_4_distance_ratio if (grind_4_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_4_sub_thresholds[grind_4_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) # and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.24)) # and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.30)) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 84.0) and (last_candle["rsi_3_4h"] < 84.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_1h"] == True) # and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.014)) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) # and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_4_stakes[grind_4_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_4_sub_grind_count > 0: grind_profit = -(exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate grind_profit_stake = grind_4_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g4) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g4) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_4_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g4" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_4_sub_grind_count > 0: grind_profit = -(exit_rate - grind_4_current_open_rate) / grind_4_current_open_rate if grind_profit > (regular_mode_grind_4_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_4_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g4) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g4) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_4_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g4" for grind_entry_id in grind_4_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g5 # Grinding entry if has_order_tags and (not partial_sell) and (grind_5_sub_grind_count < max_grind_5_sub_grinds): if ( ( (-grind_5_distance_ratio if (grind_5_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_5_sub_thresholds[grind_5_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) and ( (last_candle["protections_short_rebuy"] == True) and (last_candle["protections_short_global"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) # and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.24)) # and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.30)) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 84.0) and (last_candle["rsi_3_4h"] < 84.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_1h"] == True) # and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.014)) ) ) ) or ( (slice_profit > 0.06) and (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) # and (last_candle["rsi_14"] < 72.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_5_stakes[grind_5_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_5_sub_grind_count > 0: grind_profit = -(exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate grind_profit_stake = grind_5_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g5) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g5) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_5_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g5" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_5_sub_grind_count > 0: grind_profit = -(exit_rate - grind_5_current_open_rate) / grind_5_current_open_rate if grind_profit > (regular_mode_grind_5_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_5_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g5) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g5) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_5_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g5" for grind_entry_id in grind_5_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # Grinding g6 # Grinding entry if has_order_tags and (not partial_sell) and (grind_6_sub_grind_count < max_grind_6_sub_grinds): if ( ( (-grind_6_distance_ratio if (grind_6_sub_grind_count > 0) else profit_init_ratio) < (regular_mode_grind_6_sub_thresholds[grind_6_sub_grind_count]) ) and (current_time - timedelta(minutes=10) > filled_entries[-1].order_filled_utc) and ((current_time - timedelta(hours=2) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.02)) and ( (num_open_grinds == 0) or (current_time - timedelta(hours=6) > filled_orders[-1].order_filled_utc) or (slice_profit > 0.06) ) # and ((num_open_grinds == 0) or (slice_profit > 0.03)) # and ( # (last_candle["protections_short_rebuy"] == True) # and (last_candle["protections_short_global"] == True) # and (last_candle["global_protections_short_pump"] == True) # and (last_candle["global_protections_short_dump"] == True) # ) and ( ( ( (last_candle["close"] < (last_candle["close_min_12"] * 1.16)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.20)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.24)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.26)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.30)) # and (last_candle["close"] < (last_candle["low_min_6_1d"] * 1.24)) # and (last_candle["close"] < (last_candle["low_min_12_1d"] * 1.30)) ) and ( is_short_grind_buy or ( (last_candle["rsi_3"] < 88.0) and (last_candle["rsi_3_15m"] < 84.0) and (last_candle["rsi_3_1h"] < 84.0) and (last_candle["rsi_3_4h"] < 84.0) and (last_candle["rsi_14"] > 64.0) # and (last_candle["zlma_50_dec_1h"] == True) # and (last_candle["zlma_50_dec_4h"] == True) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) or ( (last_candle["rsi_14"] > 64.0) and (previous_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["close"] > (last_candle["sma_16"] * 1.014)) ) ) ) or ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > last_candle["bb20_2_mid"]) and (previous_candle["close"] > previous_candle["bb20_2_mid"]) ) ) ): buy_amount = ( slice_amount * regular_mode_grind_6_stakes[grind_6_sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 if buy_amount > max_stake: return None, "", is_derisk grind_profit = 0.0 grind_profit_stake = 0.0 if grind_6_sub_grind_count > 0: grind_profit = -(exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate grind_profit_stake = grind_6_current_grind_stake_profit self.dp.send_msg( f"Grinding entry (g6) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) log.info( f"Grinding entry (g6) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_6_current_grind_stake_profit} {self.config['stake_currency']})" ) order_tag = "g6" return buy_amount, order_tag, is_derisk # Grinding Exit if has_order_tags and grind_6_sub_grind_count > 0: grind_profit = -(exit_rate - grind_6_current_open_rate) / grind_6_current_open_rate if grind_profit > (regular_mode_grind_6_profit_threshold + fee_open_rate + fee_close_rate): sell_amount = grind_6_total_amount * exit_rate / trade.leverage if ((current_stake_amount / trade.leverage) - sell_amount) < (min_stake * 1.55): sell_amount = (trade.amount * exit_rate / trade.leverage) - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Grinding exit (g6) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) log.info( f"Grinding exit (g6) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Coin amount: {grind_6_total_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}% | Grind profit: {(grind_profit * 100.0):.2f}% ({grind_profit * sell_amount * trade.leverage} {self.config['stake_currency']})" ) order_tag = "g6" for grind_entry_id in grind_6_buy_orders: order_tag += " " + str(grind_entry_id) return -ft_sell_amount, order_tag, is_derisk # De-risk if profit_stake < ( slice_amount * ( (self.regular_mode_derisk_futures if self.is_futures_mode else self.regular_mode_derisk_spot) if (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 3, 19) or is_backtest) else (self.regular_mode_derisk_futures_old if self.is_futures_mode else self.regular_mode_derisk_spot_old) ) / (trade.leverage if self.is_futures_mode else 1.0) ): sell_amount = trade.amount * exit_rate / trade.leverage - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d", is_derisk # De-risk level 1 if ( has_order_tags and not is_derisk_1 and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 4, 5) or is_backtest) and profit_stake < ( slice_amount * (self.regular_mode_derisk_1_futures if self.is_futures_mode else self.regular_mode_derisk_1_spot) / (trade.leverage if self.is_futures_mode else 1.0) ) ): sell_amount = trade.amount * exit_rate / trade.leverage - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: grind_profit = 0.0 self.dp.send_msg( f"De-risk (d1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"De-risk (d1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) return -ft_sell_amount, "d1", is_derisk return None, "", is_derisk # Short Rebuy Adjust Trade Position # --------------------------------------------------------------------------------------------- def short_rebuy_adjust_trade_position( self, trade: Trade, enter_tags, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, **kwargs, ) -> Optional[float]: min_stake = self.correct_min_stake(min_stake) # min/max stakes include leverage. The return amounts is before leverage. min_stake /= trade.leverage max_stake /= trade.leverage df, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe) if len(df) < 2: return None last_candle = df.iloc[-1].squeeze() previous_candle = df.iloc[-2].squeeze() filled_orders = trade.select_filled_orders() filled_entries = trade.select_filled_orders(trade.entry_side) filled_exits = trade.select_filled_orders(trade.exit_side) count_of_entries = trade.nr_of_successful_entries count_of_exits = trade.nr_of_successful_exits if count_of_entries == 0: return None has_order_tags = False if hasattr(filled_orders[0], "ft_order_tag"): has_order_tags = True # The first exit is de-risk (providing the trade is still open) if count_of_exits > 0: return self.short_grind_adjust_trade_position( trade, enter_tags, current_time, current_rate, current_profit, min_stake, max_stake, current_entry_rate, current_exit_rate, current_entry_profit, current_exit_profit, ) exit_rate = current_rate if self.dp.runmode.value in ("live", "dry_run"): ticker = self.dp.ticker(trade.pair) if ("bid" in ticker) and ("ask" in ticker): if trade.is_short: if self.config["exit_pricing"]["price_side"] in ["ask", "other"]: if ticker["ask"] is not None: exit_rate = ticker["ask"] else: if self.config["exit_pricing"]["price_side"] in ["bid", "other"]: if ticker["bid"] is not None: exit_rate = ticker["bid"] profit_stake, profit_ratio, profit_current_stake_ratio, profit_init_ratio = self.calc_total_profit( trade, filled_entries, filled_exits, exit_rate ) slice_amount = filled_entries[0].cost slice_profit = (exit_rate - filled_orders[-1].safe_price) / filled_orders[-1].safe_price slice_profit_entry = (exit_rate - filled_entries[-1].safe_price) / filled_entries[-1].safe_price slice_profit_exit = ( ((exit_rate - filled_exits[-1].safe_price) / filled_exits[-1].safe_price) if count_of_exits > 0 else 0.0 ) current_stake_amount = trade.amount * current_rate is_rebuy = False rebuy_mode_stakes = self.rebuy_mode_stakes_futures if self.is_futures_mode else self.rebuy_mode_stakes_spot max_sub_grinds = len(rebuy_mode_stakes) rebuy_mode_sub_thresholds = ( self.rebuy_mode_thresholds_futures if self.is_futures_mode else self.rebuy_mode_thresholds_spot ) partial_sell = False sub_grind_count = 0 total_amount = 0.0 total_cost = 0.0 current_open_rate = 0.0 current_grind_stake = 0.0 current_grind_stake_profit = 0.0 for order in reversed(filled_orders): if (order.ft_order_side == "buy") and (order is not filled_orders[0]): sub_grind_count += 1 total_amount += order.safe_filled total_cost += order.safe_filled * order.safe_price elif order.ft_order_side == "sell": if (order.safe_remaining * exit_rate / (trade.leverage if self.is_futures_mode else 1.0)) > min_stake: partial_sell = True break if sub_grind_count > 0: current_open_rate = total_cost / total_amount current_grind_stake = total_amount * exit_rate * (1 - trade.fee_close) current_grind_stake_profit = current_grind_stake - total_cost if (not partial_sell) and (sub_grind_count < max_sub_grinds): if ( ((0 <= sub_grind_count < max_sub_grinds) and (slice_profit_entry < rebuy_mode_sub_thresholds[sub_grind_count])) and (last_candle["protections_short_global"] == True) and (last_candle["protections_short_rebuy"] == True) and (last_candle["global_protections_short_pump"] == True) and (last_candle["global_protections_short_dump"] == True) and ( (last_candle["close"] < (last_candle["close_min_12"] * 1.06)) and (last_candle["close"] < (last_candle["close_min_24"] * 1.08)) and (last_candle["close"] < (last_candle["close_min_48"] * 1.10)) and (last_candle["close"] < (last_candle["low_min_24_1h"] * 1.12)) and (last_candle["close"] < (last_candle["low_min_48_1h"] * 1.14)) and (last_candle["btc_pct_close_min_72_5m"] > 0.03) and (last_candle["btc_pct_close_min_24_5m"] > 0.03) ) and ( (last_candle["rsi_3"] < 90.0) and (last_candle["rsi_3_15m"] < 90.0) and (last_candle["rsi_3_1h"] < 90.0) and (last_candle["rsi_3_4h"] < 90.0) and (last_candle["rsi_14"] > 64.0) and (last_candle["close"] > (last_candle["ema_26"] * 1.012)) ) ): buy_amount = ( slice_amount * rebuy_mode_stakes[sub_grind_count] / (trade.leverage if self.is_futures_mode else 1.0) ) if buy_amount > max_stake: buy_amount = max_stake if buy_amount < (min_stake * 1.5): buy_amount = min_stake * 1.5 self.dp.send_msg( f"Rebuy (r) [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"Rebuy (r) [{current_time}] [{trade.pair}] | Rate: {current_rate} | Stake amount: {buy_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) if has_order_tags: return buy_amount, "r" else: return buy_amount if profit_stake < ( slice_amount * (self.rebuy_mode_derisk_futures if self.is_futures_mode else self.rebuy_mode_derisk_spot) / (trade.leverage if self.is_futures_mode else 1.0) ): sell_amount = trade.amount * exit_rate / trade.leverage - (min_stake * 1.55) ft_sell_amount = sell_amount * trade.leverage * (trade.stake_amount / trade.amount) / exit_rate if sell_amount > min_stake and ft_sell_amount > min_stake: self.dp.send_msg( f"Rebuy de-risk (d1) [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) log.info( f"Rebuy de-risk (d1) [{current_time}] [{trade.pair}] | Rate: {exit_rate} | Stake amount: {sell_amount} | Profit (stake): {profit_stake} | Profit: {(profit_ratio * 100.0):.2f}%" ) if has_order_tags: return -ft_sell_amount, "d1" else: return -ft_sell_amount return None ############################################################################################### # SHORT GRIND FUNCTIONS ENDS HERE ############################################################################################### # +---------------------------------------------------------------------------+ # | Custom Indicators | # +---------------------------------------------------------------------------+ # Range midpoint acts as Support # --------------------------------------------------------------------------------------------- def is_support(row_data) -> bool: conditions = [] for row in range(len(row_data) - 1): if row < len(row_data) // 2: conditions.append(row_data[row] > row_data[row + 1]) else: conditions.append(row_data[row] < row_data[row + 1]) result = reduce(lambda x, y: x & y, conditions) return result # Range midpoint acts as Resistance # --------------------------------------------------------------------------------------------- def is_resistance(row_data) -> bool: conditions = [] for row in range(len(row_data) - 1): if row < len(row_data) // 2: conditions.append(row_data[row] < row_data[row + 1]) else: conditions.append(row_data[row] > row_data[row + 1]) result = reduce(lambda x, y: x & y, conditions) return result # Elliot Wave Oscillator # --------------------------------------------------------------------------------------------- def ewo(df, ema1_length=5, ema2_length=35): ema1 = ta.EMA(df, timeperiod=ema1_length) ema2 = ta.EMA(df, timeperiod=ema2_length) emadiff = (ema1 - ema2) / df["close"] * 100.0 return emadiff # Pivot Points - 3 variants - daily recommended # --------------------------------------------------------------------------------------------- def pivot_points(df: DataFrame, mode="fibonacci") -> Series: if mode == "simple": hlc3_pivot = (df["high"] + df["low"] + df["close"]).shift(1) / 3 res1 = hlc3_pivot * 2 - df["low"].shift(1) sup1 = hlc3_pivot * 2 - df["high"].shift(1) res2 = hlc3_pivot + (df["high"] - df["low"]).shift() sup2 = hlc3_pivot - (df["high"] - df["low"]).shift() res3 = hlc3_pivot * 2 + (df["high"] - 2 * df["low"]).shift() sup3 = hlc3_pivot * 2 - (2 * df["high"] - df["low"]).shift() return hlc3_pivot, res1, res2, res3, sup1, sup2, sup3 elif mode == "fibonacci": hlc3_pivot = (df["high"] + df["low"] + df["close"]).shift(1) / 3 hl_range = (df["high"] - df["low"]).shift(1) res1 = hlc3_pivot + 0.382 * hl_range sup1 = hlc3_pivot - 0.382 * hl_range res2 = hlc3_pivot + 0.618 * hl_range sup2 = hlc3_pivot - 0.618 * hl_range res3 = hlc3_pivot + 1 * hl_range sup3 = hlc3_pivot - 1 * hl_range return hlc3_pivot, res1, res2, res3, sup1, sup2, sup3 elif mode == "DeMark": demark_pivot_lt = df["low"] * 2 + df["high"] + df["close"] demark_pivot_eq = df["close"] * 2 + df["low"] + df["high"] demark_pivot_gt = df["high"] * 2 + df["low"] + df["close"] demark_pivot = np.where( (df["close"] < df["open"]), demark_pivot_lt, np.where((df["close"] > df["open"]), demark_pivot_gt, demark_pivot_eq), ) dm_pivot = demark_pivot / 4 dm_res = demark_pivot / 2 - df["low"] dm_sup = demark_pivot / 2 - df["high"] return dm_pivot, dm_res, dm_sup # Heikin Ashi candles # --------------------------------------------------------------------------------------------- def heikin_ashi(df, smooth_inputs=False, smooth_outputs=False, length=10): df = df[["open", "close", "high", "low"]].copy().fillna(0) if smooth_inputs: df["open_s"] = ta.EMA(df["open"], timeframe=length) df["high_s"] = ta.EMA(df["high"], timeframe=length) df["low_s"] = ta.EMA(df["low"], timeframe=length) df["close_s"] = ta.EMA(df["close"], timeframe=length) open_ha = (df["open_s"].shift(1) + df["close_s"].shift(1)) / 2 high_ha = df.loc[:, ["high_s", "open_s", "close_s"]].max(axis=1) low_ha = df.loc[:, ["low_s", "open_s", "close_s"]].min(axis=1) close_ha = (df["open_s"] + df["high_s"] + df["low_s"] + df["close_s"]) / 4 else: open_ha = (df["open"].shift(1) + df["close"].shift(1)) / 2 high_ha = df.loc[:, ["high", "open", "close"]].max(axis=1) low_ha = df.loc[:, ["low", "open", "close"]].min(axis=1) close_ha = (df["open"] + df["high"] + df["low"] + df["close"]) / 4 open_ha = open_ha.fillna(0) high_ha = high_ha.fillna(0) low_ha = low_ha.fillna(0) close_ha = close_ha.fillna(0) if smooth_outputs: open_sha = ta.EMA(open_ha, timeframe=length) high_sha = ta.EMA(high_ha, timeframe=length) low_sha = ta.EMA(low_ha, timeframe=length) close_sha = ta.EMA(close_ha, timeframe=length) return open_sha, close_sha, low_sha else: return open_ha, close_ha, low_ha # Peak Percentage Change # --------------------------------------------------------------------------------------------- def range_percent_change(self, df: DataFrame, method, length: int) -> float: """ Rolling Percentage Change Maximum across interval. :param df: DataFrame The original OHLC df :param method: High to Low / Open to Close :param length: int The length to look back """ if method == "HL": return (df["high"].rolling(length).max() - df["low"].rolling(length).min()) / df["low"].rolling(length).min() elif method == "OC": return (df["open"].rolling(length).max() - df["close"].rolling(length).min()) / df["close"].rolling(length).min() else: raise ValueError(f"Method {method} not defined!") # Percentage distance to top peak # --------------------------------------------------------------------------------------------- def top_percent_change(self, df: DataFrame, length: int) -> float: """ Percentage change of the current close from the range maximum Open price :param df: DataFrame The original OHLC df :param length: int The length to look back """ if length == 0: return (df["open"] - df["close"]) / df["close"] else: return (df["open"].rolling(length).max() - df["close"]) / df["close"] # +---------------------------------------------------------------------------+ # | Classes | # +---------------------------------------------------------------------------+ # Cache Class # --------------------------------------------------------------------------------------------- class Cache: def __init__(self, path): self.path = path self.data = {} self._mtime = None self._previous_data = {} try: self.load() except FileNotFoundError: pass @staticmethod def rapidjson_load_kwargs(): return {"number_mode": rapidjson.NM_NATIVE, "parse_mode": rapidjson.PM_COMMENTS | rapidjson.PM_TRAILING_COMMAS} @staticmethod def rapidjson_dump_kwargs(): return {"number_mode": rapidjson.NM_NATIVE} def load(self): if not self._mtime or self.path.stat().st_mtime_ns != self._mtime: self._load() def save(self): if self.data != self._previous_data: self._save() def process_loaded_data(self, data): return data def _load(self): # This method only exists to simplify unit testing with self.path.open("r") as rfh: try: data = rapidjson.load(rfh, **self.rapidjson_load_kwargs()) except rapidjson.JSONDecodeError as exc: log.error("Failed to load JSON from %s: %s", self.path, exc) else: self.data = self.process_loaded_data(data) self._previous_data = copy.deepcopy(self.data) self._mtime = self.path.stat().st_mtime_ns def _save(self): # This method only exists to simplify unit testing rapidjson.dump(self.data, self.path.open("w"), **self.rapidjson_dump_kwargs()) self._mtime = self.path.stat().st_mtime self._previous_data = copy.deepcopy(self.data) class HoldsCache(Cache): @staticmethod def rapidjson_load_kwargs(): return { "number_mode": rapidjson.NM_NATIVE, "parse_mode": rapidjson.PM_COMMENTS | rapidjson.PM_TRAILING_COMMAS, "object_hook": HoldsCache._object_hook, } @staticmethod def rapidjson_dump_kwargs(): return { "number_mode": rapidjson.NM_NATIVE, "mapping_mode": rapidjson.MM_COERCE_KEYS_TO_STRINGS, } def save(self): raise RuntimeError("The holds cache does not allow programatical save") def process_loaded_data(self, data): trade_ids = data.get("trade_ids") trade_pairs = data.get("trade_pairs") if not trade_ids and not trade_pairs: return data open_trades = {} for trade in Trade.get_trades_proxy(is_open=True): open_trades[trade.id] = open_trades[trade.pair] = trade r_trade_ids = {} if trade_ids: if isinstance(trade_ids, dict): # New syntax for trade_id, profit_ratio in trade_ids.items(): if not isinstance(trade_id, int): log.error("The trade_id(%s) defined under 'trade_ids' in %s is not an integer", trade_id, self.path) continue if not isinstance(profit_ratio, float): log.error( "The 'profit_ratio' config value(%s) for trade_id %s in %s is not a float", profit_ratio, trade_id, self.path, ) if trade_id in open_trades: formatted_profit_ratio = f"{profit_ratio * 100}%" log.warning( "The trade %s is configured to HOLD until the profit ratio of %s is met", open_trades[trade_id], formatted_profit_ratio, ) r_trade_ids[trade_id] = profit_ratio else: log.warning( "The trade_id(%s) is no longer open. Please remove it from 'trade_ids' in %s", trade_id, self.path, ) else: # Initial Syntax profit_ratio = data.get("profit_ratio") if profit_ratio: if not isinstance(profit_ratio, float): log.error("The 'profit_ratio' config value(%s) in %s is not a float", profit_ratio, self.path) else: profit_ratio = 0.005 formatted_profit_ratio = f"{profit_ratio * 100}%" for trade_id in trade_ids: if not isinstance(trade_id, int): log.error("The trade_id(%s) defined under 'trade_ids' in %s is not an integer", trade_id, self.path) continue if trade_id in open_trades: log.warning( "The trade %s is configured to HOLD until the profit ratio of %s is met", open_trades[trade_id], formatted_profit_ratio, ) r_trade_ids[trade_id] = profit_ratio else: log.warning( "The trade_id(%s) is no longer open. Please remove it from 'trade_ids' in %s", trade_id, self.path, ) r_trade_pairs = {} if trade_pairs: for trade_pair, profit_ratio in trade_pairs.items(): if not isinstance(trade_pair, str): log.error("The trade_pair(%s) defined under 'trade_pairs' in %s is not a string", trade_pair, self.path) continue if "/" not in trade_pair: log.error( "The trade_pair(%s) defined under 'trade_pairs' in %s does not look like " "a valid '/' formatted pair.", trade_pair, self.path, ) continue if not isinstance(profit_ratio, float): log.error( "The 'profit_ratio' config value(%s) for trade_pair %s in %s is not a float", profit_ratio, trade_pair, self.path, ) formatted_profit_ratio = f"{profit_ratio * 100}%" if trade_pair in open_trades: log.warning( "The trade %s is configured to HOLD until the profit ratio of %s is met", open_trades[trade_pair], formatted_profit_ratio, ) else: log.warning( "The trade pair %s is configured to HOLD until the profit ratio of %s is met", trade_pair, formatted_profit_ratio, ) r_trade_pairs[trade_pair] = profit_ratio r_data = {} if r_trade_ids: r_data["trade_ids"] = r_trade_ids if r_trade_pairs: r_data["trade_pairs"] = r_trade_pairs return r_data @staticmethod def _object_hook(data): _data = {} for key, value in data.items(): try: key = int(key) except ValueError: pass _data[key] = value return _data