|
18 | 18 | ) |
19 | 19 |
|
20 | 20 |
|
21 | | -# Test 0: Sell with signal sell in candle 3 |
| 21 | +# Test 0: exit with exit signal in candle 3 |
22 | 22 | # Test with Stop-loss at 1% |
23 | 23 | tc0 = BTContainer( |
24 | 24 | data=[ |
|
279 | 279 | trades=[BTrade(exit_reason=ExitType.TRAILING_STOP_LOSS, open_tick=1, close_tick=2)], |
280 | 280 | ) |
281 | 281 |
|
282 | | -# Test 13: Buy and sell ROI on same candle |
| 282 | +# Test 13: Enter and exit ROI on same candle |
283 | 283 | # stop-loss: 10% (should not apply), ROI: 1% |
284 | 284 | tc13 = BTContainer( |
285 | 285 | data=[ |
|
296 | 296 | trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=1)], |
297 | 297 | ) |
298 | 298 |
|
299 | | -# Test 14 - Buy and Stoploss on same candle |
| 299 | +# Test 14 - Enter and Stoploss on same candle |
300 | 300 | # stop-loss: 5%, ROI: 10% (should not apply) |
301 | 301 | tc14 = BTContainer( |
302 | 302 | data=[ |
|
314 | 314 | ) |
315 | 315 |
|
316 | 316 |
|
317 | | -# Test 15 - Buy and ROI on same candle, followed by buy and Stoploss on next candle |
| 317 | +# Test 15 - Enter and ROI on same candle, followed by entry and Stoploss on next candle |
318 | 318 | # stop-loss: 5%, ROI: 10% (should not apply) |
319 | 319 | tc15 = BTContainer( |
320 | 320 | data=[ |
|
334 | 334 | ], |
335 | 335 | ) |
336 | 336 |
|
337 | | -# Test 16: Buy, hold for 65 min, then forceexit using roi=-1 |
338 | | -# Causes negative profit even though sell-reason is ROI. |
| 337 | +# Test 16: Enter, hold for 65 min, then forceexit using roi=-1 |
| 338 | +# Causes negative profit even though exit-reason is ROI. |
339 | 339 | # stop-loss: 10%, ROI: 10% (should not apply), -100% after 65 minutes (limits trade duration) |
340 | 340 | tc16 = BTContainer( |
341 | 341 | data=[ |
|
353 | 353 | trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)], |
354 | 354 | ) |
355 | 355 |
|
356 | | -# Test 17: Buy, hold for 120 mins, then forceexit using roi=-1 |
357 | | -# Causes negative profit even though sell-reason is ROI. |
| 356 | +# Test 17: Enter, hold for 120 mins, then forceexit using roi=-1 |
| 357 | +# Causes negative profit even though exit-reason is ROI. |
358 | 358 | # stop-loss: 10%, ROI: 10% (should not apply), -100% after 100 minutes (limits trade duration) |
359 | | -# Uses open as sell-rate (special case) - since the roi-time is a multiple of the timeframe. |
| 359 | +# Uses open as exit-rate (special case) - since the roi-time is a multiple of the timeframe. |
360 | 360 | tc17 = BTContainer( |
361 | 361 | data=[ |
362 | 362 | # D O H L C V EL XL ES Xs BT |
|
374 | 374 | ) |
375 | 375 |
|
376 | 376 |
|
377 | | -# Test 18: Buy, hold for 120 mins, then drop ROI to 1%, causing a sell in candle 3. |
| 377 | +# Test 18: Enter, hold for 120 mins, then drop ROI to 1%, causing an exit in candle 3. |
378 | 378 | # stop-loss: 10%, ROI: 10% (should not apply), -100% after 100 minutes (limits trade duration) |
379 | | -# uses open_rate as sell-price |
| 379 | +# uses open_rate as exit price |
380 | 380 | tc18 = BTContainer( |
381 | 381 | data=[ |
382 | 382 | # D O H L C V EL XL ES Xs BT |
383 | 383 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
384 | 384 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], |
385 | 385 | [2, 4987, 5300, 4950, 5200, 6172, 0, 0], |
386 | | - [3, 5200, 5220, 4940, 4962, 6172, 0, 0], # Sell on ROI (sells on open) |
| 386 | + [3, 5200, 5220, 4940, 4962, 6172, 0, 0], # Exit on ROI (exits on open) |
387 | 387 | [4, 4962, 4987, 4950, 4950, 6172, 0, 0], |
388 | 388 | [5, 4950, 4975, 4925, 4950, 6172, 0, 0], |
389 | 389 | ], |
|
393 | 393 | trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)], |
394 | 394 | ) |
395 | 395 |
|
396 | | -# Test 19: Buy, hold for 119 mins, then drop ROI to 1%, causing a sell in candle 3. |
| 396 | +# Test 19: Enter, hold for 119 mins, then drop ROI to 1%, causing an exit in candle 3. |
397 | 397 | # stop-loss: 10%, ROI: 10% (should not apply), -100% after 100 minutes (limits trade duration) |
398 | | -# uses calculated ROI (1%) as sell rate, otherwise identical to tc18 |
| 398 | +# uses calculated ROI (1%) as exit rate, otherwise identical to tc18 |
399 | 399 | tc19 = BTContainer( |
400 | 400 | data=[ |
401 | 401 | # D O H L C V EL XL ES Xs BT |
402 | 402 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
403 | 403 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], |
404 | 404 | [2, 4987, 5300, 4950, 5200, 6172, 0, 0], |
405 | | - [3, 5000, 5300, 4940, 4962, 6172, 0, 0], # Sell on ROI |
| 405 | + [3, 5000, 5300, 4940, 4962, 6172, 0, 0], # Exit on ROI |
406 | 406 | [4, 4962, 4987, 4950, 4950, 6172, 0, 0], |
407 | 407 | [5, 4550, 4975, 4550, 4950, 6172, 0, 0], |
408 | 408 | ], |
|
412 | 412 | trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)], |
413 | 413 | ) |
414 | 414 |
|
415 | | -# Test 20: Buy, hold for 119 mins, then drop ROI to 1%, causing a sell in candle 3. |
| 415 | +# Test 20: Enter, hold for 119 mins, then drop ROI to 1%, causing an exit in candle 3. |
416 | 416 | # stop-loss: 10%, ROI: 10% (should not apply), -100% after 100 minutes (limits trade duration) |
417 | | -# uses calculated ROI (1%) as sell rate, otherwise identical to tc18 |
| 417 | +# uses calculated ROI (1%) as exit rate, otherwise identical to tc18 |
418 | 418 | tc20 = BTContainer( |
419 | 419 | data=[ |
420 | 420 | # D O H L C V EL XL ES Xs BT |
421 | 421 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
422 | 422 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], |
423 | 423 | [2, 4987, 5300, 4950, 5200, 6172, 0, 0], |
424 | | - [3, 5200, 5300, 4940, 4962, 6172, 0, 0], # Sell on ROI |
| 424 | + [3, 5200, 5300, 4940, 4962, 6172, 0, 0], # Exit on ROI |
425 | 425 | [4, 4962, 4987, 4950, 4950, 6172, 0, 0], |
426 | 426 | [5, 4925, 4975, 4925, 4950, 6172, 0, 0], |
427 | 427 | ], |
|
434 | 434 | # Test 21: trailing_stop ROI collision. |
435 | 435 | # Roi should trigger before Trailing stop - otherwise Trailing stop profits can be > ROI |
436 | 436 | # which cannot happen in reality |
437 | | -# stop-loss: 10%, ROI: 4%, Trailing stop adjusted at the sell candle |
| 437 | +# stop-loss: 10%, ROI: 4%, Trailing stop adjusted at the exit candle |
438 | 438 | tc21 = BTContainer( |
439 | 439 | data=[ |
440 | 440 | # D O H L C V EL XL ES Xs BT |
|
501 | 501 |
|
502 | 502 | # Test 24: trailing_stop Raises in candle 2 (does not trigger) |
503 | 503 | # applying a positive trailing stop of 3% since stop_positive_offset is reached. |
504 | | -# ROI is changed after this to 4%, dropping ROI below trailing_stop_positive, causing a sell |
| 504 | +# ROI is changed after this to 4%, dropping ROI below trailing_stop_positive, causing an exit |
505 | 505 | # in the candle after the raised stoploss candle with ROI reason. |
506 | 506 | # Stoploss would trigger in this candle too, but it's no longer relevant. |
507 | | -# stop-loss: 10%, ROI: 4%, stoploss adjusted candle 2, ROI adjusted in candle 3 (causing the sell) |
| 507 | +# stop-loss: 10%, ROI: 4%, stoploss adjusted candle 2, ROI adjusted in candle 3 (causing the exit) |
508 | 508 | tc24 = BTContainer( |
509 | 509 | data=[ |
510 | 510 | # D O H L C V EL XL ES Xs BT |
|
524 | 524 | trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)], |
525 | 525 | ) |
526 | 526 |
|
527 | | -# Test 25: Sell with signal sell in candle 3 (stoploss also triggers on this candle) |
| 527 | +# Test 25: Exit with exit signal in candle 3 (stoploss also triggers on this candle) |
528 | 528 | # Stoploss at 1%. |
529 | | -# Stoploss wins over Sell-signal (because sell-signal is acted on in the next candle) |
| 529 | +# Stoploss wins over exit-signal (because exit-signal is acted on in the next candle) |
530 | 530 | tc25 = BTContainer( |
531 | 531 | data=[ |
532 | 532 | # D O H L C V EL XL ES Xs BT |
533 | 533 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
534 | 534 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], # enter trade (signal on last candle) |
535 | 535 | [2, 4987, 5012, 4986, 4986, 6172, 0, 0], |
536 | | - [3, 5010, 5010, 4855, 5010, 6172, 0, 1], # Triggers stoploss + sellsignal |
| 536 | + [3, 5010, 5010, 4855, 5010, 6172, 0, 1], # Triggers stoploss + exit-signal |
537 | 537 | [4, 5010, 5010, 4977, 4995, 6172, 0, 0], |
538 | 538 | [5, 4995, 4995, 4950, 4950, 6172, 0, 0], |
539 | 539 | ], |
|
544 | 544 | trades=[BTrade(exit_reason=ExitType.STOP_LOSS, open_tick=1, close_tick=3)], |
545 | 545 | ) |
546 | 546 |
|
547 | | -# Test 26: Sell with signal sell in candle 3 (stoploss also triggers on this candle) |
| 547 | +# Test 26: Exit with exit signal in candle 3 (stoploss also triggers on this candle) |
548 | 548 | # Stoploss at 1%. |
549 | | -# Sell-signal wins over stoploss |
| 549 | +# Exit-signal wins over stoploss |
550 | 550 | tc26 = BTContainer( |
551 | 551 | data=[ |
552 | 552 | # D O H L C V EL XL ES Xs BT |
553 | 553 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
554 | 554 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], # enter trade (signal on last candle) |
555 | 555 | [2, 4987, 5012, 4986, 4986, 6172, 0, 0], |
556 | 556 | [3, 5010, 5010, 4986, 5010, 6172, 0, 1], |
557 | | - [4, 5010, 5010, 4855, 4995, 6172, 0, 0], # Triggers stoploss + sellsignal acted on |
| 557 | + [4, 5010, 5010, 4855, 4995, 6172, 0, 0], # Triggers stoploss + exit-signal acted on |
558 | 558 | [5, 4995, 4995, 4950, 4950, 6172, 0, 0], |
559 | 559 | ], |
560 | 560 | stop_loss=-0.01, |
|
565 | 565 | ) |
566 | 566 |
|
567 | 567 | # Test 27: (copy of test26 with leverage) |
568 | | -# Sell with signal sell in candle 3 (stoploss also triggers on this candle) |
| 568 | +# Exit with exit signal in candle 3 (stoploss also triggers on this candle) |
569 | 569 | # Stoploss at 1%. |
570 | | -# Sell-signal wins over stoploss |
| 570 | +# exit-signal wins over stoploss |
571 | 571 | tc27 = BTContainer( |
572 | 572 | data=[ |
573 | 573 | # D O H L C V EL XL ES Xs BT |
574 | 574 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
575 | 575 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], # enter trade (signal on last candle) |
576 | 576 | [2, 4987, 5012, 4986, 4986, 6172, 0, 0], |
577 | 577 | [3, 5010, 5010, 4986, 5010, 6172, 0, 1], |
578 | | - [4, 5010, 5010, 4855, 4995, 6172, 0, 0], # Triggers stoploss + sellsignal acted on |
| 578 | + [4, 5010, 5010, 4855, 4995, 6172, 0, 0], # Triggers stoploss + exit-signal acted on |
579 | 579 | [5, 4995, 4995, 4950, 4950, 6172, 0, 0], |
580 | 580 | ], |
581 | 581 | stop_loss=-0.05, |
|
587 | 587 | ) |
588 | 588 |
|
589 | 589 | # Test 28: (copy of test26 with leverage and as short) |
590 | | -# Sell with signal sell in candle 3 (stoploss also triggers on this candle) |
| 590 | +# Exit with exit signal in candle 3 (stoploss also triggers on this candle) |
591 | 591 | # Stoploss at 1%. |
592 | | -# Sell-signal wins over stoploss |
| 592 | +# Exit-signal wins over stoploss |
593 | 593 | tc28 = BTContainer( |
594 | 594 | data=[ |
595 | 595 | # D O H L C V EL XL ES Xs BT |
596 | 596 | [0, 5000, 5025, 4975, 4987, 6172, 0, 0, 1, 0], |
597 | 597 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0, 0, 0], # enter trade (signal on last candle) |
598 | 598 | [2, 4987, 5012, 4986, 4986, 6172, 0, 0, 0, 0], |
599 | 599 | [3, 5010, 5010, 4986, 5010, 6172, 0, 0, 0, 1], |
600 | | - [4, 4990, 5010, 4855, 4995, 6172, 0, 0, 0, 0], # Triggers stoploss + sellsignal acted on |
| 600 | + [4, 4990, 5010, 4855, 4995, 6172, 0, 0, 0, 0], # Triggers stoploss + exit-signal acted on |
601 | 601 | [5, 4995, 4995, 4950, 4950, 6172, 0, 0, 0, 0], |
602 | 602 | ], |
603 | 603 | stop_loss=-0.05, |
|
607 | 607 | leverage=5.0, |
608 | 608 | trades=[BTrade(exit_reason=ExitType.EXIT_SIGNAL, open_tick=1, close_tick=4, is_short=True)], |
609 | 609 | ) |
610 | | -# Test 29: Sell with signal sell in candle 3 (ROI at signal candle) |
| 610 | +# Test 29: Exit with exit signal in candle 3 (ROI at signal candle) |
611 | 611 | # Stoploss at 10% (irrelevant), ROI at 5% (will trigger) |
612 | | -# Sell-signal wins over stoploss |
| 612 | +# Exit-signal wins over stoploss |
613 | 613 | tc29 = BTContainer( |
614 | 614 | data=[ |
615 | 615 | # D O H L C V EL XL ES Xs BT |
616 | 616 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
617 | 617 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], # enter trade (signal on last candle) |
618 | 618 | [2, 4987, 5012, 4986, 4986, 6172, 0, 0], |
619 | | - [3, 5010, 5251, 4986, 5010, 6172, 0, 1], # Triggers ROI, sell-signal |
| 619 | + [3, 5010, 5251, 4986, 5010, 6172, 0, 1], # Triggers ROI, exit-signal |
620 | 620 | [4, 5010, 5010, 4855, 4995, 6172, 0, 0], |
621 | 621 | [5, 4995, 4995, 4950, 4950, 6172, 0, 0], |
622 | 622 | ], |
|
627 | 627 | trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)], |
628 | 628 | ) |
629 | 629 |
|
630 | | -# Test 30: Sell with signal sell in candle 3 (ROI at signal candle) |
631 | | -# Stoploss at 10% (irrelevant), ROI at 5% (will trigger) - Wins over Sell-signal |
| 630 | +# Test 30: Exit with exit signal in candle 3 (ROI at signal candle) |
| 631 | +# Stoploss at 10% (irrelevant), ROI at 5% (will trigger) - Wins over exit-signal |
632 | 632 | tc30 = BTContainer( |
633 | 633 | data=[ |
634 | 634 | # D O H L C V EL XL ES Xs BT |
635 | 635 | [0, 5000, 5025, 4975, 4987, 6172, 1, 0], |
636 | 636 | [1, 5000, 5025, 4975, 4987, 6172, 0, 0], # enter trade (signal on last candle) |
637 | 637 | [2, 4987, 5012, 4986, 4986, 6172, 0, 0], |
638 | | - [3, 5010, 5012, 4986, 5010, 6172, 0, 1], # sell-signal |
639 | | - [4, 5010, 5251, 4855, 4995, 6172, 0, 0], # Triggers ROI, sell-signal acted on |
| 638 | + [3, 5010, 5012, 4986, 5010, 6172, 0, 1], # exit-signal |
| 639 | + [4, 5010, 5251, 4855, 4995, 6172, 0, 0], # Triggers ROI, exit-signal acted on |
640 | 640 | [5, 4995, 4995, 4950, 4950, 6172, 0, 0], |
641 | 641 | ], |
642 | 642 | stop_loss=-0.10, |
|
888 | 888 |
|
889 | 889 | # Test 42: Custom-entry-price around candle low |
890 | 890 | # Would cause immediate ROI exit, but since the trade was entered |
891 | | -# below open, we treat this as cheating, and delay the sell by 1 candle. |
| 891 | +# below open, we treat this as cheating, and delay the exit by 1 candle. |
892 | 892 | # details: https://github.com/freqtrade/freqtrade/issues/6261 |
893 | 893 | tc42 = BTContainer( |
894 | 894 | data=[ |
|
945 | 945 | ) |
946 | 946 |
|
947 | 947 | # Test 45: Custom exit price above all candles |
948 | | -# causes sell signal timeout |
| 948 | +# causes exit signal timeout |
949 | 949 | tc45 = BTContainer( |
950 | 950 | data=[ |
951 | 951 | # D O H L C V EL XL ES Xs BT |
|
964 | 964 | ) |
965 | 965 |
|
966 | 966 | # Test 46: (Short of tc45) Custom short exit price above below candles |
967 | | -# causes sell signal timeout |
| 967 | +# causes exit signal timeout |
968 | 968 | tc46 = BTContainer( |
969 | 969 | data=[ |
970 | 970 | # D O H L C V EL XL ES Xs BT |
|
0 commit comments