You can set the maximum number of positions to buy easily.
Also in this code it places a limit order at the same time that you enter the market 1.5% below the close price otherwise you don’t have an order on the market for the first candle. If there is a big gap down then you might end up with two trades opening at the start of the candle though because we can only use the closing price of the decision candle at this point.
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.