1. First of all, it's advised that you don't mix same bar AtStop/AtLimit entries
and exits. As this FAQ implies (and suggests a workaround), this isn't realistic:
I want to test a strategy that buys and sells with stop/limit orders on the same bar.2. For CoverAt* exits, I think you wanted to say "p.AutoProfitLevel * 0.99" (instead of 1.01).
3. Before trying to refer to a Position by an index the way you're doing, make sure the index is not out of bounds.