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

How do I access the observer lines after the engine has been run?



  • It seems like the data must be stored in the engine. It can produce a plot after the engine has been run. Otherwise, the value line is only calculated and stored in memory for the plot. Can anyone help me find the broker value over time by extracting it from the engine object?





  • You can access the analyzers as dictionaries from the strategy object returned by Cerebro. So for example, if you have:

    # Add an analyzer to cerebro.
    cerebro.addanalyzer(bt.analyzers.DrawDown, _name="drawdown")
    
    # Then run cerebro
    strat = cerebro.run()
    
    # Retrieve a dictionary as follows: 
    my_drawdown = results[0].analyzers.getbyname("drawdown").get_analysis()
    
    

    You can apply this technique to any analyzer you implement.



  • Sorry, typo.... strat should be results...

    # Add an analyzer to cerebro.
    cerebro.addanalyzer(bt.analyzers.DrawDown, _name="drawdown")
    
    # Then run cerebro
    results = cerebro.run()
    
    # Retrieve a dictionary as follows: 
    my_drawdown = results[0].analyzers.getbyname("drawdown").get_analysis()
    

Log in to reply
 

});