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

Help needed to analyze external order list



  • Hello everyone, I have developed my own strategy from scratch and I have tested it with historical data, and ended with a list of trades made over the historical data set. I am trying to run my trades through backtrader to analyze the performance, but I am not having much luck. I am not the greatest with making sense of the docs, I have been trying to figure it out for the last 4 hours and havent gotten anywhere. My problem lies (i think) with the adddata part I believe and also setting up an empty strategy.

    Anyways, I have my order list in the format [datetime, size, price] (as per "Evaluating external historical performance"). My historical data is 30 minute in the format [date, O,H,L,C]

    Here is my code (its not much but I think its all that is relevant)

    cerebro = bt.Cerebro()
    
    cerebro.adddata(historical_data)
    cerebro.addstrategy(strategy=None)
    cerebro.add_order_history(trade_list, notify=False)
    
    cerebro.addanalyzer(bt.analyzers.TradeAnalyzer)
    
    results = cerebro.run()
    print(results)
    

    Printing outputs an empty list, I have tried my best looking through the docs, but I am feeling a little overwhelmed. Thank you

    edit: nevermind i got it, but it wont let me delete the post


  • administrators

    @doggo said in Help needed to analyze external order list:

    cerebro.addstrategy(strategy=None)
    

    A lot of context (ie: code) is missing, but that line seems completely out of place. There is for sure no single code sample showing such a call. And for sure not in Blog - Evaluating external historical performance

    Maybe you want to let us know what your intention is.



  • @backtrader sorry, could you please delete the post? I figured it out in the end, was just all over the place when I post this