This was my first attempt at video logging and trying to explain data analysis using R. Made a major mistake, and realized after the video was recorded. Still going forward and putting it out here. Will be useful for starters on R and will give a gentle intro to backtesting.
The extremely negative return on D5Ret was likely from the day that Niftybees had a 1:10 split.
To correct for that, you can modify the CLOSE values in the NF data.frame (before calculating the returns) using:
NF$CLOSE<-ifelse(NF$CLOSE>1000, NF$CLOSE/10, NF$CLOSE).
After that everything remains the same.
Those who want to try out, can start their journey from the data freely available HERE.
Cheers.