Skip to content

backtesting.tp/sl vs bank.tp/sl -> how to know more easily that my tp/sl are up to date #253

Answered by kernc
Benouare asked this question in Q&A
Discussion options

You must be logged in to vote

It's not entirely clear to me at least. 😅 What are you missing?

Something like:

if orders[-1].set_at == date.today():

can be achieved if you expand buy()/sell():

class YourStrategy(Strategy):
    ...

    def buy(**kwargs):
        super().buy(**kwargs)

        last_order = self.orders[-1]
        last_order.set_at = date.today()

    ...

This would add .set_at attribute on orders which you can filter on.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Benouare
Comment options

Answer selected by Benouare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants