Skip to content

Close trade after specific time #505

Answered by McHill007
McHill007 asked this question in Q&A
Discussion options

You must be logged in to vote

I managed to implement the hold time.

        for trade in self.trades:
            d0 = trade.entry_time.to_pydatetime().date()
            d1 = self.data.index[-1].date()
            delta = d1 - d0
            if (  delta.days )  >= 180:
                trade.close()    

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@kernc
Comment options

@McHill007
Comment options

@McHill007
Comment options

@kernc
Comment options

Answer selected by kernc
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants