Created
December 21, 2024 07:35
-
-
Save Canx/94cb572d238a734f46fb5215e959f64d to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
import logging | |
import pathlib | |
import rapidjson | |
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 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) | |
############################################################################################################# | |
## NostalgiaForInfinityX5 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) ## | |
## BitMart: https://www.bitmart.com/invite/nfinfinity/en-US (20% lifetime discount on trading 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 NostalgiaForInfinityX5(IStrategy): | |
INTERFACE_VERSION = 3 | |
def version(self) -> str: | |
return "v15.1.298" | |
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 = False | |
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 | |
# Number of cores to use for pandas_ta indicators calculations | |
num_cores_indicators_calc = 0 | |
# Long Normal mode tags | |
long_normal_mode_tags = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"] | |
# 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 top coins mode tags | |
long_top_coins_mode_tags = ["141", "142", "143"] | |
# Long derisk mode tags | |
long_derisk_mode_tags = ["161"] | |
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" | |
long_top_coins_mode_name = "long_tc" | |
long_derisk_mode_name = "long_derisk" | |
# 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 top coins mode tags | |
short_top_coins_mode_tags = ["641", "642"] | |
short_derisk_mode_tags = ["661"] | |
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" | |
short_top_coins_mode_name = "short_tc" | |
is_futures_mode = False | |
futures_mode_leverage = 3.0 | |
futures_mode_leverage_rebuy_mode = 3.0 | |
futures_mode_leverage_grind_mode = 3.0 | |
# Based on the the first entry (regardless of rebuys) | |
stop_threshold_spot = 0.10 | |
stop_threshold_futures = 0.10 | |
stop_threshold_doom_spot = 0.25 | |
stop_threshold_doom_futures = 0.60 | |
stop_threshold_spot_rebuy = 1.0 | |
stop_threshold_futures_rebuy = 3.0 | |
stop_threshold_rapid_spot = 0.25 | |
stop_threshold_rapid_futures = 0.60 | |
stop_threshold_derisk_spot = 0.25 | |
stop_threshold_derisk_futures = 0.60 | |
# 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 | |
derisk_enable = True | |
# Grinding | |
derisk_use_grind_stops = False | |
grind_1_stop_grinds_spot = -0.50 | |
grind_1_profit_threshold_spot = 0.018 | |
grind_1_stakes_spot = [0.30, 0.32, 0.34] | |
grind_1_sub_thresholds_spot = [-0.12, -0.16, -0.20] | |
grind_1_stop_grinds_futures = -0.50 | |
grind_1_profit_threshold_futures = 0.018 | |
grind_1_stakes_futures = [0.30, 0.32, 0.34] | |
grind_1_sub_thresholds_futures = [-0.12, -0.16, -0.20] | |
grind_2_stop_grinds_spot = -0.50 | |
grind_2_profit_threshold_spot = 0.018 | |
grind_2_stakes_spot = [0.22, 0.32, 0.38] | |
grind_2_sub_thresholds_spot = [-0.12, -0.16, -0.20] | |
grind_2_stop_grinds_futures = -0.50 | |
grind_2_profit_threshold_futures = 0.018 | |
grind_2_stakes_futures = [0.22, 0.32, 0.38] | |
grind_2_sub_thresholds_futures = [-0.12, -0.16, -0.20] | |
grind_3_stop_grinds_spot = -0.50 | |
grind_3_profit_threshold_spot = 0.018 | |
grind_3_stakes_spot = [0.26, 0.28, 0.30] | |
grind_3_sub_thresholds_spot = [-0.12, -0.16, -0.20] | |
grind_3_stop_grinds_futures = -0.50 | |
grind_3_profit_threshold_futures = 0.018 | |
grind_3_stakes_futures = [0.26, 0.28, 0.30] | |
grind_3_sub_thresholds_futures = [-0.12, -0.16, -0.20] | |
grind_4_stop_grinds_spot = -0.50 | |
grind_4_profit_threshold_spot = 0.018 | |
grind_4_stakes_spot = [0.26, 0.28, 0.30] | |
grind_4_sub_thresholds_spot = [-0.12, -0.16, -0.20] | |
grind_4_stop_grinds_futures = -0.50 | |
grind_4_profit_threshold_futures = 0.018 | |
grind_4_stakes_futures = [0.26, 0.28, 0.30] | |
grind_4_sub_thresholds_futures = [-0.12, -0.16, -0.20] | |
grind_5_stop_grinds_spot = -0.50 | |
grind_5_profit_threshold_spot = 0.048 | |
grind_5_stakes_spot = [0.26, 0.28, 0.30] | |
grind_5_sub_thresholds_spot = [-0.12, -0.16, -0.20] | |
grind_5_stop_grinds_futures = -0.50 | |
grind_5_profit_threshold_futures = 0.048 | |
grind_5_stakes_futures = [0.26, 0.28, 0.30] | |
grind_5_sub_thresholds_futures = [-0.12, -0.16, -0.20] | |
grind_6_stop_grinds_spot = -0.50 | |
grind_6_profit_threshold_spot = 0.018 | |
grind_6_stakes_spot = [0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18] | |
grind_6_sub_thresholds_spot = [-0.03, -0.08, -0.10, -0.12, -0.14, -0.16, -0.18, -0.20, -0.22] | |
grind_6_stop_grinds_futures = -0.50 | |
grind_6_profit_threshold_futures = 0.018 | |
grind_6_stakes_futures = [0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18] | |
grind_6_sub_thresholds_futures = [-0.03, -0.08, -0.10, -0.12, -0.14, -0.16, -0.18, -0.20, -0.22] | |
grind_1_derisk_1_stop_grinds_spot = -0.50 | |
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.12, -0.16, -0.20] | |
grind_1_derisk_1_stop_grinds_futures = -0.50 | |
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.12, -0.16, -0.20] | |
grind_2_derisk_1_stop_grinds_spot = -0.50 | |
grind_2_derisk_1_profit_threshold_spot = 0.018 | |
grind_2_derisk_1_stakes_spot = [0.20, 0.26, 0.32] | |
grind_2_derisk_1_sub_thresholds_spot = [-0.12, -0.16, -0.20] | |
grind_2_derisk_1_stop_grinds_futures = -0.50 | |
grind_2_derisk_1_profit_threshold_futures = 0.018 | |
grind_2_derisk_1_stakes_futures = [0.20, 0.26, 0.32] | |
grind_2_derisk_1_sub_thresholds_futures = [-0.12, -0.16, -0.20] | |
grinds_stop_spot = -0.12 | |
grinds_stop_futures = -0.12 | |
# Non rebuy modes | |
regular_mode_stake_multiplier_spot = [1.0] | |
regular_mode_stake_multiplier_futures = [1.0] | |
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.10, -0.12] | |
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.10, -0.12] | |
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.10, -0.12] | |
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.10, -0.12] | |
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.10, -0.12] | |
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.05, -0.06, -0.07, -0.08, -0.09, -0.10, -0.11, -0.12] | |
regular_mode_grind_6_stop_grinds_spot = -0.20 | |
regular_mode_grind_6_profit_threshold_spot = 0.018 | |
regular_mode_derisk_1_spot = -0.24 | |
regular_mode_derisk_1_spot_old = -0.80 | |
regular_mode_derisk_1_reentry_spot = -0.08 | |
regular_mode_derisk_spot = -0.24 | |
regular_mode_derisk_spot_old = -1.60 | |
regular_mode_derisk_1_derisk_mode_spot = -0.05 | |
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.10, -0.12] | |
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.10, -0.12] | |
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.10, -0.12] | |
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.10, -0.12] | |
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.10, -0.12] | |
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.05, -0.06, -0.07, -0.08, -0.09, -0.10, -0.11, -0.12] | |
regular_mode_grind_6_stop_grinds_futures = -0.20 | |
regular_mode_grind_6_profit_threshold_futures = 0.018 | |
regular_mode_derisk_1_futures = -0.60 | |
regular_mode_derisk_1_futures_old = -0.80 | |
regular_mode_derisk_1_reentry_futures = -0.08 # without leverage | |
regular_mode_derisk_futures = -0.60 | |
regular_mode_derisk_futures_old = -1.20 | |
regular_mode_derisk_1_derisk_mode_futures = -0.05 | |
# Rebuy mode | |
rebuy_mode_stake_multiplier = 0.2 | |
# rebuy_mode_stake_multiplier_alt = 0.3 | |
# rebuy_mode_max = 3 | |
rebuy_mode_derisk_spot = -1.0 | |
rebuy_mode_derisk_futures = -2.0 | |
rebuy_mode_stakes_spot = [1.0, 1.25, 1.5, 1.75, 2.0] | |
rebuy_mode_stakes_futures = [1.0, 1.25, 1.5, 1.75, 2.0] | |
rebuy_mode_thresholds_spot = [-0.04, -0.06, -0.08, -0.10, -0.12] | |
rebuy_mode_thresholds_futures = [-0.04, -0.06, -0.08, -0.10, -0.12] | |
# Rapid mode | |
rapid_mode_stake_multiplier_spot = [0.5] | |
rapid_mode_stake_multiplier_futures = [0.5] | |
# Derisk mode | |
min_free_slots_derisk_mode = 2 | |
# 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.20 | |
grind_mode_first_entry_stop_threshold_futures = -0.20 | |
grind_mode_max_slots = 1 | |
grind_mode_coins = [ | |
"MATIC", | |
"ADA", | |
"ARB", | |
"DOT", | |
"XLM", | |
"ALGO", | |
"ETH", | |
"RNDR", | |
"XMR", | |
"AVAX", | |
"NEAR", | |
"DOGE", | |
"BCH", | |
"ETC", | |
"FTM", | |
"KAS", | |
"HBAR", | |
"SUI", | |
"TON", | |
"XRP", | |
"UNI", | |
"LTC", | |
"FIL", | |
"ATOM", | |
"GRT", | |
"LINK", | |
"VET", | |
"THETA", | |
"EOS", | |
"LRC", | |
"QTUM", | |
"CELR", | |
] | |
# Top coins mode coins | |
top_coins_mode_coins = [ | |
"AAVE", | |
"ADA", | |
"ALGO", | |
"APT", | |
"ARB", | |
"ATOM", | |
"BCH", | |
"BTC", | |
"CELR", | |
"DOGE", | |
"DOT", | |
"EOS", | |
"ETC", | |
"ETH", | |
"FET", | |
"FIL", | |
"FTM", | |
"GRT", | |
"HBAR", | |
"INJ", | |
"KAS", | |
"LRC", | |
"LTC", | |
"NEAR", | |
"OP", | |
"POL", | |
"QTUM", | |
"SEI", | |
"SOL", | |
"STX", | |
"SUI", | |
"THETA", | |
"TON", | |
"TRX", | |
"UNI", | |
"VET", | |
"XLM", | |
"XMR", | |
"XRP", | |
] | |
# 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_41_enable": True, | |
"long_entry_condition_42_enable": True, | |
"long_entry_condition_43_enable": True, | |
"long_entry_condition_101_enable": True, | |
"long_entry_condition_120_enable": True, | |
"long_entry_condition_141_enable": True, | |
"long_entry_condition_142_enable": True, | |
"long_entry_condition_143_enable": True, | |
} | |
short_entry_signal_params = { | |
# Enable/Disable conditions | |
# ------------------------------------------------------- | |
"short_entry_condition_501_enable": True, | |
# "short_entry_condition_502_enable": True, | |
# "short_entry_condition_503_enable": True, | |
# "short_entry_condition_504_enable": True, | |
# "short_entry_condition_541_enable": True, | |
# "short_entry_condition_542_enable": True, | |
# "short_entry_condition_543_enable": True, | |
# "short_entry_condition_603_enable": True, | |
# "short_entry_condition_641_enable": True, | |
# "short_entry_condition_642_enable": True, | |
# "short_entry_condition_661_enable": 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 "num_cores_indicators_calc" in self.config: | |
self.num_cores_indicators_calc = self.config["num_cores_indicators_calc"] | |
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 "stop_threshold_doom_spot" in self.config: | |
self.stop_threshold_doom_spot = self.config["stop_threshold_doom_spot"] | |
if "stop_threshold_doom_futures" in self.config: | |
self.stop_threshold_doom_futures = self.config["stop_threshold_doom_futures"] | |
if "derisk_enable" in self.config: | |
self.derisk_enable = self.config["derisk_enable"] | |
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_spot" in self.config: | |
self.regular_mode_derisk_spot = self.config["regular_mode_derisk_spot"] | |
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_futures" in self.config: | |
self.regular_mode_derisk_futures = self.config["regular_mode_derisk_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"] | |
/ ( | |
"nfix5-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() | |
self.update_signals_from_config(self.config) | |
# 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: | |
is_derisk = False | |
if previous_sell_reason in [ | |
f"exit_{mode_name}_stoploss_doom", | |
f"exit_{mode_name}_stoploss", | |
f"exit_{mode_name}_stoploss_u_e", | |
]: | |
filled_entries = trade.select_filled_orders(trade.entry_side) | |
filled_exits = trade.select_filled_orders(trade.exit_side) | |
has_order_tags = False | |
if hasattr(filled_entries[0], "ft_order_tag"): | |
has_order_tags = True | |
for order in filled_exits: | |
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 ["d", "d1"]: | |
is_derisk = True | |
break | |
if not is_derisk: | |
is_derisk = trade.amount < (filled_entries[0].safe_filled * 0.95) | |
if previous_sell_reason in [f"exit_{mode_name}_stoploss_doom", f"exit_{mode_name}_stoploss"]: | |
is_rapid_mode = all(c in self.long_rapid_mode_tags for c in enter_tags) | |
if profit_init_ratio > 0.0: | |
# profit is over the threshold, don't exit | |
self._remove_profit_target(pair) | |
return False, None | |
elif is_derisk: | |
self._remove_profit_target(pair) | |
return False, None | |
elif self.derisk_enable and (current_time - timedelta(minutes=60) > previous_time_profit_reached): | |
if profit_ratio < previous_profit: | |
return True, previous_sell_reason | |
elif profit_ratio > previous_profit: | |
self._remove_profit_target(pair) | |
return False, None | |
elif ( | |
not self.derisk_enable | |
and not is_rapid_mode | |
and ( | |
profit_init_ratio | |
<= -(self.stop_threshold_doom_futures if self.is_futures_mode else self.stop_threshold_doom_spot) | |
) | |
): | |
return True, previous_sell_reason | |
elif ( | |
not self.derisk_enable | |
and is_rapid_mode | |
and ( | |
profit_init_ratio | |
<= -(self.stop_threshold_rapid_futures if self.is_futures_mode else self.stop_threshold_rapid_spot) | |
) | |
): | |
return True, previous_sell_reason | |
elif previous_sell_reason in [f"exit_{mode_name}_stoploss_u_e"]: | |
if profit_init_ratio > 0.0: | |
# profit is over the threshold, don't exit | |
self._remove_profit_target(pair) | |
return False, None | |
elif is_derisk: | |
self._remove_profit_target(pair) | |
return False, None | |
elif profit_ratio < (previous_profit - (0.04 / trade.leverage)): | |
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 trade.is_short: | |
if 0.001 <= profit_init_ratio < 0.01: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_0_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_0_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_0_3" | |
elif 0.01 <= profit_init_ratio < 0.02: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_1_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_1_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_1_3" | |
elif 0.02 <= profit_init_ratio < 0.03: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_2_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_2_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_2_3" | |
elif 0.03 <= profit_init_ratio < 0.04: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_3_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_3_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_3_3" | |
elif 0.04 <= profit_init_ratio < 0.05: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_4_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_4_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_4_3" | |
elif 0.05 <= profit_init_ratio < 0.06: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_5_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_5_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_5_3" | |
elif 0.06 <= profit_init_ratio < 0.07: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_6_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_6_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_6_3" | |
elif 0.07 <= profit_init_ratio < 0.08: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_7_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_7_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_7_3" | |
elif 0.08 <= profit_init_ratio < 0.09: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_8_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_8_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_8_3" | |
elif 0.09 <= profit_init_ratio < 0.10: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_9_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_9_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_9_3" | |
elif 0.10 <= profit_init_ratio < 0.11: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_10_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_10_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_10_3" | |
elif 0.11 <= profit_init_ratio < 0.12: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_11_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_11_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_11_3" | |
elif 0.12 <= profit_init_ratio: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] > 50.0) | |
and (last_candle["RSI_14"] > previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_12_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] > 0.0) | |
and (last_candle["CMF_20_1h"] > 0.0) | |
and (last_candle["CMF_20_4h"] > 0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_12_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] < -40.0): | |
return True, f"exit_profit_{mode_name}_t_12_3" | |
else: | |
if 0.001 <= profit_init_ratio < 0.01: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_0_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_0_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_0_3" | |
elif 0.01 <= profit_init_ratio < 0.02: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_1_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_1_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_1_3" | |
elif 0.02 <= profit_init_ratio < 0.03: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_2_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_2_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_2_3" | |
elif 0.03 <= profit_init_ratio < 0.04: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_3_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_3_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_3_3" | |
elif 0.04 <= profit_init_ratio < 0.05: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_4_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_4_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_4_3" | |
elif 0.05 <= profit_init_ratio < 0.06: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_5_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_5_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_5_3" | |
elif 0.06 <= profit_init_ratio < 0.07: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_6_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_6_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_6_3" | |
elif 0.07 <= profit_init_ratio < 0.08: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_7_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_7_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_7_3" | |
elif 0.08 <= profit_init_ratio < 0.09: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_8_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_8_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_8_3" | |
elif 0.09 <= profit_init_ratio < 0.10: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_9_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_9_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_9_3" | |
elif 0.10 <= profit_init_ratio < 0.11: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_10_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_10_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_10_3" | |
elif 0.11 <= profit_init_ratio < 0.12: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_11_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_11_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_11_3" | |
elif 0.12 <= profit_init_ratio: | |
if ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14"] < previous_candle_1["RSI_14"]) | |
and (last_candle["CMF_20"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_12_1" | |
elif ( | |
profit_init_ratio < (previous_profit - 0.03) | |
and (last_candle["CMF_20"] < -0.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_profit_{mode_name}_t_12_2" | |
elif profit_init_ratio < (previous_profit - 0.05) and (last_candle["ROC_9_4h"] > 40.0): | |
return True, f"exit_profit_{mode_name}_t_12_3" | |
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 all(c in self.long_rapid_mode_tags for c in enter_tags) or ( | |
any(c in self.long_rapid_mode_tags for c in enter_tags) | |
and all( | |
c | |
in ( | |
self.long_rapid_mode_tags | |
+ self.long_rebuy_mode_tags | |
+ self.long_grind_mode_tags | |
+ self.long_derisk_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})" | |
# Long Top Coins mode | |
if any(c in self.long_top_coins_mode_tags for c in enter_tags): | |
sell, signal_name = self.long_exit_top_coins( | |
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 derisk mode | |
if all(c in self.long_derisk_mode_tags for c in enter_tags): | |
sell, signal_name = self.long_exit_derisk( | |
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 X5 | |
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 | |
+ self.long_top_coins_mode_tags | |
+ self.long_derisk_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 X5 | |
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 | |
# Rapid mode | |
if all(c in self.long_rapid_mode_tags for c in enter_tags) or ( | |
any(c in self.long_rapid_mode_tags for c in enter_tags) | |
and all( | |
c | |
in ( | |
self.long_rapid_mode_tags | |
+ self.long_rebuy_mode_tags | |
+ self.long_grind_mode_tags | |
+ self.long_derisk_mode_tags | |
) | |
for c in enter_tags | |
) | |
): | |
stake_multiplier = ( | |
self.rapid_mode_stake_multiplier_futures[0] | |
if self.is_futures_mode | |
else self.rapid_mode_stake_multiplier_spot[0] | |
) | |
if (proposed_stake * stake_multiplier) > min_stake: | |
return proposed_stake * stake_multiplier | |
else: | |
return min_stake | |
# 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 | |
+ self.long_top_coins_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 | |
+ self.long_top_coins_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 | |
# ----------------------------------------------------------------------------------------- | |
# informative_1d_indicators_pandas_ta = pta.Strategy( | |
# name="informative_1d_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}, | |
# # MFI | |
# {"kind": "mfi"}, | |
# # CMF | |
# {"kind": "cmf"}, | |
# # Williams %R | |
# {"kind": "willr", "length": 14}, | |
# # STOCHRSI | |
# {"kind": "stochrsi"}, | |
# # KST | |
# {"kind": "kst"}, | |
# # ROC | |
# {"kind": "roc"}, | |
# # AROON | |
# {"kind": "aroon"}, | |
# ], | |
# ) | |
# informative_1d.ta.study(informative_1d_indicators_pandas_ta, cores=self.num_cores_indicators_calc) | |
# RSI | |
informative_1d["RSI_3"] = pta.rsi(informative_1d["close"], length=3) | |
informative_1d["RSI_14"] = pta.rsi(informative_1d["close"], length=14) | |
informative_1d["RSI_3_change_pct"] = ( | |
(informative_1d["RSI_3"] - informative_1d["RSI_3"].shift(1)) / (informative_1d["RSI_3"].shift(1)) | |
) * 100.0 | |
informative_1d["RSI_14_change_pct"] = ( | |
(informative_1d["RSI_14"] - informative_1d["RSI_14"].shift(1)) / (informative_1d["RSI_14"].shift(1)) | |
) * 100.0 | |
informative_1d["RSI_3_diff"] = informative_1d["RSI_3"] - informative_1d["RSI_3"].shift(1) | |
informative_1d["RSI_14_diff"] = informative_1d["RSI_14"] - informative_1d["RSI_14"].shift(1) | |
# BB 20 - STD2 | |
bbands_20_2 = pta.bbands(informative_1d["close"], length=20) | |
informative_1d["BBL_20_2.0"] = bbands_20_2["BBL_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1d["BBM_20_2.0"] = bbands_20_2["BBM_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1d["BBU_20_2.0"] = bbands_20_2["BBU_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1d["BBB_20_2.0"] = bbands_20_2["BBB_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1d["BBP_20_2.0"] = bbands_20_2["BBP_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
# MFI | |
informative_1d["MFI_14"] = pta.mfi( | |
informative_1d["high"], informative_1d["low"], informative_1d["close"], informative_1d["volume"], length=14 | |
) | |
# CMF | |
informative_1d["CMF_20"] = pta.cmf( | |
informative_1d["high"], informative_1d["low"], informative_1d["close"], informative_1d["volume"], length=20 | |
) | |
# Williams %R | |
informative_1d["WILLR_14"] = pta.willr( | |
informative_1d["high"], informative_1d["low"], informative_1d["close"], length=14 | |
) | |
# AROON | |
aroon_14 = pta.aroon(informative_1d["high"], informative_1d["low"], length=14) | |
informative_1d["AROONU_14"] = aroon_14["AROONU_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
informative_1d["AROOND_14"] = aroon_14["AROOND_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
# Stochastic | |
try: | |
stochrsi = pta.stoch(informative_1d["high"], informative_1d["low"], informative_1d["close"]) | |
informative_1d["STOCHk_14_3_3"] = stochrsi["STOCHk_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
informative_1d["STOCHd_14_3_3"] = stochrsi["STOCHd_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
except AttributeError: | |
informative_1d["STOCHk_14_3_3"] = np.nan | |
informative_1d["STOCHd_14_3_3"] = np.nan | |
# Stochastic RSI | |
stochrsi = pta.stochrsi(informative_1d["close"]) | |
informative_1d["STOCHRSIk_14_14_3_3"] = ( | |
stochrsi["STOCHRSIk_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
informative_1d["STOCHRSId_14_14_3_3"] = ( | |
stochrsi["STOCHRSId_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
# ROC | |
informative_1d["ROC_2"] = pta.roc(informative_1d["close"], length=2) | |
informative_1d["ROC_9"] = pta.roc(informative_1d["close"], length=9) | |
# Candle change | |
informative_1d["change_pct"] = (informative_1d["close"] - informative_1d["open"]) / informative_1d["open"] * 100.0 | |
# 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"]) | |
* 100.0 | |
) | |
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"]) | |
* 100.0 | |
) | |
# 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 | |
# ----------------------------------------------------------------------------------------- | |
# informative_4h_indicators_pandas_ta = pta.Strategy( | |
# name="informative_4h_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}, | |
# # BB 20 - STD2 | |
# {"kind": "bbands", "length": 20}, | |
# # MFI | |
# {"kind": "mfi"}, | |
# # CMF | |
# {"kind": "cmf"}, | |
# # Williams %R | |
# {"kind": "willr", "length": 14}, | |
# # CTI | |
# {"kind": "cti", "length": 20}, | |
# # STOCHRSI | |
# {"kind": "stochrsi"}, | |
# # KST | |
# {"kind": "kst"}, | |
# # ROC | |
# {"kind": "roc"}, | |
# # AROON | |
# {"kind": "aroon"}, | |
# # UO | |
# {"kind": "uo"}, | |
# # AO | |
# {"kind": "ao"}, | |
# ], | |
# ) | |
# informative_4h.ta.study(informative_4h_indicators_pandas_ta, cores=self.num_cores_indicators_calc) | |
# RSI | |
informative_4h["RSI_3"] = pta.rsi(informative_4h["close"], length=3) | |
informative_4h["RSI_14"] = pta.rsi(informative_4h["close"], length=14) | |
informative_4h["RSI_3_change_pct"] = ( | |
(informative_4h["RSI_3"] - informative_4h["RSI_3"].shift(1)) / (informative_4h["RSI_3"].shift(1)) | |
) * 100.0 | |
informative_4h["RSI_14_change_pct"] = ( | |
(informative_4h["RSI_14"] - informative_4h["RSI_14"].shift(1)) / (informative_4h["RSI_14"].shift(1)) | |
) * 100.0 | |
informative_4h["RSI_3_diff"] = informative_4h["RSI_3"] - informative_4h["RSI_3"].shift(1) | |
informative_4h["RSI_14_diff"] = informative_4h["RSI_14"] - informative_4h["RSI_14"].shift(1) | |
# EMA | |
informative_4h["EMA_12"] = pta.ema(informative_4h["close"], length=12) | |
informative_4h["EMA_200"] = pta.ema(informative_4h["close"], length=200, fillna=0.0) | |
# BB 20 - STD2 | |
bbands_20_2 = pta.bbands(informative_4h["close"], length=20) | |
informative_4h["BBL_20_2.0"] = bbands_20_2["BBL_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_4h["BBM_20_2.0"] = bbands_20_2["BBM_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_4h["BBU_20_2.0"] = bbands_20_2["BBU_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_4h["BBB_20_2.0"] = bbands_20_2["BBB_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_4h["BBP_20_2.0"] = bbands_20_2["BBP_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
# MFI | |
informative_4h["MFI_14"] = pta.mfi( | |
informative_4h["high"], informative_4h["low"], informative_4h["close"], informative_4h["volume"], length=14 | |
) | |
# CMF | |
informative_4h["CMF_20"] = pta.cmf( | |
informative_4h["high"], informative_4h["low"], informative_4h["close"], informative_4h["volume"], length=20 | |
) | |
# Williams %R | |
informative_4h["WILLR_14"] = pta.willr( | |
informative_4h["high"], informative_4h["low"], informative_4h["close"], length=14 | |
) | |
# AROON | |
aroon_14 = pta.aroon(informative_4h["high"], informative_4h["low"], length=14) | |
informative_4h["AROONU_14"] = aroon_14["AROONU_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
informative_4h["AROOND_14"] = aroon_14["AROOND_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
# Stochastic | |
try: | |
stochrsi = pta.stoch(informative_4h["high"], informative_4h["low"], informative_4h["close"]) | |
informative_4h["STOCHk_14_3_3"] = stochrsi["STOCHk_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
informative_4h["STOCHd_14_3_3"] = stochrsi["STOCHd_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
except AttributeError: | |
informative_4h["STOCHk_14_3_3"] = np.nan | |
informative_4h["STOCHd_14_3_3"] = np.nan | |
# Stochastic RSI | |
stochrsi = pta.stochrsi(informative_4h["close"]) | |
informative_4h["STOCHRSIk_14_14_3_3"] = ( | |
stochrsi["STOCHRSIk_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
informative_4h["STOCHRSId_14_14_3_3"] = ( | |
stochrsi["STOCHRSId_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
informative_4h["STOCHRSIk_14_14_3_3_change_pct"] = ( | |
(informative_4h["STOCHRSIk_14_14_3_3"] - informative_4h["STOCHRSIk_14_14_3_3"].shift(1)) | |
/ informative_4h["STOCHRSIk_14_14_3_3"].shift(1) | |
) * 100.0 | |
# KST | |
kst = pta.kst(informative_4h["close"]) | |
informative_4h["KST_10_15_20_30_10_10_10_15"] = ( | |
kst["KST_10_15_20_30_10_10_10_15"] if isinstance(kst, pd.DataFrame) else np.nan | |
) | |
informative_4h["KSTs_9"] = kst["KSTs_9"] if isinstance(kst, pd.DataFrame) else np.nan | |
# UO | |
informative_4h["UO_7_14_28"] = pta.uo(informative_4h["high"], informative_4h["low"], informative_4h["close"]) | |
# ROC | |
informative_4h["ROC_2"] = pta.roc(informative_4h["close"], length=2) | |
informative_4h["ROC_9"] = pta.roc(informative_4h["close"], length=9) | |
# CCI | |
informative_4h["CCI_20"] = pta.cci( | |
informative_4h["high"], informative_4h["low"], informative_4h["close"], length=20 | |
) | |
informative_4h["CCI_20"] = ( | |
(informative_4h["CCI_20"]).astype(np.float64).replace(to_replace=[np.nan, None], value=(0.0)) | |
) | |
informative_4h["CCI_20_change_pct"] = ( | |
(informative_4h["CCI_20"] - informative_4h["CCI_20"].shift(1)) / abs(informative_4h["CCI_20"].shift(1)) | |
) * 100.0 | |
# Candle change | |
informative_4h["change_pct"] = (informative_4h["close"] - informative_4h["open"]) / informative_4h["open"] * 100.0 | |
# 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"]) | |
* 100.0 | |
) | |
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"]) | |
* 100.0 | |
) | |
# 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 | |
# ----------------------------------------------------------------------------------------- | |
# informative_1h_indicators_pandas_ta = pta.Strategy( | |
# name="informative_1h_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}, | |
# # BB 20 - STD2 | |
# {"kind": "bbands", "length": 20}, | |
# # MFI | |
# {"kind": "mfi"}, | |
# # CMF | |
# {"kind": "cmf"}, | |
# # Williams %R | |
# {"kind": "willr", "length": 14}, | |
# # CTI | |
# {"kind": "cti", "length": 20}, | |
# # STOCHRSI | |
# {"kind": "stochrsi"}, | |
# # KST | |
# {"kind": "kst"}, | |
# # ROC | |
# {"kind": "roc"}, | |
# # AROON | |
# {"kind": "aroon"}, | |
# # UO | |
# {"kind": "uo"}, | |
# # AO | |
# {"kind": "ao"}, | |
# ], | |
# ) | |
# informative_1h.ta.study(informative_1h_indicators_pandas_ta, cores=self.num_cores_indicators_calc) | |
# RSI | |
informative_1h["RSI_3"] = pta.rsi(informative_1h["close"], length=3) | |
informative_1h["RSI_14"] = pta.rsi(informative_1h["close"], length=14) | |
informative_1h["RSI_3_change_pct"] = ( | |
(informative_1h["RSI_3"] - informative_1h["RSI_3"].shift(1)) / (informative_1h["RSI_3"].shift(1)) | |
) * 100.0 | |
informative_1h["RSI_14_change_pct"] = ( | |
(informative_1h["RSI_14"] - informative_1h["RSI_14"].shift(1)) / (informative_1h["RSI_14"].shift(1)) | |
) * 100.0 | |
informative_1h["RSI_3_diff"] = informative_1h["RSI_3"] - informative_1h["RSI_3"].shift(1) | |
informative_1h["RSI_14_diff"] = informative_1h["RSI_14"] - informative_1h["RSI_14"].shift(1) | |
# EMA | |
informative_1h["EMA_12"] = pta.ema(informative_1h["close"], length=12) | |
informative_1h["EMA_200"] = pta.ema(informative_1h["close"], length=200, fillna=0.0) | |
# BB 20 - STD2 | |
bbands_20_2 = pta.bbands(informative_1h["close"], length=20) | |
informative_1h["BBL_20_2.0"] = bbands_20_2["BBL_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1h["BBM_20_2.0"] = bbands_20_2["BBM_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1h["BBU_20_2.0"] = bbands_20_2["BBU_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1h["BBB_20_2.0"] = bbands_20_2["BBB_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
informative_1h["BBP_20_2.0"] = bbands_20_2["BBP_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
# MFI | |
informative_1h["MFI_14"] = pta.mfi( | |
informative_1h["high"], informative_1h["low"], informative_1h["close"], informative_1h["volume"], length=14 | |
) | |
# CMF | |
informative_1h["CMF_20"] = pta.cmf( | |
informative_1h["high"], informative_1h["low"], informative_1h["close"], informative_1h["volume"], length=20 | |
) | |
# Williams %R | |
informative_1h["WILLR_14"] = pta.willr( | |
informative_1h["high"], informative_1h["low"], informative_1h["close"], length=14 | |
) | |
informative_1h["WILLR_84"] = pta.willr( | |
informative_1h["high"], informative_1h["low"], informative_1h["close"], length=84 | |
) | |
# AROON | |
aroon_14 = pta.aroon(informative_1h["high"], informative_1h["low"], length=14) | |
informative_1h["AROONU_14"] = aroon_14["AROONU_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
informative_1h["AROOND_14"] = aroon_14["AROOND_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
# Stochastic | |
stochrsi = pta.stoch(informative_1h["high"], informative_1h["low"], informative_1h["close"]) | |
informative_1h["STOCHk_14_3_3"] = stochrsi["STOCHk_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
informative_1h["STOCHd_14_3_3"] = stochrsi["STOCHd_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
# Stochastic RSI | |
stochrsi = pta.stochrsi(informative_1h["close"]) | |
informative_1h["STOCHRSIk_14_14_3_3"] = ( | |
stochrsi["STOCHRSIk_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
informative_1h["STOCHRSId_14_14_3_3"] = ( | |
stochrsi["STOCHRSId_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
# KST | |
kst = pta.kst(informative_1h["close"]) | |
informative_1h["KST_10_15_20_30_10_10_10_15"] = ( | |
kst["KST_10_15_20_30_10_10_10_15"] if isinstance(kst, pd.DataFrame) else np.nan | |
) | |
informative_1h["KSTs_9"] = kst["KSTs_9"] if isinstance(kst, pd.DataFrame) else np.nan | |
# UO | |
informative_1h["UO_7_14_28"] = pta.uo(informative_1h["high"], informative_1h["low"], informative_1h["close"]) | |
informative_1h["UO_7_14_28"] = ( | |
(informative_1h["UO_7_14_28"]).astype(np.float64).replace(to_replace=[np.nan, None], value=(50.0)) | |
) | |
informative_1h["UO_7_14_28_change_pct"] = ( | |
(informative_1h["UO_7_14_28"] - informative_1h["UO_7_14_28"].shift(1)) | |
/ abs(informative_1h["UO_7_14_28"].shift(1)) | |
) * 100.0 | |
# OBV | |
informative_1h["OBV"] = pta.obv(informative_1h["close"], informative_1h["volume"]) | |
informative_1h["OBV_change_pct"] = ( | |
(informative_1h["OBV"] - informative_1h["OBV"].shift(1)) / abs(informative_1h["OBV"].shift(1)) | |
) * 100.0 | |
# ROC | |
informative_1h["ROC_2"] = pta.roc(informative_1h["close"], length=2) | |
informative_1h["ROC_9"] = pta.roc(informative_1h["close"], length=9) | |
# CCI | |
informative_1h["CCI_20"] = pta.cci( | |
informative_1h["high"], informative_1h["low"], informative_1h["close"], length=20 | |
) | |
informative_1h["CCI_20"] = ( | |
(informative_1h["CCI_20"]).astype(np.float64).replace(to_replace=[np.nan, None], value=(0.0)) | |
) | |
informative_1h["CCI_20_change_pct"] = ( | |
(informative_1h["CCI_20"] - informative_1h["CCI_20"].shift(1)) / abs(informative_1h["CCI_20"].shift(1)) | |
) * 100.0 | |
# Candle change | |
informative_1h["change_pct"] = (informative_1h["close"] - informative_1h["open"]) / informative_1h["open"] * 100.0 | |
# 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"]) | |
* 100.0 | |
) | |
informative_1h["bot_wick_pct"] = abs( | |
(informative_1h["low"] - np.minimum(informative_1h["open"], informative_1h["close"])) | |
/ np.minimum(informative_1h["open"], informative_1h["close"]) | |
* 100.0 | |
) | |
# 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 | |
# ----------------------------------------------------------------------------------------- | |
# informative_15m_indicators_pandas_ta = pta.Strategy( | |
# name="informative_15m_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}, | |
# # BB 20 - STD2 | |
# {"kind": "bbands", "length": 20}, | |
# # Williams %R | |
# {"kind": "willr", "length": 14}, | |
# # CTI | |
# {"kind": "cti", "length": 20}, | |
# # STOCHRSI | |
# {"kind": "stochrsi"}, | |
# # ROC | |
# {"kind": "roc"}, | |
# # AROON | |
# {"kind": "aroon"}, | |
# # UO | |
# {"kind": "uo"}, | |
# # AO | |
# {"kind": "ao"}, | |
# ], | |
# ) | |
# informative_15m.ta.study(informative_15m_indicators_pandas_ta, cores=self.num_cores_indicators_calc) | |
# RSI | |
informative_15m["RSI_3"] = pta.rsi(informative_15m["close"], length=3) | |
informative_15m["RSI_14"] = pta.rsi(informative_15m["close"], length=14) | |
informative_15m["RSI_3_change_pct"] = ( | |
(informative_15m["RSI_3"] - informative_15m["RSI_3"].shift(1)) / (informative_15m["RSI_3"].shift(1)) | |
) * 100.0 | |
informative_15m["RSI_14_change_pct"] = ( | |
(informative_15m["RSI_14"] - informative_15m["RSI_14"].shift(1)) / (informative_15m["RSI_14"].shift(1)) | |
) * 100.0 | |
# MFI | |
informative_15m["MFI_14"] = pta.mfi( | |
informative_15m["high"], informative_15m["low"], informative_15m["close"], informative_15m["volume"], length=14 | |
) | |
# CMF | |
informative_15m["CMF_20"] = pta.cmf( | |
informative_15m["high"], informative_15m["low"], informative_15m["close"], informative_15m["volume"], length=20 | |
) | |
# Williams %R | |
informative_15m["WILLR_14"] = pta.willr( | |
informative_15m["high"], informative_15m["low"], informative_15m["close"], length=14 | |
) | |
# AROON | |
aroon_14 = pta.aroon(informative_15m["high"], informative_15m["low"], length=14) | |
informative_15m["AROONU_14"] = aroon_14["AROONU_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
informative_15m["AROOND_14"] = aroon_14["AROOND_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
# Stochastic | |
stochrsi = pta.stoch(informative_15m["high"], informative_15m["low"], informative_15m["close"]) | |
informative_15m["STOCHk_14_3_3"] = stochrsi["STOCHk_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
informative_15m["STOCHd_14_3_3"] = stochrsi["STOCHd_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
# Stochastic RSI | |
stochrsi = pta.stochrsi(informative_15m["close"]) | |
informative_15m["STOCHRSIk_14_14_3_3"] = ( | |
stochrsi["STOCHRSIk_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
informative_15m["STOCHRSId_14_14_3_3"] = ( | |
stochrsi["STOCHRSId_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
) | |
# UO | |
informative_15m["UO_7_14_28"] = pta.uo(informative_15m["high"], informative_15m["low"], informative_15m["close"]) | |
informative_15m["UO_7_14_28_change_pct"] = ( | |
informative_15m["UO_7_14_28"] - informative_15m["UO_7_14_28"].shift(1) | |
) * 100.0 | |
# OBV | |
informative_15m["OBV"] = pta.obv(informative_15m["close"], informative_15m["volume"]) | |
informative_15m["OBV_change_pct"] = ( | |
(informative_15m["OBV"] - informative_15m["OBV"].shift(1)) / abs(informative_15m["OBV"].shift(1)) | |
) * 100.0 | |
# ROC | |
informative_15m["ROC_9"] = pta.roc(informative_15m["close"], length=9) | |
# CCI | |
informative_15m["CCI_20"] = pta.cci( | |
informative_15m["high"], informative_15m["low"], informative_15m["close"], length=20 | |
) | |
informative_15m["CCI_20"] = ( | |
(informative_15m["CCI_20"]).astype(np.float64).replace(to_replace=[np.nan, None], value=(0.0)) | |
) | |
informative_15m["CCI_20_change_pct"] = ( | |
(informative_15m["CCI_20"] - informative_15m["CCI_20"].shift(1)) / abs(informative_15m["CCI_20"].shift(1)) | |
) * 100.0 | |
# Candle change | |
informative_15m["change_pct"] = ( | |
(informative_15m["close"] - informative_15m["open"]) / informative_15m["open"] * 100.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": 4}, | |
# {"kind": "rsi", "length": 14}, | |
# {"kind": "rsi", "length": 20}, | |
# # EMA | |
# {"kind": "ema", "length": 3}, | |
# {"kind": "ema", "length": 9}, | |
# {"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}, | |
# # MFI | |
# {"kind": "mfi"}, | |
# # CMF | |
# {"kind": "cmf"}, | |
# # 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"}, | |
# # STOCHRSI | |
# {"kind": "stochrsi"}, | |
# # KST | |
# {"kind": "kst"}, | |
# # ROC | |
# {"kind": "roc"}, | |
# # AROON | |
# {"kind": "aroon"}, | |
# # UO | |
# {"kind": "uo"}, | |
# # AO | |
# {"kind": "ao"}, | |
# # OBV | |
# {"kind": "obv"}, | |
# ], | |
# ) | |
# df.ta.study(base_tf_5m_indicators_pandas_ta, cores=self.num_cores_indicators_calc) | |
# RSI | |
df["RSI_3"] = pta.rsi(df["close"], length=3) | |
df["RSI_4"] = pta.rsi(df["close"], length=4) | |
df["RSI_14"] = pta.rsi(df["close"], length=14) | |
df["RSI_20"] = pta.rsi(df["close"], length=20) | |
df["RSI_3_change_pct"] = ((df["RSI_3"] - df["RSI_3"].shift(1)) / (df["RSI_3"].shift(1))) * 100.0 | |
df["RSI_14_change_pct"] = ((df["RSI_14"] - df["RSI_14"].shift(1)) / (df["RSI_14"].shift(1))) * 100.0 | |
# EMA | |
df["EMA_3"] = pta.ema(df["close"], length=3) | |
df["EMA_9"] = pta.ema(df["close"], length=9) | |
df["EMA_12"] = pta.ema(df["close"], length=12) | |
df["EMA_16"] = pta.ema(df["close"], length=16) | |
df["EMA_20"] = pta.ema(df["close"], length=20) | |
df["EMA_26"] = pta.ema(df["close"], length=26) | |
df["EMA_50"] = pta.ema(df["close"], length=50) | |
df["EMA_200"] = pta.ema(df["close"], length=200, fillna=0.0) | |
# SMA | |
df["SMA_16"] = pta.sma(df["close"], length=16) | |
df["SMA_30"] = pta.sma(df["close"], length=30) | |
# BB 20 - STD2 | |
bbands_20_2 = pta.bbands(df["close"], length=20) | |
df["BBL_20_2.0"] = bbands_20_2["BBL_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
df["BBM_20_2.0"] = bbands_20_2["BBM_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
df["BBU_20_2.0"] = bbands_20_2["BBU_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
df["BBB_20_2.0"] = bbands_20_2["BBB_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
df["BBP_20_2.0"] = bbands_20_2["BBP_20_2.0"] if isinstance(bbands_20_2, pd.DataFrame) else np.nan | |
# MFI | |
df["MFI_14"] = pta.mfi(df["high"], df["low"], df["close"], df["volume"], length=14) | |
# CMF | |
df["CMF_20"] = pta.cmf(df["high"], df["low"], df["close"], df["volume"], length=20) | |
# Williams %R | |
df["WILLR_14"] = pta.willr(df["high"], df["low"], df["close"], length=14) | |
df["WILLR_480"] = pta.willr(df["high"], df["low"], df["close"], length=480) | |
# AROON | |
aroon_14 = pta.aroon(df["high"], df["low"], length=14) | |
df["AROONU_14"] = aroon_14["AROONU_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
df["AROOND_14"] = aroon_14["AROOND_14"] if isinstance(aroon_14, pd.DataFrame) else np.nan | |
# Stochastic RSI | |
stochrsi = pta.stochrsi(df["close"]) | |
df["STOCHRSIk_14_14_3_3"] = stochrsi["STOCHRSIk_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
df["STOCHRSId_14_14_3_3"] = stochrsi["STOCHRSId_14_14_3_3"] if isinstance(stochrsi, pd.DataFrame) else np.nan | |
# KST | |
kst = pta.kst(df["close"]) | |
df["KST_10_15_20_30_10_10_10_15"] = kst["KST_10_15_20_30_10_10_10_15"] if isinstance(kst, pd.DataFrame) else np.nan | |
df["KSTs_9"] = kst["KSTs_9"] if isinstance(kst, pd.DataFrame) else np.nan | |
# OBV | |
df["OBV"] = pta.obv(df["close"], df["volume"]) | |
df["OBV_change_pct"] = ((df["OBV"] - df["OBV"].shift(1)) / abs(df["OBV"].shift(1))) * 100.0 | |
# ROC | |
df["ROC_2"] = pta.roc(df["close"], length=2) | |
df["ROC_9"] = pta.roc(df["close"], length=9) | |
# Candle change | |
df["change_pct"] = (df["close"] - df["open"]) / df["open"] * 100.0 | |
# Close max | |
df["close_max_48"] = df["close"].rolling(48).max() | |
# Number of empty candles | |
df["num_empty_288"] = (df["volume"] <= 0).rolling(window=288, min_periods=288).sum() | |
# ----------------------------------------------------------------------------------------- | |
# 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_indicators_pandas_ta = pta.Strategy( | |
# name="btc_info_1d_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}, | |
# ], | |
# ) | |
# btc_info_1d.ta.study(btc_info_1d_indicators_pandas_ta, cores=self.num_cores_indicators_calc) | |
# 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 | |
# ----------------------------------------------------------------------------------------- | |
# 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 | |
# ----------------------------------------------------------------------------------------- | |
# 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 | |
# ----------------------------------------------------------------------------------------- | |
# 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 | |
# ----------------------------------------------------------------------------------------- | |
# 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["CTI_20_1d"] = df["CTI_20_1d"].astype(np.float64).replace(to_replace=[np.nan, None], value=(0.0)) | |
# df["WILLR_480_1h"] = df["WILLR_480_1h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(-50.0)) | |
# df["WILLR_480_4h"] = df["WILLR_480_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)) | |
df["RSI_14_1h"] = df["RSI_14_1h"].astype(np.float64).replace(to_replace=[np.nan, None], value=(50.0)) | |
# Global protections Long | |
df["protections_long_global"] = True | |
df["global_protections_long_pump"] = ( | |
# 5m & 15m & 4h down move, 5m & 4h still not low enough, 1d high & overbought | |
( | |
(df["RSI_3"] > 5.0) | |
| (df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["AROONU_14"] < 25.0) | |
| (df["WILLR_14_4h"] < -75.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 5m & 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d overbought | |
& ( | |
(df["RSI_3"] > 5.0) | |
| (df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 5m & 4h down move, 15m high, 1h & 4h stil high, 1d high | |
& ( | |
(df["RSI_3"] > 10.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h & 1d stil high | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_14_15m"] < 10.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["STOCHk_14_3_3_4h"] < 80.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_14_15m"] < 10.0) | |
| (df["CCI_20_15m"] < -500.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 15.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_14_15m"] < 5.0) | |
| (df["CCI_20_15m"] < -500.0) | |
| (df["RSI_14_1h"] < 10.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 45.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still now low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 10.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -500.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h down move, 15m & 1h still high, 4h & 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["RSI_14_4h"] < 45.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 25.0) | |
) | |
# 15m & 1h down move, 1h still high, 4h high, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["WILLR_14_4h"] < -30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m down move, 15m & 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h still not low enough, 4h still high, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["WILLR_14_1h"] < -85.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["WILLR_14_4h"] < -85.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 20.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h still high, 1d stil high & overbought | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 45.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["RSI_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h down move, 15m & 1h still high, 4h high | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 250.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still now low enough, 4h still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 45.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 100.0) | |
| (df["STOCHk_14_3_3_4h"] < 30.0) | |
| (df["ROC_9_4h"] < 80.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["RSI_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -400.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
) | |
# 15m & 4h down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h still high, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -350.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1d down move, 15m & 1h still high, 4h high & overbought, 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["STOCHk_14_3_3_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -0.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 80.0) | |
| (df["ROC_9_4h"] < 15.0) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 200.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h high | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["STOCHk_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 200.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h & 1d high | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 45.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 80.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 100.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_4h"] < 40.0) | |
) | |
# 15m & 1h & 4h down move, 1h still not low enough, 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["RSI_14_1d"] < 80.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 200.0) | |
) | |
# 15m & 4h down move, 15m & 1h & 4h still high, 1d high | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["STOCHk_14_3_3_4h"] < 40.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 1h still not low enough & downtrend, 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 25.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["CCI_20_1h"] < -400.0) | |
| (df["ROC_2_1h"] > -5.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHk_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h down move, 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h still high, 1h high & overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CMF_20_15m"] < -0.35) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CMF_20_1h"] < -0.25) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["CMF_20_4h"] < -0.25) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 80.0) | |
) | |
# 15m down move, 15m & 1h still high, 4h high & overbought, 1d high | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m & 1h down move, 1h still high, 4h high, 1h & 4h overbought | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_1h"] < 15.0) | |
| (df["ROC_9_4h"] < 25.0) | |
) | |
# 15m down move, 15m still not low enough, 1h high, 4h still not low enough, 1d high | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m down move, 15m & 1h still not low enough, 4h high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 85.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["RSI_14_1d"] < 85.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 200.0) | |
) | |
& ( | |
# 15m & 1h & 4h down move, 1h still not low enough & downtrend, 4h still high & overbought, 1d high & overbought | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["ROC_9_1h"] > -25.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["STOCHk_14_3_3_4h"] < 70.0) | |
| (df["RSI_14_1d"] < 75.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15 & 1h down move, 15m & 1h & 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -150.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 45.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h high & overbought | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["WILLR_14_4h"] < -10.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 15m & 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m down move, 15m still not low enough, 1h high, 1d high & going down & overbought | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_2_1d"] > -10.0) | |
| (df["ROC_9_1d"] < 150.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h still high | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h still high, 1d high | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h high & overbought, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 80.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_4h"] < 80.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m down move, 15m still not low enough, 1h & 4h high, 1d overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["WILLR_14_4h"] < -20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["RSI_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1 & 4h down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["STOCHk_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["CCI_20_15m"] < -150.0) | |
| (df["STOCHk_14_3_3_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 45.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHk_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m & 1h & 1d down move, 15m & 1h & 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHk_14_3_3_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["WILLR_14_1h"] < -25.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHk_14_3_3_1h"] < 70.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["STOCHk_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 60.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -300.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h still high, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["CCI_20_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 35.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < 100.0) | |
| (df["STOCHk_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 25.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CMF_20_1h"] > -0.25) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m down move, 15m & 1h still high, 4h high | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["WILLR_14_4h"] < -10.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 70.0) | |
) | |
# 15m down move, 15m & 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["WILLR_14_4h"] < -25.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHk_14_3_3_4h"] < 70.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["STOCHk_14_3_3_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m & 4h down move, 15m & 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["WILLR_14_1h"] < -90.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["WILLR_14_4h"] < -90.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 200.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 15m & 1h & 4h & 1d high | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
) | |
# 15m & 1h down move, 15m & 1h still high, 4h still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_4h"] < 30.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["CCI_20_1h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["ROC_9_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 250.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 25.0) | |
) | |
# 14m & 4h down move, 15m still high, 1h & 1d high | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m down move, 15m still high, 4h & 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_14_4h"] < 75.0) | |
| (df["WILLR_14_4h"] < -20.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["ROC_9_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 80.0) | |
) | |
# 15m down move, 15m still not low enough, 1h & 4h high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 75.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["ROC_9_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 80.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 300.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 30.0) | |
) | |
# 15m down move, 15m still not low enough, 1h & 4h high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["WILLR_14_4h"] < -35.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m & 1h down move, 15m & 1h still high, 4h high, 1d overbought | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 4h down move, 15m & 1h stil high, 4h high | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m down move, 15m still not low enough, 1h & 4h high, 4h overbought | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["RSI_14_1h"] < 70.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 80.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 150.0) | |
) | |
# 15m & 4h & 1d down move, 15m & 1h still high, 4h still not low enough & downtrend, 1d overbought | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["ROC_9_4h"] > -15.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 15m & 1h & 1d high | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["WILLR_14_1h"] < -10.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
) | |
# 15m & 1h down move, 15m & 1h still not low enough, 4h high & overbought | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 80.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 50.0) | |
) | |
# 15m down move, 15m & 1h still high, 4h & 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["CCI_20_15m"] < -150.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["WILLR_14_4h"] < -25.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["ROC_9_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["STOCHk_14_3_3_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 5.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h still high, 1d still high & overbought | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["STOCHk_14_3_3_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h still high & overbought, 1d overbought | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["STOCHk_14_3_3_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 50.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_4h"] < 30.0) | |
| (df["ROC_9_1d"] < 250.0) | |
) | |
# 15m & 4h down move, 15m still not low enough, 1h & 4h still high | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 35.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < 300.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 4h down move, 15m & 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_3_4h"] > 65.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["CCI_20_15m"] < -0.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -0.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m down move, 15m stil not low enough, 1h & 4h high, 1d overbought | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 70.0) | |
| (df["STOCHk_14_3_3_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["STOCHk_14_3_3_4h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m down move, 15m & 1h still high, 4h & 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["STOCHk_14_3_3_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 70.0) | |
| (df["RSI_14_4h"] < 85.0) | |
| (df["WILLR_14_4h"] < -20.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 80.0) | |
| (df["RSI_14_1d"] < 85.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m down move, 15m stil high, 1h high, 4h & 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 70.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHk_14_3_3_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["WILLR_14_4h"] < -10.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 80.0) | |
| (df["ROC_9_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m down move, 15m still high, 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["WILLR_14_15m"] < -80.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m down move, 15m & 1h & 4h high, 1d high & overbought | |
& ( | |
(df["RSI_3_15m"] > 50.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHk_14_3_3_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 60.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m down move, 15m & 1h still high, 4h high & overbought | |
& ( | |
(df["RSI_3_15m"] > 50.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["CCI_20_15m"] < -0.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_1h"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 20.0) | |
) | |
# 15m & 1h down move, 15m & 1h still high, 4h high & overbought, 1d overbought | |
& ( | |
(df["RSI_3_15m"] > 50.0) | |
| (df["RSI_3_1h"] > 65.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -0.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 100.0) | |
| (df["STOCHk_14_3_3_4h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["ROC_9_4h"] < 50.0) | |
| (df["ROC_9_1d"] < 250.0) | |
) | |
# 15m & 4h down move, 15m still high, 1h & 4h still not low enough. 1d overbought | |
& ( | |
(df["RSI_3_15m"] > 60.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["RSI_14_1d"] < 60.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 1ddown move, 15m & 1h still high, 4h high, 1d overbought | |
& ( | |
(df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 14m & 1h & 4h still not low enough, 1d high, 15m & 1h & 4h & 1d down move, 1d overbought | |
& ( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
| (df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 1h & 4h not low enough, 1d high & overbought | |
& ( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 85.0) | |
| (df["ROC_9_1d"] < 250.0) | |
) | |
# 1h P&D, 15m down move, 15m still high, 1h high | |
& ( | |
(df["change_pct_1h"] > -10.0) | |
| (df["change_pct_1h"].shift(12) < 10.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 4h P&D, 15m & 1h still high, 4h high & overbought | |
& ( | |
(df["change_pct_4h"] > -2.0) | |
| (df["change_pct_4h"].shift(48) < 10.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 50.0) | |
) | |
# 4h P&D, 15m down move, 15m & 1h still high, 4h still high & overbought | |
& ( | |
(df["change_pct_4h"] > -10.0) | |
| (df["change_pct_4h"].shift(48) < 25.0) | |
| (df["RSI_3_15m"] > 25.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["ROC_9_4h"] < 30.0) | |
) | |
# 4h P&D, 1h still high, 4h down move, 4h still high | |
& ( | |
(df["change_pct_4h"] > -20.0) | |
| (df["change_pct_4h"].shift(48) < 20.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_4h"].shift(48) < 80.0) | |
) | |
# 4h green with top wick, 15m & 1h down move, 15m & 1h still high, 4h high & overbought | |
& ( | |
(df["change_pct_4h"] < 5.0) | |
| (df["top_wick_pct_4h"] < 5.0) | |
| (df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_4h"] < 20.0) | |
) | |
# 5h green with top wick, 15m down move, 15m still high, 1h still high, 4h high | |
& ( | |
(df["change_pct_4h"] < 5.0) | |
| (df["top_wick_pct_4h"] < 5.0) | |
| (df["RSI_3_15m"] > 45.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 80.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 25.0) | |
) | |
# 4h green with top wick, 15m down move, 15m still not low enough, 4h still high & overbought, 1d high | |
& ( | |
(df["change_pct_4h"] < 5.0) | |
| (df["top_wick_pct_4h"] < 5.0) | |
| (df["RSI_3_15m"] > 50.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 4h green with top wick, 15m still not low enough, 1h high, 4h high | |
& ( | |
(df["change_pct_4h"] < 10.0) | |
| (df["top_wick_pct_4h"] < 10.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 4h green with top wick, 15m & 1h & 4h still high, 1d overbought | |
& ( | |
(df["change_pct_4h"] < 10.0) | |
| (df["top_wick_pct_4h"] < 10.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d red, 1h & 4h down move, 1h high & overbought | |
& ( | |
(df["change_pct_1d"] > -4.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 5.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d P&D, 15m still not low enough, 1h & 4h still high, 1d overbought | |
& ( | |
(df["change_pct_1d"] > -5.0) | |
| (df["change_pct_1d"].shift(288) < 30.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["STOCHk_14_3_3_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d P&D, 15m & 1h & 4h down move, 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1d P&D, 15m down move, 15m & 1h & 4h & 1d still high | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 1d P&D, 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 4h downtrend | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["ROC_9_4h"] > -20.0) | |
) | |
# 1d green with top wick, 15m & 1h & 4h still high, 4h overbought | |
& ( | |
(df["change_pct_1d"] < 5.0) | |
| (df["top_wick_pct_1d"] < 5.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 20.0) | |
) | |
# 1d green with top wick, 15m & 1h & 4h down move, 1h & 4h still not low enough, 1h high & overbought | |
& ( | |
(df["change_pct_1d"] < 5.0) | |
| (df["top_wick_pct_1d"] < 10.0) | |
| (df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d green with top wick, 15m & 1h down move, 1h & 4h still high, 1d overbought | |
& ( | |
(df["change_pct_1d"] < 5.0) | |
| (df["top_wick_pct_1d"] < 30.0) | |
| (df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["ROC_9_1d"] < 150.0) | |
) | |
# 1d green with top wick, 15m & 1h & 4h high, 1d high & overbought | |
& ( | |
(df["change_pct_1d"] < 10.0) | |
| (df["top_wick_pct_1d"] < 10.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
| (df["RSI_14_1h"] < 70.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
| (df["ROC_9_1d"] < 20.0) | |
) | |
# 1d green with top wick, 15m & 1h & 4h down move, 15m high, 4h still not low enough, 1d overbought | |
& ( | |
(df["change_pct_1d"] < 10.0) | |
| (df["top_wick_pct_1d"] < 10.0) | |
| (df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["ROC_9_1d"] < 150.0) | |
) | |
# 1d green & top wick, 15m down move, 15m still not low enough, 1h high, 4h & 1d high & overbought | |
& ( | |
(df["change_pct_1d"] < 10.0) | |
| (df["top_wick_pct_1d"] < 10.0) | |
| (df["RSI_3_15m"] > 60.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 60.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 1d green with top wick, 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["change_pct_1d"] < 10.0) | |
| (df["top_wick_pct_1d"] < 20.0) | |
| (df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 80.0) | |
) | |
# 1d green with top wick, 4h down move, 4h still high, 4h overbought | |
& ( | |
(df["change_pct_1d"] < 20.0) | |
| (df["top_wick_pct_1d"] < 20.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_4h"] < 80.0) | |
) | |
# 1d green with top wick, 15m down move, 15m & 1h still not high, 4h still high & overbought, 1d high & overbought | |
& ( | |
(df["change_pct_1d"] < 20.0) | |
| (df["top_wick_pct_1d"] < 20.0) | |
| (df["RSI_3_15m"] > 50.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["ROC_9_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 80.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 1d green, 5m & 15m down move, 15m still not low enough, 1h & 4h high, 4h overbought | |
& ( | |
(df["change_pct_1d"] < 20.0) | |
| (df["RSI_3"] > 10.0) | |
| (df["RSI_3_15m"] > 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["RSI_14_4h"] < 85.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 50.0) | |
) | |
# 1d green, 15m & 4h down move, 15m & 4h still high, 4h overbought | |
& ( | |
(df["change_pct_1d"] < 20.0) | |
| (df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["ROC_9_4h"] < 20.0) | |
) | |
# 1d green with top wick, 15m & 4h down move, 15m & 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["change_pct_1d"] < 20.0) | |
| (df["top_wick_pct_1d"] < 20.0) | |
| (df["RSI_3_15m"] > 45.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["RSI_14_1d"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 1d green, 1h down move, 15m still not low enough, 1h still high, 4h & 1d high & overbought | |
& ( | |
(df["change_pct_1d"] < 30.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 60.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["ROC_9_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 1d green with top wick, 15m down move, 15m & 1h & 4h still not low enough, 4h & 1d overbought | |
& ( | |
(df["change_pct_1d"] < 35.0) | |
| (df["top_wick_pct_1d"] < 35.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_4h"] < 20.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 1d green, 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high & overbought | |
& ( | |
(df["change_pct_1d"] < 50.0) | |
| (df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 1d top wick, 15m down move, 15m & 1h & 4h still high, 1d high & overbought | |
& ( | |
(df["top_wick_pct_1d"] < 20.0) | |
| (df["RSI_3_15m"] > 60.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
) | |
df["global_protections_long_dump"] = ( | |
# 5m & 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
( | |
(df["RSI_3"] > 2.0) | |
| (df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 5m & 15m & 1h & 4h & 1d down move, 1h & 4h low, 4h still not low enough | |
& ( | |
(df["RSI_3"] > 5.0) | |
| (df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["MFI_14_1h"] > 10.0) | |
| (df["CCI_20_change_pct_1h"] > 0.0) | |
| (df["MFI_14_4h"] > 10.0) | |
| (df["CCI_20_change_pct_4h"] > 0.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 5m & 15m & 1h down move, 15m & 1h still not low enough, 4h still high | |
& ( | |
(df["RSI_3"] > 5.0) | |
| (df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHk_14_3_3_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < 50.0) | |
| (df["STOCHk_14_3_3_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 5m & 15m & 1h down move, 15m still not low enough, 1h & 4h & 1d still high | |
& ( | |
(df["RSI_3"] > 5.0) | |
| (df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 5m & 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough. 1 still not low enough & downtrend | |
& ( | |
(df["RSI_3"] > 10.0) | |
| (df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 5.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["RSI_14_15m"] < 5.0) | |
| (df["CCI_20_15m"] < -500.0) | |
| (df["RSI_14_1h"] < 5.0) | |
| (df["CCI_20_1h"] < -350.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -350.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["ROC_9_1d"] > -10.0) | |
) | |
# 5m & 15m & 1h & 4h down move, 15m & 1h & 4h still high | |
& ( | |
(df["RSI_3"] > 10.0) | |
| (df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 65.0) | |
| (df["RSI_3_4h"] > 65.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["RSI_14_4h"] < 45.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 5.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 5.0) | |
| (df["CCI_20_15m"] < -800.0) | |
| (df["RSI_14_1h"] < 10.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -300.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["STOCHk_14_3_3_1d"] < 20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h & 1d stil not low enough | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHk_14_3_3_4h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["STOCHk_14_3_3_1d"] < 20.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still now low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 5.0) | |
| (df["RSI_3_4h"] > 5.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 5.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["RSI_14_4h"] < 10.0) | |
| (df["CCI_20_4h"] < -300.0) | |
| (df["RSI_14_1d"] < 20.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_14_15m"] < 10.0) | |
| (df["CCI_20_15m"] < -450.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -150.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_3_1d"] > 45.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -350.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["UO_7_14_28_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["RSI_14_4h"] < 25.0) | |
| (df["UO_7_14_28_4h"] < 35.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 50.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["RSI_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -350.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -300.0) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_3_1d"] > 50.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h still high, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_1d"] > -25.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 5.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
| (df["UO_7_14_28_1h"] < 30.0) | |
| (df["UO_7_14_28_4h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 30.0) | |
) | |
# 15m & 1h & 4h down move, 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["WILLR_14_1h"] < -75.0) | |
| (df["UO_7_14_28_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["WILLR_14_4h"] < -75.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["UO_7_14_28_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 25.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHk_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 60.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -350.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CMF_20_15m"] > -0.20) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["UO_7_14_28_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["UO_7_14_28_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -150.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -400.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -400.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 1h & 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < -150.0) | |
| (df["STOCHk_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["STOCHk_14_3_3_1d"] < 20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 1h still high, 4h high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 15.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 20.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 1h & 4h still not low enough & downtrend, 1h still high | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -450.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CMF_20_1h"] > -0.10) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["CMF_20_4h"] > -0.10) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 10.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["STOCHk_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["STOCHk_14_3_3_1d"] < 10.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_3_1d"] > 45.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHk_14_3_3_4h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 40.0) | |
) | |
# 15m & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 10.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["RSI_14_1h"] < 5.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_4h"] < 15.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["UO_7_14_28_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["WILLR_14_4h"] < -90.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["ROC_2_1d"] > -30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low ennough | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 10.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 15.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["STOCHk_14_3_3_1d"] < 20.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["MFI_14_15m"] < 10.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["MFI_14_1h"] < 10.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["MFI_14_4h"] < 10.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["RSI_14_1d"] < 30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h still not low enough, 4h still not low enough & downtrend, 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -300.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["ROC_9_4h"] > -20.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -450.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHk_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -150.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["ROC_9_1d"] > -40.0) | |
) | |
# 15m & 1h down move, 15m still not low enough, 1h & 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -0.0) | |
| (df["STOCHk_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["STOCHk_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m downtrend, 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["CMF_20_15m"] > -0.20) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["UO_7_14_28_1h"] < 40.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["UO_7_14_28_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHk_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_3_1d"] > 50.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["STOCHk_14_3_3_15m"] < 5.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["CCI_20_4h"] < -150.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m still high, 1h & 4h still not low enough, 4h & 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | |
| (df["WILLR_14_1h"] < -85.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["ROC_9_4h"] > -15.0) | |
| (df["ROC_9_1d"] > -40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low & downtrend | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h still not low enough, 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["STOCHk_14_3_3_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["WILLR_14_4h"] < -90.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["STOCHk_14_3_3_1d"] < 30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 5.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 15.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h still not low enough, 4h & 1d still high | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -450.0) | |
| (df["RSI_14_1h"] < 25.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["CCI_20_1h"] < -450.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["STOCHk_14_3_3_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d dowmove, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_3_1d"] > 20.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -400.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -400.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 20.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 10.0) | |
| (df["CCI_20_15m"] < -350.0) | |
| (df["RSI_14_1h"] < 15.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["RSI_14_1d"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 15.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 15.0) | |
| (df["CCI_20_1h"] < -450.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -450.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -450.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -250.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["CCI_20_15m"] < -450.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -450.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -150.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["ROC_9_1d"] > -15.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_3_1d"] > 45.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -350.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 40.0) | |
) | |
# 15m & 1h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["WILLR_14_1h"] < -80.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["WILLR_14_4h"] < -75.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["STOCHk_14_3_3_1d"] < 10.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still now low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 20.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -150.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 15.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -250.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHk_14_3_3_4h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["ROC_9_1d"] > -15.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_3_1d"] > 60.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["WILLR_14_1h"] < -80.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHk_14_3_3_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHk_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h * 1d down move, 15m high, 4h still not low enough, 1d still high, 4h downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["ROC_9_4h"] > -20.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 4h still not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m high, 1h & 4h & 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["ROC_9_1h"] > -10.0) | |
| (df["ROC_9_4h"] > -20.0) | |
| (df["ROC_2_1d"] > -25.0) | |
| (df["ROC_9_1d"] > -25.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["WILLR_14_4h"] < -95.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still high, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1h"] > 55.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_3_1d"] > 45.0) | |
| (df["RSI_14_15m"] < 25.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["MFI_14_1h"] < 35.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["MFI_14_4h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["MFI_14_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m high, 1h still high, 4h downtrend | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 5.0) | |
| (df["RSI_3_1d"] > 15.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["ROC_9_4h"] > -20.0) | |
) | |
# 15m & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 50.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["STOCHk_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -150.0) | |
| (df["STOCHk_14_3_3_4h"] < 10.0) | |
| (df["RSI_14_1d"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHk_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m& 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -200.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["CCI_20_1h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["STOCHk_14_3_3_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CCI_20_4h"] < -150.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["STOCHk_14_3_3_1d"] < 20.0) | |
| (df["ROC_9_1d"] > -15.0) | |
) | |
# 15m & 1d down move, 15m & 1h & 4h still high, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1d"] > 45.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["RSI_14_4h"] < 50.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["ROC_9_1d"] > -15.0) | |
) | |
# 15m down move, 15m & 1h & 4h still high | |
& ( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_14_15m"] < 45.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["CCI_20_15m"] < -50.0) | |
| (df["STOCHk_14_3_3_15m"] < 40.0) | |
| (df["RSI_14_1h"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["CCI_20_1h"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["CCI_20_15m"] < -100.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CCI_20_1h"] < -300.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CCI_20_4h"] < -300.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still high, 4h & 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 55.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 20.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["ROC_9_4h"] > -20.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h still not low enough, 4h high, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 60.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["CCI_20_15m"] < -250.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -200.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m & 1h & 4h down move, 15m still not low enough, 1h & 4h still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 35.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["CMF_20_15m"] > -0.25) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["MFI_14_1h"] < 10.0) | |
| (df["ROC_9_1h"] > -10.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["MFI_14_4h"] < 20.0) | |
| (df["ROC_9_4h"] > -15.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["MFI_14_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["MFI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["RSI_14_1d"] < 40.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h still not low enough, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["ROC_9_1d"] > -40.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m high, 1h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 60.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_3_1d"] > 45.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_3_1h"] > 30.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_3_1d"] > 25.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1h & 4h downtrend | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["ROC_9_1h"] > -30.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["ROC_9_4h"] > -50.0) | |
) | |
# 15m down move, 15m & 1h still high, 4h high, 1d downtrend | |
& ( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["ROC_9_1d"] > -25.0) | |
) | |
# 15m & 1h & 4h down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["RSI_3_15m"] > 55.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["STOCHk_14_3_3_15m"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["UO_7_14_28_1h"] < 40.0) | |
| (df["CCI_20_1h"] < -100.0) | |
| (df["STOCHk_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["UO_7_14_28_4h"] < 40.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["RSI_14_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d down move, 15m high, 1h & 4h still high | |
& ( | |
(df["RSI_3_15m"] > 60.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_15m"] < 50.0) | |
| (df["AROONU_14_15m"] < 75.0) | |
| (df["CCI_20_15m"] < 100.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 35.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] < -150.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["CCI_20_4h"] < -0.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 1h & 4h & 1d down move, 14m still not low enough, 1h & 4h downtrend, 1d still not low enough & downtrend | |
& ( | |
(df["RSI_3_1h"] > 5.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 10.0) | |
| (df["RSI_14_15m"] < 20.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["CMF_20_1h"] > -0.25) | |
| (df["CMF_20_4h"] > -0.25) | |
| (df["RSI_14_1d"] < 20.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["ROC_9_1d"] > -40.0) | |
) | |
# 1h & 4h & 1d down move, 15m still high, 1h not low enough, 4h still high, 1d not low enough, 1d downtrend | |
& ( | |
(df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 25.0) | |
| (df["ROC_2_1d"] > -25.0) | |
| (df["ROC_9_1d"] > -25.0) | |
) | |
& ( | |
# 15m still not low enough, 4h & 1d down move, 1d downtrend | |
(df["STOCHRSIk_14_14_3_3_15m"] < 5.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 10.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 4h still not low enough, 1h & 4h & 1d down move | |
& ( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_3_1d"] > 30.0) | |
) | |
# 1h green with top wick, 15m high, 1h & 4h still high | |
& ( | |
(df["change_pct_1h"] < 10.0) | |
| (df["top_wick_pct_1h"] < 10.0) | |
| (df["RSI_14_15m"] < 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["RSI_14_1h"] < 40.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
) | |
# 4h red, 15m & 4h down move, 15m & 1h & 4h & 1d still high | |
& ( | |
(df["change_pct_4h"] > -4.0) | |
| (df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 4h red, 15m & 4h down move, 15m still not low enough, 1h & 4h & 1d still high | |
& ( | |
(df["change_pct_4h"] > -4.0) | |
| (df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 4h P&D, 1h & 4h & 1d down move, 15m & 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["change_pct_4h"] > -5.0) | |
| (df["change_pct_4h"].shift(48) < 5.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["RSI_3_1d"] > 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 35.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
) | |
# 4h red, 1h & 4h & 1d down move, 1h & 4h still not low enough, 4h & 1d downtrend | |
& ( | |
(df["change_pct_4h"] > -10.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["RSI_3_1d"] > 40.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["CMF_20_4h"] > -0.25) | |
| (df["RSI_14_1d"] < 40.0) | |
) | |
# 1d red, 15m & 1h & 4h & 1d down move, 4h stil not low enough, 1d still high, 4h downtrend | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["RSI_3_1d"] > 20.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["ROC_9_4h"] > -15.0) | |
) | |
# 1d red, 4h & 1d down move, 1h & 4h still not low enough & downtrend, 1d downtrend | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["RSI_3_1d"] > 20.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["CMF_20_1h"] > -0.25) | |
| (df["RSI_14_4h"] < 25.0) | |
| (df["CMF_20_1h"] > -0.25) | |
| (df["ROC_9_4h"] > -20.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 1d red, 1h still not low enough, 4h & 1d still not low enough & downtrend | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["RSI_14_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 20.0) | |
| (df["CMF_20_4h"] > -0.40) | |
| (df["ROC_9_4h"] > -20.0) | |
| (df["RSI_14_1d"] < 30.0) | |
| (df["CMF_20_1d"] > -0.50) | |
| (df["ROC_9_1d"] > -50.0) | |
) | |
# 1d red with top wick, 4h down move, 15m high, 1h & 4h still not low enough, 4h downtrend | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["top_wick_pct_1d"] < 10.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["ROC_9_4h"] > -20.0) | |
) | |
# 1d P&D, 1h & 4h down move, 15m & 1h & 4h still not low enough | |
& ( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 40.0) | |
| (df["RSI_3_1h"] > 50.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["STOCHk_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["WILLR_14_1h"] < -95.0) | |
| (df["RSI_14_4h"] < 40.0) | |
| (df["WILLR_14_4h"] < -80.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["STOCHk_14_3_3_4h"] < 40.0) | |
) | |
# 1d red, 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["change_pct_1d"] > -15.0) | |
| (df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 45.0) | |
| (df["RSI_3_4h"] > 45.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 1d red, 15m & 1d down move, 15m still high, 1h high, 1d still not low enough | |
& ( | |
(df["change_pct_1d"] > -15.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
| (df["RSI_14_1d"] < 35.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 1d red, 15m & 1h & 4h & 1d down move, 15m & 1h & 4h & 1d still not low enough | |
& ( | |
(df["change_pct_1d"] > -15.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 35.0) | |
| (df["RSI_3_1d"] > 35.0) | |
| (df["RSI_14_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["RSI_14_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["RSI_14_4h"] < 30.0) | |
| (df["RSI_14_1d"] < 35.0) | |
) | |
# 1d red, 1d down move, 1h low, 4h low & downtrend, 1d not low enough & downtrend | |
& ( | |
(df["change_pct_1d"] > -20.0) | |
| (df["RSI_3_1d"] > 10.0) | |
| (df["CMF_20_1h"] > -0.15) | |
| (df["CMF_20_4h"] > -0.30) | |
| (df["ROC_9_4h"] > -20.0) | |
| (df["RSI_14_1d"] < 20.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 30.0) | |
| (df["ROC_9_1d"] > -30.0) | |
) | |
# 1d P&D, 15m down move, 15m still not low enough, 1h & 4h & 1d still high | |
& ( | |
(df["change_pct_1d"] > -20.0) | |
| (df["change_pct_1d"].shift(288) < 20.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1d red, 15m & 1h & 4h down move, 1h & 4h still not low enough, 1d still high | |
& ( | |
(df["change_pct_1d"] > -30.0) | |
| (df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 40.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 20.0) | |
) | |
# 1d green with top wick, 4h down move, 4h still high, 4h overbought | |
& ( | |
(df["change_pct_1d"] < 20.0) | |
| (df["top_wick_pct_1d"] < 20.0) | |
| (df["RSI_3_4h"] > 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["ROC_9_4h"] < 50.0) | |
) | |
# 1d green, 15m & 1h & 4h down move, 15m still not low enough 1h & 4h & 1d still high | |
& ( | |
(df["change_pct_1d"] < 20.0) | |
| (df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1h"] > 55.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 5.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
) | |
df["protections_long_rebuy"] = True | |
# Global protections Short | |
df["protections_short_global"] = True | |
df["global_protections_short_pump"] = ( | |
# 1d green, 15m & 1h & 4h & 1d up move, 4h & 1d still not high enough & uptrend | |
( | |
(df["RSI_3_15m"] < 60.0) | |
| (df["RSI_3_1h"] < 70.0) | |
| (df["RSI_3_4h"] < 70.0) | |
| (df["RSI_3_1d"] < 80.0) | |
| (df["RSI_14_4h"] > 70.0) | |
| (df["WILLR_14_4h"] > -10.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
| (df["ROC_9_4h"] < 40.0) | |
| (df["RSI_14_1d"] > 80.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h & 4h & 1d up move, 15m & 1h & 4h & 1d still not high enough, 1d uptrend | |
& ( | |
(df["RSI_3_15m"] < 70.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["RSI_3_4h"] < 80.0) | |
| (df["RSI_3_1d"] < 80.0) | |
| (df["MFI_14_15m"] > 90.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] > 90.0) | |
| (df["MFI_14_1h"] > 90.0) | |
| (df["MFI_14_4h"] > 80.0) | |
| (df["WILLR_14_4h"] > -5.0) | |
| (df["AROOND_14_4h"] < 50.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m & 1h up move, 15m & 1h & 4h still not high enough, 1d still not high enough & uptrend | |
& ( | |
(df["RSI_3_15m"] < 70.0) | |
| (df["RSI_3_1h"] < 85.0) | |
| (df["MFI_14_15m"] > 90.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] > 80.0) | |
| (df["RSI_14_1h"] > 80.0) | |
| (df["MFI_14_1h"] > 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
| (df["RSI_14_4h"] > 80.0) | |
| (df["RSI_14_1d"] > 80.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h & 1d up move, 15m & 1h still not high enough, 4h & 1d stil not high enough & uptrend | |
& ( | |
(df["RSI_3_15m"] < 80.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["RSI_3_4h"] < 80.0) | |
| (df["RSI_3_1d"] < 95.0) | |
| (df["RSI_14_15m"] > 85.0) | |
| (df["CCI_20_15m"] > 250.0) | |
| (df["RSI_14_1h"] > 85.0) | |
| (df["CCI_20_1h"] > 250.0) | |
| (df["CCI_20_change_pct_1h"] < -0.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
| (df["RSI_14_4h"] > 85.0) | |
| (df["CCI_20_4h"] > 250.0) | |
| (df["CCI_20_change_pct_4h"] < -0.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
| (df["ROC_9_4h"] < 30.0) | |
| (df["RSI_14_1d"] > 90.0) | |
| (df["WILLR_14_1d"] > -10.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h up move, 15m & 1h & 4h still not high enough, 1d still not high enough & uptrend | |
& ( | |
(df["RSI_3_15m"] < 80.0) | |
| (df["RSI_3_1h"] < 90.0) | |
| (df["RSI_14_15m"] > 85.0) | |
| (df["CCI_20_15m"] > 250.0) | |
| (df["RSI_14_1h"] > 75.0) | |
| (df["AROOND_14_1h"] < 50.0) | |
| (df["CCI_20_1h"] > 350.0) | |
| (df["CCI_20_change_pct_1h"] < -0.0) | |
| (df["RSI_14_4h"] > 85.0) | |
| (df["CCI_20_4h"] > 150.0) | |
| (df["CCI_20_change_pct_4h"] < -0.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
| (df["RSI_14_1d"] > 85.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h & 1d up move, 15m & 1h & 4h & 1d still not high enough | |
& ( | |
(df["RSI_3_15m"] < 80.0) | |
| (df["RSI_3_1h"] < 90.0) | |
| (df["RSI_3_4h"] < 70.0) | |
| (df["RSI_3_1d"] < 70.0) | |
| (df["RSI_14_15m"] > 85.0) | |
| (df["RSI_14_1h"] > 85.0) | |
| (df["CCI_20_1h"] > 250.0) | |
| (df["CCI_20_change_pct_1h"] < -0.0) | |
| (df["RSI_14_4h"] > 70.0) | |
| (df["AROOND_14_4h"] < 75.0) | |
| (df["CCI_20_4h"] > 200.0) | |
| (df["CCI_20_change_pct_4h"] < -0.0) | |
| (df["STOCHk_14_3_3_4h"] > 70.0) | |
| (df["RSI_14_1d"] > 70.0) | |
) | |
# 15m & 1h & 4h & 1d up move, 1h still not high enough, 1d still low, 4h & 1d uptrend | |
& ( | |
(df["RSI_3_15m"] < 80.0) | |
| (df["RSI_3_1h"] < 85.0) | |
| (df["RSI_3_4h"] < 90.0) | |
| (df["RSI_3_1d"] < 95.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 60.0) | |
| (df["AROOND_14_1d"] < 50.0) | |
| (df["ROC_9_4h"] < 100.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h & 4h & 1d up move, 15m & 1h still not high enough, 4h & 1d still not high enough & uptrend | |
& ( | |
(df["RSI_3_15m"] < 80.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["RSI_3_4h"] < 90.0) | |
| (df["RSI_3_1d"] < 95.0) | |
| (df["RSI_14_15m"] > 85.0) | |
| (df["STOCHk_14_3_3_15m"] > 90.0) | |
| (df["RSI_14_1h"] > 90.0) | |
| (df["STOCHk_14_3_3_1h"] > 90.0) | |
| (df["RSI_14_4h"] > 95.0) | |
| (df["STOCHk_14_3_3_4h"] > 90.0) | |
| (df["ROC_9_4h"] < 50.0) | |
| (df["RSI_14_1d"] > 95.0) | |
| (df["STOCHk_14_3_3_1d"] > 70.0) | |
| (df["AROOND_14_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h up move, 1h & 4h still not high enough, 1d uptrend | |
& ( | |
(df["RSI_3_15m"] < 85.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["RSI_3_4h"] < 60.0) | |
| (df["WILLR_14_1h"] > -5.0) | |
| (df["AROOND_14_1h"] < 25.0) | |
| (df["WILLR_14_4h"] > -10.0) | |
| (df["AROOND_14_4h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h up move, 15m & 1h & 4h still not high enough, 1d still not high enough & overbought | |
& ( | |
(df["RSI_3_15m"] < 90.0) | |
| (df["RSI_3_1h"] < 60.0) | |
| (df["RSI_3_4h"] < 60.0) | |
| (df["RSI_14_15m"] > 85.0) | |
| (df["CCI_20_15m"] > 250.0) | |
| (df["RSI_14_1h"] > 70.0) | |
| (df["CCI_20_1h"] > 200.0) | |
| (df["STOCHk_14_3_3_1h"] > 90.0) | |
| (df["RSI_14_4h"] > 65.0) | |
| (df["CCI_20_4h"] > 200.0) | |
| (df["STOCHk_14_3_3_4h"] > 90.0) | |
| (df["RSI_14_1d"] > 65.0) | |
| (df["STOCHk_14_3_3_1d"] > 70.0) | |
| (df["ROC_9_1d"] < 30.0) | |
) | |
# 15m & 1h & 4h & 1d up move, 15m & 1h & 4h still not high enough. 1d still not high enough & uptrend | |
& ( | |
(df["RSI_3_15m"] < 95.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["RSI_3_4h"] < 80.0) | |
| (df["RSI_3_1d"] < 80.0) | |
| (df["RSI_14_15m"] > 90.0) | |
| (df["RSI_14_1h"] > 90.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
| (df["RSI_14_4h"] > 90.0) | |
| (df["WILLR_14_4h"] > -5.0) | |
| (df["RSI_14_1d"] > 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 80.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m & 1h & 4h up move, 15m & 1h still not high enough, 4h still not high enough & uptrend | |
& ( | |
(df["RSI_3_15m"] < 95.0) | |
| (df["RSI_3_1h"] < 90.0) | |
| (df["RSI_3_4h"] < 90.0) | |
| (df["RSI_14_15m"] > 90.0) | |
| (df["CCI_20_15m"] > 250.0) | |
| (df["RSI_14_1h"] > 90.0) | |
| (df["AROOND_14_1h"] < 25.0) | |
| (df["CCI_20_1h"] > 300.0) | |
| (df["STOCHk_14_3_3_1h"] > 90.0) | |
| (df["RSI_14_4h"] > 95.0) | |
| (df["CCI_20_4h"] > 300.0) | |
| (df["ROC_9_4h"] < 20.0) | |
) | |
# 1h & 4h & 1d up move, 15m still not high enough, 1h & 4h & 1d still not high enough, 1d uptrend | |
& ( | |
(df["RSI_3_1h"] < 80.0) | |
| (df["RSI_3_4h"] < 60.0) | |
| (df["RSI_3_1d"] < 90.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] > 80.0) | |
| (df["WILLR_14_1h"] > -20.0) | |
| (df["WILLR_14_4h"] > -25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
| (df["AROOND_14_1d"] < 50.0) | |
| (df["ROC_9_1d"] < 20.0) | |
) | |
) | |
df["global_protections_short_dump"] = ( | |
# 15m up move, 15m still low, 1h & 4h & 1d still not high | |
(df["RSI_3_15m"] < 85.0) | |
| (df["AROOND_14_15m"] < 50.0) | |
| (df["RSI_14_1h"] > 70.0) | |
| (df["WILLR_14_1h"] > -50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
| (df["AROOND_14_1h"] < 75.0) | |
| (df["RSI_14_4h"] > 70.0) | |
| (df["WILLR_14_4h"] > -50.0) | |
| (df["AROOND_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
| (df["RSI_14_1d"] > 70.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 | |
# 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 | |
log.info(f"Cancelling entry for {pair} due to reached the limit of grind mode open trades.") | |
return False | |
else: | |
# The pair is not in the list of grind mode allowed | |
log.info(f"[{current_time}] Cancelling entry for {pair} due to {pair} not in list of grind mode coins.") | |
return False | |
# Top Coins mode | |
elif all(c in self.long_top_coins_mode_tags for c in entry_tags): | |
is_pair_top_coins_mode = pair.split("/")[0] in self.top_coins_mode_coins | |
if not is_pair_top_coins_mode: | |
# The pair is not in the list of top_coins mode allowed | |
log.info(f"[{current_time}] Cancelling entry for {pair} due to {pair} not in list of top coins mode coins.") | |
return False | |
# Derisk mode | |
elif all(c in self.long_derisk_mode_tags for c in entry_tags): | |
current_free_slots = self.config["max_open_trades"] | |
current_free_slots = self.config["max_open_trades"] - Trade.get_open_trade_count() | |
if current_free_slots < self.min_free_slots_derisk_mode: | |
# not enough free slots for derisk mode | |
log.info(f"[{current_time}] Cancelling entry for {pair} due to not enough free slots.") | |
return False | |
df, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) | |
if len(df) >= 1: | |
last_candle = df.iloc[-1].squeeze() | |
if ("side" == "long" and rate > last_candle["close"]) or ("side" == "short" and rate < last_candle["close"]): | |
slippage = (rate / last_candle["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"[{current_time}] Cancelling entry 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 in ["stop_loss", "trailing_stop_loss", "liquidation"]: | |
log.info(f"[{current_time}] Cancelling {exit_reason} exit for {pair}") | |
return False | |
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 | |
def is_backtest_mode(self) -> bool: | |
"""Check if the current run mode is backtest or hyperopt""" | |
return self.dp.runmode.value in ["backtest", "hyperopt"] | |
def has_valid_entry_conditions(self, trade: Trade, exit_rate: float, last_candle, previous_candle) -> bool: | |
"""Check if there are valid entry conditions""" | |
filled_orders = trade.select_filled_orders() | |
if len(filled_orders) < 1: | |
return False | |
slice_profit = (exit_rate - filled_orders[-1].safe_price) / filled_orders[-1].safe_price | |
if not trade.is_short: | |
return last_candle["enter_long"] or self.long_grind_entry(last_candle, previous_candle, slice_profit, False) | |
else: | |
return last_candle["enter_short"] or self.short_grind_entry(last_candle, previous_candle, slice_profit, False) | |
return False | |
# Update signals (enable/disable) from config | |
# --------------------------------------------------------------------------------------------- | |
def update_signals_from_config(self, config): | |
# Update long entry signal parameters (if they exist in the config) | |
if hasattr(self, "long_entry_signal_params") and "long_entry_signal_params" in config: | |
for condition_key in self.long_entry_signal_params: | |
if condition_key in config["long_entry_signal_params"]: | |
self.long_entry_signal_params[condition_key] = config["long_entry_signal_params"][condition_key] | |
# Update short entry signal parameters (if they exist in the config) | |
if hasattr(self, "short_entry_signal_params") and "short_entry_signal_params" in config: | |
for condition_key in self.short_entry_signal_params: | |
if condition_key in config["short_entry_signal_params"]: | |
self.short_entry_signal_params[condition_key] = config["short_entry_signal_params"][condition_key] | |
# 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"] = "" | |
df.loc[:, "enter_long"] = "" | |
df.loc[:, "enter_short"] = "" | |
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_long_grind_mode = 0 | |
is_pair_long_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_long_grind_mode += 1 | |
# Top Coins mode | |
is_pair_long_top_coins_mode = metadata["pair"].split("/")[0] in self.top_coins_mode_coins | |
is_pair_short_top_coins_mode = metadata["pair"].split("/")[0] in self.top_coins_mode_coins | |
# if BTC/ETH stake | |
is_btc_stake = self.config["stake_currency"] in self.btc_stakes | |
allowed_empty_candles_288 = 144 if is_btc_stake else 60 | |
############################################################################################### | |
# LONG ENTRY CONDITIONS STARTS HERE | |
############################################################################################### | |
# | |
# /$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$$/$$ /$$/$$$$$$$$/$$$$$$$$/$$$$$$$ | |
# | $$ /$$__ $| $$$ | $$/$$__ $$ | $$_____| $$$ | $|__ $$__| $$_____| $$__ $$ | |
# | $$ | $$ \ $| $$$$| $| $$ \__/ | $$ | $$$$| $$ | $$ | $$ | $$ \ $$ | |
# | $$ | $$ | $| $$ $$ $| $$ /$$$$ | $$$$$ | $$ $$ $$ | $$ | $$$$$ | $$$$$$$/ | |
# | $$ | $$ | $| $$ $$$| $$|_ $$ | $$__/ | $$ $$$$ | $$ | $$__/ | $$__ $$ | |
# | $$ | $$ | $| $$\ $$| $$ \ $$ | $$ | $$\ $$$ | $$ | $$ | $$ \ $$ | |
# | $$$$$$$| $$$$$$| $$ \ $| $$$$$$/ | $$$$$$$| $$ \ $$ | $$ | $$$$$$$| $$ | $$ | |
# |________/\______/|__/ \__/\______/ |________|__/ \__/ |__/ |________|__/ |__/ | |
# | |
for enabled_long_entry_signal in self.long_entry_signal_params: | |
long_entry_condition_index = int(enabled_long_entry_signal.split("_")[3]) | |
item_buy_protection_list = [True] | |
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 - Normal mode (Long). | |
if long_entry_condition_index == 1: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_3_1h"] <= 95.0) | |
long_entry_logic.append(df["RSI_3_4h"] <= 80.0) | |
long_entry_logic.append(df["RSI_3_1d"] <= 80.0) | |
long_entry_logic.append(df["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 90.0) | |
# 5m strong down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["ROC_9"] > -50.0)) | |
# 5m & 15m strong down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 2.0) | (df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 5m strong down move, 1h & 4h down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0)) | |
# 15m & 1h strong down move, 1h strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["CMF_20_1h"] > -0.30)) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["UO_7_14_28_1h"] < 25.0)) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["MFI_14_1h"] < 50.0)) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["UO_7_14_28_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["MFI_14_4h"] < 50.0)) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m down move, 15m & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 5m strong down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_change_pct_15m"] > -80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 1h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 15m down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["MFI_14_1d"] > 10.0) | |
) | |
# 15m down move, 4h still not low enough, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 15m still not low enough, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m down move, 15m still not low enoug, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["AROONU_14_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 60.0) | |
) | |
# 15m down move, 1h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m down move, 1h still high, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["ROC_9_4h"] < 80.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["UO_7_14_28_4h"] < 40.0)) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 15m still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_change_pct_4h"] > -50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_change_pct_4h"] > -65.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["UO_7_14_28_4h"] < 40.0)) | |
# 1h & 4h down move, 15m high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1h down move, 1h still not low enough, 1d strong downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 1h downmove, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_2_1d"] > -30.0) | |
) | |
# 1h down move, 1h not low enough, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["AROONU_14_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 1h & 4h down move, 1h stil high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 1h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 15m still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 1h still not low enough, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 4h & 1d down move, 1d strong downtrend | |
long_entry_logic.append((df["RSI_3_4h"] > 10.0) | (df["RSI_3_1d"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 4h down move, 1h still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 4h downmove, 1d downtrend, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["ROC_2_1d"] > -15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 1h downtrend, 4h down move, 1d downtrend | |
long_entry_logic.append((df["ROC_9_1h"] > -15.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h overbought, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["ROC_9_4h"] < 100.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m red, 15m strong downtrend | |
long_entry_logic.append((df["change_pct_15m"] > -20.0) | (df["RSI_3_15m"] > 5.0)) | |
# 1d red, 4h down move, 4h downtrend | |
long_entry_logic.append((df["change_pct_1d"] > -20.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_4h"] > -40.0)) | |
# 1d green witj green wick, 1d downtrend | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 20.0) | (df["top_wick_pct_1d"] < 20.0) | (df["ROC_9_1d"] > -50.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.030)) | |
long_entry_logic.append((df["EMA_26"].shift() - df["EMA_12"].shift()) > (df["open"] / 100.0)) | |
long_entry_logic.append(df["close"] < (df["BBL_20_2.0"] * 0.999)) | |
# Condition #2 - Normal mode (Long). | |
if long_entry_condition_index == 2: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
long_entry_logic.append(df["global_protections_long_pump"] == True) | |
long_entry_logic.append(df["global_protections_long_dump"] == True) | |
# 5m down move, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | (df["ROC_9_4h"] < 50.0) | |
) | |
# 5m strong down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["ROC_9"] > -50.0)) | |
# 15m & 1h & 1d downmove | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_1d"] > 10.0)) | |
# 5m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3"] > 5.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 5m down move, 1h still high, 4h down move | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["RSI_3_4h"] > 10.0) | |
) | |
# 15m downmove, 4h overbought | |
long_entry_logic.append((df["RSI_3_change_pct_15m"] > -40.0) | (df["RSI_14_4h"] < 75.0)) | |
# 5m & 15m & 1h down move | |
long_entry_logic.append((df["RSI_3"] > 5.0) | (df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 15.0)) | |
# 5m down move, 4h high | |
long_entry_logic.append((df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 75.0)) | |
# 5m down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 2.0) | (df["RSI_3_1h"] > 15.0) | (df["MFI_14_4h"] < 50.0)) | |
# 15m & 1h down move, 4h down | |
long_entry_logic.append((df["RSI_3_15m"] > 2.0) | (df["RSI_3_1h"] > 10.0) | (df["ROC_9_4h"] > -10.0)) | |
# 15m down move, 15m still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0)) | |
# 15m down move, 15m still not low enough, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
| (df["MFI_14_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["AROONU_14_1h"] < 50.0)) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 20.0) | (df["UO_7_14_28_4h"] < 45.0)) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 4h overbought & high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["ROC_9_4h"] < 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15 & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m down move, 1h high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0)) | |
# 15m & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_1d"] > -40.0)) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m down move, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m down move, 1h moving down, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["CCI_20_change_pct_1h"] > 0.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 1h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m down move, 1h low, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["ROC_9_1h"] > -20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0)) | |
# 15m down move, 1h still high, 4h overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["RSI_14_1h"] < 40.0) | (df["RSI_14_4h"] < 80.0)) | |
# 15m down move, 15m still high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0) | |
) | |
# 15m down move, 1h high, 1d low | |
long_entry_logic.append( | |
(df["RSI_3_change_pct_15m"] > -40.0) | (df["ROC_9_1h"] < 10.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m down move, 4h high, 1d low | |
long_entry_logic.append( | |
(df["ROC_9_15m"] > -5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m down move, 4h high, 1d low | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["ROC_9_4h"] < 20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m down move, 1h still high, 1d high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_14_1h"] < 40.0) | (df["ROC_9_1d"] < 50.0)) | |
# 15m & 1h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["ROC_9_1h"] > -20.0) | (df["ROC_9_1d"] < 40.0)) | |
# 15m down move, 1h high, 4h downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | (df["ROC_9_4h"] > -10.0) | |
) | |
# 15m & 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h & 4h down move | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["CMF_20_1h"] > -0.4) | (df["RSI_3_4h"] > 10.0)) | |
# 15m strong downtrend, 1h downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["MFI_14_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0)) | |
# 15m down move, 15m still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m down move, 4h still high, 1d still high & down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["RSI_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] > -15.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["UO_7_14_28_4h"] < 50.0) | |
) | |
# 15m down move, 1h high, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 14m down move, 4h downtrend, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["ROC_9_4h"] > -15.0) | (df["ROC_9_1d"] < 100.0)) | |
# 15m & 1h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
) | |
# 15m down move, 1h still not low enough, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_4h"] < 80.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 25.0) | (df["RSI_3_4h"] > 15.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m down move, 1h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m down move, 1h still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["UO_7_14_28_4h"] < 50.0) | |
) | |
# 15m down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 15m down move, 1h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_2_1d"] > -15.0) | |
) | |
# 15m down move, 1h still not low enough, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_4h"] < 50.0) | |
) | |
# 15m down move, 15m not low enough, 1h overbought | |
long_entry_logic.append( | |
(df["RSI_14_change_pct_15m"] > -40.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | (df["RSI_14_1h"] < 70.0) | |
) | |
# 15m still not low enough, 4h & 1d going down | |
long_entry_logic.append((df["AROONU_14_15m"] < 25.0) | (df["RSI_3_4h"] > 20.0) | (df["RSI_3_1d"] > 30.0)) | |
# 15m still not low enough, 4h overbought | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | (df["ROC_9_4h"] < 40.0) | |
) | |
# 15m still not low enough, 1h overbought | |
long_entry_logic.append((df["AROONU_14_15m"] < 25.0) | (df["RSI_14_1h"] < 90.0)) | |
# 1h strong down move | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_change_pct_1h"] > -85.0)) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h down move, 1d strong downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_3_1d"] > 5.0)) | |
# 1h down move, 1h still not low enough, 4h still not low | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_change_pct_4h"] > -50.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1h down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["AROONU_14_4h"] < 25.0) | (df["ROC_9_1d"] < 120.0)) | |
# 1h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 1h down move, 4h overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 15.0) | (df["RSI_14_4h"] < 75.0)) | |
# 15m down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1h & 4h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 60.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h down move, 4h still not low enough, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1h P&D, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["RSI_3_1h"].shift(12) < 80.0) | (df["ROC_9_1d"] > -20.0) | |
) | |
# 4h down move, 15m high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 4h strong downtrend | |
long_entry_logic.append((df["RSI_3_4h"] > 5.0) | (df["ROC_9_4h"] > -40.0)) | |
# 4h down move, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["MFI_14_1d"] < 70.0) | |
) | |
# 4h P&D | |
long_entry_logic.append((df["RSI_3_4h"] > 30.0) | (df["RSI_3_4h"].shift(48) < 95.0)) | |
# 4h down move, 1h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 4h down move, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 4h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_14_4h"] > 40.0) | (df["RSI_3_1d"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m still not low enough, 1h & 4h high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 4h & 1h high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
) | |
# 1h stil high, 1d overbought | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 95.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1h & 4h still high, 1d strong down move | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["UO_7_14_28_4h"] < 45.0) | (df["RSI_3_1d"] > 10.0) | |
) | |
# 5m down, 1h down move, 4h high | |
long_entry_logic.append( | |
(df["ROC_9"] > -5.0) | (df["RSI_3_change_pct_1h"] > -50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 4h pumped and going down | |
long_entry_logic.append((df["ROC_9_15m"] > -10.0) | (df["ROC_2_4h"] > -5.0) | (df["ROC_9_4h"] < 20.0)) | |
# 14m down move, 4h high | |
long_entry_logic.append( | |
(df["ROC_9_15m"] > -10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_4h"] < 35.0) | |
) | |
# 1h downtrend, 4h overbought | |
long_entry_logic.append( | |
(df["ROC_2_1h"] > -5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 95.0) | (df["ROC_9_4h"] < 70.0) | |
) | |
# 1h downtrend, 4h overbought | |
long_entry_logic.append((df["ROC_2_1h"] > -5.0) | (df["ROC_9_1h"] > -5.0) | (df["ROC_9_4h"] < 35.0)) | |
# 1h down, 1d strong downtrend | |
long_entry_logic.append((df["ROC_9_1h"] > -10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 1h & 4h & 1d downtrend | |
long_entry_logic.append((df["ROC_9_1h"] > -10.0) | (df["ROC_9_4h"] > -20.0) | (df["ROC_9_1d"] > -40.0)) | |
# 1h down, 1d overbought | |
long_entry_logic.append((df["ROC_9_1h"] > -10.0) | (df["ROC_9_1d"] < 80.0)) | |
# 4h P&D | |
long_entry_logic.append((df["ROC_2_4h"] > -20.0) | (df["ROC_9_4h"] < 80.0)) | |
# 4h overbought, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["ROC_9_4h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1d P&D | |
long_entry_logic.append((df["ROC_2_1d"] > -20.0) | (df["ROC_9_1d"] < 50.0)) | |
# 1d strong downtrend | |
long_entry_logic.append((df["ROC_2_1d"] > -20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 1d going down and it was pumped, 4h down move | |
long_entry_logic.append( | |
(df["ROC_2_1d"] > -20.0) | (df["ROC_9_1d"].shift(288) < 100.0) | (df["RSI_3_4h"] > 20.0) | |
) | |
# 15m red, 15m strong downtrend | |
long_entry_logic.append((df["change_pct_15m"] > -20.0) | (df["RSI_3_15m"] > 5.0)) | |
# 1h red, previous 1h green, 1h overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["change_pct_1h"].shift(12) < 5.0) | (df["RSI_14_1h"].shift(12) < 80.0) | |
) | |
# 1h red, previous 1h green, 1h overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -2.0) | (df["change_pct_1h"].shift(12) < 10.0) | (df["RSI_14_1h"].shift(12) < 80.0) | |
) | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["change_pct_1h"].shift(12) < 5.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h red, 4h green, 1h overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["change_pct_4h"] < 10.0) | (df["RSI_14_1h"].shift(12) < 70.0) | |
) | |
# 4h red, previous 4h green, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | |
| (df["change_pct_4h"].shift(48) < 5.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 4h red, previous 4h green, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -8.0) | (df["change_pct_4h"].shift(48) < 8.0) | (df["RSI_14_4h"].shift(48) < 80.0) | |
) | |
# 4h red, previous 4h green, 15m down move | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -8.0) | (df["change_pct_4h"].shift(48) < 8.0) | (df["RSI_3_15m"] > 5.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | (df["change_pct_1d"].shift(288) < 10.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1d P&D, 5m & 1h down move | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["RSI_3_15m"] > 10.0) | |
| (df["change_pct_1h"] > -5.0) | |
) | |
# 1d P&D, 1h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1d P&D, 15m & 1h still not low enough | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -20.0) | |
| (df["change_pct_1d"].shift(288) < 20.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1d green with top wick, 1h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 20.0) | (df["top_wick_pct_1d"] < 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# Logic | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3"] < 20.0) | |
long_entry_logic.append(df["close"] < (df["EMA_20"] * 0.944)) | |
# Condition #3 - Normal mode (Long). | |
if long_entry_condition_index == 3: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_3_1h"] <= 95.0) | |
long_entry_logic.append(df["RSI_3_4h"] <= 80.0) | |
long_entry_logic.append(df["RSI_3_1d"] <= 80.0) | |
long_entry_logic.append(df["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 90.0) | |
# 5m & 15m strong down move, 1h down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0)) | |
# 5m strong down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["ROC_9"] > -50.0)) | |
# 5m down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 5m down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# 5m down move, 4h still high | |
long_entry_logic.append((df["RSI_3"] > 10.0) | (df["MFI_14"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 5m & 15m down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
) | |
# 5m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 5m down move, 4h downtrend, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 5m & 4h strong down move, 4h still not low enough | |
long_entry_logic.append((df["RSI_3"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0)) | |
# 5m down move, 1h high, 1d overbought | |
long_entry_logic.append((df["RSI_3"] > 10.0) | (df["ROC_9_1h"] < 15.0) | (df["ROC_9_1d"] < 40.0)) | |
# 5m down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["UO_7_14_28_1h"] < 60.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 5m down move, 1h high, 4h downtrend | |
long_entry_logic.append( | |
(df["RSI_3"] > 2.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | (df["ROC_9_4h"] > -10.0) | |
) | |
# 5m & 1h down move, 4h down | |
long_entry_logic.append((df["RSI_3"] > 10.0) | (df["RSI_3_1h"] > 15.0) | (df["CMF_20_4h"] > -0.2)) | |
# 5m down move, 1h high | |
long_entry_logic.append((df["RSI_14_change_pct"] > -40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0)) | |
# 5m down move, 1h high | |
long_entry_logic.append((df["RSI_14_change_pct"] > -40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 5m & 1h & 4h strong down move | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0)) | |
# 15m & 1h & 4h down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["CCI_20_change_pct_4h"] > 0.0) | |
) | |
# 15m & 1h & 1d downmove | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_1d"] > 10.0)) | |
# 15m down move, 15m still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 15m still not low enough, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
| (df["MFI_14_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 15.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 5m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 4h down move, 1h still not low | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_1d"] > -40.0)) | |
# 15m & 1h & 4h down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_change_pct_1h"] > -60.0) | (df["RSI_3_change_pct_4h"] > -40.0) | |
) | |
# 15m down move, 1d downtrend, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["ROC_9_1d"] > -25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m & 1d down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1d"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 15m still not low enough, 4h down move | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["AROONU_14_15m"] < 50.0) | (df["RSI_3_4h"] > 15.0)) | |
# 15m down move, 4h still high, 1d still high & down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["RSI_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] > -15.0) | |
) | |
# 15m down move, 1h high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 1h still high, 1d strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["AROONU_14_1h"] < 25.0) | (df["MFI_14_1d"] > 10.0)) | |
# 15m down move, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 15.0) | (df["ROC_9_1d"] > -70.0)) | |
# 15m down move, 4h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 15m not low enough, 1h overbought | |
long_entry_logic.append( | |
(df["RSI_14_change_pct_15m"] > -40.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | (df["RSI_14_1h"] < 70.0) | |
) | |
# 15m strong down move, 1h still high | |
long_entry_logic.append((df["ROC_9_15m"] > -15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0)) | |
# 15m downtrend, 1h & 4h still high | |
long_entry_logic.append( | |
(df["ROC_9_15m"] > -10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m strong down move | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["MFI_14_15m"] > 15.0) | (df["AROONU_14_15m"] < 25.0)) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["UO_7_14_28_4h"] < 50.0)) | |
# 15m & 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 15m still not low enough, & 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 15m still high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["UO_7_14_28_4h"] < 45.0) | |
) | |
# 15m down move, 15m still high, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 14m down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["AROONU_14_15m"] < 50.0) | (df["UO_7_14_28_4h"] < 50.0) | |
) | |
# 15m down move, 1h stil high, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["AROONU_14_1h"] < 25.0) | (df["ROC_9_1d"] < 80.0)) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 25.0) | (df["RSI_3_4h"] > 15.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m down move, 1h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m down move, 15m still high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 1h & 4h down move, 15m still not high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
) | |
# 1h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_14_4h"] < 40.0)) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 1h downmove, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_2_1d"] > -30.0) | |
) | |
# 1h & 4h down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h down move, 15m & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_change_pct_4h"] > -65.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["AROONU_14_4h"] < 25.0) | (df["ROC_9_1d"] < 120.0)) | |
# 1h down move, 1h still not low enough, 4h still not low | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 1h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h & 1d down move, 1h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 1h down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h down move, 1h still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 45.0) | |
) | |
# 1h down move, 1h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_change_pct_1h"] > -65.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 4h & 1d down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 10.0) | (df["ROC_2_1d"] > -20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 4h down move, 15m still high, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 4h down move, 1h high | |
long_entry_logic.append((df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0)) | |
# 4h down move, 15m still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 4h down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 4h down move, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["MFI_14_1d"] < 70.0) | |
) | |
# 4h down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 4h down move, 1h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["ROC_9_1d"] < 80.0) | |
) | |
# 4h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_14_4h"] > 40.0) | (df["RSI_3_1d"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m still high, 1h down move, 4h high | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 50.0) | (df["RSI_3_change_pct_1h"] > -50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m still high, 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 50.0) | |
| (df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m still high, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m & 1h still high, 4h overbought | |
long_entry_logic.append((df["AROONU_14_15m"] < 50.0) | (df["AROONU_14_1h"] < 50.0) | (df["ROC_9_4h"] < 40.0)) | |
# 15m still high, 1h down move, 1d downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h & 4h still high, 1d strong down move | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["UO_7_14_28_4h"] < 45.0) | (df["RSI_3_1d"] > 10.0) | |
) | |
# 1h high, 1d still high, 1d downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h still high, 4h & 1d downtrend | |
long_entry_logic.append((df["AROONU_14_1h"] < 25.0) | (df["ROC_9_4h"] > -20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h moving down, 1d P&D | |
long_entry_logic.append( | |
(df["ROC_9_4h"] > -30.0) | (df["RSI_3_change_pct_1d"] > -50.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d strong downtrend, 4h still high | |
long_entry_logic.append( | |
(df["ROC_2_1d"] > -20.0) | (df["ROC_9_1d"] > -50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["ROC_2_1d"] > -10.0) | (df["ROC_9_1d"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 95.0) | |
) | |
# 1d going down and it was pumped, 4h down move | |
long_entry_logic.append( | |
(df["ROC_2_1d"] > -20.0) | (df["ROC_9_1d"].shift(288) < 100.0) | (df["RSI_3_4h"] > 20.0) | |
) | |
# 1d downtrend, 4h downtrend, 4h still not low enough | |
long_entry_logic.append((df["ROC_9_1d"] > -40.0) | (df["CMF_20_4h"] > -0.25) | (df["AROONU_14_4h"] < 50.0)) | |
# 1d downtrend, 4h downtrend | |
long_entry_logic.append((df["ROC_9_1d"] > -40.0) | (df["CMF_20_4h"] > -0.30) | (df["RSI_3_4h"] > 10.0)) | |
# 15m red, 15m strong downtrend | |
long_entry_logic.append((df["change_pct_15m"] > -20.0) | (df["RSI_3_15m"] > 5.0)) | |
# 1h red, previous 1h green, 1h overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -1.0) | (df["change_pct_1h"].shift(12) < 5.0) | (df["RSI_14_1h"].shift(12) < 80.0) | |
) | |
# 1h red, 1h stil high, 4h downtrend | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_4h"] > -25.0) | |
) | |
# 4h red, 15m down move, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | (df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 4h red, previous 4h green, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | (df["change_pct_4h"].shift(48) < 5.0) | (df["ROC_9_4h"].shift(48) < 25.0) | |
) | |
# 4h red, 4h still not low enough, 1h downtrend, 1h overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["ROC_9_1h"] > -20.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# 4h red, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | (df["change_pct_1d"].shift(288) < 10.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1d P&D, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -15.0) | (df["change_pct_1d"].shift(288) < 15.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still going down | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["CCI_20_change_pct_4h"] > 0.0) | |
) | |
# 1d P&D, 1h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1d green, 4h red, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 20.0) | (df["change_pct_4h"] > -5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# Logic | |
long_entry_logic.append(df["RSI_20"] < df["RSI_20"].shift(1)) | |
long_entry_logic.append(df["RSI_4"] < 46.0) | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["close"] < df["SMA_16"] * 0.942) | |
# Condition #4 - Normal mode (Long). | |
if long_entry_condition_index == 4: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_3_1h"] <= 95.0) | |
long_entry_logic.append(df["RSI_3_4h"] <= 80.0) | |
long_entry_logic.append(df["RSI_3_1d"] <= 80.0) | |
long_entry_logic.append(df["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 90.0) | |
# 5m & 15m strong down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 2.0) | (df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 5m strong down move, 1h & 4h down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0)) | |
# 15m down move, 1h strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["MFI_14_1h"] > 5.0)) | |
# 15m & 1h strong down move, 1h strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["CMF_20_1h"] > -0.30)) | |
# 15m & 1h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["ROC_9_1d"] < 40.0)) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["MFI_14_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 1h low | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["CMF_20_1h"] > -0.15) | |
) | |
# 5m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["MFI_14_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 14m & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["UO_7_14_28_1h"] < 45.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 15m down move, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["UO_7_14_28_4h"] < 50.0)) | |
# 15m down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["UO_7_14_28_4h"] < 45.0) | |
) | |
# 15m down move, 1h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h & 4h down move, 15m high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h strong down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_14_change_pct_1h"] > -40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 1h strong down move, 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_change_pct_4h"] > -50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h & 4h down move, 15m high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 25.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 1h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 15m & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 4h & 1d strong down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_4h"] > 2.0) | (df["RSI_3_1d"] > 2.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h down move, 15m high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m downtrend, 4h down move, 4h stil high | |
long_entry_logic.append( | |
(df["ROC_9_15m"] > -20.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m red, 15m strong downtrend | |
long_entry_logic.append((df["change_pct_15m"] > -20.0) | (df["RSI_3_15m"] > 5.0)) | |
# 4h P&D, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -20.0) | |
| (df["change_pct_4h"].shift(48) < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1d red, 4h down move, 4h downtrend | |
long_entry_logic.append((df["change_pct_1d"] > -20.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_4h"] > -40.0)) | |
# 1d green witj green wick, 1d downtrend | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 20.0) | (df["top_wick_pct_1d"] < 20.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# Logic | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["AROONU_14_15m"] < 25.0) | |
long_entry_logic.append(df["close"] < (df["EMA_9"] * 0.942)) | |
long_entry_logic.append(df["close"] < (df["EMA_20"] * 0.960)) | |
# Condition #5 - Normal mode (Long). | |
if long_entry_condition_index == 5: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
long_entry_logic.append(df["global_protections_long_pump"] == True) | |
long_entry_logic.append(df["global_protections_long_dump"] == True) | |
# 5m strong down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["ROC_9"] > -50.0)) | |
# 5m still high, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3"] < 45.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 5m & 1h strong down move | |
long_entry_logic.append((df["RSI_3"] > 5.0) | (df["RSI_3_1h"] > 5.0)) | |
# 5m & 1h down move, 5h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 15.0) | |
) | |
# 5h & 1h down move, 1d high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 1h & 4h strong down move | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0)) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
) | |
# 15m & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 15m down move, 1h stil high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0)) | |
# 15m down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m & 1h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["ROC_9_1d"] > -40.0)) | |
# 15m & 1h down move, 15m still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 15.0) | (df["AROONU_14_15m"] < 50.0)) | |
# 15m & 1h down move, 15m still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 25.0) | (df["UO_7_14_28_4h"] < 40.0)) | |
# 15m down move, 4h still high, 1d still high & down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["RSI_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] > -15.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 15m down move, 1h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["AROONU_14_4h"] < 25.0) | (df["ROC_9_1d"] < 100.0)) | |
# 15m down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 15m & 1h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
) | |
# 15m & 1h down move, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 4h down move, 1h stil not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 15m down move, 1h high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m down move, 1h high | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0)) | |
# 15m & 1h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 14m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m down move, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m down move, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m down move, 1d high & overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | (df["ROC_9_1d"] < 60.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 1h down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["ROC_9_1d"] < 150.0) | |
) | |
# 15m down move, 4h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m down move, 15m still not low enough, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 35.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 1h & 4h strong down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1h & 4h down move, 15m high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 1h & 4h down move, 4h down | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["CMF_20_4h"] > -0.25)) | |
# 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0)) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 1h & 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1h & 1d down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_1d"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h down move, 1d high | |
long_entry_logic.append((df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0)) | |
# 1h & 1d down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h & 1d down move, 1h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 1h down move, 1h still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 4h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 1h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 25.0) | (df["ROC_9_1d"] < 100.0)) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 4h down move, 15m high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 4h down move, 1h high | |
long_entry_logic.append((df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0)) | |
# 4h & 1d down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 4h & 1d down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["RSI_3_1d"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 4h overbought & high | |
long_entry_logic.append((df["RSI_14_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 1d down move, 1h still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1d"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1d down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1d"] > 20.0) | (df["ROC_9_1d"] > -40.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1h down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_change_pct_1h"] > -50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h still high, 4h high | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0)) | |
# 4h overbought & high | |
long_entry_logic.append((df["ROC_9_4h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 1h red, 15m & 1h strong down move | |
long_entry_logic.append((df["change_pct_1h"] > -5.0) | (df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0)) | |
# 1h P&D 4h down move | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["change_pct_1h"].shift(12) < 5.0) | (df["RSI_3_4h"] > 20.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -5.0) | |
| (df["change_pct_1d"].shift(288) < 20.0) | |
| (df["RSI_14_1d"].shift(288) < 80.0) | |
) | |
# 1d P&D | |
long_entry_logic.append((df["change_pct_1d"] > -20.0) | (df["change_pct_1d"].shift(288) < 20.0)) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1d red with top wick, 4h down move | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | (df["top_wick_pct_1d"] < 10.0) | (df["RSI_3_4h"] > 25.0) | |
) | |
# 1d red, 4h downtrend | |
long_entry_logic.append((df["change_pct_1d"] > -25.0) | (df["ROC_9_4h"] > -25.0)) | |
# 1d green, 1h & 4h high | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 15.0) | (df["AROONU_14_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1d green with top wick, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 25.0) | (df["top_wick_pct_1d"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1d green with top wick, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 30.0) | (df["top_wick_pct_1d"] < 30.0) | (df["ROC_9_4h"] < 80.0) | |
) | |
# 1d green with top wick, 4h down move | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 30.0) | (df["top_wick_pct_1d"] < 30.0) | (df["RSI_3_4h"] > 25.0) | |
) | |
# Logic | |
long_entry_logic.append(df["RSI_3"] < 50.0) | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["AROOND_14"] > 75.0) | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3"] < 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.020)) | |
long_entry_logic.append((df["EMA_26"].shift() - df["EMA_12"].shift()) > (df["open"] / 100.0)) | |
# Condition #6 - Normal mode (Long). | |
if long_entry_condition_index == 6: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
long_entry_logic.append(df["global_protections_long_pump"] == True) | |
long_entry_logic.append(df["global_protections_long_dump"] == True) | |
# 5m down move, 1h high | |
long_entry_logic.append((df["RSI_3"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0)) | |
# 5m down move, 15m still not low enough, 1d high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
) | |
# 5m down move, 1h high, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_9_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 15m & 1h & 4h down move | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 20.0)) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 5m & 1h down move, 5h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 30.0) | (df["AROONU_14_1h"] < 50.0)) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m & 4h down move, 4h stil not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 15m down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0)) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 5.0) | (df["AROONU_14_1h"] < 50.0)) | |
# 15m & 1h & 4h & 1d down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["RSI_3_1d"] > 5.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["AROONU_14_1h"] < 50.0)) | |
# 15m & 1h down move, 15m still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 15.0) | (df["AROONU_14_15m"] < 50.0)) | |
# 15m & 1h & 4h down move, 15 still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 10.0) | (df["AROONU_14_15m"] < 25.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 4h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["ROC_2_1d"] < 25.0) | |
) | |
# 15m down move, 1h & 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["AROONU_14_1h"] < 75.0) | (df["AROONU_14_4h"] < 75.0)) | |
# 15m down move, 4h downtrend, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["CMF_20_4h"] > 0.0) | (df["ROC_9_1d"] < 80.0)) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 15.0) | (df["AROONU_14_4h"] < 75.0)) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 4h down move, 15m & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_3_4h"] > 10.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 30.0) | (df["AROONU_14_4h"] < 75.0)) | |
# 15m & 4h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 35.0) | (df["ROC_9_1d"] < 40.0)) | |
# 15m down move, 15m still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 45.0) | (df["UO_7_14_28_4h"] < 45.0) | |
) | |
# 15m down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 60.0) | |
) | |
# 15m down move, 1h stil high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["ROC_9_1d"] < 40.0) | |
) | |
# 15m down move, 1h high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0)) | |
# 15m down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0)) | |
# 15m down move, 15m still high | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["AROONU_14_15m"] < 50.0)) | |
# 15m down move, 15m & 1h still high, 4h still not low enough, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | |
| (df["RSI_14_15m"] < 35.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["AROONU_14_1d"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 4h overbought, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_14_4h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m & 1h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 15.0) | (df["ROC_9_1d"] > -40.0)) | |
# 15m & 1h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["ROC_9_1d"] < 50.0)) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 60.0) | |
) | |
# 15m & 4h down move, 15m still not low enough, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["AROONU_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 4h down move, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 80.0) | |
) | |
# 15m down move, 15m still not low enough, 4h high, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["MFI_14_1d"] < 60.0) | |
) | |
# 15m down move, 15m still high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 15m still high, 4h downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["ROC_9_4h"] > -40.0) | |
) | |
# 15m down move, 1h still not low enough, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m down move, 15m still high, 1h still high, 1h downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
| (df["ROC_9_1h"] > -10.0) | |
) | |
# 15m down move, 15m still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["AROONU_14_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["AROONU_14_1h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m down move, 5h & 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["ROC_9_4h"] < 40.0) | (df["ROC_9_1d"] < 80.0)) | |
# 15m & 4h down move, 15m & 1h still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_4h"] > 40.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["WILLR_14_4h"] > -85.0) | |
) | |
# 15m & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
) | |
# 15m down move, 1h still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["AROONU_14_4h"] < 100.0) | |
) | |
# 15m down move, 1h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m down move, 1h high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m down move, 4h still not low enough, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
) | |
# 15m down move, 4h still high, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_4h"] < 40.0) | |
) | |
# 15m down move, 1h high, 15m still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["AROONU_14_15m"] < 50.0) | |
) | |
# 15m down move, 4h high, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | (df["ROC_9_4h"] < 40.0) | |
) | |
# 15m down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["AROONU_14_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 15m high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 20.0) | (df["AROONU_14_15m"] < 75.0) | |
) | |
# 15m & 4h down move, 15m still not low enough, 1h down | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_4h"] > 5.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["MFI_14_1h"] > 10.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_4h"] > 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 1d down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_1d"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 15m down move, 15m still high, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 15m still not low enough, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 15m down move, 15m still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m down move, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m down move, 1h & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m own move, 1h high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | (df["MFI_14_4h"] < 80.0) | |
) | |
# 15m down move, 15m still not low enough, 4h high, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
| (df["ROC_9_4h"] < 50.0) | |
) | |
# 15m down move, 15m still high, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 35.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m down move, 15m high | |
long_entry_logic.append((df["RSI_3_15m"] > 35.0) | (df["AROONU_14_15m"] < 75.0)) | |
# 15m downb move, 15m still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 35.0) | (df["AROONU_14_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m & 1d down move, 15m still high, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 40.0) | |
| (df["RSI_3_1d"] > 20.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m down move, 15m still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 40.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m down move, 15m still high, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 45.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h & 4h down move, 1h still not low enough, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_4h"] > 15.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 1h down move, 1h still high | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0)) | |
# 1h down move, 4h high, 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_14_4h"] < 70.0) | (df["ROC_9_1d"] < 50.0)) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
) | |
# 1h & 4h down move, 4h downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["ROC_9_4h"] > -40.0)) | |
# 1h down move, 1h still not low enough, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h & 4h & 1d down move, 14 still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 15.0) | (df["RSI_3_1d"] > 15.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# 1h down move, 1h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["ROC_9_1d"] < 40.0) | |
) | |
# 1h down move, 1h still high | |
long_entry_logic.append((df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0)) | |
# 1h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0)) | |
# 1h down move, 1d still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 1h & 1d down move, 1h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 1h down move, 4h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["ROC_9_1d"] < 40.0) | |
) | |
# 1h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 25.0) | (df["ROC_9_1d"] < 200.0)) | |
# 1h down move, 1h & 4h high | |
long_entry_logic.append((df["RSI_3_1h"] > 30.0) | (df["AROONU_14_1h"] < 75.0) | (df["AROONU_14_4h"] < 75.0)) | |
# 1h down move, 4h & 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 40.0) | (df["RSI_14_4h"] < 80.0) | (df["ROC_9_1d"] < 100.0)) | |
# 1h down move, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 45.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["ROC_9_1d"] < 100.0) | |
) | |
# 1h down move, 15m & 4h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 50.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 1h down move, 15m & 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 50.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 4h down move, 1d high | |
long_entry_logic.append((df["RSI_3_4h"] > 15.0) | (df["MFI_14_1d"] < 80.0)) | |
# 4h down move, 15m & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 4h down move, 15m high, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 80.0) | (df["AROONU_14_1h"] < 50.0) | |
) | |
# 4h down move, 15m still high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 4h down move, 15m & 1h high | |
long_entry_logic.append((df["RSI_3_4h"] > 20.0) | (df["AROONU_14_15m"] < 75.0) | (df["AROONU_14_1h"] < 75.0)) | |
# 4h & 1d down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_4h"] > 25.0) | (df["RSI_3_1d"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h down move, 15m & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 4h down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append((df["RSI_3_4h"] > 25.0) | (df["AROONU_14_4h"] < 25.0) | (df["ROC_9_1d"] < 150.0)) | |
# 4h down move, 1h still not low enough, 1h downtrend, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
| (df["ROC_9_1h"] > -15.0) | |
| (df["ROC_9_1d"] < 80.0) | |
) | |
# 4h down move, 15m still high, 1d overbought | |
long_entry_logic.append((df["RSI_3_4h"] > 35.0) | (df["AROONU_14_15m"] < 75.0) | (df["ROC_9_1d"] < 80.0)) | |
# 4h down move, 1h still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 1d down move, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1d"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m still not low enough, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
) | |
# 15m still not low enough, 1h still high, 1d overbought | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0)) | |
# 15m still not low enough, 1h still high, 4h overbought | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_4h"] < 50.0) | |
) | |
# 15m still not low enough, 1h & 4h high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m high, 4h high & overbought | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
| (df["RSI_14_4h"] < 70.0) | |
| (df["ROC_9_4h"] < 40.0) | |
) | |
# 15m high, 1h still not low enough | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0)) | |
# 15m high, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 1h still high, 1h overbought, 4h overbought | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_1h"] < 80.0) | (df["RSI_14_4h"] < 80.0) | |
) | |
# 1h high, 4h overbought, 1d downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_9_4h"] < 25.0) | (df["ROC_9_1d"] > -25.0) | |
) | |
# 1h & 4h high, 1h overbought | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | (df["ROC_9_1h"] < 100.0) | |
) | |
# 1h high, 1h uptrend, 1d downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["ROC_9_1h"] < 20.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 1h high , 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 1h high, 4h & 1d downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | (df["ROC_9_4h"] > -30.0) | (df["ROC_9_1d"] > -80.0) | |
) | |
# 15m high, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m high, 1h & 4h high | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m high, 1h high, 1d downtrend | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["ROC_9_1d"] > -20.0) | |
) | |
# 15m high, 4h high, 4h overbought | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | (df["ROC_9_4h"] < 20.0) | |
) | |
# 15m high, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["AROONU_14_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | (df["ROC_9_1d"] > -25.0) | |
) | |
# 1h overbought, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["ROC_9_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1d green with top wick, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 15.0) | (df["top_wick_pct_1d"] < 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h P&D, 1h high | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["change_pct_1h"].shift(12) < 5.0) | (df["RSI_14_1h"].shift(12) < 70.0) | |
) | |
# 1h P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["change_pct_1h"].shift(12) < 5.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 4h P&D, 15m down move, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | |
| (df["change_pct_4h"].shift(48) < 5.0) | |
| (df["RSI_3_15m"] > 15.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
) | |
# 4h P&D, 1h downtrend, 4h high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | |
| (df["change_pct_4h"].shift(48) < 10.0) | |
| (df["ROC_9_1h"] > -20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 4h green, 1h & 4h high | |
long_entry_logic.append( | |
(df["change_pct_4h"] < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 4h green, 4h high, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] < 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | (df["ROC_9_4h"] < 50.0) | |
) | |
# 4h green, 15m & 4h high | |
long_entry_logic.append( | |
(df["change_pct_4h"] < 25.0) | (df["AROONU_14_15m"] < 75.0) | (df["AROONU_14_4h"] < 75.0) | |
) | |
# 1d P&D, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["AROONU_14_1h"] < 25.0) | |
| (df["ROC_9_1d"] < 80.0) | |
) | |
# 1d P&D, 1h high | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -20.0) | |
| (df["change_pct_1d"].shift(288) < 20.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -20.0) | |
| (df["change_pct_1d"].shift(288) < 20.0) | |
| (df["RSI_14_1d"].shift(288) < 80.0) | |
) | |
# 1d green, 4h still high, 4h downtrend | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_2_4h"] > -15.0) | |
) | |
# 1d green with top wick, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 25.0) | (df["top_wick_pct_1d"] < 25.0) | (df["ROC_9_4h"] < 80.0) | |
) | |
# 1d top wick, 15m down move, 15m still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["top_wick_pct_1d"] < 15.0) | |
| (df["RSI_3_15m"] > 20.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
) | |
# 1d top wick, 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["top_wick_pct_1d"] < 25.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# Logic | |
long_entry_logic.append(df["RSI_20"] < df["RSI_20"].shift(1)) | |
long_entry_logic.append(df["RSI_3"] < 46.0) | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3"] < 20.0) | |
long_entry_logic.append(df["close"] < df["SMA_16"] * 0.956) | |
# Condition #41 - Quick mode (Long). | |
if long_entry_condition_index == 41: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
long_entry_logic.append(df["global_protections_long_pump"] == True) | |
long_entry_logic.append(df["global_protections_long_dump"] == True) | |
# 5m & 15m down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 5.0) | (df["RSI_3_change_pct_15m"] > -50.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 5m & 15m & 1h down move | |
long_entry_logic.append((df["RSI_3"] > 5.0) | (df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0)) | |
# 5m strong down move, 1h & 4h down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0)) | |
# 5m strong down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["ROC_9"] > -50.0)) | |
# 15m & 1h strong down move & downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["MFI_14_1h"] > 5.0)) | |
# 15m & 1h down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["CCI_20_change_pct_1h"] > 0.0) | |
) | |
# 15m & 1h & 4h down move, 1h low | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["CMF_20_1h"] > -0.15) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_change_pct_1h"] > -50.0) | (df["MFI_14_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 1h not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m & 4h down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m strong down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0)) | |
# 15m strong down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["MFI_14_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 4h & 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["ROC_9_4h"] > -30.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m down move, 1h strong down move | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_14_change_pct_1h"] > -70.0)) | |
# 15m down move, 1h strong down move, 4h stil high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m down move, 1h high, 4h stil high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# 15m down move, 1h downtrend, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["ROC_9_1h"] > -20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m down move, 1h high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m down move, 1h still dropping, 4h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["CCI_20_change_pct_1h"] > 0.0) | (df["RSI_14_4h"] < 80.0) | |
) | |
# 15m down move, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_change_pct_1h"] > -30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 1h high, 1d still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
| (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 25.0) | (df["AROONU_14_4h"] < 25.0) | (df["ROC_9_1d"] < 100.0)) | |
# 15m down move, 4h high, 1h overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | (df["ROC_9_1h"] < 50.0) | |
) | |
# 15m down move, 1h high | |
long_entry_logic.append((df["RSI_3_change_pct_15m"] > -70.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0)) | |
# 1h & 4h down move, 4h still going down | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["CCI_20_change_pct_4h"] > 0.0)) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_1d"] > -25.0)) | |
# 1h strong down move, 4h high | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0)) | |
# 1h down move, 4h downtrend, 4h not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["CMF_20_4h"] > -0.25) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h down move, 4h strong down move | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_14_change_pct_4h"] > -40.0)) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_change_pct_4h"] > -65.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_9_1d"] > -20.0)) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["UO_7_14_28_4h"] < 40.0)) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["ROC_9_1d"] > -40.0)) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h strong down move | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["CMF_20_1h"] > -0.30) | (df["MFI_14_1h"] > 15.0)) | |
# 1h downmove, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_2_1d"] > -30.0) | |
) | |
# 1h down ove, 1h still high, 4h downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["AROONU_14_1h"] < 75.0) | (df["CMF_20_4h"] > -0.25)) | |
# 1h down move, 4h down move, 4h P&D | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_change_pct_4h"] > -70.0) | (df["RSI_14_4h"].shift(48) < 70.0) | |
) | |
# 1h down move, 4h high, 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["RSI_14_4h"] < 60.0) | (df["ROC_9_1d"] < 50.0)) | |
# 1h & 4h down move, 4h still not low enough, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | |
| (df["RSI_3_change_pct_4h"] > -50.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h down move, 1h still high, 1d going down | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_2_1d"] > -50.0) | |
) | |
# 4h downtrend, 4h still high, 1d strong downtrend | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["ROC_9_1d"] > -60.0) | |
) | |
# 1h down move, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1h down move, 4h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_2_1d"] < 50.0) | |
) | |
# 1h down move, 4h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h down move, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 1h down move, 1h still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["AROONU_14_1h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1h down move, 1h still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 1h down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 4h down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 4h downmove, 1d downtrend, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["ROC_2_1d"] > -15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 4h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_14_4h"] > 40.0) | (df["RSI_3_1d"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1d down move, 1d strong downtrend, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1d"] > 15.0) | (df["ROC_9_1d"] > -70.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 4h & 1d strong down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_4h"] > 2.0) | (df["RSI_3_1d"] > 2.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m down move, 1h strong down move, 1d overbought | |
long_entry_logic.append( | |
(df["MFI_14_15m"] > 20.0) | (df["RSI_3_change_pct_1h"] > -80.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h not low enough, 4h high, 1d strong downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | (df["ROC_9_1d"] > -60.0) | |
) | |
# 5m strong downtrend, 1h down move, 1d overbought | |
long_entry_logic.append((df["ROC_9"] > -25.0) | (df["RSI_3_1h"] > 20.0) | (df["ROC_9_1d"] < 40.0)) | |
# 1h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_change_pct_1h"] > -65.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m strong down move, 1h still high | |
long_entry_logic.append((df["ROC_9_15m"] > -15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0)) | |
# 15m downtrend, 4h down move, 4h stil high | |
long_entry_logic.append( | |
(df["ROC_9_15m"] > -15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 1h downtrend, 4h overbought | |
long_entry_logic.append((df["ROC_2_1h"] > -5.0) | (df["RSI_14_4h"] < 80.0) | (df["ROC_9_4h"] < 25.0)) | |
# 1h P&D, 4h still high | |
long_entry_logic.append( | |
(df["ROC_2_1h"] > -10.0) | (df["ROC_9_1h"] < 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 1h downtrend, 4h down move, 1d downtrend | |
long_entry_logic.append((df["ROC_9_1h"] > -40.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h very overbought | |
long_entry_logic.append((df["ROC_9_4h"] < 200.0) | (df["RSI_14_4h"] < 80.0)) | |
# 4h down move, 1d P&D | |
long_entry_logic.append((df["ROC_9_4h"] > -20.0) | (df["ROC_2_1d"] > -20.0) | (df["ROC_9_1d"] < 50.0)) | |
# 15m red, 15m strong downtrend | |
long_entry_logic.append((df["change_pct_15m"] > -20.0) | (df["RSI_3_15m"] > 5.0)) | |
# 1h P&D, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -2.0) | (df["change_pct_1h"].shift(12) < 2.0) | (df["RSI_14_4h"] < 80.0) | |
) | |
# 1h P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["change_pct_1h"].shift(12) < 5.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1h red, 4h high, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["RSI_14_1d"] < 80.0) | |
) | |
# 1h & 4h red, 1h not low enough | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -10.0) | (df["change_pct_4h"] > -10.0) | (df["MFI_14_1h"] < 50.0) | |
) | |
# 1h red, 1h still not low enough, 1d down move | |
long_entry_logic.append((df["change_pct_1h"] > -15.0) | (df["MFI_14_1h"] < 50.0) | (df["RSI_3_1d"] > 10.0)) | |
# 4h red, previous 4h green, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | (df["change_pct_4h"].shift(48) < 5.0) | (df["RSI_14_4h"].shift(48) < 80.0) | |
) | |
# 4h P&D, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | |
| (df["change_pct_4h"].shift(48) < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 4h red, previous 4h green, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | (df["change_pct_4h"].shift(48) < 10.0) | (df["ROC_9_4h"].shift(48) < 50.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | (df["change_pct_1d"].shift(288) < 10.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1d green with top wick, 1h down move | |
long_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | (df["top_wick_pct_1d"] < 10.0) | (df["RSI_3_1h"] > 15.0) | |
) | |
# 1d P&D, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -15.0) | (df["change_pct_1d"].shift(288) < 15.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# 1d red, 4h down move, 4h downtrend | |
long_entry_logic.append((df["change_pct_1d"] > -20.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_4h"] > -40.0)) | |
# Logic | |
long_entry_logic.append(df["RSI_14"] < 36.0) | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["AROOND_14"] > 75.0) | |
long_entry_logic.append(df["EMA_9"] < (df["EMA_26"] * 0.960)) | |
# Condition #42 - Quick mode (Long). | |
if long_entry_condition_index == 42: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_3_1h"] <= 95.0) | |
long_entry_logic.append(df["RSI_3_4h"] <= 80.0) | |
long_entry_logic.append(df["RSI_3_1d"] <= 80.0) | |
long_entry_logic.append(df["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 90.0) | |
# 15m high, 4h still high, 1h downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["ROC_9_1h"] > -15.0) | |
) | |
# 15m high, 4h strong down move, 1d strong downtrend | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m high, 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m high, 1h low, 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
| (df["CMF_20_1h"] > -0.20) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 15.0) | |
) | |
# 4m & 1h & 4h down move | |
long_entry_logic.append((df["RSI_3"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0)) | |
# 15m & 1h & 4h down move | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0)) | |
# 15m & 1h strong down move & downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["MFI_14_1h"] > 5.0)) | |
# 15m & 1h down move, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m down move, 1h down move | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["CCI_20_change_pct_15m"] > 0.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["CCI_20_change_pct_1h"] > 0.0) | |
) | |
# 15m & 1h & 1d down move | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_1d"] > 30.0)) | |
# 15m & 1h down move, 4h red, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["change_pct_4h"] > -5.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h down move, 4h downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 15.0) | (df["ROC_9_4h"] > -25.0)) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 1h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["ROC_9_1d"] < 100.0)) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["AROONU_14_4h"] < 25.0) | (df["ROC_9_1d"] < 100.0)) | |
# 15m & 4h down move, 15m still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
) | |
# 15m & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 15.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m & 1h down move, 4h high, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 10.0) | |
| (df["AROONU_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 25.0) | (df["MFI_14_4h"] < 70.0)) | |
# 15m down move, 1h downtrend, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["ROC_9_1h"] > -20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append((df["RSI_3_15m"] > 25.0) | (df["RSI_3_4h"] > 15.0) | (df["AROONU_14_4h"] < 50.0)) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m & 1h down move, 4h hig | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h & 4h down move, 4h not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 15.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["RSI_3_change_pct_4h"] > -75.0) | |
) | |
# 1h down move, 4h strong down move | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["RSI_14_change_pct_4h"] > -50.0) | |
) | |
# 1h & 4h down move, 1h still going down | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 25.0) | (df["CCI_20_change_pct_1h"] > 0.0) | |
) | |
# 1h down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["AROONU_14_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h & 4h down move, 15m high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | |
) | |
# 1h down move, 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | |
| (df["RSI_3_4h"] > 20.0) | |
| (df["CCI_20_4h"] < -100.0) | |
| (df["AROONU_14_4h"] < 25.0) | |
) | |
# 1h & 1d down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 15.0) | (df["RSI_3_1d"] > 20.0) | (df["ROC_9_1d"] > -40.0)) | |
# 1h & 4h down move, 15m still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 1h & 4h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 60.0) | |
) | |
# 1h down move, 15m high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["ROC_9_1d"] < 40.0) | |
) | |
# 1h down move, 4h low, 1h not low enough | |
long_entry_logic.append((df["RSI_3_1h"] > 20.0) | (df["MFI_14_4h"] > 5.0) | (df["UO_7_14_28_1h"] < 30.0)) | |
# 1h & 4h down move, 15m still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 1h & 1d down move, 1h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_1d"] > 30.0) | |
| (df["AROONU_14_1h"] < 50.0) | |
| (df["AROONU_14_1d"] < 75.0) | |
) | |
# 1h down move, 4h high, 1d overbought | |
long_entry_logic.append((df["RSI_3_1h"] > 25.0) | (df["AROONU_14_4h"] < 75.0) | (df["ROC_9_1d"] < 80.0)) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 30.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_1d"] > -40.0)) | |
# 1h down move, 15m high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 4h down move, 15m & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 4h down move, 15m still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 4h down move, 15m high, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["UO_7_14_28_1h"] < 40.0) | |
) | |
# 4h & 1d down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_4h"] > 15.0) | (df["RSI_3_1d"] > 25.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h down move, 4h still not low enough, 4h downtrend | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | (df["ROC_9_4h"] > -40.0) | |
) | |
# 4h down move, 4h still high, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["RSI_3_1d"] < 50.0) | |
) | |
# 4h down move, 4h still not low enough, 1d overbought | |
long_entry_logic.append((df["RSI_3_4h"] > 25.0) | (df["AROONU_14_4h"] < 25.0) | (df["ROC_9_1d"] < 150.0)) | |
# 4h down move, 15m stil high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 1h & 4h strong down move | |
long_entry_logic.append( | |
(df["MFI_14_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["RSI_3_change_pct_4h"] > -70.0) | |
) | |
# 1h downtrend, 4h down move, 1h overbought | |
long_entry_logic.append((df["ROC_9_1h"] > -30.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_9_1d"] < 40.0)) | |
# 1h downtrend, 4h down move, 1h downtrend | |
long_entry_logic.append((df["ROC_9_1h"] > -30.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 4h moving down, 1d P&D | |
long_entry_logic.append( | |
(df["ROC_9_4h"] > -30.0) | (df["RSI_3_change_pct_1d"] > -50.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d going down and it was pumped, 4h down move | |
long_entry_logic.append( | |
(df["ROC_2_1d"] > -20.0) | (df["ROC_9_1d"].shift(288) < 100.0) | (df["RSI_3_4h"] > 20.0) | |
) | |
# 1d downtrend, 4h downtrend, 4h still not low enough | |
long_entry_logic.append((df["ROC_9_1d"] > -40.0) | (df["CMF_20_4h"] > -0.25) | (df["AROONU_14_4h"] < 50.0)) | |
# 1d downtrend, 4h downtrend | |
long_entry_logic.append((df["ROC_9_1d"] > -40.0) | (df["CMF_20_4h"] > -0.30) | (df["RSI_3_4h"] > 10.0)) | |
# 1h & 4h red, 1h not low enough | |
long_entry_logic.append( | |
(df["change_pct_1h"] > -10.0) | (df["change_pct_4h"] > -10.0) | (df["MFI_14_1h"] < 50.0) | |
) | |
# 4h red, previous 4h green, 15m down move | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | (df["change_pct_4h"].shift(48) < 5.0) | (df["RSI_3_15m"] > 5.0) | |
) | |
# 4h red, previous 4h green, 4h still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | |
| (df["change_pct_4h"].shift(48) < 5.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 4h red, previous 4h red, 1h still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | (df["change_pct_4h"].shift(48) < 10.0) | (df["AROONU_14_1h"] < 50.0) | |
) | |
# 4h red, 4h still moving down, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | (df["CCI_20_change_pct_4h"] > 0.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 4h red, 4h & 1d still high | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -15.0) | (df["AROONU_14_4h"] < 50.0) | (df["AROONU_14_1d"] < 50.0) | |
) | |
# 1d red, 15m high, 1h still not low enough | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -5.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1d red, 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["RSI_14_1d"].shift(288) < 80.0) | |
) | |
# 1d P&D, 1d overbought | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | (df["change_pct_1d"].shift(288) < 10.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d red, 15m & 1h down move | |
long_entry_logic.append((df["change_pct_1d"] > -15.0) | (df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0)) | |
# # # 1d red, 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -15.0) | |
| (df["RSI_3_1h"] > 25.0) | |
| (df["RSI_3_4h"] > 25.0) | |
| (df["UO_7_14_28_4h"] < 35.0) | |
) | |
# Logic | |
long_entry_logic.append(df["WILLR_14"] < -50.0) | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3"] < 20.0) | |
long_entry_logic.append(df["WILLR_84_1h"] < -70.0) | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
long_entry_logic.append(df["BBB_20_2.0_1h"] > 16.0) | |
long_entry_logic.append(df["close_max_48"] >= (df["close"] * 1.10)) | |
# Condition #43 - Quick mode (Long). | |
if long_entry_condition_index == 43: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 90.0) | |
# 5m & 15m strong down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 2.0) | (df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 5m & 15m strong down move, 1h down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0)) | |
# 5m strong down move | |
long_entry_logic.append((df["RSI_3"] > 2.0) | (df["ROC_9"] > -50.0)) | |
# 15m & 1h strong down move, 1h strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["CMF_20_1h"] > -0.30)) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m down move, 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_change_pct_1h"] > -60.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_change_pct_1h"] > -40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 5m down move, 1h down, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["CMF_20_1h"] > -0.2) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["AROONU_14_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 5m & 1h strong down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 5m & 1h strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["MFI_14_1h"] > 10.0)) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["AROONU_14_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still high, 4h downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["UO_7_14_28_4h"] < 40.0) | (df["ROC_9_4h"] > -20.0) | |
) | |
# 15m & 1h down move, 1d strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 10.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m & 1h & 4h strong down move | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0)) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15 & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 45.0) | |
) | |
# 15m down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m down move, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m down move, 15m still not low enough, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m down move, 1h still high, 1d overbought | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["ROC_9_1d"] < 100.0) | |
) | |
# 15m down move, 1h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m down move, 15m still not low enoug, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["AROONU_14_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 90.0) | |
) | |
# 15m down move, 1h downtrend, 4h overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["ROC_9_1h"] > -5.0) | (df["ROC_9_4h"] < 35.0)) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["UO_7_14_28_4h"] < 50.0)) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 1h & 4h down move, 15m still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
) | |
# 1h down move, 4h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_change_pct_4h"] > -50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_change_pct_4h"] > -65.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still not low | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["RSI_14_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h downmove, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_2_1d"] > -30.0) | |
) | |
# 15m down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["OBV_change_pct_15m"] > -50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 1h down move, 1h not low enough, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["AROONU_14_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 1d down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 30.0) | (df["RSI_3_4h"] > 20.0) | (df["ROC_9_1d"] > -40.0)) | |
# 4h downmove, 1d downtrend, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["ROC_2_1d"] > -15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 4h down move, 15m still not low enough, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 4h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 4h & 1d down move, 1d strong downtrend | |
long_entry_logic.append((df["RSI_3_4h"] > 10.0) | (df["RSI_3_1d"] > 10.0) | (df["ROC_9_1d"] > -60.0)) | |
# 1h still high, 4h high, 1d still high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["WILLR_14_4h"] < -20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 4h overbought, 1h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["ROC_9_4h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 15m red, 15m strong downtrend | |
long_entry_logic.append((df["change_pct_15m"] > -20.0) | (df["RSI_3_15m"] > 5.0)) | |
# 4h red, previous 4h green, 4h overbought | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -5.0) | (df["change_pct_4h"].shift(48) < 5.0) | (df["RSI_14_4h"].shift(48) < 80.0) | |
) | |
# 4h red, 4h moving down, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["change_pct_4h"] > -10.0) | |
| (df["CCI_20_change_pct_4h"] > 0.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
| (df["ROC_9_1d"] > -40.0) | |
) | |
# 1d P&D, 4h down move | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -30.0) | (df["change_pct_1d"].shift(288) < 30.0) | (df["RSI_3_4h"] > 20.0) | |
) | |
# Logic | |
long_entry_logic.append(df["RSI_14"] < 40.0) | |
long_entry_logic.append(df["MFI_14"] < 40.0) | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
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.0)) | |
long_entry_logic.append(df["close"] < (df["EMA_20"] * 0.958)) | |
long_entry_logic.append(df["close"] < (df["BBL_20_2.0"] * 0.992)) | |
# Condition #101 - Rapid mode (Long). | |
if long_entry_condition_index == 101: | |
# Protections | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 80.0) | |
# 15m down move, 1h high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0)) | |
# 15m down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# Logic | |
long_entry_logic.append(df["RSI_14"] < 36.0) | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3"] < 20.0) | |
long_entry_logic.append(df["close"] < (df["SMA_16"] * 0.948)) | |
long_entry_logic.append(df["AROONU_14_15m"] < 50.0) | |
# Condition #120 - Grind mode (Long). | |
if long_entry_condition_index == 120: | |
# Protections | |
long_entry_logic.append(num_open_long_grind_mode < self.grind_mode_max_slots) | |
long_entry_logic.append(is_pair_long_grind_mode) | |
long_entry_logic.append(df["RSI_3"] <= 50.0) | |
long_entry_logic.append(df["RSI_3_15m"] >= 20.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_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 80.0) | |
# Logic | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3"] < 20.0) | |
long_entry_logic.append(df["WILLR_14"] < -80.0) | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["close"] < (df["EMA_20"] * 0.978)) | |
# Condition #141 - Top Coins mode (Long). | |
if long_entry_condition_index == 141: | |
# Protections | |
long_entry_logic.append(is_pair_long_top_coins_mode) | |
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["num_empty_288"] <= allowed_empty_candles_288) | |
long_entry_logic.append(df["RSI_3_1h"] <= 95.0) | |
long_entry_logic.append(df["RSI_3_4h"] <= 80.0) | |
long_entry_logic.append(df["RSI_3_1d"] <= 80.0) | |
long_entry_logic.append(df["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 90.0) | |
# 5m down move, 1h still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 5m down move, 1h high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 5m down move, 1h still not low enough, 1d high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m down move, 15m still not low enough, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["AROONU_14_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 1h down move, 1d still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 15m down move, 1h high, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 4h down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m down move, 1h high, 1 downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_2_1d"] > -15.0) | |
) | |
# 15m down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h down move, 15m & 1h stil high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | |
| (df["RSI_3_1h"] > 20.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
) | |
# 15m down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
) | |
# 1h & 4h & 1d down move | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["RSI_3_1d"] > 20.0)) | |
# 1h & 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1h & 4h down move, 15m not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 25.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 1h down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h & 4h down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1h down move, 15m & 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 50.0) | |
| (df["AROONU_14_15m"] < 50.0) | |
| (df["AROONU_14_1h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 4h down move, 15m still high, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 4h down move, 15m & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 4h down move, 1h stil high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 4h down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 4h down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# Logic | |
long_entry_logic.append(df["RSI_20"] < df["RSI_20"].shift(1)) | |
long_entry_logic.append(df["RSI_3"] < 30.0) | |
long_entry_logic.append(df["AROONU_14"] < 25.0) | |
long_entry_logic.append(df["close"] < df["SMA_16"] * 0.956) | |
# Condition #142 - Top Coins mode (Long). | |
if long_entry_condition_index == 142: | |
# Protections | |
long_entry_logic.append(is_pair_long_top_coins_mode) | |
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["num_empty_288"] <= allowed_empty_candles_288) | |
# 5m & 1h & 4h down move | |
long_entry_logic.append((df["RSI_3"] > 10.0) | (df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0)) | |
# 5m down move, 15m & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 5m down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3"] > 15.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 15m & 1h down move, 1d still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 15m down move, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_2_1d"] > -20.0) | |
) | |
# 15m strong down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0)) | |
# 15m down move, 15m stil high, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h down move, 1d overbought | |
long_entry_logic.append((df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 20.0) | (df["ROC_9_1d"] < 80.0)) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 4h down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m & 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m down move, 15m still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m down move, 1h high, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 15m down move, 4h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m down move, 1h high, 1 downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_2_1d"] > -15.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_1h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 15m down move, 1h still high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m down move, 1h still not low enough, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m down move, 1h high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 15m down move, 4h high, 1d stil high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m down move, 15m still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 90.0) | |
) | |
# 15m & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m down move, 15m still high 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h still high, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m down move, 15m still high, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["AROONU_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h & 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 15.0) | |
) | |
# 1h & 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 15.0) | |
) | |
# 1h down move, 4h still high, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 4h down move, 15m still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 4h down move, 15m still high, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 4h & 1d down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["RSI_3_1d"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 4h down move, 15m still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 4h down move, 1h still not low enough, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 4h down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# 1d down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1d"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 1h still high, 4h high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 90.0) | |
) | |
# 15m still high, 1h & 1d high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 15m & 4h high | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0)) | |
# 15m high, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 15m & 4h high | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0)) | |
# 1h & 4h still high, 1d high | |
long_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 1h & 4h high | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 90.0)) | |
# 1h & 4h high | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0)) | |
# 4h & 1d high | |
long_entry_logic.append((df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 80.0)) | |
# 1d red, 1d high | |
long_entry_logic.append((df["change_pct_1d"] > -5.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 80.0)) | |
# 1d P&D, 1d high | |
long_entry_logic.append( | |
(df["change_pct_1d"] > -10.0) | |
| (df["change_pct_1d"].shift(288) < 10.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# Logic | |
long_entry_logic.append(df["RSI_4"] < 46.0) | |
long_entry_logic.append(df["RSI_20"] < df["RSI_20"].shift(1)) | |
long_entry_logic.append(df["close"] < df["SMA_16"] * 0.958) | |
# Condition #143 - Top Coins mode (Long). | |
if long_entry_condition_index == 143: | |
# Protections | |
long_entry_logic.append(is_pair_long_top_coins_mode) | |
long_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
long_entry_logic.append(df["RSI_3_1h"] < 95.0) | |
long_entry_logic.append(df["RSI_3_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_3_1d"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_4h"] < 80.0) | |
long_entry_logic.append(df["RSI_14_1d"] < 90.0) | |
# 15m down move, 1h still not low enough, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 15m & 1h & 4h strong downtrend | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0)) | |
# 15m & 1h strong down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_1h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | |
) | |
# 15m & 4h down move, 4h high | |
long_entry_logic.append((df["RSI_3_15m"] > 5.0) | (df["RSI_3_4h"] > 30.0) | (df["UO_7_14_28_4h"] < 50.0)) | |
# 5m down move, 1h still not low enough, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m down move, 1h & 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | (df["UO_7_14_28_4h"] < 40.0) | |
) | |
# 15m & 1h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 1h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 15m & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 10.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 40.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 15m & 4h down move, 1h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | |
) | |
# 15m down move, 1h high, 1 downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["ROC_2_1d"] > -15.0) | |
) | |
# 15m down move, 4h high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 70.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 15m & 1h down move, 4h high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 30.0) | (df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 2.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 1h & 4h strong down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 5.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 10.0) | |
) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 10.0) | (df["ROC_2_1d"] > -20.0)) | |
# 1h & 4h down move, 1d still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 5.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 40.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 20.0) | |
) | |
# 1h & 4h down move, 15m still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 30.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 10.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 10.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 4h high | |
long_entry_logic.append((df["RSI_3_1h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0)) | |
# 1h & 4h down move, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 15m & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_15m"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 40.0) | |
) | |
# 1h & 4h down move, 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 1h & 4h down move, 1d downtrend | |
long_entry_logic.append((df["RSI_3_1h"] > 15.0) | (df["RSI_3_4h"] > 25.0) | (df["ROC_9_1d"] > -30.0)) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 30.0) | |
) | |
# 1h down move, 4h still not low enough, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 25.0) | (df["ROC_2_1d"] > -20.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["ROC_9_1d"] > -30.0) | |
) | |
# 1h & 4h down move, 1h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | |
) | |
# 1h & 4h down move, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 25.0) | (df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | |
) | |
# 1h down move, 1h high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# 1h down move, 4h & 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 70.0) | |
) | |
# 1h down move, 4h & 1d high | |
long_entry_logic.append( | |
(df["RSI_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1d"] < 50.0) | |
) | |
# 4h down move, 15m stil high, 1h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 20.0) | |
) | |
# 4h down move, 1h still high, 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 20.0) | |
) | |
# 4h down move, 1h high, 4h still high | |
long_entry_logic.append( | |
(df["RSI_3_4h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 70.0) | (df["AROONU_14_4h"] < 50.0) | |
) | |
# 1d down move, 1h & 4h still not low enough | |
long_entry_logic.append( | |
(df["RSI_3_1d"] > 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 30.0) | |
) | |
# Logic | |
long_entry_logic.append(df["RSI_3"] < 40.0) | |
long_entry_logic.append(df["STOCHRSIk_14_14_3_3"] < 50.0) | |
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.0)) | |
############################################################################################### | |
# 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"{long_entry_condition_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) | |
############################################################################################### | |
# SHORT ENTRY CONDITIONS STARTS HERE | |
############################################################################################### | |
# ______ __ __ ______ _______ ________ ________ __ __ ________ ________ _______ | |
# / \| \ | \/ \| | \ | | \ | | | | \ | |
# | $$$$$$| $$ | $| $$$$$$| $$$$$$$\$$$$$$$$ | $$$$$$$| $$\ | $$\$$$$$$$| $$$$$$$| $$$$$$$\ | |
# | $$___\$| $$__| $| $$ | $| $$__| $$ | $$ | $$__ | $$$\| $$ | $$ | $$__ | $$__| $$ | |
# \$$ \| $$ $| $$ | $| $$ $$ | $$ | $$ \ | $$$$\ $$ | $$ | $$ \ | $$ $$ | |
# _\$$$$$$| $$$$$$$| $$ | $| $$$$$$$\ | $$ | $$$$$ | $$\$$ $$ | $$ | $$$$$ | $$$$$$$\ | |
# | \__| $| $$ | $| $$__/ $| $$ | $$ | $$ | $$_____| $$ \$$$$ | $$ | $$_____| $$ | $$ | |
# \$$ $| $$ | $$\$$ $| $$ | $$ | $$ | $$ | $$ \$$$ | $$ | $$ | $$ | $$ | |
# \$$$$$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$ \$$$$$$$$\$$ \$$ \$$ \$$$$$$$$\$$ \$$ | |
# | |
for enabled_short_entry_signal in self.short_entry_signal_params: | |
short_entry_condition_index = int(enabled_short_entry_signal.split("_")[3]) | |
item_short_buy_protection_list = [True] | |
if self.short_entry_signal_params[f"{enabled_short_entry_signal}"]: | |
# Short Entry Conditions Starts Here | |
# ----------------------------------------------------------------------------------------- | |
# IMPORTANT: Short Condition Descriptions are not for shorts. These are for longs but completely mirrored opposite side | |
# Please dont change these comment descriptions. With these descriptions we are comparing long/short positions. | |
short_entry_logic = [] | |
short_entry_logic.append(reduce(lambda x, y: x & y, item_short_buy_protection_list)) | |
# Condition #501 - Normal mode (Short). | |
if short_entry_condition_index == 501: | |
# Protections | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_3_1h"] >= 5.0) | |
short_entry_logic.append(df["RSI_3_4h"] >= 20.0) | |
short_entry_logic.append(df["RSI_3_1d"] >= 20.0) | |
short_entry_logic.append(df["RSI_14_1h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_4h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_1d"] > 10.0) | |
# 5m up move, 15m & 1h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 60.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
) | |
# 15m up move, 15m stil not high enough, 1h low | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 70.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0) | |
) | |
# 15m up move, 1h & 4h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 15m & 1h up move, 4h still going up | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["CCI_20_change_pct_4h"] < -0.0) | |
) | |
# 15m & 1h up move, 4h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 15m & 1h up move, 4h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m & 4h up move, 1h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_4h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
) | |
# 15m up move, 1h up move, 1h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_change_pct_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m & 1h up move, 1h not high enough | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 90.0) | (df["AROOND_14_1h"] < 50.0)) | |
# 15m & 1h up move, 1d stil not high enough | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 90.0) | (df["RSI_14_1h"] > 80.0)) | |
# 15m & 4h up move, 1h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
) | |
# 15m & 4h up move, 1d low | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 20.0) | |
) | |
# 15m & 4h up move, 4h not high enough | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["AROOND_14_4h"] < 50.0)) | |
# 15m & 4h up move, 1h low | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
) | |
# 15m up move, 1h low, 4h still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 15m & 1h up move, 4h low | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
) | |
# 15m & 1h up move, 1d still low | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 60.0) | |
) | |
# 15m & 1h up move, 4h low | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["RSI_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 1h & 4h up move, 4h still not high enough | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 95.0) | (df["UO_7_14_28_4h"] > 60.0)) | |
# 1h & 4h up move, 4h still low | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h & 4h up move, 4h uptrend | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 85.0) | (df["ROC_9_4h"] < 40.0)) | |
# 1h & 4h strong up move | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["MFI_14_1h"] < 95.0) | (df["RSI_3_4h"] < 95.0)) | |
# 1h & 4h up move, 1h still low | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 1h & 4h up move, 1d still not high enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
# 1h up move, 1h still not high enough, 1d low | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 30.0) | |
) | |
# 4h up move, 15m still low, 1h not high enough | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["AROOND_14_1h"] < 25.0) | |
) | |
# 1d up move, 1h & 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1d"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.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.030)) | |
short_entry_logic.append((df["EMA_12"].shift() - df["EMA_26"].shift()) > (df["open"] / 100.0)) | |
short_entry_logic.append(df["close"] > (df["BBU_20_2.0"] * 1.001)) | |
# Condition #502 - Normal mode (Short). | |
if short_entry_condition_index == 502: | |
# Protections | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
# 5m strong down move | |
short_entry_logic.append((df["RSI_3"] < 98.0) | (df["ROC_9"] < 50.0)) | |
# 5m down move, 1h still high, 4h down move | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["RSI_3_4h"] < 90.0) | |
) | |
# 15m downmove, 4h overbought | |
short_entry_logic.append((df["RSI_3_change_pct_15m"] < 40.0) | (df["RSI_14_4h"] > 25.0)) | |
# 5m & 15m & 1h down move | |
short_entry_logic.append((df["RSI_3"] < 95.0) | (df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 85.0)) | |
# 5m down move, 4h high | |
short_entry_logic.append((df["RSI_3"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 25.0)) | |
# 5m down move, 15m still high, 1h high | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["AROOND_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0) | |
) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append((df["RSI_3_15m"] < 98.0) | (df["RSI_3_1h"] < 85.0) | (df["MFI_14_4h"] > 50.0)) | |
# 15m & 1h down move, 4h down | |
short_entry_logic.append((df["RSI_3_15m"] < 98.0) | (df["RSI_3_1h"] < 90.0) | (df["ROC_9_4h"] < 10.0)) | |
# 15m down move, 1h high | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0)) | |
# 15m down move, 15m still not low enough, 1h & 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | |
| (df["AROOND_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
| (df["MFI_14_4h"] > 50.0) | |
) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m down move, 1h high | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0)) | |
# 15m down move, 1h still high, 4h overbought | |
short_entry_logic.append((df["RSI_3_15m"] < 80.0) | (df["RSI_14_1h"] > 60.0) | (df["RSI_14_4h"] > 20.0)) | |
# 15m down move, 1h high | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0)) | |
# 15m down move, 1h low, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["ROC_9_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 1h & 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0) | (df["RSI_3_4h"] > 10.0) | |
) | |
# 15m down move, 1h high, 1d low | |
short_entry_logic.append( | |
(df["RSI_3_change_pct_15m"] < 40.0) | (df["ROC_9_1h"] > -10.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 4h high, 1d low | |
short_entry_logic.append( | |
(df["ROC_9_15m"] < 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 4h high, 1d low | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["ROC_9_4h"] > -20.0) | (df["ROC_9_1d"] < 50.0)) | |
# 15m down move, 1h still high, 1d high | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["RSI_14_1h"] > 60.0) | (df["ROC_9_1d"] > -50.0)) | |
# 15m & 1h down move, 1d overbought | |
short_entry_logic.append((df["RSI_3_15m"] < 80.0) | (df["ROC_9_1h"] < 20.0) | (df["ROC_9_1d"] > -40.0)) | |
# 15m down move, 1h high, 4h downtrend | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0) | (df["ROC_9_4h"] < 10.0) | |
) | |
# 15m & 1h & 4h down move | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["CMF_20_1h"] < 0.4) | (df["RSI_3_4h"] < 90.0)) | |
# 14m down move, 4h downtrend, 1d overbought | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["ROC_9_4h"] < 15.0) | (df["ROC_9_1d"] > -100.0)) | |
# 15m strong downtrend, 1h downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["MFI_14_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0)) | |
# 15m down move, 4h overbought & high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["ROC_9_4h"] > -15.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 1h & 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["UO_7_14_28_4h"] > 50.0) | |
) | |
# 15m down move, 15m not low enough, 1h overbought | |
short_entry_logic.append( | |
(df["RSI_14_change_pct_15m"] < 40.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 90.0) | (df["RSI_14_1h"] > 30.0) | |
) | |
# 15m still not low enough, 4h & 1d going down | |
short_entry_logic.append((df["AROOND_14_15m"] < 25.0) | (df["RSI_3_4h"] < 80.0) | (df["RSI_3_1d"] < 70.0)) | |
# 15m still not low enough, 4h overbought | |
short_entry_logic.append( | |
(df["AROOND_14_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0) | (df["ROC_9_4h"] > -40.0) | |
) | |
# 15m still not low enough, 1h overbought | |
short_entry_logic.append((df["AROOND_14_15m"] < 25.0) | (df["RSI_14_1h"] > 10.0)) | |
# 1h strong down move | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["RSI_3_change_pct_1h"] < 85.0)) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 1h down move, 1d strong downtrend | |
short_entry_logic.append((df["RSI_3_1h"] < 90.0) | (df["RSI_3_1d"] < 95.0)) | |
# 1h down move, 1h still not low enough, 4h still not low | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["RSI_14_4h"] > 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough, 1d still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | |
| (df["RSI_3_change_pct_4h"] < 50.0) | |
| (df["AROOND_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 60.0) | |
) | |
# 1h down move, 4h still not low enough, 1d overbought | |
short_entry_logic.append((df["RSI_3_1h"] < 90.0) | (df["AROOND_14_4h"] < 25.0) | (df["ROC_9_1d"] > -120.0)) | |
# 1h down move, 4h overbought | |
short_entry_logic.append((df["RSI_3_1h"] < 85.0) | (df["RSI_14_4h"] > 25.0)) | |
# 1h P&D, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 70.0) | (df["RSI_3_1h"].shift(12) > 20.0) | (df["ROC_9_1d"] < 20.0) | |
) | |
# 4h P&D | |
short_entry_logic.append((df["RSI_3_4h"] < 70.0) | (df["RSI_3_4h"].shift(48) > 5.0)) | |
# 4h strong downtrend | |
short_entry_logic.append((df["RSI_3_4h"] < 95.0) | (df["ROC_9_4h"] < 40.0)) | |
# 1h stil high, 1d overbought | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 5.0) | (df["ROC_9_1d"] > -100.0) | |
) | |
# 1h & 4h still high, 1d strong down move | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["UO_7_14_28_4h"] > 55.0) | (df["RSI_3_1d"] < 90.0) | |
) | |
# 5m down, 1h down move, 4h high | |
short_entry_logic.append( | |
(df["ROC_9"] > -5.0) | (df["RSI_3_change_pct_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 4h pumped and going down | |
short_entry_logic.append((df["ROC_9_15m"] < 10.0) | (df["ROC_2_4h"] > -5.0) | (df["ROC_9_4h"] > -20.0)) | |
# 14m down move, 4h high | |
short_entry_logic.append( | |
(df["ROC_9_15m"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | (df["ROC_9_4h"] > -35.0) | |
) | |
# 1h downtrend, 4h overbought | |
short_entry_logic.append( | |
(df["ROC_2_1h"] < 5.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 95.0) | (df["ROC_9_4h"] < 70.0) | |
) | |
# 1h downtrend, 4h overbought | |
short_entry_logic.append((df["ROC_2_1h"] < 5.0) | (df["ROC_9_1h"] < 5.0) | (df["ROC_9_4h"] > -35.0)) | |
# 1h down, 1d strong downtrend | |
short_entry_logic.append((df["ROC_9_1h"] < 10.0) | (df["ROC_9_1d"] < 50.0)) | |
# 1h & 4h & 1d downtrend | |
short_entry_logic.append((df["ROC_9_1h"] < 10.0) | (df["ROC_9_4h"] < 20.0) | (df["ROC_9_1d"] < 40.0)) | |
# 1h down, 1d overbought | |
short_entry_logic.append((df["ROC_9_1h"] < 10.0) | (df["ROC_9_1d"] > -80.0)) | |
# 4h P&D | |
short_entry_logic.append((df["ROC_2_4h"] < 20.0) | (df["ROC_9_4h"] > -80.0)) | |
# 4h overbought, 1h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["ROC_9_4h"] > -50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1d P&D | |
short_entry_logic.append((df["ROC_2_1d"] < 20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 1d strong downtrend | |
short_entry_logic.append((df["ROC_2_1d"] < 20.0) | (df["ROC_9_1d"] < 50.0)) | |
# 1h red, previous 1h green, 1h overbought | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 5.0) | (df["change_pct_1h"].shift(12) > -5.0) | (df["RSI_14_1h"].shift(12) < 80.0) | |
) | |
# 1h red, previous 1h green, 1h overbought | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 2.0) | (df["change_pct_1h"].shift(12) > -10.0) | (df["RSI_14_1h"].shift(12) < 80.0) | |
) | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 5.0) | (df["change_pct_1h"].shift(12) > -5.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h red, 4h green, 1h overbought | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 5.0) | (df["change_pct_4h"] > -10.0) | (df["RSI_14_1h"].shift(12) > 30.0) | |
) | |
# 4h red, previous 4h green, 4h still high | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 5.0) | |
| (df["change_pct_4h"].shift(48) > -5.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 4h red, previous 4h green, 4h overbought | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 8.0) | (df["change_pct_4h"].shift(48) > -8.0) | (df["RSI_14_4h"].shift(48) > 20.0) | |
) | |
# 4h red, previous 4h green, 15m down move | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 8.0) | (df["change_pct_4h"].shift(48) > -8.0) | (df["RSI_3_15m"] < 95.0) | |
) | |
# 1d P&D, 1d overbought | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | (df["change_pct_1d"].shift(288) > -10.0) | (df["ROC_9_1d"] > -100.0) | |
) | |
# 1d P&D, 5m & 1h down move | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | |
| (df["change_pct_1d"].shift(288) > 10.0) | |
| (df["RSI_3_15m"] < 90.0) | |
| (df["change_pct_1h"] < 5.0) | |
) | |
# 1d P&D, 15m & 1h still not low enough | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 20.0) | |
| (df["change_pct_1d"].shift(288) > -20.0) | |
| (df["AROOND_14_15m"] < 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# Logic | |
short_entry_logic.append(df["AROOND_14"] < 25.0) | |
short_entry_logic.append(df["STOCHRSIk_14_14_3_3"] > 80.0) | |
short_entry_logic.append(df["close"] > (df["EMA_20"] * 1.056)) | |
# Condition #503 - Normal mode (Short). | |
if short_entry_condition_index == 503: | |
# Protections | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
short_entry_logic.append(df["RSI_3_1h"] >= 5.0) | |
short_entry_logic.append(df["RSI_3_4h"] >= 20.0) | |
short_entry_logic.append(df["RSI_3_1d"] >= 20.0) | |
short_entry_logic.append(df["RSI_14_1h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_4h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_1d"] > 10.0) | |
# 5m strong down move | |
short_entry_logic.append((df["RSI_3"] < 98.0) | (df["ROC_9"] < 50.0)) | |
# 5m down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["MFI_14"] > 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 5m & 1h down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
) | |
# 5m down move, 4h downtrend, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3"] < 95.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
) | |
# 5m & 4h strong down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 5m down move, 1h high, 1d overbought | |
short_entry_logic.append((df["RSI_3"] < 90.0) | (df["ROC_9_1h"] < 15.0) | (df["ROC_9_1d"] > -40.0)) | |
# 5m down move, 1h & 4h high | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["UO_7_14_28_1h"] > 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 5m down move, 1h high, 4h downtrend | |
short_entry_logic.append( | |
(df["RSI_3"] < 98.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0) | (df["ROC_9_4h"] < 10.0) | |
) | |
# 5m & 1h down move, 4h down | |
short_entry_logic.append((df["RSI_3"] < 90.0) | (df["RSI_3_1h"] < 85.0) | (df["CMF_20_4h"] > -0.2)) | |
# 5m down move, 1h high | |
short_entry_logic.append((df["RSI_14_change_pct"] < 40.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0)) | |
# 5m down move, 1h high | |
short_entry_logic.append((df["RSI_14_change_pct"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0)) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 15m still not low enough, 1h & 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | |
| (df["AROOND_14_15m"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
| (df["MFI_14_4h"] > 50.0) | |
) | |
# 5m & 1h down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m & 4h down move, 1h still not low | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m down move, 1h & 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["RSI_14_4h"] > 50.0) | |
) | |
# 15m & 1h & 4h down move | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_change_pct_1h"] > -60.0) | (df["RSI_3_change_pct_4h"] > -40.0) | |
) | |
# 15m down move, 1d downtrend, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["ROC_9_1d"] > -25.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
) | |
# 15m & 1d down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_1d"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
) | |
# 15m & 4h down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m down move, 15m still not low enough, 4h down move | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["AROOND_14_15m"] < 50.0) | (df["RSI_3_4h"] < 85.0)) | |
# 15m down move, 1h still high, 1d strong downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 80.0) | (df["AROOND_14_1h"] < 25.0) | (df["MFI_14_1d"] < 90.0)) | |
# 15m down move, 1h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m down move, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m & 4h down move, 1d downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["RSI_3_4h"] < 85.0) | (df["ROC_9_1d"] > -70.0)) | |
# 15m down move, 15m not low enough, 1h overbought | |
short_entry_logic.append( | |
(df["RSI_14_change_pct_15m"] > -40.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 90.0) | (df["RSI_14_1h"] > 30.0) | |
) | |
# 15m strong down move, 1h still high | |
short_entry_logic.append((df["ROC_9_15m"] < 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0)) | |
# 15m downtrend, 1h & 4h still high | |
short_entry_logic.append( | |
(df["ROC_9_15m"] < 10.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m & 1h & 4h down move | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["CCI_20_change_pct_4h"] < 0.0) | |
) | |
# 15m strong down move | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["MFI_14_15m"] < 85.0) | (df["AROOND_14_15m"] < 25.0)) | |
# 14m down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | (df["AROOND_14_15m"] < 50.0) | (df["UO_7_14_28_4h"] > 50.0) | |
) | |
# 15m down move, 1h stil high, 1d overbought | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["AROOND_14_1h"] < 25.0) | (df["ROC_9_1d"] > -80.0)) | |
# 15m down move, 1h high, 1d overbought | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_change_pct_4h"] < 65.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] < 10.0) | |
) | |
# 1h down move, 4h still not low enough, 1d overbought | |
short_entry_logic.append((df["RSI_3_1h"] < 90.0) | (df["AROOND_14_4h"] < 25.0) | (df["ROC_9_1d"] > -120.0)) | |
# 1h down move, 1h still not low enough, 4h still not low | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["RSI_14_4h"] > 50.0) | |
) | |
# 1h down move, 4h still high | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["RSI_14_4h"] > 60.0)) | |
# 1h down move, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_change_pct_1h"] > -65.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 4h & 1d down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 90.0) | (df["ROC_2_1d"] < 20.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m still high, 1h down move, 4h high | |
short_entry_logic.append( | |
(df["AROOND_14_15m"] < 50.0) | (df["RSI_3_change_pct_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m still high, 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["AROOND_14_15m"] < 50.0) | |
| (df["RSI_3_1h"] < 85.0) | |
| (df["RSI_3_4h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 15m & 1h still high, 4h overbought | |
short_entry_logic.append( | |
(df["AROOND_14_15m"] < 50.0) | (df["AROOND_14_1h"] < 50.0) | (df["ROC_9_4h"] > -40.0) | |
) | |
# 15m still high, 1h down move, 1d downtrend | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["RSI_3_4h"] < 90.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h & 4h still high, 1d strong down move | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["UO_7_14_28_4h"] > 55.0) | (df["RSI_3_1d"] < 90.0) | |
) | |
# 1h still high, 4h & 1d downtrend | |
short_entry_logic.append((df["AROOND_14_1h"] < 25.0) | (df["ROC_9_4h"] < 20.0) | (df["ROC_9_1d"] < 50.0)) | |
# 4h moving down, 1d P&D | |
short_entry_logic.append( | |
(df["ROC_9_4h"] < 30.0) | (df["RSI_3_change_pct_1d"] < 50.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1d strong downtrend, 4h still high | |
short_entry_logic.append( | |
(df["ROC_2_1d"] < 20.0) | (df["ROC_9_1d"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 1d P&D, 1d overbought | |
short_entry_logic.append( | |
(df["ROC_2_1d"] < 10.0) | (df["ROC_9_1d"] > -50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 5.0) | |
) | |
# 1h red, previous 1h green, 1h overbought | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 1.0) | (df["change_pct_1h"].shift(12) > -5.0) | (df["RSI_14_1h"].shift(12) < 80.0) | |
) | |
# 1h red, 1h stil high, 4h downtrend | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 5.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["ROC_9_4h"] > -25.0) | |
) | |
# 4h red, 15m down move, 4h still high | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 5.0) | (df["RSI_3_15m"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 4h red, previous 4h green, 4h overbought | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 5.0) | (df["change_pct_4h"].shift(48) > -5.0) | (df["ROC_9_4h"].shift(48) > -25.0) | |
) | |
# 4h red, 4h still not low enough, 1h downtrend, 1h overbought | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 10.0) | |
| (df["AROOND_14_4h"] < 25.0) | |
| (df["ROC_9_1h"] < 20.0) | |
| (df["ROC_9_1d"] > -40.0) | |
) | |
# 4h red, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 10.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | (df["ROC_9_1d"] < 40.0) | |
) | |
# 1d P&D, 1d overbought | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | (df["change_pct_1d"].shift(288) > -10.0) | (df["ROC_9_1d"] > -100.0) | |
) | |
# 1d P&D, 4h still high | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 15.0) | (df["change_pct_1d"].shift(288) > -15.0) | (df["AROOND_14_4h"] < 50.0) | |
) | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 95.0) | (df["CCI_20_change_pct_4h"] < 0.0) | |
) | |
# Logic | |
short_entry_logic.append(df["RSI_20"] > df["RSI_20"].shift(1)) | |
short_entry_logic.append(df["RSI_4"] > 54.0) | |
short_entry_logic.append(df["AROOND_14"] < 25.0) | |
short_entry_logic.append(df["close"] > df["SMA_16"] * 1.058) | |
# Condition #504 - Normal mode (Short). | |
if short_entry_condition_index == 504: | |
# Protections | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
short_entry_logic.append(df["RSI_3_1h"] >= 5.0) | |
short_entry_logic.append(df["RSI_3_4h"] >= 20.0) | |
short_entry_logic.append(df["RSI_3_1d"] >= 20.0) | |
short_entry_logic.append(df["RSI_14_1h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_4h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_1d"] > 10.0) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | |
| (df["MFI_14_15m"] < 90.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["MFI_14_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 14m & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m down move, 1h & 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["UO_7_14_28_1h"] < 45.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 1h strong down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_14_change_pct_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 1h strong down move, 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_change_pct_4h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 75.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 75.0) | (df["AROOND_14_4h"] < 50.0)) | |
# 15m down move, 1h strong downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["MFI_14_1h"] > 5.0)) | |
# 15m downtrend, 4h down move, 4h stil high | |
short_entry_logic.append( | |
(df["ROC_9_15m"] > -20.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# Logic | |
short_entry_logic.append(df["AROOND_14"] < 25.0) | |
short_entry_logic.append(df["AROOND_14_15m"] < 25.0) | |
short_entry_logic.append(df["close"] > (df["EMA_9"] * 1.058)) | |
short_entry_logic.append(df["close"] > (df["EMA_20"] * 1.040)) | |
# Condition #541 - Quick mode (Short). | |
if short_entry_condition_index == 541: | |
# Protections | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
# 5m & 15m down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3"] < 95.0) | (df["RSI_3_change_pct_15m"] < 50.0) | (df["RSI_14_4h"] > 50.0) | |
) | |
# 5m & 15m & 1h down move | |
short_entry_logic.append((df["RSI_3"] < 95.0) | (df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0)) | |
# 5m strong down move | |
short_entry_logic.append((df["RSI_3"] < 98.0) | (df["ROC_9"] < 50.0)) | |
# 15m & 1h strong down move & downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["MFI_14_1h"] > 5.0)) | |
# 15m strong down move, 4h high | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0)) | |
# 15m & 1h down move | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["CCI_20_change_pct_1h"] > 0.0) | |
) | |
# 15m & 1h down move, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_change_pct_1h"] < 50.0) | (df["MFI_14_4h"] > 50.0) | |
) | |
# 15m strong down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["MFI_14_15m"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m & 1h down move, 1h not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
) | |
# 15m down move, 1h strong down move | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["RSI_14_change_pct_1h"] < 70.0)) | |
# 15m down move, 4h & 1d downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["ROC_9_4h"] < 30.0) | (df["ROC_9_1d"] < 50.0)) | |
# 15m down move, 1h strong down move, 4h stil high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 1h & 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 1h downtrend, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["ROC_9_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m & 1h down move, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m down move, 1h down move, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["RSI_3_change_pct_1h"] < 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
) | |
# 1m down move, 1h still dropping, 4h overbought | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["CCI_20_change_pct_1h"] < 0.0) | (df["RSI_14_4h"] > 20.0) | |
) | |
# 15m down move, 1h high | |
short_entry_logic.append((df["RSI_3_change_pct_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0)) | |
# 1h strong down move, 4h high | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0)) | |
# 1h down move, 4h downtrend, 4h not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["CMF_20_4h"] > -0.25) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 1h down move, 4h high, 1d overbought | |
short_entry_logic.append((df["RSI_3_1h"] < 90.0) | (df["RSI_14_4h"] > 40.0) | (df["ROC_9_1d"] > -50.0)) | |
# 1h down move, 4h strong down move | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["RSI_14_change_pct_4h"] < 40.0)) | |
# 1h & 4h down move, 4h still going down | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 95.0) | (df["CCI_20_change_pct_4h"] < 0.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_change_pct_4h"] < 65.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 1h down move, 4h down move, 4h P&D | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_change_pct_4h"] < 70.0) | (df["RSI_14_4h"].shift(48) > 30.0) | |
) | |
# 1h & 4h down move, 4h still not low enough, 1d still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | |
| (df["RSI_3_change_pct_4h"] < 50.0) | |
| (df["AROOND_14_4h"] < 25.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 60.0) | |
) | |
# 1h down move, 1h still high, 1d going down | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["ROC_2_1d"] > -50.0) | |
) | |
# 4h downtrend, 4h still high, 1d strong downtrend | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | (df["ROC_9_1d"] < 60.0) | |
) | |
# 15m down move, 1h strong down move, 1d overbought | |
short_entry_logic.append( | |
(df["MFI_14_15m"] < 80.0) | (df["RSI_3_change_pct_1h"] < 80.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1h not low enough, 4h high, 1d strong downtrend | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0) | (df["ROC_9_1d"] < 60.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_change_pct_1h"] < 65.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m strong down move, 1h still high | |
short_entry_logic.append((df["ROC_9_15m"] < 15.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0)) | |
# 15m downtrend, 4h down move, 4h stil high | |
short_entry_logic.append( | |
(df["ROC_9_15m"] < 15.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 1h downtrend, 4h overbought | |
short_entry_logic.append((df["ROC_2_1h"] < 5.0) | (df["RSI_14_4h"] > 20.0) | (df["ROC_9_4h"] > -25.0)) | |
# 1h P&D, 4h still high | |
short_entry_logic.append( | |
(df["ROC_2_1h"] < 10.0) | (df["ROC_9_1h"] > -5.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 1h downtrend, 4h down move, 1d downtrend | |
short_entry_logic.append((df["ROC_9_1h"] < 40.0) | (df["RSI_3_4h"] < 90.0) | (df["ROC_9_1d"] < 50.0)) | |
short_entry_logic.append((df["ROC_9_4h"] > -200.0) | (df["RSI_14_4h"] > 20.0)) | |
# 4h down move, 1d P&D | |
short_entry_logic.append((df["ROC_9_4h"] < 20.0) | (df["ROC_2_1d"] < 20.0) | (df["ROC_9_1d"] > -50.0)) | |
# 1h P&D, 4h overbought | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 2.0) | (df["change_pct_1h"].shift(12) > 2.0) | (df["RSI_14_4h"] > 20.0) | |
) | |
# 1h P&D, 1d overbought | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 5.0) | (df["change_pct_1h"].shift(12) > -5.0) | (df["ROC_9_1d"] > -100.0) | |
) | |
# 1h & 4h red, 1h not low enough | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 10.0) | (df["change_pct_4h"] < 10.0) | (df["MFI_14_1h"] > 50.0) | |
) | |
# 1h red, 1h still not low enough, 1d down move | |
short_entry_logic.append((df["change_pct_1h"] < 15.0) | (df["MFI_14_1h"] > 50.0) | (df["RSI_3_1d"] < 90.0)) | |
# 4h red, previous 4h green, 4h overbought | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 5.0) | (df["change_pct_4h"].shift(48) > -5.0) | (df["RSI_14_4h"].shift(48) > 20.0) | |
) | |
# 1d P&D, 1d overbought | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | (df["change_pct_1d"].shift(288) > -10.0) | (df["ROC_9_1d"] > -100.0) | |
) | |
# 1d P&D, 4h still high | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 15.0) | (df["change_pct_1d"].shift(288) > -15.0) | (df["AROOND_14_4h"] < 50.0) | |
) | |
# Logic | |
short_entry_logic.append(df["RSI_14"] > 64.0) | |
short_entry_logic.append(df["AROOND_14"] < 25.0) | |
short_entry_logic.append(df["AROONU_14"] > 75.0) | |
short_entry_logic.append(df["EMA_9"] > (df["EMA_26"] * 1.040)) | |
# Condition #542 - Quick mode (Short). | |
if short_entry_condition_index == 542: | |
# Protections | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
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["RSI_3_1h"] >= 5.0) | |
short_entry_logic.append(df["RSI_3_4h"] >= 20.0) | |
short_entry_logic.append(df["RSI_3_1d"] >= 20.0) | |
short_entry_logic.append(df["RSI_14_1h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_4h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_1d"] > 10.0) | |
# 15m high, 4h still high, 1h downtrend | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | (df["ROC_9_1h"] < 15.0) | |
) | |
# 15m high, 4h strong down move, 1d strong downtrend | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["RSI_3_4h"] < 90.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 15m high, 4h down move, 1d still high | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["RSI_3_4h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# 15m high, 1h low, 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | |
| (df["CMF_20_1h"] < 0.20) | |
| (df["RSI_3_4h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 85.0) | |
) | |
# 4m & 1h & 4h down move | |
short_entry_logic.append((df["RSI_3"] < 95.0) | (df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0)) | |
# 15m & 1h & 4h down move | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 90.0)) | |
# 15m & 1h strong down move & downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["MFI_14_1h"] < 95.0)) | |
# 15m & 1h down move, 1d high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 30.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m down move, 1h down move | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | |
| (df["CCI_20_change_pct_15m"] < 0.0) | |
| (df["RSI_3_1h"] < 90.0) | |
| (df["CCI_20_change_pct_1h"] < 0.0) | |
) | |
# 15m & 1h & 1d down move | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 90.0) | (df["RSI_3_1d"] < 70.0)) | |
# 15m & 1h down move, 4h red, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | |
| (df["RSI_3_1h"] < 90.0) | |
| (df["change_pct_4h"] < 5.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m & 1h down move, 4h downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 85.0) | (df["ROC_9_4h"] < 25.0)) | |
# 15m & 1h down move, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m & 1h down move, 1d overbought | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["RSI_3_1h"] < 90.0) | (df["ROC_9_1d"] > -100.0)) | |
# 15m & 4h down move, 4h still high | |
short_entry_logic.append((df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 80.0) | (df["AROOND_14_4h"] < 50.0)) | |
# 15m down move, 4h still not low enough, 1d overbought | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["AROOND_14_4h"] < 25.0) | (df["ROC_9_1d"] > -100.0)) | |
# 15m & 4h down move, 15m still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | |
) | |
# 15m & 4h down move, 1d downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["RSI_3_4h"] < 85.0) | (df["ROC_9_1d"] < 50.0)) | |
# 15m & 1h down move, 4h high, 1d still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | |
| (df["RSI_3_1h"] < 90.0) | |
| (df["AROOND_14_4h"] < 75.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# 15m & 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["RSI_3_4h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m & 1h down move, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | (df["RSI_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | (df["RSI_3_4h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 75.0) | |
) | |
# 15m & 1h down move, 4h high | |
short_entry_logic.append((df["RSI_3_15m"] < 75.0) | (df["RSI_3_1h"] < 75.0) | (df["MFI_14_4h"] > 30.0)) | |
# 15m down move, 1h downtrend, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | (df["ROC_9_1h"] < 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m & 4h down move, 4h still high | |
short_entry_logic.append((df["RSI_3_15m"] < 75.0) | (df["RSI_3_4h"] < 85.0) | (df["AROOND_14_4h"] < 50.0)) | |
# 15m & 1h down move, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["RSI_3_1h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
) | |
# 15m & 1h down move, 4h hig | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["RSI_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
) | |
# 15m & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m down move, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h & 4h down move, 4h not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 85.0) | |
) | |
# 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h & 4h down move | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["RSI_3_change_pct_4h"] < 75.0) | |
) | |
# 1h down move, 4h strong down move | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 95.0) | (df["RSI_14_change_pct_4h"] < 50.0) | |
) | |
# 1h & 4h down move, 1h still going down | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 75.0) | (df["CCI_20_change_pct_1h"] < 0.0) | |
) | |
# 1h down move, 1h & 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["AROOND_14_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h down move, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 1h & 4h down move, 15m high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 60.0) | |
) | |
# 1h down move, 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 85.0) | (df["RSI_3_4h"] < 80.0) | (df["CCI_20_4h"] > 100.0) | (df["AROOND_14_4h"] < 25.0) | |
) | |
# 1h & 1d down move, 1d downtrend | |
short_entry_logic.append((df["RSI_3_1h"] < 85.0) | (df["RSI_3_1d"] < 80.0) | (df["ROC_9_1d"] < 40.0)) | |
# 1h & 4h down move, 15m still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["RSI_3_4h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 70.0) | |
) | |
# 1h & 4h down move, 1d downtrend | |
short_entry_logic.append((df["RSI_3_1h"] < 80.0) | (df["RSI_3_4h"] < 80.0) | (df["ROC_9_1d"] < 50.0)) | |
# 1h & 4h down move, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["RSI_3_4h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
) | |
# 1h down move, 15m high, 1d overbought | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["ROC_9_1d"] > -40.0) | |
) | |
# 1h down move, 4h low, 1h not low enough | |
short_entry_logic.append((df["RSI_3_1h"] < 80.0) | (df["MFI_14_4h"] < 95.0) | (df["UO_7_14_28_1h"] > 70.0)) | |
# 1h & 4h down move, 15m still high, 1d high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 75.0) | |
| (df["RSI_3_4h"] < 70.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 30.0) | |
) | |
# 1h & 1d down move, 1h still high, 1d high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 75.0) | |
| (df["RSI_3_1d"] < 70.0) | |
| (df["AROOND_14_1h"] < 50.0) | |
| (df["AROOND_14_1d"] < 75.0) | |
) | |
# 1h down move, 4h high, 1d overbought | |
short_entry_logic.append((df["RSI_3_1h"] < 75.0) | (df["AROOND_14_4h"] < 75.0) | (df["ROC_9_1d"] > -80.0)) | |
# 1h & 4h down move, 1d downtrend | |
short_entry_logic.append((df["RSI_3_1h"] < 70.0) | (df["RSI_3_4h"] < 80.0) | (df["ROC_9_1d"] < 40.0)) | |
# 1h down move, 15m high, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 4h down move, 15m & 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 60.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 4h down move, 15m still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 60.0) | (df["ROC_9_1d"] < 40.0) | |
) | |
# 4h down move, 15m high, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["UO_7_14_28_1h"] > 60.0) | |
) | |
# 4h & 1d down move, 1d downtrend | |
short_entry_logic.append((df["RSI_3_4h"] < 85.0) | (df["RSI_3_1d"] < 75.0) | (df["ROC_9_1d"] < 50.0)) | |
# 4h down move, 4h still not low enough, 4h downtrend | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | (df["ROC_9_4h"] < 40.0) | |
) | |
# 4h down move, 4h still high, 1d still high | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | (df["RSI_3_1d"] > 50.0) | |
) | |
# 4h down move, 4h still not low enough, 1d overbought | |
short_entry_logic.append((df["RSI_3_4h"] < 75.0) | (df["AROOND_14_4h"] < 25.0) | (df["ROC_9_1d"] > -150.0)) | |
# 4h down move, 15m stil high, 1d overbought | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["ROC_9_1d"] > -100.0) | |
) | |
# 1h & 4h strong down move | |
short_entry_logic.append( | |
(df["MFI_14_1h"] < 90.0) | (df["RSI_3_4h"] < 95.0) | (df["RSI_3_change_pct_4h"] < 70.0) | |
) | |
# 1h downtrend, 4h down move, 1h overbought | |
short_entry_logic.append((df["ROC_9_1h"] < 30.0) | (df["RSI_3_4h"] < 90.0) | (df["ROC_9_1d"] > -40.0)) | |
# 1h downtrend, 4h down move, 1h downtrend | |
short_entry_logic.append((df["ROC_9_1h"] < 30.0) | (df["RSI_3_4h"] < 90.0) | (df["ROC_9_1d"] < 50.0)) | |
# 4h moving down, 1d P&D | |
short_entry_logic.append( | |
(df["ROC_9_4h"] < 30.0) | (df["RSI_3_change_pct_1d"] < 50.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1d going down and it was pumped, 4h down move | |
short_entry_logic.append( | |
(df["ROC_2_1d"] < 20.0) | (df["ROC_9_1d"].shift(288) > -100.0) | (df["RSI_3_4h"] < 80.0) | |
) | |
# 1d downtrend, 4h downtrend, 4h still not low enough | |
short_entry_logic.append((df["ROC_9_1d"] < 40.0) | (df["CMF_20_4h"] < 0.25) | (df["AROOND_14_4h"] < 50.0)) | |
# 1d downtrend, 4h downtrend | |
short_entry_logic.append((df["ROC_9_1d"] < 40.0) | (df["CMF_20_4h"] < 0.30) | (df["RSI_3_4h"] < 90.0)) | |
# 1h & 4h red, 1h not low enough | |
short_entry_logic.append( | |
(df["change_pct_1h"] < 10.0) | (df["change_pct_4h"] < 10.0) | (df["MFI_14_1h"] > 50.0) | |
) | |
# 4h red, previous 4h green, 15m down move | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 5.0) | (df["change_pct_4h"].shift(48) > -5.0) | (df["RSI_3_15m"] < 95.0) | |
) | |
# 4h red, previous 4h green, 4h still high | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 5.0) | |
| (df["change_pct_4h"].shift(48) > -5.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 4h red, previous 4h red, 1h still high | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 10.0) | (df["change_pct_4h"].shift(48) > -10.0) | (df["AROOND_14_1h"] < 50.0) | |
) | |
# 4h red, 4h still moving down, 1d overbought | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 10.0) | (df["CCI_20_change_pct_4h"] < 0.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 4h red, 4h & 1d still high | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 15.0) | (df["AROOND_14_4h"] < 50.0) | (df["AROOND_14_1d"] < 50.0) | |
) | |
# 1d red, 15m high, 1h still not low enough | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 5.0) | |
| (df["STOCHRSIk_14_14_3_3_15m"] > 20.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
) | |
# 1d red, 4h down move, 1d still high | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | (df["RSI_3_4h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 30.0) | |
) | |
# 1d P&D, 1d overbought | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | |
| (df["change_pct_1d"].shift(288) > -10.0) | |
| (df["RSI_14_1d"].shift(288) > 20.0) | |
) | |
# 1d P&D, 1d overbought | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | (df["change_pct_1d"].shift(288) > -10.0) | (df["ROC_9_1d"] > -50.0) | |
) | |
# 1d red, 15m & 1h down move | |
short_entry_logic.append((df["change_pct_1d"] < 15.0) | (df["RSI_3_15m"] < 80.0) | (df["RSI_3_1h"] < 80.0)) | |
# # # 1d red, 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 15.0) | |
| (df["RSI_3_1h"] < 75.0) | |
| (df["RSI_3_4h"] < 75.0) | |
| (df["UO_7_14_28_4h"] > 65.0) | |
) | |
# Logic | |
short_entry_logic.append(df["WILLR_14"] > -50.0) | |
short_entry_logic.append(df["STOCHRSIk_14_14_3_3"] > 80.0) | |
short_entry_logic.append(df["WILLR_84_1h"] > -30.0) | |
short_entry_logic.append(df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
short_entry_logic.append(df["BBB_20_2.0_1h"] > 16.0) | |
short_entry_logic.append(df["close_min_48"] <= (df["close"] * 0.90)) | |
# Condition #543 - Rapid mode (Short). | |
if short_entry_condition_index == 543: | |
# Protections | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
short_entry_logic.append(df["RSI_14_1h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_4h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_1d"] > 10.0) | |
# 5m strong down move | |
short_entry_logic.append((df["RSI_3"] < 98.0) | (df["ROC_9"] < 50.0)) | |
# 15m down move, 1h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_change_pct_1h"] < 60.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m down move, 1h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_change_pct_1h"] < 40.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 5m down move, 1h down, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["CMF_20_1h"] < 0.2) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 1h still not low enough, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["AROOND_14_1h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
) | |
# 15m down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["OBV_change_pct_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
) | |
# 5m & 1h strong down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
) | |
# 5m & 1h strong downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["MFI_14_1h"] < 90.0)) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | |
| (df["RSI_3_1h"] < 80.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
| (df["AROOND_14_4h"] < 50.0) | |
) | |
# 15m & 1h down move, 4h still high, 4h downtrend | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 90.0) | (df["UO_7_14_28_4h"] > 60.0) | (df["ROC_9_4h"] < 20.0) | |
) | |
# 15m & 1h down move, 1d strong downtrend | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 90.0) | (df["ROC_9_1d"] < 50.0)) | |
# 15m & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 55.0) | |
) | |
# 15m down move, 15m still not low enough, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
) | |
# 15m & 1h down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["RSI_3_1h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
) | |
# 15m down move, 15m still not low enoug, 1h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["AROOND_14_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 10.0) | |
) | |
# 15m down move, 1h downtrend, 4h overbought | |
short_entry_logic.append((df["RSI_3_15m"] < 85.0) | (df["ROC_9_1h"] < 5.0) | (df["ROC_9_4h"] > -35.0)) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 75.0) | |
) | |
# 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_change_pct_4h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_change_pct_4h"] < 65.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still not low | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["RSI_14_4h"] > 50.0) | |
) | |
# 1h down move, 1h not low enough, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 85.0) | (df["AROOND_14_1h"] < 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 4h down move, 15m still not low enough, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 70.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
) | |
# 4h down move, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 4h & 1d down move, 1d strong downtrend | |
short_entry_logic.append((df["RSI_3_4h"] < 90.0) | (df["RSI_3_1d"] < 90.0) | (df["ROC_9_1d"] < 60.0)) | |
# 4h overbought, 1h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["ROC_9_4h"] > -50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["ROC_9_1d"] < 50.0) | |
) | |
# 4h red, previous 4h green, 4h overbought | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 5.0) | (df["change_pct_4h"].shift(48) > -5.0) | (df["RSI_14_4h"].shift(48) > 20.0) | |
) | |
# 4h red, 4h moving down, 4h still high, 1d downtrend | |
short_entry_logic.append( | |
(df["change_pct_4h"] < 10.0) | |
| (df["CCI_20_change_pct_4h"] < 0.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
| (df["ROC_9_1d"] < 40.0) | |
) | |
# Logic | |
short_entry_logic.append(df["RSI_14"] > 60.0) | |
short_entry_logic.append(df["MFI_14"] > 60.0) | |
short_entry_logic.append(df["AROOND_14"] < 25.0) | |
short_entry_logic.append(df["EMA_26"] < df["EMA_12"]) | |
short_entry_logic.append((df["EMA_26"] - df["EMA_12"]) > (df["open"] * 0.024)) | |
short_entry_logic.append((df["EMA_26"].shift() - df["EMA_12"].shift()) > (df["open"] / 100.0)) | |
short_entry_logic.append(df["close"] < (df["EMA_20"] * 0.958)) | |
short_entry_logic.append(df["close"] < (df["BBL_20_2.0"] * 0.992)) | |
# # Condition #620 - Grind mode (Short). | |
# if short_entry_condition_index == 620: | |
# # Protections | |
# short_entry_logic.append(num_open_short_grind_mode < self.grind_mode_max_slots) | |
# short_entry_logic.append(is_pair_short_grind_mode) | |
# short_entry_logic.append(df["RSI_3"] <= 40.0) | |
# short_entry_logic.append(df["RSI_3_15m"] >= 10.0) | |
# short_entry_logic.append(df["RSI_3_1h"] >= 5.0) | |
# short_entry_logic.append(df["RSI_3_4h"] >= 5.0) | |
# short_entry_logic.append(df["RSI_14_1h"] < 85.0) | |
# short_entry_logic.append(df["RSI_14_4h"] < 85.0) | |
# short_entry_logic.append(df["RSI_14_1d"] < 85.0) | |
# short_entry_logic.append(df["close_max_48"] >= (df["close"] * 1.10)) | |
# # Logic | |
# short_entry_logic.append(df["STOCHRSIk_14_14_3_3"] > 80.0) | |
# short_entry_logic.append(df["WILLR_14"] > -20.0) | |
# short_entry_logic.append(df["AROOND_14"] < 25.0) | |
# Condition #641 - Top Coins mode (Short). | |
if short_entry_condition_index == 641: | |
# Protections | |
short_entry_logic.append(is_pair_short_top_coins_mode) | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
short_entry_logic.append(df["RSI_3_1h"] >= 5.0) | |
short_entry_logic.append(df["RSI_3_4h"] >= 20.0) | |
short_entry_logic.append(df["RSI_3_1d"] >= 20.0) | |
short_entry_logic.append(df["RSI_14_1h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_4h"] > 20.0) | |
short_entry_logic.append(df["RSI_14_1d"] > 10.0) | |
# 5m down move, 1h still not low enough, 4h high | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 5m down move, 1h high, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
) | |
# 15m down move, 15m still not low enough, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["AROOND_14_15m"] < 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m & 1h down move, 1d still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["RSI_3_1h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
) | |
# 15m down move, 1h high, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 75.0) | |
) | |
# 15m & 1h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | (df["RSI_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 1h still not low enough, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 1h & 4h & 1d down move | |
short_entry_logic.append((df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 90.0) | (df["RSI_3_1d"] < 80.0)) | |
# 1h & 4h down move, 15m not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 75.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 85.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
) | |
# 1h & 4h down move, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 85.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 75.0) | |
) | |
# 1h down move, 1h & 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 4h down move, 15m still high, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
) | |
# 4h down move, 15m & 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 15.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# Logic | |
short_entry_logic.append(df["RSI_20"] > df["RSI_20"].shift(1)) | |
short_entry_logic.append(df["RSI_3"] > 70.0) | |
short_entry_logic.append(df["AROOND_14"] < 25.0) | |
short_entry_logic.append(df["close"] > df["SMA_16"] * 1.044) | |
# Condition #642 - Top Coins mode (Short). | |
if short_entry_condition_index == 642: | |
# Protections | |
short_entry_logic.append(is_pair_short_top_coins_mode) | |
short_entry_logic.append(df["num_empty_288"] <= allowed_empty_candles_288) | |
# 5m & 1h & 4h down move | |
short_entry_logic.append((df["RSI_3"] < 90.0) | (df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 90.0)) | |
# 5m down move, 15m & 4h still high | |
short_entry_logic.append( | |
(df["RSI_3"] < 90.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 60.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 5m down move, 15m still high, 1h high | |
short_entry_logic.append( | |
(df["RSI_3"] < 85.0) | (df["AROOND_14_15m"] < 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
) | |
# 15m & 1h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
) | |
# 15m & 1h down move, 1d still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
# 15m strong down move, 4h high | |
short_entry_logic.append((df["RSI_3_15m"] < 95.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 20.0)) | |
# 15m & 1h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
) | |
# 15m down move, 15m stil high, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
) | |
# 15m down move, 1h & 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 60.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 95.0) | (df["RSI_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 15m still not low enough, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
) | |
# 15m down move, 4h still high, 1d high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 30.0) | |
) | |
# 15m & 4h down move, 1d still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 85.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 80.0) | (df["RSI_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 15m & 1h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["RSI_3_1h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
) | |
# 15m & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 15m down move, 1h still high, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | |
) | |
# 15m down move, 1h still not low enough, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
) | |
# 15m down move, 1h high, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
) | |
# 15m down move, 4h high, 1d stil high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# 15m & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
) | |
# 15m & 4h down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["RSI_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
) | |
# 15m down move, 15m still high 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 70.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 15m down move, 1h still high, 4h high | |
short_entry_logic.append( | |
(df["RSI_3_15m"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 95.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 95.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 85.0) | |
) | |
# 1h & 4h down move, 1d still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 90.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 85.0) | (df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 85.0) | |
) | |
# 1h down move, 4h still high, 1d high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 60.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 30.0) | |
) | |
# 1h & 4h down move, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
) | |
# 1h & 4h down move, 15m still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 80.0) | (df["RSI_3_4h"] < 80.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | |
) | |
# 1h & 4h down move, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 75.0) | (df["RSI_3_4h"] < 90.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
) | |
# 1h & 4h down move, 1h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 70.0) | (df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 60.0) | |
) | |
# 1h down move, 1h still not low enough, 4h still high | |
short_entry_logic.append( | |
(df["RSI_3_1h"] < 70.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
) | |
# 4h down move, 15m still high, 1h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 85.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 60.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
) | |
# 4h down move, 15m still high, 4h still not low enough | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 75.0) | (df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 75.0) | |
) | |
# 4h down move, 1h still not low enough, 1d still high | |
short_entry_logic.append( | |
(df["RSI_3_4h"] < 25.0) | (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# 15m & 1h still high, 4h high | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 70.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
) | |
# 15m still high, 1h & 1d high | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 60.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 30.0) | |
) | |
# 15m & 4h high | |
short_entry_logic.append((df["STOCHRSIk_14_14_3_3_15m"] > 50.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 20.0)) | |
# 15m high, 1h & 4h still not low enough | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | |
| (df["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 75.0) | |
) | |
# 15m & 4h high | |
short_entry_logic.append((df["STOCHRSIk_14_14_3_3_15m"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 30.0)) | |
# 1h & 4h still high, 1d high | |
short_entry_logic.append( | |
(df["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
| (df["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# 1h & 4h high | |
short_entry_logic.append((df["STOCHRSIk_14_14_3_3_1h"] > 30.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 10.0)) | |
# 1h & 4h high | |
short_entry_logic.append((df["STOCHRSIk_14_14_3_3_1h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_4h"] > 20.0)) | |
# 4h & 1d high | |
short_entry_logic.append((df["STOCHRSIk_14_14_3_3_4h"] > 20.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 20.0)) | |
# 1d red, 1d high | |
short_entry_logic.append((df["change_pct_1d"] < 5.0) | (df["STOCHRSIk_14_14_3_3_1d"] > 20.0)) | |
# 1d P&D, 1d high | |
short_entry_logic.append( | |
(df["change_pct_1d"] < 10.0) | |
| (df["change_pct_1d"].shift(288) > -10.0) | |
| (df["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
# Logic | |
short_entry_logic.append(df["RSI_4"] > 54.0) | |
short_entry_logic.append(df["RSI_20"] > df["RSI_20"].shift(1)) | |
short_entry_logic.append(df["close"] > df["SMA_16"] * 1.042) | |
############################################################################################### | |
# 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_entry_condition_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 | |
# if the profit is negative skip checking these | |
if profit_init_ratio > 0.0: | |
# 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 | |
previous_sell_reason = "" | |
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"] | |
previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] | |
if signal_name in [ | |
f"exit_{self.long_normal_mode_name}_stoploss_doom", | |
f"exit_{self.long_normal_mode_name}_stoploss_u_e", | |
] and ( | |
previous_sell_reason | |
not in [ | |
f"exit_{self.long_normal_mode_name}_stoploss_doom", | |
f"exit_profit_{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 >= 0.005: | |
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}" | |
# Here ends exit signal conditions for long_exit_normal | |
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 | |
# if the profit is negative skip checking these | |
if profit_init_ratio > 0.0: | |
# 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 >= 0.005: | |
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}" | |
# Here ends exit signal conditions for long_exit_pump | |
return False, None | |
# Long Exit Quick | |
# --------------------------------------------------------------------------------------------- | |
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 | |
# if the profit is negative skip checking these | |
if profit_init_ratio > 0.0: | |
# 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" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["MFI_14"] > 84.0): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_2" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["WILLR_14"] >= -0.1): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_3" | |
elif ( | |
(0.09 >= profit_init_ratio > 0.02) | |
and (last_candle["RSI_14"] >= 72.0) | |
and (last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_3_15m"] > 90.0) | |
): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_4" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["RSI_3_15m"] > 96.0): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_5" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["RSI_3"] > 85.0) and (last_candle["RSI_3_15m"] > 85.0): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_6" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["RSI_3"] > 90.0) and (last_candle["RSI_3_15m"] > 80.0): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_7" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["RSI_3"] > 92.0) and (last_candle["RSI_3_15m"] > 75.0): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_8" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["RSI_3"] > 94.0) and (last_candle["RSI_3_15m"] > 70.0): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_9" | |
elif (0.09 >= profit_init_ratio > 0.02) and (last_candle["RSI_3"] > 99.0): | |
sell, signal_name = True, f"exit_{self.long_quick_mode_name}_q_10" | |
# 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.001): | |
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 | |
previous_sell_reason = "" | |
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"] | |
previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] | |
if signal_name in [ | |
f"exit_{self.long_quick_mode_name}_stoploss_doom", | |
f"exit_{self.long_quick_mode_name}_stoploss_u_e", | |
] and ( | |
previous_sell_reason | |
not in [ | |
f"exit_{self.long_quick_mode_name}_stoploss_doom", | |
f"exit_profit_{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 >= 0.005: | |
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}" | |
# Here ends exit signal conditions for long_exit_quick | |
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: | |
is_backtest = self.dp.runmode.value in ["backtest", "hyperopt"] | |
sell = False | |
# Original sell signals | |
sell, signal_name = self.long_exit_signals( | |
self.long_rebuy_mode_name, | |
profit_current_stake_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_current_stake_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_current_stake_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_current_stake_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) | |
) | |
# temporary | |
and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 9, 13) or is_backtest) | |
): | |
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.001): | |
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 >= 0.005: | |
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}" | |
# Here ends exit signal conditions for long_exit_rebuy | |
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.001): | |
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 >= 0.03: | |
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}" | |
# Here ends exit signal conditions for long_exit_high_profit | |
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: | |
is_backtest = self.is_backtest_mode() | |
sell = False | |
signal_name = None | |
# if the profit is negative skip checking these | |
if profit_init_ratio > 0.0: | |
# 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, | |
) | |
# Extra exit logic | |
if not sell: | |
if (0.09 >= profit_init_ratio > 0.005) and (last_candle["RSI_14"] > 78.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_1" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["MFI_14"] > 84.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_2" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["WILLR_14"] >= -0.1): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_3" | |
elif ( | |
(0.09 >= profit_init_ratio > 0.005) | |
and (last_candle["RSI_14"] >= 72.0) | |
and (last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_3_15m"] > 90.0) | |
): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_4" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["RSI_3_15m"] > 96.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_5" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["RSI_3"] > 85.0) and (last_candle["RSI_3_15m"] > 85.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_6" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["RSI_3"] > 90.0) and (last_candle["RSI_3_15m"] > 80.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_7" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["RSI_3"] > 92.0) and (last_candle["RSI_3_15m"] > 75.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_8" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["RSI_3"] > 94.0) and (last_candle["RSI_3_15m"] > 70.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_9" | |
elif (0.09 >= profit_init_ratio > 0.005) and (last_candle["RSI_3"] > 99.0): | |
sell, signal_name = True, f"exit_{self.long_rapid_mode_name}_rpd_10" | |
# Stoplosses | |
if ( | |
( | |
profit_stake | |
< -( | |
filled_entries[0].cost | |
* (self.stop_threshold_rapid_futures if self.is_futures_mode else self.stop_threshold_rapid_spot) | |
/ trade.leverage | |
) | |
) | |
# temporary | |
and (trade.open_date_utc.replace(tzinfo=None) >= datetime(2024, 9, 13) or is_backtest) | |
): | |
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.001): | |
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 | |
previous_sell_reason = "" | |
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"] | |
previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] | |
if signal_name in [ | |
f"exit_{self.long_rapid_mode_name}_stoploss_doom", | |
f"exit_{self.long_rapid_mode_name}_stoploss_u_e", | |
] and ( | |
previous_sell_reason | |
not in [ | |
f"exit_{self.long_rapid_mode_name}_stoploss_doom", | |
f"exit_profit_{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.005: | |
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", | |
f"exit_{self.long_rapid_mode_name}_stoploss_doom", | |
f"exit_{self.long_rapid_mode_name}_stoploss_u_e", | |
]: | |
if sell and (signal_name is not None): | |
return True, f"{signal_name}" | |
# Here ends exit signal conditions for long_exit_rapid | |
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 > 0.25: | |
return True, f"exit_{self.long_grind_mode_name}_g" | |
# Here ends exit signal conditions for long_exit_grind | |
return False, None | |
# Long Exit Top Coins | |
# --------------------------------------------------------------------------------------------- | |
def long_exit_top_coins( | |
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_top_coins_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_top_coins_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_top_coins_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_top_coins_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_top_coins_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_top_coins_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_top_coins_mode_name}_stoploss_u_e"]: | |
if profit_ratio > (previous_profit + 0.005): | |
mark_pair, mark_signal = self.mark_profit_target( | |
self.long_top_coins_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_top_coins_mode_name}_stoploss_doom"] | |
): | |
# Update the target, raise it. | |
mark_pair, mark_signal = self.mark_profit_target( | |
self.long_top_coins_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 | |
previous_sell_reason = "" | |
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"] | |
previous_sell_reason = self.target_profit_cache.data[pair]["sell_reason"] | |
if signal_name in [ | |
f"exit_{self.long_top_coins_mode_name}_stoploss_doom", | |
f"exit_{self.long_top_coins_mode_name}_stoploss_u_e", | |
] and ( | |
previous_sell_reason | |
not in [ | |
f"exit_{self.long_top_coins_mode_name}_stoploss_doom", | |
f"exit_profit_{self.long_top_coins_mode_name}_stoploss_u_e", | |
] | |
): | |
mark_pair, mark_signal = self.mark_profit_target( | |
self.long_top_coins_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_top_coins_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.005: | |
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_top_coins_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_top_coins_mode_name}_max", | |
f"exit_{self.long_top_coins_mode_name}_stoploss_doom", | |
f"exit_{self.long_top_coins_mode_name}_stoploss_u_e", | |
]: | |
if sell and (signal_name is not None): | |
return True, f"{signal_name}" | |
# Here ends exit signal conditions for long_exit_top_coins | |
return False, None | |
# Long Exit Derisk | |
# --------------------------------------------------------------------------------------------- | |
def long_exit_derisk( | |
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_derisk_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_derisk_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_derisk_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_derisk_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 profit_stake < -( | |
filled_entries[0].cost | |
* (self.stop_threshold_derisk_futures if self.is_futures_mode else self.stop_threshold_derisk_spot) | |
# / (trade.leverage if self.is_futures_mode else 1.0) | |
): | |
sell, signal_name = True, f"exit_{self.long_derisk_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_derisk_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_derisk_mode_name}_stoploss_u_e"]: | |
if profit_ratio > (previous_profit + 0.005): | |
mark_pair, mark_signal = self.mark_profit_target( | |
self.long_derisk_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_derisk_mode_name}_stoploss_doom"] | |
): | |
# Update the target, raise it. | |
mark_pair, mark_signal = self.mark_profit_target( | |
self.long_derisk_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_derisk_mode_name}_stoploss_doom", | |
f"exit_{self.long_derisk_mode_name}_stoploss_u_e", | |
]: | |
mark_pair, mark_signal = self.mark_profit_target( | |
self.long_derisk_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_derisk_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.005: | |
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_derisk_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_derisk_mode_name}_max", | |
# f"exit_{self.long_derisk_mode_name}_stoploss_doom", | |
# f"exit_{self.long_derisk_mode_name}_stoploss_u_e", | |
]: | |
if sell and (signal_name is not None): | |
return True, f"{signal_name}" | |
# Here ends exit signal conditions for long_exit_derisk | |
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"] > 84.0) | |
and (last_candle["close"] > last_candle["BBU_20_2.0"]) | |
and (previous_candle_1["close"] > previous_candle_1["BBU_20_2.0"]) | |
and (previous_candle_2["close"] > previous_candle_2["BBU_20_2.0"]) | |
and (previous_candle_3["close"] > previous_candle_3["BBU_20_2.0"]) | |
and (previous_candle_4["close"] > previous_candle_4["BBU_20_2.0"]) | |
): | |
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"] > 86.0) | |
and (last_candle["close"] > last_candle["BBU_20_2.0"]) | |
and (previous_candle_1["close"] > previous_candle_1["BBU_20_2.0"]) | |
and (previous_candle_2["close"] > previous_candle_2["BBU_20_2.0"]) | |
): | |
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"] > 88.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"] > 84.0) and (last_candle["RSI_14_1h"] > 80.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["BBU_20_2.0_1h"] * 1.14: | |
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" | |
# Here ends exit signal conditions for long_exit_signals | |
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["EMA_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["EMA_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" | |
# Here ends exit signal conditions for long_exit_main | |
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["WILLR_480"] > -0.1) and (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 75.0): | |
return True, f"exit_{mode_name}_w_0_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 84.0): | |
return True, f"exit_{mode_name}_w_0_2" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] < 40.0): | |
return True, f"exit_{mode_name}_w_0_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -1.0) | |
and (last_candle["RSI_14"] > 80.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_0_4" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_0_5" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_0_6" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_0_7" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_0_8" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_0_9" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_0_10" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_0_11" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_0_12" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_0_13" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_0_14" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_0_15" | |
elif 0.02 > current_profit >= 0.01: | |
if last_candle["WILLR_480"] > -0.2: | |
return True, f"exit_{mode_name}_w_1_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 78.0): | |
return True, f"exit_{mode_name}_w_1_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 46.0): | |
return True, f"exit_{mode_name}_w_1_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -2.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_1_4" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_1_5" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_1_6" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_1_7" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_1_8" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_1_9" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_1_10" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_1_11" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_1_12" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_1_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_1_14" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_1_15" | |
elif 0.03 > current_profit >= 0.02: | |
if last_candle["WILLR_480"] > -0.3: | |
return True, f"exit_{mode_name}_w_2_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 77.0): | |
return True, f"exit_{mode_name}_w_2_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 48.0): | |
return True, f"exit_{mode_name}_w_2_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -5.0) | |
and (last_candle["RSI_14"] > 75.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_2_4" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_2_5" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_2_6" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_2_7" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_2_8" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_2_9" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_2_10" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_2_11" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_2_12" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_2_13" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_2_14" | |
elif ( | |
(last_candle["RSI_3"] > 48.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_2_15" | |
elif 0.04 > current_profit >= 0.03: | |
if last_candle["WILLR_480"] > -0.4: | |
return True, f"exit_{mode_name}_w_3_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 76.0): | |
return True, f"exit_{mode_name}_w_3_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 50.0): | |
return True, f"exit_{mode_name}_w_3_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -5.0) | |
and (last_candle["RSI_14"] > 75.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_3_4" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_3_5" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_3_6" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_3_7" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_3_8" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_3_9" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -22.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_3_10" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_3_11" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_3_12" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_3_13" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_3_14" | |
elif ( | |
(last_candle["RSI_3"] > 46.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_3_15" | |
elif 0.05 > current_profit >= 0.04: | |
if last_candle["WILLR_480"] > -0.5: | |
return True, f"exit_{mode_name}_w_4_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 75.0): | |
return True, f"exit_{mode_name}_w_4_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 52.0): | |
return True, f"exit_{mode_name}_w_4_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -5.0) | |
and (last_candle["RSI_14"] > 75.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_4_4" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_4_5" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_4_6" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_4_7" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_4_8" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_4_9" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -24.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_4_10" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_4_11" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_4_12" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_4_13" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_4_14" | |
elif ( | |
(last_candle["RSI_3"] > 44.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_4_15" | |
elif 0.06 > current_profit >= 0.05: | |
if last_candle["WILLR_480"] > -0.6: | |
return True, f"exit_{mode_name}_w_5_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 74.0): | |
return True, f"exit_{mode_name}_w_5_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 54.0): | |
return True, f"exit_{mode_name}_w_5_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -10.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_5_4" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_5_5" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_5_6" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_5_7" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_5_8" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_5_9" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -26.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_5_10" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_5_11" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_5_12" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_5_13" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_5_14" | |
elif ( | |
(last_candle["RSI_3"] > 42.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 58.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_5_15" | |
elif 0.07 > current_profit >= 0.06: | |
if last_candle["WILLR_480"] > -0.7: | |
return True, f"exit_{mode_name}_w_6_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 75.0): | |
return True, f"exit_{mode_name}_w_6_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 52.0): | |
return True, f"exit_{mode_name}_w_6_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -15.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_6_4" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_6_5" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_6_6" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_6_7" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_6_8" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_6_9" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -24.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_6_10" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_6_11" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_6_12" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_6_13" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_6_14" | |
elif ( | |
(last_candle["RSI_3"] > 44.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_6_15" | |
elif 0.08 > current_profit >= 0.07: | |
if last_candle["WILLR_480"] > -0.8: | |
return True, f"exit_{mode_name}_w_7_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 76.0): | |
return True, f"exit_{mode_name}_w_7_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 50.0): | |
return True, f"exit_{mode_name}_w_7_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -15.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_7_4" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_7_5" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_7_6" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_7_7" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_7_8" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_7_9" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -22.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_7_10" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_7_11" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_7_12" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_7_13" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_7_14" | |
elif ( | |
(last_candle["RSI_3"] > 46.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_7_15" | |
elif 0.09 > current_profit >= 0.08: | |
if last_candle["WILLR_480"] > -0.9: | |
return True, f"exit_{mode_name}_w_8_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 77.0): | |
return True, f"exit_{mode_name}_w_8_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 48.0): | |
return True, f"exit_{mode_name}_w_8_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -15.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_8_4" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_8_5" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_8_6" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_8_7" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_8_8" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_8_9" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_8_10" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_8_11" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_8_12" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_8_13" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_8_14" | |
elif ( | |
(last_candle["RSI_3"] > 48.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_8_15" | |
elif 0.1 > current_profit >= 0.09: | |
if last_candle["WILLR_480"] > -1.0: | |
return True, f"exit_{mode_name}_w_9_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 78.0): | |
return True, f"exit_{mode_name}_w_9_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 46.0): | |
return True, f"exit_{mode_name}_w_9_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -15.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_9_4" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_9_5" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_9_6" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_9_7" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_9_8" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_9_9" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_9_10" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_9_11" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_9_12" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_9_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_9_14" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_9_15" | |
elif 0.12 > current_profit >= 0.1: | |
if last_candle["WILLR_480"] > -1.1: | |
return True, f"exit_{mode_name}_w_10_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 79.0): | |
return True, f"exit_{mode_name}_w_10_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 44.0): | |
return True, f"exit_{mode_name}_w_10_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -15.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_10_4" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_10_5" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_10_6" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_10_7" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_10_8" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_10_9" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_10_10" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_10_11" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_10_12" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_10_13" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_10_14" | |
elif ( | |
(last_candle["RSI_3"] > 52.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_10_15" | |
elif 0.2 > current_profit >= 0.12: | |
if last_candle["WILLR_480"] > -0.4: | |
return True, f"exit_{mode_name}_w_11_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 80.0): | |
return True, f"exit_{mode_name}_w_11_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 42.0): | |
return True, f"exit_{mode_name}_w_11_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -15.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_11_4" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_11_5" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_11_6" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_11_7" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_11_8" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_11_9" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_11_10" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_11_11" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_11_12" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_11_13" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_11_14" | |
elif ( | |
(last_candle["RSI_3"] > 54.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_11_15" | |
elif current_profit >= 0.2: | |
if last_candle["WILLR_480"] > -0.2: | |
return True, f"exit_{mode_name}_w_12_1" | |
elif (last_candle["WILLR_14"] >= -1.0) and (last_candle["RSI_14"] > 81.0): | |
return True, f"exit_{mode_name}_w_12_2" | |
elif (last_candle["WILLR_14"] >= -2.0) and (last_candle["RSI_14"] < 40.0): | |
return True, f"exit_{mode_name}_w_12_3" | |
elif ( | |
(last_candle["WILLR_14"] >= -1.0) | |
and (last_candle["RSI_14"] > 80.0) | |
and (last_candle["ROC_9_1h"] < -0.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_12_4" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_w_12_5" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_w_12_6" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14_4h"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
): | |
return True, f"exit_{mode_name}_w_12_7" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_w_12_8" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] > 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_w_12_9" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["CCI_20_change_pct_4h"] < -0.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_w_12_10" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
): | |
return True, f"exit_{mode_name}_w_12_11" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_w_12_12" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_w_12_13" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_w_12_14" | |
elif ( | |
(last_candle["RSI_3"] > 56.0) | |
and (last_candle["WILLR_480"] > -25.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 100.0)) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 100.0)) | |
): | |
return True, f"exit_{mode_name}_w_12_15" | |
# Here ends exit signal conditions for long_exit_williams_r | |
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["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_1h"] < last_candle["KSTs_9_1h"]) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_4h"] < last_candle["KSTs_9_4h"]) | |
): | |
return True, f"exit_{mode_name}_d_0_1" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_2" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 99.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and ( | |
(last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) and (last_candle["STOCHRSIk_14_14_3_3_change_pct_4h"] < -10.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_3" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_4" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_0_5" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_6" | |
elif ( | |
(last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -40.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_7" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 99.0) | |
and (last_candle["CMF_20_1h"] < -0.1) | |
and (last_candle["CMF_20_4h"] < -0.1) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 15.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_8" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3"] > 99.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_9" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_10" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 45.0) | |
and (last_candle["ROC_9_15m"] < -10.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -20.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_11" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_1h"] < -20.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_12" | |
elif (last_candle["RSI_3"] > 99.0) and (last_candle["RSI_3_4h"] < 5.0) and (last_candle["ROC_9_4h"] < -25.0): | |
return True, f"exit_{mode_name}_d_0_13" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_4h"] < 5.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_0_14" | |
elif (last_candle["RSI_3"] > 99.0) and (last_candle["RSI_14"] > 78.0) and (last_candle["ROC_9_4h"] < -30.0): | |
return True, f"exit_{mode_name}_d_0_15" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["AROONU_14_1d"] > 50.0) | |
and (last_candle["change_pct_1d"] < -15.0) | |
): | |
return True, f"exit_{mode_name}_d_0_16" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_0_17" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] > 75.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["ROC_2_1d"] < -50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_18" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_19" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_0_20" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_0_21" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_22" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -5.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_1d"] < 5.0) | |
): | |
return True, f"exit_{mode_name}_d_0_23" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and (last_candle["WILLR_14"] > -5.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_0_24" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_4h"] < -15.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_25" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_26" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_27" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 10.0) | |
and (last_candle["ROC_9_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_28" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_0_29" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_0_30" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_0_31" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_0_32" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["ROC_2_1h"] < -10.0) | |
and (last_candle["ROC_9_1h"] > 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_33" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_3_15m"] < 30.0) | |
and (last_candle["RSI_14_1h"] > 80.0) | |
and (last_candle["ROC_9_1h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_0_34" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -5.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_0_35" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_36" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_37" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_38" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_0_39" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_40" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -5.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_41" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_42" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_43" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_44" | |
elif (last_candle["RSI_3"] > 96.0) and (last_candle["WILLR_14"] > -4.0) and (last_candle["RSI_3_1h"] < 10.0): | |
return True, f"exit_{mode_name}_d_0_45" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_2_1d"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_46" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_47" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_48" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_49" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1d"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_0_50" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_51" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] > 62.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_52" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["WILLR_14"] > -5.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_53" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (last_candle["change_pct_1d"] < -10.0) | |
): | |
return True, f"exit_{mode_name}_d_0_54" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_55" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
): | |
return True, f"exit_{mode_name}_d_0_56" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 34.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_0_57" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_58" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_0_59" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 38.0) | |
and (last_candle["RSI_14_4h"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_60" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_0_61" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 20.0)) | |
and (last_candle["change_pct_1d"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_0_62" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_0_63" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_64" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
): | |
return True, f"exit_{mode_name}_d_0_65" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_66" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_67" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_0_68" | |
elif ( | |
(last_candle["RSI_3"] > 97.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_0_69" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 38.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_70" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_71" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_0_72" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_73" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_74" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_75" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["ROC_9_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_d_0_76" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_77" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_78" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_0_79" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_0_80" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["RSI_14_1d"], np.float64) and (last_candle["RSI_14_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_81" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_0_82" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_0_83" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_0_84" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_85" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["RSI_14_4h"] > 80.0) | |
and (last_candle["ROC_2_1h"] < -5.0) | |
and (last_candle["ROC_9_1h"] > 5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_86" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_87" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_1h"] < -2.0) | |
): | |
return True, f"exit_{mode_name}_d_0_88" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 38.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 25.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_89" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_90" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_91" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_92" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_15m"] < 50.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_93" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 45.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_0_94" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
and (isinstance(last_candle["AROONU_14_1d"], np.float64) and (last_candle["AROONU_14_1d"] > 75.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_95" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_1d"] < 45.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_96" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 35.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_0_97" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["RSI_3_15m"] > 74.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["RSI_3_1d"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_98" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 65.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHk_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_99" | |
elif ( | |
(last_candle["RSI_3"] > 99.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and (last_candle["RSI_3_15m"] > 70.0) | |
and (last_candle["RSI_3_4h"] < 80.0) | |
): | |
return True, f"exit_{mode_name}_d_0_100" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_101" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_102" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_0_103" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_0_104" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_15m"] < 55.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_0_105" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_0_106" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["RSI_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_0_107" | |
elif 0.02 > current_profit >= 0.01: | |
if ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_1h"] < last_candle["KSTs_9_1h"]) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_4h"] < last_candle["KSTs_9_4h"]) | |
): | |
return True, f"exit_{mode_name}_d_1_1" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 68.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_2" | |
elif ( | |
(last_candle["WILLR_14"] > -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 99.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and ( | |
(last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) and (last_candle["STOCHRSIk_14_14_3_3_change_pct_4h"] < -10.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_3" | |
elif ( | |
(last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_14"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_4" | |
elif ( | |
(last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_14"] > 72.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_1_5" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_6" | |
elif ( | |
(last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -40.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_7" | |
elif ( | |
(last_candle["WILLR_14"] > -2.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.1) | |
and (last_candle["CMF_20_4h"] < -0.1) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 15.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_8" | |
elif ( | |
(last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3"] > 95.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_9" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_10" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 45.0) | |
and (last_candle["ROC_9_15m"] < -10.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -20.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_11" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_1h"] < -20.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_12" | |
elif (last_candle["RSI_3"] > 80.0) and (last_candle["RSI_3_4h"] < 5.0) and (last_candle["ROC_9_4h"] < -25.0): | |
return True, f"exit_{mode_name}_d_1_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_4h"] < 5.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_1_14" | |
elif (last_candle["RSI_3"] > 95.0) and (last_candle["RSI_14"] > 75.0) and (last_candle["ROC_9_4h"] < -30.0): | |
return True, f"exit_{mode_name}_d_1_15" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["AROONU_14_1d"] > 50.0) | |
and (last_candle["change_pct_1d"] < -15.0) | |
): | |
return True, f"exit_{mode_name}_d_1_16" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_1_17" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] > 60.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["ROC_2_1d"] < -50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_18" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] > 72.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_19" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_1_20" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_1_21" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_22" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_1d"] < 5.0) | |
): | |
return True, f"exit_{mode_name}_d_1_23" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["RSI_14"] > 75.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_1_24" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_4h"] < -15.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_25" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_26" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_27" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 10.0) | |
and (last_candle["ROC_9_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_28" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_1_29" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_1_30" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_1_31" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_1_32" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["ROC_2_1h"] < -10.0) | |
and (last_candle["ROC_9_1h"] > 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_33" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_3_15m"] < 30.0) | |
and (last_candle["RSI_14_1h"] > 80.0) | |
and (last_candle["ROC_9_1h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_1_34" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_1_35" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -15.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_36" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_37" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_38" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -5.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_1_39" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -15.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_40" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_41" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_42" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_43" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["WILLR_14"] > -5.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_44" | |
elif (last_candle["RSI_3"] > 94.0) and (last_candle["WILLR_14"] > -6.0) and (last_candle["RSI_3_1h"] < 10.0): | |
return True, f"exit_{mode_name}_d_1_45" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_2_1d"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_46" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_47" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_48" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_49" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_1d"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_1_50" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_51" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] > 60.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_52" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_53" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (last_candle["change_pct_1d"] < -10.0) | |
): | |
return True, f"exit_{mode_name}_d_1_54" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_55" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
): | |
return True, f"exit_{mode_name}_d_1_56" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 36.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_1_57" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_58" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_1_59" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["RSI_14_4h"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_60" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_1_61" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 20.0)) | |
and (last_candle["change_pct_1d"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_1_62" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_1_63" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_64" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
): | |
return True, f"exit_{mode_name}_d_1_65" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_66" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_67" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_1_68" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_1_69" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_70" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_71" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_1_72" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_73" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_74" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_75" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_d_1_76" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_77" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_78" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_1_79" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_1_80" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["RSI_14_1d"], np.float64) and (last_candle["RSI_14_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_81" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_1_82" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_1_83" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -2.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_1_84" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_85" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["RSI_14_4h"] > 80.0) | |
and (last_candle["ROC_2_1h"] < -5.0) | |
and (last_candle["ROC_9_1h"] > 5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_86" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_87" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_1h"] < -2.0) | |
): | |
return True, f"exit_{mode_name}_d_1_88" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 25.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_89" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_90" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_91" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_92" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 50.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_93" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 45.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_1_94" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
and (isinstance(last_candle["AROONU_14_1d"], np.float64) and (last_candle["AROONU_14_1d"] > 75.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_95" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_1d"] < 45.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_96" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 35.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_1_97" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_3_15m"] > 72.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["RSI_3_1d"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_98" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 65.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHk_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_99" | |
elif ( | |
(last_candle["RSI_3"] > 98.0) | |
and (last_candle["RSI_14"] > 76.0) | |
and (last_candle["RSI_3_15m"] > 70.0) | |
and (last_candle["RSI_3_4h"] < 80.0) | |
): | |
return True, f"exit_{mode_name}_d_1_100" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_101" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_102" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_1_103" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_1_104" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_15m"] < 55.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_1_105" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_1_106" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["RSI_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_1_107" | |
elif 0.03 > current_profit >= 0.02: | |
if ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_1h"] < last_candle["KSTs_9_1h"]) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_4h"] < last_candle["KSTs_9_4h"]) | |
): | |
return True, f"exit_{mode_name}_d_2_1" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 66.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_2" | |
elif ( | |
(last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 99.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and ( | |
(last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) and (last_candle["STOCHRSIk_14_14_3_3_change_pct_4h"] < -10.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_3" | |
elif ( | |
(last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_14"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_4" | |
elif ( | |
(last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_2_5" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_6" | |
elif ( | |
(last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -40.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_7" | |
elif ( | |
(last_candle["WILLR_14"] > -4.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.1) | |
and (last_candle["CMF_20_4h"] < -0.1) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 15.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_8" | |
elif ( | |
(last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3"] > 95.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_9" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_10" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 45.0) | |
and (last_candle["ROC_9_15m"] < -10.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -20.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_11" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_1h"] < -20.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_12" | |
elif (last_candle["RSI_3"] > 80.0) and (last_candle["RSI_3_4h"] < 5.0) and (last_candle["ROC_9_4h"] < -25.0): | |
return True, f"exit_{mode_name}_d_2_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_4h"] < 5.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_2_14" | |
elif (last_candle["RSI_3"] > 92.0) and (last_candle["RSI_14"] > 70.0) and (last_candle["ROC_9_4h"] < -30.0): | |
return True, f"exit_{mode_name}_d_2_15" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["AROONU_14_1d"] > 50.0) | |
and (last_candle["change_pct_1d"] < -15.0) | |
): | |
return True, f"exit_{mode_name}_d_2_16" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_2_17" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] > 60.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["ROC_2_1d"] < -50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_18" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_19" | |
elif ( | |
(last_candle["RSI_3"] > 48.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_2_20" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_2_21" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_22" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -15.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_1d"] < 5.0) | |
): | |
return True, f"exit_{mode_name}_d_2_23" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_2_24" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_4h"] < -15.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_25" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_26" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_27" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 10.0) | |
and (last_candle["ROC_9_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_28" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_2_29" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_2_30" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_2_31" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_2_32" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["ROC_2_1h"] < -10.0) | |
and (last_candle["ROC_9_1h"] > 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_33" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_3_15m"] < 30.0) | |
and (last_candle["RSI_14_1h"] > 80.0) | |
and (last_candle["ROC_9_1h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_2_34" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -7.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_2_35" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_36" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_37" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_38" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_2_39" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_40" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -15.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_41" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_42" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_43" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_44" | |
elif (last_candle["RSI_3"] > 92.0) and (last_candle["WILLR_14"] > -8.0) and (last_candle["RSI_3_1h"] < 10.0): | |
return True, f"exit_{mode_name}_d_2_45" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_2_1d"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_46" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_47" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_48" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_49" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1d"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_2_50" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_51" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] > 58.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_52" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_53" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (last_candle["change_pct_1d"] < -10.0) | |
): | |
return True, f"exit_{mode_name}_d_2_54" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_55" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
): | |
return True, f"exit_{mode_name}_d_2_56" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 38.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_2_57" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_58" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_2_59" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_14_4h"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_60" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_2_61" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 20.0)) | |
and (last_candle["change_pct_1d"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_2_62" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_2_63" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_64" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
): | |
return True, f"exit_{mode_name}_d_2_65" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_66" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_67" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_2_68" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_2_69" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_70" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_71" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_2_72" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_73" | |
elif ( | |
(last_candle["RSI_3"] > 97.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_74" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_75" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["ROC_9_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_d_2_76" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_77" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_78" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_2_79" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_2_80" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["RSI_14_1d"], np.float64) and (last_candle["RSI_14_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_81" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_2_82" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_2_83" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -4.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_2_84" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_85" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["RSI_14_4h"] > 80.0) | |
and (last_candle["ROC_2_1h"] < -5.0) | |
and (last_candle["ROC_9_1h"] > 5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_86" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_87" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -22.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_1h"] < -2.0) | |
): | |
return True, f"exit_{mode_name}_d_2_88" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 25.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_89" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_90" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_91" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_92" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_15m"] < 50.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_93" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 45.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_2_94" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
and (isinstance(last_candle["AROONU_14_1d"], np.float64) and (last_candle["AROONU_14_1d"] > 75.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_95" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_1d"] < 45.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_96" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 35.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_2_97" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["RSI_3_15m"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["RSI_3_1d"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_98" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 65.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHk_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_99" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["RSI_14"] > 74.0) | |
and (last_candle["RSI_3_15m"] > 70.0) | |
and (last_candle["RSI_3_4h"] < 80.0) | |
): | |
return True, f"exit_{mode_name}_d_2_100" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_101" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_102" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 58.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_2_103" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_2_104" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 55.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_2_105" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_2_106" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["RSI_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_2_107" | |
elif 0.04 > current_profit >= 0.03: | |
if ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_1h"] < last_candle["KSTs_9_1h"]) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_4h"] < last_candle["KSTs_9_4h"]) | |
): | |
return True, f"exit_{mode_name}_d_3_1" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 64.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_2" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and ( | |
(last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) and (last_candle["STOCHRSIk_14_14_3_3_change_pct_4h"] < -10.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_3" | |
elif ( | |
(last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_14"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_4" | |
elif ( | |
(last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_14"] > 68.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_3_5" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_6" | |
elif ( | |
(last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -40.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_7" | |
elif ( | |
(last_candle["WILLR_14"] > -6.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.1) | |
and (last_candle["CMF_20_4h"] < -0.1) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 15.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_8" | |
elif ( | |
(last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3"] > 95.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_9" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_10" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 45.0) | |
and (last_candle["ROC_9_15m"] < -10.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -20.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_11" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_1h"] < -20.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_12" | |
elif (last_candle["RSI_3"] > 80.0) and (last_candle["RSI_3_4h"] < 5.0) and (last_candle["ROC_9_4h"] < -25.0): | |
return True, f"exit_{mode_name}_d_3_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 5.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_3_14" | |
elif (last_candle["RSI_3"] > 90.0) and (last_candle["RSI_14"] > 65.0) and (last_candle["ROC_9_4h"] < -30.0): | |
return True, f"exit_{mode_name}_d_3_15" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["AROONU_14_1d"] > 50.0) | |
and (last_candle["change_pct_1d"] < -15.0) | |
): | |
return True, f"exit_{mode_name}_d_3_16" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_3_17" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] > 60.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["ROC_2_1d"] < -50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_18" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["RSI_14"] > 68.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_19" | |
elif ( | |
(last_candle["RSI_3"] > 46.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_3_20" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_3_21" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_22" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_1d"] < 5.0) | |
): | |
return True, f"exit_{mode_name}_d_3_23" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["RSI_14"] > 68.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_3_24" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_4h"] < -15.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_25" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_26" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_27" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 10.0) | |
and (last_candle["ROC_9_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_28" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_3_29" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_3_30" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_3_31" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_3_32" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["ROC_2_1h"] < -10.0) | |
and (last_candle["ROC_9_1h"] > 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_33" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_3_15m"] < 30.0) | |
and (last_candle["RSI_14_1h"] > 80.0) | |
and (last_candle["ROC_9_1h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_3_34" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_3_35" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_36" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_37" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_38" | |
elif ( | |
(last_candle["RSI_3"] > 93.0) | |
and (last_candle["WILLR_14"] > -7.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_3_39" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_40" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_41" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -35.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_42" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_43" | |
elif ( | |
(last_candle["RSI_3"] > 55.0) | |
and (last_candle["WILLR_14"] > -15.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_44" | |
elif (last_candle["RSI_3"] > 90.0) and (last_candle["WILLR_14"] > -10.0) and (last_candle["RSI_3_1h"] < 10.0): | |
return True, f"exit_{mode_name}_d_3_45" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_2_1d"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_46" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_47" | |
elif ( | |
(last_candle["RSI_3"] > 55.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_48" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_49" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1d"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_3_50" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_51" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] > 56.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_52" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_53" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (last_candle["change_pct_1d"] < -10.0) | |
): | |
return True, f"exit_{mode_name}_d_3_54" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_55" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
): | |
return True, f"exit_{mode_name}_d_3_56" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_3_57" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_58" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_3_59" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_14_4h"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_60" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_3_61" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 20.0)) | |
and (last_candle["change_pct_1d"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_3_62" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_3_63" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_64" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
): | |
return True, f"exit_{mode_name}_d_3_65" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_66" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_67" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_3_68" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_3_69" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_70" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_71" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_3_72" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_73" | |
elif ( | |
(last_candle["RSI_3"] > 96.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_74" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_75" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["ROC_9_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_d_3_76" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_77" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_78" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_3_79" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_3_80" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["RSI_14_1d"], np.float64) and (last_candle["RSI_14_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_81" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_3_82" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_3_83" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -6.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_3_84" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_85" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14_4h"] > 80.0) | |
and (last_candle["ROC_2_1h"] < -5.0) | |
and (last_candle["ROC_9_1h"] > 5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_86" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_87" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -24.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_1h"] < -2.0) | |
): | |
return True, f"exit_{mode_name}_d_3_88" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 25.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_89" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_90" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_91" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_92" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_15m"] < 50.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_93" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 45.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_3_94" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
and (isinstance(last_candle["AROONU_14_1d"], np.float64) and (last_candle["AROONU_14_1d"] > 75.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_95" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_1d"] < 45.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_96" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 35.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_3_97" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_3_15m"] > 68.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["RSI_3_1d"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_98" | |
elif ( | |
(last_candle["RSI_3"] > 56.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 65.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHk_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_99" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["RSI_14"] > 72.0) | |
and (last_candle["RSI_3_15m"] > 70.0) | |
and (last_candle["RSI_3_4h"] < 80.0) | |
): | |
return True, f"exit_{mode_name}_d_3_100" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_101" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_102" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 60.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_3_103" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_3_104" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_15m"] < 55.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_3_105" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_3_106" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["RSI_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_3_107" | |
elif 0.05 > current_profit >= 0.04: | |
if ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_1h"] < last_candle["KSTs_9_1h"]) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_4h"] < last_candle["KSTs_9_4h"]) | |
): | |
return True, f"exit_{mode_name}_d_4_1" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 62.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_2" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and ( | |
(last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) and (last_candle["STOCHRSIk_14_14_3_3_change_pct_4h"] < -10.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_3" | |
elif ( | |
(last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_14"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_4" | |
elif ( | |
(last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_14"] > 66.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_4_5" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_6" | |
elif ( | |
(last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -40.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_7" | |
elif ( | |
(last_candle["WILLR_14"] > -8.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.1) | |
and (last_candle["CMF_20_4h"] < -0.1) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 15.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_8" | |
elif ( | |
(last_candle["WILLR_14"] > -7.0) | |
and (last_candle["RSI_3"] > 95.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_9" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_10" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 45.0) | |
and (last_candle["ROC_9_15m"] < -10.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -20.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_11" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_1h"] < -20.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_12" | |
elif (last_candle["RSI_3"] > 80.0) and (last_candle["RSI_3_4h"] < 5.0) and (last_candle["ROC_9_4h"] < -25.0): | |
return True, f"exit_{mode_name}_d_4_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 5.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_4_14" | |
elif (last_candle["RSI_3"] > 88.0) and (last_candle["RSI_14"] > 60.0) and (last_candle["ROC_9_4h"] < -30.0): | |
return True, f"exit_{mode_name}_d_4_15" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["AROONU_14_1d"] > 50.0) | |
and (last_candle["change_pct_1d"] < -15.0) | |
): | |
return True, f"exit_{mode_name}_d_4_16" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_4_17" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] > 60.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["ROC_2_1d"] < -50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_18" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_14"] > 66.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_19" | |
elif ( | |
(last_candle["RSI_3"] > 44.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_4_20" | |
elif ( | |
(last_candle["RSI_3"] > 55.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_4_21" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_22" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_1d"] < 5.0) | |
): | |
return True, f"exit_{mode_name}_d_4_23" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_14"] > 66.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_4_24" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_4h"] < -15.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_25" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_26" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_27" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 10.0) | |
and (last_candle["ROC_9_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_28" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_4_29" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_4_30" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_4_31" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_4_32" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["ROC_2_1h"] < -10.0) | |
and (last_candle["ROC_9_1h"] > 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_33" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_3_15m"] < 30.0) | |
and (last_candle["RSI_14_1h"] > 80.0) | |
and (last_candle["ROC_9_1h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_4_34" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -9.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_4_35" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_36" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_37" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_38" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_4_39" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_40" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_41" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_42" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_43" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_44" | |
elif (last_candle["RSI_3"] > 88.0) and (last_candle["WILLR_14"] > -12.0) and (last_candle["RSI_3_1h"] < 10.0): | |
return True, f"exit_{mode_name}_d_4_45" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_2_1d"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_46" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_47" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_48" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_49" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1d"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_4_50" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_51" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] > 54.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_52" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_53" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (last_candle["change_pct_1d"] < -10.0) | |
): | |
return True, f"exit_{mode_name}_d_4_54" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_55" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
): | |
return True, f"exit_{mode_name}_d_4_56" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_4_57" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_58" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_4_59" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_14_4h"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_60" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_4_61" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 20.0)) | |
and (last_candle["change_pct_1d"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_4_62" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_4_63" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_64" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
): | |
return True, f"exit_{mode_name}_d_4_65" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_66" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_67" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_4_68" | |
elif ( | |
(last_candle["RSI_3"] > 93.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_4_69" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_70" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_71" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_4_72" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_73" | |
elif ( | |
(last_candle["RSI_3"] > 95.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_74" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_75" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["ROC_9_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_d_4_76" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_77" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -22.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_78" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_4_79" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_4_80" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["RSI_14_1d"], np.float64) and (last_candle["RSI_14_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_81" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_4_82" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_4_83" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_4_84" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -14.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_85" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["RSI_14_4h"] > 80.0) | |
and (last_candle["ROC_2_1h"] < -5.0) | |
and (last_candle["ROC_9_1h"] > 5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_86" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_87" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -26.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_1h"] < -2.0) | |
): | |
return True, f"exit_{mode_name}_d_4_88" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 25.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_89" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_90" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_91" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_92" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_15m"] < 50.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_93" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 45.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_4_94" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
and (isinstance(last_candle["AROONU_14_1d"], np.float64) and (last_candle["AROONU_14_1d"] > 75.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_95" | |
elif ( | |
(last_candle["RSI_3"] > 56.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_1d"] < 45.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_96" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 35.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_4_97" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_3_15m"] > 66.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["RSI_3_1d"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_98" | |
elif ( | |
(last_candle["RSI_3"] > 54.0) | |
and (last_candle["RSI_14"] < 58.0) | |
and (last_candle["RSI_3_1h"] < 65.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHk_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_99" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["RSI_14"] > 70.0) | |
and (last_candle["RSI_3_15m"] > 70.0) | |
and (last_candle["RSI_3_4h"] < 80.0) | |
): | |
return True, f"exit_{mode_name}_d_4_100" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["WILLR_14"] > -22.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_101" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_102" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 62.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_4_103" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_4_104" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_15m"] < 55.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_4_105" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_4_106" | |
elif ( | |
(last_candle["RSI_3"] > 68.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["RSI_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_4_107" | |
elif 0.06 > current_profit >= 0.05: | |
if ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_1h"] < last_candle["KSTs_9_1h"]) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_4h"] < last_candle["KSTs_9_4h"]) | |
): | |
return True, f"exit_{mode_name}_d_5_1" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 60.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_2" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and ( | |
(last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) and (last_candle["STOCHRSIk_14_14_3_3_change_pct_4h"] < -10.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_3" | |
elif ( | |
(last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_14"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_4" | |
elif ( | |
(last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_14"] > 64.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_5_5" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_6" | |
elif ( | |
(last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -40.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_7" | |
elif ( | |
(last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.1) | |
and (last_candle["CMF_20_4h"] < -0.1) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 15.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_8" | |
elif ( | |
(last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3"] > 95.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_9" | |
elif ( | |
(last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_10" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 45.0) | |
and (last_candle["ROC_9_15m"] < -10.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -20.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_11" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_1h"] < -20.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_12" | |
elif (last_candle["RSI_3"] > 80.0) and (last_candle["RSI_3_4h"] < 5.0) and (last_candle["ROC_9_4h"] < -25.0): | |
return True, f"exit_{mode_name}_d_5_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_4h"] < 5.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_5_14" | |
elif (last_candle["RSI_3"] > 86.0) and (last_candle["RSI_14"] > 58.0) and (last_candle["ROC_9_4h"] < -30.0): | |
return True, f"exit_{mode_name}_d_5_15" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["AROONU_14_1d"] > 50.0) | |
and (last_candle["change_pct_1d"] < -15.0) | |
): | |
return True, f"exit_{mode_name}_d_5_16" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -35.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_5_17" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] > 60.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["ROC_2_1d"] < -50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_18" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_14"] > 64.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_19" | |
elif ( | |
(last_candle["RSI_3"] > 42.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_5_20" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_5_21" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_22" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_1d"] < 5.0) | |
): | |
return True, f"exit_{mode_name}_d_5_23" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["RSI_14"] > 64.0) | |
and (last_candle["WILLR_14"] > -35.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_5_24" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_4h"] < -15.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_25" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_26" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_27" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 10.0) | |
and (last_candle["ROC_9_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_28" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_5_29" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_5_30" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_5_31" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_5_32" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["ROC_2_1h"] < -10.0) | |
and (last_candle["ROC_9_1h"] > 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_33" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_3_15m"] < 30.0) | |
and (last_candle["RSI_14_1h"] > 80.0) | |
and (last_candle["ROC_9_1h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_5_34" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_5_35" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["WILLR_14"] > -35.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_36" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_37" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["WILLR_14"] > -35.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_38" | |
elif ( | |
(last_candle["RSI_3"] > 91.0) | |
and (last_candle["WILLR_14"] > -9.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_5_39" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["WILLR_14"] > -35.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_40" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_41" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -45.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_42" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_43" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_44" | |
elif (last_candle["RSI_3"] > 86.0) and (last_candle["WILLR_14"] > -14.0) and (last_candle["RSI_3_1h"] < 10.0): | |
return True, f"exit_{mode_name}_d_5_45" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_2_1d"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_46" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_47" | |
elif ( | |
(last_candle["RSI_3"] > 45.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_48" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_49" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -12.0) | |
and (last_candle["RSI_3_1d"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_5_50" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_51" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] > 52.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_52" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_53" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (last_candle["change_pct_1d"] < -10.0) | |
): | |
return True, f"exit_{mode_name}_d_5_54" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["WILLR_14"] > -22.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_55" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
): | |
return True, f"exit_{mode_name}_d_5_56" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 44.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_5_57" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_58" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_5_59" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_14_4h"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_60" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_5_61" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 20.0)) | |
and (last_candle["change_pct_1d"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_5_62" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_5_63" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_64" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
): | |
return True, f"exit_{mode_name}_d_5_65" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_66" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_67" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_5_68" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_5_69" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_70" | |
elif ( | |
(last_candle["RSI_3"] > 56.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_71" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_5_72" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_73" | |
elif ( | |
(last_candle["RSI_3"] > 94.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_74" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_75" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 58.0) | |
and (last_candle["ROC_9_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
): | |
return True, f"exit_{mode_name}_d_5_76" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_77" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["WILLR_14"] > -24.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_78" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_5_79" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_5_80" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["RSI_14_1d"], np.float64) and (last_candle["RSI_14_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_81" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_5_82" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_5_83" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_5_84" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -16.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_85" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_14_4h"] > 80.0) | |
and (last_candle["ROC_2_1h"] < -5.0) | |
and (last_candle["ROC_9_1h"] > 5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_86" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_87" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -28.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_1h"] < -2.0) | |
): | |
return True, f"exit_{mode_name}_d_5_88" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 25.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_89" | |
elif ( | |
(last_candle["RSI_3"] > 84.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_90" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_91" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_92" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 58.0) | |
and (last_candle["RSI_3_15m"] < 50.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_93" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 58.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 45.0) | |
and (last_candle["AROONU_14_1h"] > 75.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_5_94" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
and (isinstance(last_candle["AROONU_14_1d"], np.float64) and (last_candle["AROONU_14_1d"] > 75.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_95" | |
elif ( | |
(last_candle["RSI_3"] > 54.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 45.0) | |
and (last_candle["RSI_3_1d"] < 45.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_96" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 35.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_5_97" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["RSI_3_15m"] > 64.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["RSI_3_1d"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_98" | |
elif ( | |
(last_candle["RSI_3"] > 52.0) | |
and (last_candle["RSI_14"] < 60.0) | |
and (last_candle["RSI_3_1h"] < 65.0) | |
and (last_candle["RSI_3_4h"] < 60.0) | |
and (last_candle["AROONU_14_4h"] > 50.0) | |
and (last_candle["STOCHk_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_99" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["RSI_14"] > 68.0) | |
and (last_candle["RSI_3_15m"] > 70.0) | |
and (last_candle["RSI_3_4h"] < 80.0) | |
): | |
return True, f"exit_{mode_name}_d_5_100" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["WILLR_14"] > -24.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_101" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_102" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 64.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_4h"], np.float64) and (last_candle["ROC_9_4h"] > 80.0)) | |
): | |
return True, f"exit_{mode_name}_d_5_103" | |
elif ( | |
(last_candle["RSI_3"] > 56.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 60.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_5_104" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_15m"] < 55.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_5_105" | |
elif ( | |
(last_candle["RSI_3"] > 64.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["RSI_14_4h"] > 70.0) | |
and (last_candle["ROC_9_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_5_106" | |
elif ( | |
(last_candle["RSI_3"] > 66.0) | |
and (last_candle["RSI_14"] < 56.0) | |
and (last_candle["RSI_3_1h"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (last_candle["RSI_14_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_5_107" | |
elif 0.07 > current_profit >= 0.06: | |
if ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 78.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_1h"] < last_candle["KSTs_9_1h"]) | |
and (last_candle["KST_10_15_20_30_10_10_10_15_4h"] < last_candle["KSTs_9_4h"]) | |
): | |
return True, f"exit_{mode_name}_d_6_1" | |
elif ( | |
(last_candle["WILLR_14"] > -1.0) | |
and (last_candle["RSI_14"] > 62.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_2" | |
elif ( | |
(last_candle["WILLR_14"] > -15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 98.0) | |
and (last_candle["CMF_20_1h"] < -0.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and ( | |
(last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) and (last_candle["STOCHRSIk_14_14_3_3_change_pct_4h"] < -10.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_3" | |
elif ( | |
(last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_14"] > 68.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
and ( | |
isinstance(last_candle["EMA_200_1h"], np.float64) and (last_candle["EMA_12_1h"] < last_candle["EMA_200_1h"]) | |
) | |
and ( | |
isinstance(last_candle["EMA_200_4h"], np.float64) and (last_candle["EMA_12_4h"] < last_candle["EMA_200_4h"]) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_4" | |
elif ( | |
(last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_14"] > 66.0) | |
and (last_candle["ROC_9_1h"] < -5.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_6_5" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["RSI_14"] < 40.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_6" | |
elif ( | |
(last_candle["RSI_14"] < 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 70.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -40.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_7" | |
elif ( | |
(last_candle["WILLR_14"] > -8.0) | |
and (last_candle["STOCHRSIk_14_14_3_3"] > 95.0) | |
and (last_candle["CMF_20_1h"] < -0.1) | |
and (last_candle["CMF_20_4h"] < -0.1) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 15.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_8" | |
elif ( | |
(last_candle["WILLR_14"] > -7.0) | |
and (last_candle["RSI_3"] > 95.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_9" | |
elif ( | |
(last_candle["WILLR_14"] > -15.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_10" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 45.0) | |
and (last_candle["ROC_9_15m"] < -10.0) | |
and (last_candle["ROC_9_1h"] < -10.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -20.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_11" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_1h"] < -20.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_6_12" | |
elif (last_candle["RSI_3"] > 85.0) and (last_candle["RSI_3_4h"] < 5.0) and (last_candle["ROC_9_4h"] < -25.0): | |
return True, f"exit_{mode_name}_d_6_13" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 5.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_6_14" | |
elif (last_candle["RSI_3"] > 88.0) and (last_candle["RSI_14"] > 60.0) and (last_candle["ROC_9_4h"] < -30.0): | |
return True, f"exit_{mode_name}_d_6_15" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["AROONU_14_1d"] > 50.0) | |
and (last_candle["change_pct_1d"] < -15.0) | |
): | |
return True, f"exit_{mode_name}_d_6_16" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
and (last_candle["ROC_9_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_6_17" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] > 65.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["ROC_2_1d"] < -50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_18" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_14"] > 66.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_19" | |
elif ( | |
(last_candle["RSI_3"] > 44.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_6_20" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_6_21" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_22" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_1d"] < 5.0) | |
): | |
return True, f"exit_{mode_name}_d_6_23" | |
elif ( | |
(last_candle["RSI_3"] > 86.0) | |
and (last_candle["RSI_14"] > 66.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["AROONU_14_4h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_6_24" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_9_4h"] < -15.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_25" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_6_26" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_6_27" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_15m"] < 10.0) | |
and (last_candle["ROC_9_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_28" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_6_29" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_6_30" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_6_31" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_6_32" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["ROC_2_1h"] < -10.0) | |
and (last_candle["ROC_9_1h"] > 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_33" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_3_15m"] < 30.0) | |
and (last_candle["RSI_14_1h"] > 80.0) | |
and (last_candle["ROC_9_1h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_6_34" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["WILLR_14"] > -9.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 75.0) | |
): | |
return True, f"exit_{mode_name}_d_6_35" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["ROC_9_4h"] < -25.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_36" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_37" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_6_38" | |
elif ( | |
(last_candle["RSI_3"] > 92.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["CMF_20_4h"] < -0.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
): | |
return True, f"exit_{mode_name}_d_6_39" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["WILLR_14"] > -30.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_40" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 50.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_41" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -40.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 40.0)) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 70.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_42" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 40.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 90.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_43" | |
elif ( | |
(last_candle["RSI_3"] > 55.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_44" | |
elif (last_candle["RSI_3"] > 88.0) and (last_candle["WILLR_14"] > -12.0) and (last_candle["RSI_3_1h"] < 10.0): | |
return True, f"exit_{mode_name}_d_6_45" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_3_1h"] < 15.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["ROC_2_1d"] < -20.0) | |
): | |
return True, f"exit_{mode_name}_d_6_46" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -5.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_47" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_48" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["change_pct_1d"] < -5.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_49" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["RSI_3_1d"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 90.0) | |
): | |
return True, f"exit_{mode_name}_d_6_50" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_51" | |
elif ( | |
(last_candle["RSI_3"] > 74.0) | |
and (last_candle["RSI_14"] > 54.0) | |
and (last_candle["WILLR_14"] > -10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 70.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_52" | |
elif ( | |
(last_candle["RSI_3"] > 70.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and ( | |
isinstance(last_candle["STOCHRSIk_14_14_3_3_1d"], np.float64) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
) | |
): | |
return True, f"exit_{mode_name}_d_6_53" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 52.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
and (last_candle["ROC_9_4h"] < -10.0) | |
and (last_candle["change_pct_1d"] < -10.0) | |
): | |
return True, f"exit_{mode_name}_d_6_54" | |
elif ( | |
(last_candle["RSI_3"] > 88.0) | |
and (last_candle["WILLR_14"] > -20.0) | |
and (last_candle["ROC_9_4h"] < -5.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 10.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_55" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 10.0) | |
): | |
return True, f"exit_{mode_name}_d_6_56" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 42.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -30.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 70.0) | |
): | |
return True, f"exit_{mode_name}_d_6_57" | |
elif ( | |
(last_candle["RSI_3"] > 75.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_58" | |
elif ( | |
(last_candle["RSI_3"] > 85.0) | |
and (last_candle["WILLR_14"] > -18.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -15.0)) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 40.0) | |
): | |
return True, f"exit_{mode_name}_d_6_59" | |
elif ( | |
(last_candle["RSI_3"] > 65.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_14_4h"] > 65.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1d"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_60" | |
elif ( | |
(last_candle["RSI_3"] > 90.0) | |
and (last_candle["WILLR_14"] > -25.0) | |
and (last_candle["RSI_3_4h"] < 10.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_6_61" | |
elif ( | |
(last_candle["RSI_3"] > 80.0) | |
and (last_candle["WILLR_14"] > -8.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 20.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 20.0)) | |
and (last_candle["change_pct_1d"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_6_62" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_3_1d"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 80.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 30.0) | |
): | |
return True, f"exit_{mode_name}_d_6_63" | |
elif ( | |
(last_candle["RSI_3"] > 82.0) | |
and (last_candle["RSI_3_1h"] < 30.0) | |
and (last_candle["RSI_3_4h"] < 30.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] > 30.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_64" | |
elif ( | |
(last_candle["RSI_3"] > 62.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
): | |
return True, f"exit_{mode_name}_d_6_65" | |
elif ( | |
(last_candle["RSI_3"] > 76.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 50.0) | |
): | |
return True, f"exit_{mode_name}_d_6_66" | |
elif ( | |
(last_candle["RSI_3"] > 50.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 80.0) | |
and (isinstance(last_candle["ROC_9_1d"], np.float64) and (last_candle["ROC_9_1d"] < -25.0)) | |
): | |
return True, f"exit_{mode_name}_d_6_67" | |
elif ( | |
(last_candle["RSI_3"] > 78.0) | |
and (last_candle["RSI_14"] < 54.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["ROC_2_4h"] < -30.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_6_68" | |
elif ( | |
(last_candle["RSI_3"] > 93.0) | |
and (last_candle["ROC_9_4h"] > 20.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 50.0) | |
and (last_candle["change_pct_4h"] < -5.0) | |
): | |
return True, f"exit_{mode_name}_d_6_69" | |
elif ( | |
(last_candle["RSI_3"] > 60.0) | |
and (last_candle["RSI_14"] < 46.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_4h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_6_70" | |
elif ( | |
(last_candle["RSI_3"] > 58.0) | |
and (last_candle["RSI_14"] < 50.0) | |
and (last_candle["RSI_3_4h"] < 25.0) | |
and (last_candle["STOCHRSIk_14_14_3_3_1h"] > 20.0) | |
): | |
return True, f"exit_{mode_name}_d_6_71" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_14"] < 48.0) | |
and (last_candle["RSI_3_1h"] < 10.0) | |
and (last_candle["AROONU_14_4h"] > 25.0) | |
): | |
return True, f"exit_{mode_name}_d_6_72" | |
elif ( | |
(last_candle["RSI_3"] > 72.0) | |
and (last_candle["RSI_3_1h"] < 25.0) | |
and (last_candle["RSI_3_4h"] < 15.0) | |
and (last_candle["ROC_9_4h"] < -20.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment