I'm wondering if there's perhaps a way to generate a list of buy signals, take the top ten, then if the buyPrice is greater than the next day's low, then the program buys, and if not, the buy is cancelled. My tested buyPrice is 0.8 * Close, but the trades go through regardless of the Low's price.
In case anyone has a better method: I'm looking to make a system that makes a limit order at the start of each day for ten stocks, then cancels the orders if they're not filled at the end of the day. So if anyone has a better way to interpret that, I'm curious. Below is the CBT attempt at it.
Edit: Just so we're aware, I based this heavily off of pmxgs's code at the following link, which is in turn based off of the code from the introduction to CBT. backtestRegularRawMulti Mode in low-level CBT
Hi,
can you provide a code that can be copy&paste in an Amibroker session? People are wasting their time if you do not provide a testable code.
Why do you not work with SetOption( "MaxOpenPositions", 10);? Why can you not add the buyprice > low condition to your Buy definition?
Sorry, here's a completed version. The MaxOpenPositions partially helps, but it does not ultimately solve the issue. If I add buyprice > low to the buy condition, the program will select other buys, based on prices in the future, and that's ultimately not what I'm looking for.