Hi Bill,
Your code is a bit illogical. For example, “Trade 1 & 2” are executed in December, while “Trade 3 & 4” take place in November, and so on…
Additionally, you need to pay attention to the timeframe you are using. For instance, on November 21, you are buying at “081000”. This time can only be read if you are using a timeframe of 10 minutes or less.
Other than that, your original code does what it is supposed to do (with the correct settings).
If, based on my previous comments, you add “DefParam CumulateOrders=False” at the top of your code, this setting will prevent cumulative orders. This means that only the first 10 contracts will be purchased, and these must be sold first before new contracts can be bought.