Replies: 1 comment
-
Yes and this is by design If you want to see open trades that should not be closed, just look for those closed on the last bar |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi - After a strategy is finished being backtested, I wanted to find out if we're currently in an open trade for this strategy.
Let's say I run a simple moving average crossover strategy such as:
At the conclusion of the backtest, I'd like to know if we currently have an open position (ie. the exit criteria havent been triggered as of the end of my dataset).
When I query stats["_trades"] it always shows the last trade as "exited". If you see this image below, you can see that it exited the trade on 3/10/23 which is the last day of my dataset, but that trade, by the strategy conditions, should still be open.
So my two questions are:
y=stats["_trades"]
what would I use to see if an open trade currently exists?Thanks for any insight
Beta Was this translation helpful? Give feedback.
All reactions