For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

analyzer with multiple strategies - results[n] no matter n gives identical results.



  • adding my analyzers as such:

    cerebro.addanalyzer(bt.analyzers.DrawDown,  _name='ddown')
    cerebro.addanalyzer(bt.analyzers.TimeReturn, 
    _name='myreturntme',timeframe=bt.TimeFrame.Months)
    
    print('Starting Portfolio Value: %.2f' % cerebro.broker.getvalue())
    
    results = cerebro.run()
    result = results[0]
    
    print('Final Portfolio Value: %.2f' % cerebro.broker.getvalue())`
    

    based on docs if I have N strategy results[n] should house the analyzer data for that strategy. However my results are all identical no matter what results[n] is.

    results[0].analyzers.myreturntme.get_analysis()

    will display same results as

    results[1].analyzers.myreturntme.get_analysis()

    it seems to be giving me results for the entire system not independent strategies.



  • @blonc

    I believe I have resolved this problem myself. Some analyzers are based on the broker as a whole and some are based on individual strategies..



  • Analyzers you use are related to bt broker. Single or multiple strategies use the same broker by default. That is the reason to have same drawdown or return. If you add trades analyzer, you might have results related to particular strategy.


  • administrators

    @blonc said in analyzer with multiple strategies - results[n] no matter n gives identical results.:

    it seems to be giving me results for the entire system not independent strategies.

    Yes. The broker is a single account broker. Nowhere it is stated that strategies operate on individual accounts. Actually, the examples that show multiple strategies operating, show that they operate on the same account.

    If you want strategies that operate on different accounts, run them with different cerebros.