I have a simple strategy which Buys At Close, holds for a month (20 days) and Sells At Close (code below). Problem is the script doesn't execute the BuyAtClose at the same bar as SellAtClose.
To make matters worse, it "thinks" it has bought (i.e. IsLastPositionActive = true after the BuyAtClose command), so it doesn't buy at the next bar either, but skips 20 days and Buys at the next month. As a result my Exposure is only 50% and it's holding cash every alternate month. The Trade tab shows the same outcome.
- How do i make the script BuyAtClose after Selling At Close in the same bar?
CODE:
Please log in to see this code.