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

check if an order would be accepted before its created



  • Hey Coders and Backtrader supporters,

    Is there an inbuilt function to check if an order would be accepted (without sending it?)

    Otherwise, if i want to build such an order, (only for backtesting purposes), what should it check else but the margin? (+ any tips how to get the current margin)

    Motivation:
    I need to send Takeprofit and stoploss at the same time as the main ordercreation to get reliable backtesting results

    (e.g. if the order is completed and the TP & SL are beeing sent but the current HighPrice hits the level where the unexecuted TP will be (which gets executed at the next bar)


  • administrators

    You have to manually check it, just like in real life. But your approach doesn't have the goal to achieve reliable backtesting results. Quite the opposite.



  • @backtrader yes and what else but the margin do i need to check in this case?


Log in to reply
 

});