kieran-mackle / AutoTrader

A Python-based development platform for automated trading systems - from backtesting to optimisation to livetrading.
https://kieran-mackle.github.io/AutoTrader/
GNU General Public License v3.0
937 stars 215 forks source link

How to properly close a position in a strategy #108

Open stophr opened 3 months ago

stophr commented 3 months ago

Hello, I really appreciate the effort that went into this project. I would like to know the proper way to close a position. For instance, my strategy's logic decides that its confused (getting mixed signals), as a result it needs to close all open positions till it gets a clear signal. How would one best go about this from within the strategy? I have a feeling its to create a market order in the opposite direction, but this leaves open stop & limit orders that need to be cleaned up. Just wondering if this is the correct path or if there is a better way. Thanks!