I looked through your code and I dont think the calculation is correct for intraday systems. In particular, the following line is problematic:
prof = cl(ntrd+st+ho) - cl(ntrd+st)
Here you are calculating the "random day" profit/loss from close to close. However, if you are trading an...