Thanks so much Roberto, that’s spot on what I wanted it to do. I really can’t thank you enough for taking the time to put that together for me!
I’ll have a play, initial backtesting of it looks to be behaving as I expected, but the results are so different to when I manually backtested, so I’m scratching my head over that. I’ve accounted for an average spread on it, can’t think what else might be skewing the results, because your code seems to cover everything perfectly.
It’s really interesting for me to learn from seeing what you’ve done there using:
Take spread (and trading hours, as well) into account. That will not affect much your performance of you open 50-70 trades yearly, but if you open 1K+ trades…. well it can impair your strategy.