Backtrader Community

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

    Laurent Michelizza

    @Laurent Michelizza

    9
    Reputation
    1051
    Profile views
    35
    Posts
    0
    Followers
    1
    Following
    Joined Last Online

    Laurent Michelizza Unfollow Follow

    Best posts made by Laurent Michelizza

    • RE: How to add event information into strategy

      Hi,

      Another way of doing this could be to create an indicator events, load the csv in a panda df during the init and at each bar check whether or not the date is in the df. So the indicator would return true if the date is an event and false if not.

      posted in General Code/Help
      L
      Laurent Michelizza
    • RE: Furtures data with missing days - how to handle

      This sounds suspicious. I use futures data with missing days but don't have this issue.
      Do you load only one future when running your tests?

      Also, you should include your code.

      posted in Indicators/Strategies/Analyzers
      L
      Laurent Michelizza
    • RE: Backtesting UI

      Hi,

      I actually have an updated version of this UI. As this one had a few issues with Dash. Let me know if you would like to discuss further.

      Thanks

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Including data from a database

      It would be helpful to add some of your code for debugging. I don't load data from a database but from a csv file that I load in a panda DataFrame, so I suppose that there's a little issue along the way which we can't really find without any code.

      posted in General Code/Help
      L
      Laurent Michelizza
    • RE: Backtesting with Futures data (Actual individual contract)

      Hi,
      I did as ab_trader suggested and can confirm that it works pretty well. I am actually loading a future as a chain in backtrader via a default_strategy that I inherit when I create a new strategy. So my code works on a specific future and I am able to trade the whole curve.
      Let me know if you have any questions.

      posted in General Discussion
      L
      Laurent Michelizza
    • Accessing Strategy Parameters

      Hi,

      I would like to access the strategy parameters for a project I am working on.

      However when trying to do so, I get the following:

      ort.Test.params
      Out[25]: backtrader.metabase.AutoInfoClass_LineRoot_LineMultiple_LineSeries_LineIterator_DataAccessor_StrategyBase_Strategy_Test1
      

      So as a workaround, I put my parameters in a dictionary "parameters" and then passed these parameters as a tuple to params, see below:

         parameters = {'param1': 1}
         params = tuple(parameters.items())
      

      This seems to be working but I am curious to know if there is a better/more elegant way of doing this?

      Thanks!

      posted in General Code/Help
      L
      Laurent Michelizza
    • RE: Backtesting with Futures data (Actual individual contract)

      If this is daily data that should work fine. I've had to do the same with an even bigger basket and I didn't have any issues.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtesting with Futures data (Actual individual contract)

      @tianjixuetu You need to make sure to close the contracts that are expiring. In this case it seems a contract might have expired with a position.
      I have a table which gives me LTD and FND (if applicable) for all futures.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtrader 2.0?

      Why not starting on some of these ideas and sharing with the community? That could be an idea, if you feel that you miss something you can always get it done for yourself.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtesting UI

      Ok, I will aim to post it within a few days. I need to check a few things.

      posted in General Discussion
      L
      Laurent Michelizza

    Latest posts made by Laurent Michelizza

    • RE: Backtrader 2.0?

      Why not starting on some of these ideas and sharing with the community? That could be an idea, if you feel that you miss something you can always get it done for yourself.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtesting with Futures data (Actual individual contract)

      @tianjixuetu You need to make sure to close the contracts that are expiring. In this case it seems a contract might have expired with a position.
      I have a table which gives me LTD and FND (if applicable) for all futures.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtesting with Futures data (Actual individual contract)

      If this is daily data that should work fine. I've had to do the same with an even bigger basket and I didn't have any issues.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtesting with Futures data (Actual individual contract)

      Hi,
      I did as ab_trader suggested and can confirm that it works pretty well. I am actually loading a future as a chain in backtrader via a default_strategy that I inherit when I create a new strategy. So my code works on a specific future and I am able to trade the whole curve.
      Let me know if you have any questions.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtesting UI

      Ok, I will aim to post it within a few days. I need to check a few things.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Backtesting UI

      Hi,

      I actually have an updated version of this UI. As this one had a few issues with Dash. Let me know if you would like to discuss further.

      Thanks

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: I'm looking for someone who can give me screen sharing support on backtrader via Skype or Google Hangouts, for a fee.

      It might not be possible, I can't find the option. Do you have an email address I can contact you on?

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: I'm looking for someone who can give me screen sharing support on backtrader via Skype or Google Hangouts, for a fee.

      Hi Pierre,
      I could help you depending on what you are trying to achieve.
      Pm me with more details.

      posted in General Discussion
      L
      Laurent Michelizza
    • RE: Quantified moving average strategy of crude oil futures market based on fuzzy logic rules and genetic algorithms

      Having more details would definitely help... Is the strategy trading a continuous timeserie or is it trading the term structure of crude oil?

      posted in Indicators/Strategies/Analyzers
      L
      Laurent Michelizza
    • RE: Pyfolio integration in backtrader 1.9.36

      @eduedix

      Hi,

      This is what I do to use pyfolio:

              cerebro = bt.Cerebro()
              cerebro.broker.setcash(cash)
              cerebro.addanalyzer(bt.analyzers.PyFolio, _name='pyfolio')
      
              for s in symbols:
                  df = pd.read_csv(os.path.join(path_dir, '{}.csv'.format(s)), parse_dates=True, index_col=0)
                  data = bt.feeds.PandasData(dataname=df)
                  cerebro.adddata(data)
      
              cerebro.addstrategy(strategy, **params)
      
              results = cerebro.run()
              strat = results[0]
              pyfoliozer = strat.analyzers.getbyname('pyfolio')
              returns, positions, transactions, gross_lev = pyfoliozer.get_pf_items()
      

      Hope this helps.

      posted in General Code/Help
      L
      Laurent Michelizza