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

execute next() step for each tick



  • Hey, everyone. i want to backtest a strategy base in 5min, but i will modify the limit order based on the new tick data coming once i send a limit order. Can i use the data replay function with tick data to achieve this goal? Is it means backtrader will execute the next function for every tick?


  • administrators

    replay will send each tick to next. That's the point.



  • Thank you:)



  • Another problem relate to it. Let's say i placed a stoptraillimit order and the order has been executed. (the trailamount is 3 pips), i backtest the strategy tick by tick. Is it means the stop price will be recalculated for every new tick coming rather than recalculated by using the latest 5min bar's close price?
    (The Doc says that : the stop price is recalculated by using the latest close price and substracting the trailamount distance)


  • administrators

    Each incoming tick happens to be the last available close price for the current bar.



  • @backtrader so if i want to access the newest tick data i should use datas[0].close, right? If i want to access the current bar's high and low value and the last closed bar's close price, i use datas[0].high and datas[0].low and datas[-1].close? It's confusing. Sorry, i am new to backtrader...


Log in to reply
 

});