how do i write code that will close trades automatically at the end of the time period. for example if i am trading on a 5 minute period, it will close the trade at the end of the 5 minutes.
Simply add SELL AT MARKET or/and EXITSHORT AT MARKET at the beginning of your code, as this will ensure your trades will be closed at the end of the candle, when your strategy is run.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok