Glanced at your code.
Do you have an updated code as the EMA is 5,not 200 and the times do not reflect 8am start but 8.20 and eod is also different from what you indicated earlier.
It is nice to see someone offer a strategy with supporting documention.
The P/L is missing commissions so...