dragon_glued_followthrough_exit.py 962 B

1234567891011121314151617181920212223242526272829303132
  1. from __future__ import annotations
  2. from dragon_strategy_config import StrategyConfig
  3. def should_hold_glued_followthrough_reentry_kdj_only(
  4. *,
  5. enabled: bool,
  6. entry_reason_code: str,
  7. kdj_sell: bool,
  8. ql_sell: bool,
  9. holding_days: int,
  10. a1: float,
  11. b1: float,
  12. c1: float,
  13. config: StrategyConfig,
  14. ) -> bool:
  15. if not enabled:
  16. return False
  17. if entry_reason_code != "entry_glued_followthrough_reentry":
  18. return False
  19. if not kdj_sell or ql_sell:
  20. return False
  21. if holding_days > config.glued_followthrough_exit_hold_kdj_only_days_max:
  22. return False
  23. if not (config.glued_followthrough_exit_hold_kdj_only_c1_low < c1 < config.glued_followthrough_exit_hold_kdj_only_c1_high):
  24. return False
  25. if a1 <= config.glued_followthrough_exit_hold_kdj_only_a1_min:
  26. return False
  27. if b1 <= config.glued_followthrough_exit_hold_kdj_only_b1_min:
  28. return False
  29. return True