Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. hakankaan
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    H
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    hakankaan

    @hakankaan

    0
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    hakankaan Unfollow Follow

    Latest posts made by hakankaan

    • Brackets are executing at different price

      In the results you will see the problem. Here are my codes and result examples.

      every time pre_load consume time :2.123161554336548
      date: 2021-03-25
      price 50557.69458913322
      takeprofit: 53085.57931858989
      stoploss: 48029.809859676556
      
      501
      2021-03-25, BUY EXECUTED, Price: 50557.69, Cost: 80000.00, Comm 80.00, Bar 501.00
      2021-03-26, SELL EXECUTED, Price: 53085.58, Cost: 80000.00, Comm 84.00, Bar 501.00
      2021-03-26, Order Canceled/Margin/Rejected
      #######2021-03-26 BTCUSDTTF2 price 50557.69 Closed: PnL Gross 4000.0, Net 3836.0#######
      
      date: 2021-04-17
      price 56047.47360016612
      takeprofit: 58849.84728017443
      stoploss: 53245.099920157816
      
      642
      2021-04-18, BUY EXECUTED, Price: 56047.47, Cost: 83068.80, Comm 83.07, Bar 642.00
      2021-04-18, SELL EXECUTED, Price: 53245.10, Cost: 83068.80, Comm 78.92, Bar 642.00
      2021-04-18, Order Canceled/Margin/Rejected
      #######2021-04-18 BTCUSDTTF2 price 56047.47 Closed: PnL Gross -4153.44, Net -4315.42#######
      
      date: 2021-04-18
      price 56049.13806918237
      takeprofit: 58851.59497264149
      stoploss: 53246.681165723254
      
      643
      2021-04-18, BUY EXECUTED, Price: 56049.14, Cost: 79616.46, Comm 79.62, Bar 643.00
      2021-04-18, SELL EXECUTED, Price: 53246.68, Cost: 79616.46, Comm 75.64, Bar 643.00
      2021-04-18, Order Canceled/Margin/Rejected
      #######2021-04-18 BTCUSDTTF2 price 56049.14 Closed: PnL Gross -3980.82, Net -4136.08#######
      
      date: 2021-04-18
      price 56056.961502129896
      takeprofit: 58859.809577236396
      stoploss: 53254.113427023396
      
      644
      2021-04-18, BUY EXECUTED, Price: 55000.01, Cost: 74868.82, Comm 74.87, Bar 644.00
      2021-04-18, SELL EXECUTED, Price: 53254.11, Cost: 74868.82, Comm 72.49, Bar 644.00
      2021-04-18, Order Canceled/Margin/Rejected
      #######2021-04-18 BTCUSDTTF2 price 55000.01 Closed: PnL Gross -2376.6, Net -2523.96#######
      
      date: 2021-04-18
      price 56079.02556398865
      takeprofit: 58882.97684218809
      stoploss: 53275.07428578922
      
      648
      2021-04-18, BUY EXECUTED, Price: 55720.66, Cost: 73813.70, Comm 73.81, Bar 648.00
      2021-04-22, SELL EXECUTED, Price: 53275.07, Cost: 73813.70, Comm 70.57, Bar 648.00
      2021-04-22, Order Canceled/Margin/Rejected
      #######2021-04-22 BTCUSDTTF2 price 55720.66 Closed: PnL Gross -3239.69, Net -3384.08#######
      
      date: 2021-04-27
      price 55334.898813251966
      takeprofit: 58101.64375391457
      stoploss: 52568.15387258936
      
      701
      2021-04-27, BUY EXECUTED, Price: 54981.86, Cost: 71124.48, Comm 71.12, Bar 701.00
      2021-04-29, SELL EXECUTED, Price: 52568.15, Cost: 71124.48, Comm 68.00, Bar 701.00
      2021-04-29, Order Canceled/Margin/Rejected
      #######2021-04-29 BTCUSDTTF2 price 54981.86 Closed: PnL Gross -3122.37, Net -3261.49#######
      
      date: 2021-05-03
      price 55956.12936976721
      takeprofit: 58753.93583825557
      stoploss: 53158.32290127884
      
      738
      2021-05-04, BUY EXECUTED, Price: 55956.13, Cost: 68971.97, Comm 68.97, Bar 738.00
      2021-05-04, SELL EXECUTED, Price: 53158.32, Cost: 68971.97, Comm 65.52, Bar 738.00
      2021-05-04, Order Canceled/Margin/Rejected
      #######2021-05-04 BTCUSDTTF2 price 55956.13 Closed: PnL Gross -3448.6, Net -3583.09#######
      
      date: 2021-05-05
      price 55993.48594642696
      takeprofit: 58793.16024374831
      stoploss: 53193.81164910561
      
      747
      2021-05-05, BUY EXECUTED, Price: 54858.35, Cost: 64765.36, Comm 64.77, Bar 747.00
      2021-05-08, SELL EXECUTED, Price: 58793.16, Cost: 64765.36, Comm 69.41, Bar 747.00
      2021-05-08, Order Canceled/Margin/Rejected
      #######2021-05-08 BTCUSDTTF2 price 54858.35 Closed: PnL Gross 4645.41, Net 4511.23#######
      
      date: 2021-05-09
      price 56236.06174008065
      takeprofit: 59047.86482708469
      stoploss: 53424.25865307661
      
      771
      2021-05-09, BUY EXECUTED, Price: 56236.06, Cost: 69714.48, Comm 69.71, Bar 771.00
      2021-05-10, SELL EXECUTED, Price: 59047.86, Cost: 69714.48, Comm 73.20, Bar 771.00
      2021-05-10, Order Canceled/Margin/Rejected
      #######2021-05-10 BTCUSDTTF2 price 56236.06 Closed: PnL Gross 3485.72, Net 3342.81#######
      
      date: 2021-05-10
      price 56262.81097297412
      takeprofit: 59075.951521622825
      stoploss: 53449.67042432541
      
      778
      2021-05-10, BUY EXECUTED, Price: 56262.81, Cost: 72388.73, Comm 72.39, Bar 778.00
      2021-05-10, SELL EXECUTED, Price: 53449.67, Cost: 72388.73, Comm 68.77, Bar 778.00
      2021-05-10, Order Canceled/Margin/Rejected
      #######2021-05-10 BTCUSDTTF2 price 56262.81 Closed: PnL Gross -3619.44, Net -3760.59#######
      
      date: 2021-05-10
      price 56266.91049510851
      takeprofit: 59080.25601986394
      stoploss: 53453.56497035308
      
      780
      2021-05-10, BUY EXECUTED, Price: 55733.76, Cost: 68722.85, Comm 68.72, Bar 780.00
      2021-05-11, SELL EXECUTED, Price: 53453.56, Cost: 68722.85, Comm 65.91, Bar 780.00
      2021-05-11, Order Canceled/Margin/Rejected
      #######2021-05-11 BTCUSDTTF2 price 55733.76 Closed: PnL Gross -2811.61, Net -2946.24#######
      
      date: 2021-05-11
      price 56274.56630029635
      takeprofit: 59088.29461531117
      stoploss: 53460.83798528153
      
      784
      2021-05-11, BUY EXECUTED, Price: 55210.47, Cost: 65755.92, Comm 65.76, Bar 784.00
      2021-05-12, SELL EXECUTED, Price: 53460.84, Cost: 65755.92, Comm 63.67, Bar 784.00
      2021-05-12, Order Canceled/Margin/Rejected
      #######2021-05-12 BTCUSDTTF2 price 55210.47 Closed: PnL Gross -2083.82, Net -2213.25#######
      
      date: 2021-05-31
      price 48309.38748860005
      takeprofit: 50724.85686303005
      stoploss: 45893.91811417005
      
      903
      2021-05-31, BUY EXECUTED, Price: 35850.17, Cost: 48423.69, Comm 48.42, Bar 903.00
      2021-05-31, SELL EXECUTED, Price: 35850.17, Cost: 48423.69, Comm 48.42, Bar 903.00
      2021-05-31, Order Canceled/Margin/Rejected
      #######2021-05-31 BTCUSDTTF2 price 35850.17 Closed: PnL Gross 0.0, Net -96.85#######
      
      date: 2021-05-31
      price 48304.230663942246
      takeprofit: 50719.44219713936
      stoploss: 45889.01913074513
      
      904
      2021-05-31, BUY EXECUTED, Price: 36836.46, Cost: 49702.13, Comm 49.70, Bar 904.00
      2021-05-31, SELL EXECUTED, Price: 36836.46, Cost: 49702.13, Comm 49.70, Bar 904.00
      2021-05-31, Order Canceled/Margin/Rejected
      #######2021-05-31 BTCUSDTTF2 price 36836.46 Closed: PnL Gross 0.0, Net -99.4#######
      
      date: 2021-05-31
      price 48294.75301333754
      takeprofit: 50709.49066400442
      stoploss: 45880.01536267066
      
      905
      2021-05-31, BUY EXECUTED, Price: 36961.16, Cost: 49819.31, Comm 49.82, Bar 905.00
      2021-05-31, SELL EXECUTED, Price: 36961.16, Cost: 49819.31, Comm 49.82, Bar 905.00
      2021-05-31, Order Canceled/Margin/Rejected
      #######2021-05-31 BTCUSDTTF2 price 36961.16 Closed: PnL Gross 0.0, Net -99.64#######
      
      date: 2021-05-31
      price 48281.637467536864
      takeprofit: 50695.71934091371
      stoploss: 45867.55559416002
      
      906
      2021-05-31, BUY EXECUTED, Price: 36865.75, Cost: 49643.34, Comm 49.64, Bar 906.00
      2021-06-01, SELL EXECUTED, Price: 36865.75, Cost: 49643.34, Comm 49.64, Bar 906.00
      2021-06-01, Order Canceled/Margin/Rejected
      #######2021-06-01 BTCUSDTTF2 price 36865.75 Closed: PnL Gross 0.0, Net -99.29#######
      
      Profit Percent: 5 Stop-loss Percent: 5 Final PnL: -18829.35
      Total Trades: 16
       Winning Trades: 3 
       Losing Trades: 13
      81170.64902433063
      
      import backtrader as bt
      import backtrader.analyzers as btanalyzers
      import matplotlib.pyplot as plt
      from Vidya import Vidya
      import math
      from PrintAnalyzers import printTradeAnalysis, printSQN
      from utils import size_by_percent
      from get_binance_data import get_data
      import datetime as dt
      
      TF1 = '30m'
      TF2 = '4h'
      PERIOD = 50
      
      START_DATE = dt.datetime(2021, 1, 1)
      END_DATE = dt.datetime(2021, 6, 1)
      
      
      class VidyaTouchStrategy(bt.Strategy):
          params = dict(profit_percent=5, stop_loss_percent=5,
                        cash_percent=80, oneplot=True, hold=40)
      
          def log(self, txt, dt=None):
              ''' Logging function fot this strategy'''
              dt = dt or self.datas[0].datetime.date(0)
              print('%s, %s' % (dt.isoformat(), txt))
      
          def __init__(self):
              self.startcash = self.broker.getvalue()
              self.inds = dict()
              self.orders = dict()
              self.o = dict()  # orders per data (main, stop, limit, manual-close)
              self.holding = dict()  # holding periods per data
              self.winning_trades = 0
              self.losing_trades = 0
              self.last_order_bar = 0
      
              for i, d in enumerate(self.datas):
                  dn = d._name
                  if "TF1" not in dn:
                      self.inds[d] = dict()
                      self.inds[d]['vidya100'] = self.vidya100 = Vidya(
                          d, period=PERIOD, above_percent=1.03)
      
                  if i > 0:
                      if self.p.oneplot:
                          d.plotinfo.plotmaster = self.datas[0]
      
          def next(self):
              for i, d in enumerate(self.datas):
                  date, dn = self.datetime.date(), d._name           # Get time and stock code
                  if "TF1" not in dn:
                      is_not_last = True  # len(self) < len(d.high.array) - 3
                      pos = self.getposition(d).size
      
                      touched_above = self.inds[d]['vidya100'].buy_price[0] if is_not_last and self.inds[
                          d]['vidya100'].touched_above[0] else None
      
                      stop_loss = touched_above * \
                          (1 - self.p.stop_loss_percent /
                           100) if touched_above else None
      
                      take_profit = touched_above * \
                          (1 + self.p.profit_percent /
                           100) if touched_above else None
      
      
                      if not pos and not self.o.get(d, None) and self.last_order_bar != len(d):
                          if touched_above and not math.isnan(touched_above):
                              print(
                                  f"date: {date}\nprice {touched_above}\ntakeprofit: {take_profit}\nstoploss: {stop_loss}\n")
                              stake_size = size_by_percent(
                                  percent=self.p.cash_percent, current_price=touched_above, current_cash=self.broker.get_cash())
                              self.o[d] = self.buy_bracket(
                                  data=d,
                                  size=stake_size,
                                  price=touched_above,
                                  tradeid="qwe",
                                  oargs=dict(valid=dt.timedelta(1)),
                                  stopprice=stop_loss,
                                  # stopargs=dict(valid=valid2),
                                  limitprice=take_profit,
                                  # limitargs=dict(valid=valid3),
                              )
      
                              self.last_order_bar = len(d)
                              print(self.last_order_bar)
                              self.holding[d] = 0
      
      
      
          def notify_trade(self, trade):
              dt = self.data.datetime.date()
              if trade.isclosed:
                  print('#######{} {} price {} Closed: PnL Gross {}, Net {}#######\n'.format(
                      dt,
                      trade.data._name,
                      round(trade.price, 2),
                      round(trade.pnl, 2),
                      round(trade.pnlcomm, 2)))
                  if round(trade.pnlcomm, 2) > 0:
                      self.winning_trades += 1
                  else:
                      self.losing_trades += 1
      
          def notify_order(self, order):
              if order.status in [order.Submitted, order.Accepted]:
                  # Buy/Sell order submitted/accepted to/by broker - Nothing to do
                  return
      
              if order.status in [order.Completed]:
                  if order.isbuy():
                      self.log(
                          'BUY EXECUTED, Price: %.2f, Cost: %.2f, Comm %.2f, Bar %.2f' %
                          (order.executed.price,
                           order.executed.value,
                           order.executed.comm,
                           self.last_order_bar))
      
                  else:  # Sell
                      self.log('SELL EXECUTED, Price: %.2f, Cost: %.2f, Comm %.2f, Bar %.2f' %
                               (order.executed.price,
                                order.executed.value,
                                order.executed.comm,
                                self.last_order_bar))
      
                      self.remove_orders(order)
      
              elif order.status in [order.Canceled, order.Margin, order.Rejected]:
                  self.remove_orders(order)
                  self.log('Order Canceled/Margin/Rejected')
      
          def stop(self):
              pnl = round(self.broker.getvalue() - self.startcash, 2)
              print('Profit Percent: {} Stop-loss Percent: {} Final PnL: {}'.format(
                  self.p.profit_percent, self.p.stop_loss_percent, pnl, ))
              print(
                  f"Total Trades: {self.winning_trades + self.losing_trades}\n Winning Trades: {self.winning_trades} \n Losing Trades: {self.losing_trades}")
      
      
      
          def remove_orders(self, order):
              for key, value in self.o.items():
                  new_list = []
                  for idx, elm in enumerate(value):
                      if elm.tradeid != order.tradeid:
                          new_list.append(elm)
                  else:
                      self.o[key] = new_list
      
      
      tickers = [
          'BTCUSDT',
          # 'ETHUSDT',
          # 'ADAUSDT',
          # 'LINKUSDT',
          # 'XRPUSDT',
          # 'TRONUSDT',
      ]
      
      for ticker in tickers:
          cerebro = bt.Cerebro()
      
          df = get_data(ticker, TF1, START_DATE, END_DATE)
          data = bt.feeds.PandasData(
              dataname=df, timeframe=bt.TimeFrame.Minutes, compression=1)
          cerebro.adddata(data, name=ticker+"TF1")
      
          df2 = get_data(ticker, TF2, START_DATE, END_DATE)
          data2 = bt.feeds.PandasData(
              dataname=df2, )
          cerebro.adddata(data2, name=ticker+"TF2")
      
          cerebro.addstrategy(VidyaTouchStrategy)
      
          cerebro.broker.setcash(100000)
      
          cerebro.broker.setcommission(commission=0.001)
      
          cerebro.addobserver(bt.observers.Trades)
          cerebro.addobserver(bt.observers.BuySell)
      
          cerebro.addanalyzer(btanalyzers.SharpeRatio, _name="sharpe")
          cerebro.addanalyzer(btanalyzers.TradeAnalyzer, _name="trade")
      
          # cerebro.addwriter(bt.WriterFile, csv=False)
      
          back = cerebro.run(stdstats=False)
      
          print(cerebro.broker.getvalue())
      
          printTradeAnalysis(back[0].analyzers.trade.get_analysis())
          print(back[0].analyzers.sharpe.get_analysis())
      
          # cerebro.plot(style='candle')
      
      
      posted in General Code/Help
      H
      hakankaan
    • RE: Hourly indicator with intraday strategy doesnt trade

      Start date: 01.01.2019
      End date: 01.06.2021

      Result for 30m and 1h timeframes:
      Total trades: 2

      every time pre_load consume time :17.86236882209778
      2019-01-10, BUY EXECUTED, Price: 3819.86, Cost: 10000.00, Comm 10.00
      2019-01-10, SELL EXECUTED, Price: 3726.32, Cost: 10000.00, Comm 9.76
      #######2019-01-10 BTCUSDTTF2 price 3819.86 Closed: PnL Gross -244.87, Net -264.63#######
      
      2019-01-20, BUY EXECUTED, Price: 3590.40, Cost: 9973.54, Comm 9.97
      2019-01-28, SELL EXECUTED, Price: 3479.01, Cost: 9973.54, Comm 9.66
      #######2019-01-28 BTCUSDTTF2 price 3590.4 Closed: PnL Gross -309.42, Net -329.06#######
      
      Profit Percent: 10 Stop-loss Percent: 5 Final PnL: -593.69
      
      posted in Indicators/Strategies/Analyzers
      H
      hakankaan
    • Hourly indicator with intraday strategy doesnt trade

      I'm creating a strategy that i want it to use 1m or 5m candles to trade -to make it more realistic-.
      Trades will happen if price touches from above to 1h and 4h Vidya lines.

      Problem is if i use 30m or 1h datafeeds to buy or sell it trades. But smaller timeframes like 1m and 5m creates lesser trades.

      I couldnt find the source of the problem.
      Below the full code and some result examples with different used timeframes.

      What can be the problem?

      Start date: 01.01.2021
      End date: 01.06.2021

      import backtrader as bt
      import backtrader.analyzers as btanalyzers
      from Vidya import Vidya
      import math
      from PrintAnalyzers import printTradeAnalysis, printSQN
      from utils import size_by_percent
      from get_binance_data import get_data
      
      
      TF1 = '5m'
      TF2 = '1h'
      
      
      class VidyaTouchStrategy(bt.Strategy):
          params = dict(profit_percent=10, stop_loss_percent=5,
                        cash_percent=10, oneplot=True)
      
          def log(self, txt, dt=None):
              ''' Logging function fot this strategy'''
              dt = dt or self.datas[0].datetime.date(0)
              print('%s, %s' % (dt.isoformat(), txt))
      
          def __init__(self):
              self.startcash = self.broker.getvalue()
              self.inds = dict()
              self.orders = dict()
              self.winning_trades = 0
              self.losing_trades = 0
      
              for i, d in enumerate(self.datas):
                  dn = d._name
                  if "TF1" not in dn:
                      self.inds[d] = dict()
                      self.inds[d]['vidya100'] = self.vidya100 = Vidya(
                          d, period=21)
      
                  if i > 0:
                      if self.p.oneplot:
                          d.plotinfo.plotmaster = self.datas[0]
      
          def next(self):
              for i, d in enumerate(self.datas):
                  dt, dn = self.datetime.date(), d._name           # Get time and stock code
                  if "TF1" not in dn:
                      is_not_last = len(self) < len(d.high.array) - 3
                      pos = self.getposition(d).size
      
                      stop_loss = self.getposition(d).price * \
                          (1 - self.p.stop_loss_percent /
                           100) if self.getposition(d).price else None
      
                      take_profit = self.getposition(d).price * \
                          (1 + self.p.profit_percent /
                           100) if self.getposition(d).price else None
      
                      touched_above = self.inds[d]['vidya100'].vidya[1] if is_not_last and self.inds[
                          d]['vidya100'].touched_above[1] else None
                      orders = self.broker.get_orders_open()
                      # is_same_order = any(s.price == touched_above for s in orders)
                      is_order = len(orders) > 0
                      if not is_order:
                          if not pos:   # Not in the market, you can buy
                              if touched_above and not math.isnan(touched_above):
                                  stake_size = size_by_percent(
                                      percent=self.p.cash_percent, current_price=touched_above, current_cash=self.broker.get_cash())
                                  self.buy(data=d, size=stake_size, exectype=bt.Order.Limit,
                                           price=touched_above,
                                           )
                          # take profit
                          elif pos and is_not_last and take_profit <= d.high[0]:
                              self.close(data=d)
                          elif pos and is_not_last and take_profit <= d.high[1]:
                              self.close(data=d, exectype=bt.Order.Limit,
                                         price=take_profit,
                                         )
                          # stoploss
                          elif pos and is_not_last and stop_loss >= d.low[0]:
                              self.close(data=d)
                          elif pos and is_not_last and stop_loss >= d.low[1]:
                              self.close(data=d, exectype=bt.Order.Limit,
                                         price=stop_loss,
                                         )
      
          def notify_trade(self, trade):
              dt = self.data.datetime.date()
              if trade.isclosed:
                  print('#######{} {} price {} Closed: PnL Gross {}, Net {}#######\n'.format(
                      dt,
                      trade.data._name,
                      round(trade.price, 2),
                      round(trade.pnl, 2),
                      round(trade.pnlcomm, 2)))
                  if round(trade.pnlcomm, 2) > 0:
                      self.winning_trades += 1
                  else:
                      self.losing_trades += 1
      
          def notify_order(self, order):
              if order.status in [order.Submitted, order.Accepted]:
                  # Buy/Sell order submitted/accepted to/by broker - Nothing to do
                  return
      
              if order.status in [order.Completed]:
                  if order.isbuy():
                      self.log(
                          'BUY EXECUTED, Price: %.2f, Cost: %.2f, Comm %.2f' %
                          (order.executed.price,
                           order.executed.value,
                           order.executed.comm))
      
                  else:  # Sell
                      self.log('SELL EXECUTED, Price: %.2f, Cost: %.2f, Comm %.2f' %
                               (order.executed.price,
                                order.executed.value,
                                order.executed.comm))
      
              # elif order.status in [order.Canceled, order.Margin, order.Rejected]:
                  # self.log('Order Canceled/Margin/Rejected')
      
          def stop(self):
              pnl = round(self.broker.getvalue() - self.startcash, 2)
              print('Profit Percent: {} Stop-loss Percent: {} Final PnL: {}'.format(
                  self.p.profit_percent, self.p.stop_loss_percent, pnl, ))
              print(
                  f"Total Trades: {self.winning_trades + self.losing_trades}\n Winning Trades: {self.winning_trades} \n Losing Trades: {self.losing_trades}")
      
      
      tickers = [
          'BTCUSDT',
          # 'ETHUSDT',
          # 'ADAUSDT',
          # 'LINKUSDT',
          # 'SOLUSDT',
          # 'ZILUSDT',
      ]
      
      for ticker in tickers:
          cerebro = bt.Cerebro()
          df = get_data(ticker, TF1)
          data = bt.feeds.PandasData(
              dataname=df, timeframe=bt.TimeFrame.Minutes, compression=1)
          cerebro.adddata(data, name=ticker+"TF1")
      
          df2 = get_data(ticker, TF2)
          data2 = bt.feeds.PandasData(dataname=df2)
          cerebro.adddata(data2, name=ticker+"TF2")
      
          cerebro.addstrategy(VidyaTouchStrategy)
      
          cerebro.broker.setcash(100000)
      
          cerebro.broker.setcommission(commission=0.001)
      
          cerebro.addobserver(bt.observers.Trades)
          cerebro.addobserver(bt.observers.BuySell)
      
          cerebro.addanalyzer(btanalyzers.SharpeRatio, _name="sharpe")
          cerebro.addanalyzer(btanalyzers.TradeAnalyzer, _name="trade")
      
          back = cerebro.run(stdstats=False)
      
          print(cerebro.broker.getvalue())
      
          printTradeAnalysis(back[0].analyzers.trade.get_analysis())
          print(back[0].analyzers.sharpe.get_analysis())
      
          cerebro.plot(style='candle')
      
      

      Result for 5m and 1h timeframes:
      Total trades: 1

      every time pre_load consume time :12.597188472747803
      2021-01-10, BUY EXECUTED, Price: 35919.11, Cost: 10000.00, Comm 10.00
      2021-01-11, SELL EXECUTED, Price: 37237.67, Cost: 10000.00, Comm 10.37
      #######2021-01-11 BTCUSDTTF2 price 35919.11 Closed: PnL Gross 367.09, Net 346.72#######
      
      Profit Percent: 10 Stop-loss Percent: 5 Final PnL: 346.72
      

      Result for 15m and 1h timeframes:
      Total trades: 6

      every time pre_load consume time :5.127857685089111
      2021-01-10, BUY EXECUTED, Price: 35919.11, Cost: 10000.00, Comm 10.00
      2021-01-11, SELL EXECUTED, Price: 37237.67, Cost: 10000.00, Comm 10.37
      #######2021-01-11 BTCUSDTTF2 price 35919.11 Closed: PnL Gross 367.09, Net 346.72#######
      
      2021-01-15, BUY EXECUTED, Price: 35228.91, Cost: 10034.67, Comm 10.03
      2021-01-20, SELL EXECUTED, Price: 34875.87, Cost: 10034.67, Comm 9.93
      #######2021-01-20 BTCUSDTTF2 price 35228.91 Closed: PnL Gross -100.56, Net -120.53#######
      
      2021-01-25, BUY EXECUTED, Price: 32764.47, Cost: 10022.62, Comm 10.02
      2021-01-26, SELL EXECUTED, Price: 32062.32, Cost: 10022.62, Comm 9.81
      #######2021-01-26 BTCUSDTTF2 price 32764.47 Closed: PnL Gross -214.79, Net -234.62#######
      
      2021-01-29, BUY EXECUTED, Price: 32041.32, Cost: 9999.16, Comm 10.00
      2021-01-29, SELL EXECUTED, Price: 35245.45, Cost: 9999.16, Comm 11.00
      #######2021-01-29 BTCUSDTTF2 price 32041.32 Closed: PnL Gross 999.92, Net 978.92#######
      
      2021-01-29, BUY EXECUTED, Price: 34028.14, Cost: 10097.05, Comm 10.10
      2021-01-31, SELL EXECUTED, Price: 32862.65, Cost: 10097.05, Comm 9.75
      #######2021-01-31 BTCUSDTTF2 price 34028.14 Closed: PnL Gross -345.83, Net -365.68#######
      
      2021-05-19, BUY EXECUTED, Price: 33725.16, Cost: 10060.48, Comm 10.06
      Profit Percent: 10 Stop-loss Percent: 5 Final PnL: 1551.55
      

      Result for 1m and 1h timeframes:
      Total trades: 0

      every time pre_load consume time :50.99492526054382
      Profit Percent: 10 Stop-loss Percent: 5 Final PnL: 0.0
      
      posted in Indicators/Strategies/Analyzers
      H
      hakankaan