From 08587d826e70482ca23379c11d8946e5e6dccd7b Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 20 Feb 2025 20:07:44 +0100 Subject: [PATCH] test: Long adjust-exit-price test --- tests/optimize/test_backtest_detail.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/optimize/test_backtest_detail.py b/tests/optimize/test_backtest_detail.py index 8918f3b9d..736c4dcab 100644 --- a/tests/optimize/test_backtest_detail.py +++ b/tests/optimize/test_backtest_detail.py @@ -1237,6 +1237,26 @@ tc58 = BTContainer( trades=[BTrade(exit_reason=ExitType.EXIT_SIGNAL, open_tick=1, close_tick=4, is_short=True)], ) +# Test 59: Custom-exit-price above all candles - readjust order +tc59 = BTContainer( + data=[ + # D O H L C V EL XL ES Xs BT + [0, 5000, 5050, 4950, 5000, 6172, 1, 0], + [1, 5000, 5500, 4951, 5000, 6172, 0, 0], + [2, 4900, 5250, 4500, 5100, 6172, 0, 1], # exit + [3, 5100, 5100, 4650, 4750, 6172, 0, 0], # order readjust + [4, 4750, 4950, 4350, 4750, 6172, 0, 0], + ], + stop_loss=-0.2, + roi={"0": 0.10}, + profit_perc=-0.02, + use_exit_signal=True, + timeout=1000, + custom_exit_price=5300, + adjust_exit_price=4900, + trades=[BTrade(exit_reason=ExitType.EXIT_SIGNAL, open_tick=1, close_tick=4, is_short=False)], +) + TESTS = [ tc0, @@ -1298,6 +1318,7 @@ TESTS = [ tc56, tc57, tc58, + tc59, ]