Example #1
0
    data=[
        # D  O     H     L     C     V    B  S
        [0, 5000, 5025, 4975, 4987, 6172, 1, 0],
        [1, 5000, 5025, 4975, 4987, 6172, 0,
         0],  # enter trade (signal on last candle)
        [2, 4987, 5012, 4986, 4600, 6172, 0, 0],  # exit with stoploss hit
        [3, 5010, 5000, 4980, 5010, 6172, 0, 1],
        [4, 5010, 4987, 4977, 4995, 6172, 0, 0],
        [5, 4995, 4995, 4995, 4950, 6172, 0, 0]
    ],
    stop_loss=-0.01,
    roi=1,
    profit_perc=0.002,
    use_sell_signal=True,
    trades=[
        BTrade(sell_reason=SellType.SELL_SIGNAL, open_tick=1, close_tick=4)
    ])

# Test 1: Stop-Loss Triggered 1% loss
# Test with Stop-loss at 1%
tc1 = BTContainer(
    data=[
        # D  O     H     L     C     V    B  S
        [0, 5000, 5025, 4975, 4987, 6172, 1, 0],
        [1, 5000, 5025, 4975, 4987, 6172, 0,
         0],  # enter trade (signal on last candle)
        [2, 4987, 5012, 4600, 4600, 6172, 0, 0],  # exit with stoploss hit
        [3, 4975, 5000, 4980, 4977, 6172, 0, 0],
        [4, 4977, 4987, 4977, 4995, 6172, 0, 0],
        [5, 4995, 4995, 4995, 4950, 6172, 0, 0]
    ],
Example #2
0
    data=[
        # D  O     H     L     C     V    B  S
        [0, 5000, 5025, 4975, 4987, 6172, 1, 0],
        [1, 5000, 5025, 4975, 4987, 6172, 0,
         1],  # enter trade (signal on last candle)
        [2, 5000, 5025, 4975, 4987, 6172, 0, 0],  # exit at open
        [3, 5000, 5025, 4975, 4987, 6172, 1, 0],  # no action
        [4, 5000, 5025, 4975, 4987, 6172, 0, 0],  # should enter the trade
        [5, 5000, 5025, 4975, 4987, 6172, 0, 1],  # no action
        [6, 5000, 5025, 4975, 4987, 6172, 0, 0],  # should sell
    ],
    stop_loss=-0.99,
    roi=float('inf'),
    profit_perc=0.00,
    trades=[
        BTrade(sell_reason=SellType.SELL_SIGNAL, open_tick=1, close_tick=2),
        BTrade(sell_reason=SellType.SELL_SIGNAL, open_tick=4, close_tick=6)
    ])

# 3) Entered, sl 1%, candle drops 8% => Trade closed, 1% loss
tc2 = BTContainer(
    data=[
        # D  O     H     L     C     V    B  S
        [0, 5000, 5025, 4975, 4987, 6172, 1, 0],
        [1, 5000, 5025, 4600, 4987, 6172, 0, 0],  # enter trade, stoploss hit
        [2, 5000, 5025, 4975, 4987, 6172, 0, 0],
    ],
    stop_loss=-0.01,
    roi=float('inf'),
    profit_perc=-0.01,
    trades=[BTrade(sell_reason=SellType.STOP_LOSS, open_tick=1, close_tick=1)])
Example #3
0
# TC1: Stop-Loss Triggered 1% loss
tc0 = BTContainer(
    data=[
        # D  O     H     L     C     V    B  S
        [0, 5000, 5025, 4975, 4987, 6172, 1, 0],
        [1, 5000, 5025, 4975, 4987, 6172, 0,
         0],  # enter trade (signal on last candle)
        [2, 4987, 5012, 4600, 4600, 6172, 0, 0],  # exit with stoploss hit
        [3, 4975, 5000, 4980, 4977, 6172, 0, 0],
        [4, 4977, 4987, 4977, 4995, 6172, 0, 0],
        [5, 4995, 4995, 4995, 4950, 6172, 0, 0]
    ],
    stop_loss=-0.01,
    roi=1,
    profit_perc=-0.01,
    trades=[BTrade(sell_reason=SellType.STOP_LOSS, open_tick=1, close_tick=2)])

# Test 1 Minus 4% Low, minus 1% close
# Test with Stop-Loss at 3%
# TC2: Stop-Loss Triggered 3% Loss
tc1 = BTContainer(
    data=[
        # D  O     H     L     C     V    B  S
        [0, 5000, 5025, 4975, 4987, 6172, 1, 0],
        [1, 5000, 5025, 4975, 4987, 6172, 0,
         0],  # enter trade (signal on last candle)
        [2, 4987, 5012, 4962, 4975, 6172, 0, 0],
        [3, 4975, 5000, 4800, 4962, 6172, 0, 0],  # exit with stoploss hit
        [4, 4962, 4987, 4937, 4950, 6172, 0, 0],
        [5, 4950, 4975, 4925, 4950, 6172, 0, 0]
    ],