I know, I have tested many strategies using MT4’s backtester, but because of the limitation of just 1 pair to be tested, it isnt good enough.
I would like to test strategies and use other instruments as confirmation(like stocks and yields etc).
And I would like to learn how to use R
This is how the code looks like now(crap, I know). It dosnt work, because I have a stupid issue trying to initialize my results data frame (called [I]Test[/I] in this edition)
My problem right now is that Time/Date dosnt work in the resulting diagram, since R thinks all the data is supposed to be numbers, and not mixed(Date/Time and Numbers)
eu <- read.csv(file.choose(), header=F)
head(eu)
time.date <- unique(eu[,1])
#test2 <- matrix(rep(NA,length(eu$V) * 7), length(eu$V1), 7)
#Test <- rbind(NA, 1:7)
#Test <- data.frame(Test)
#Test <- as.data.frame(list(a1 = vector("numeric", n), a2 = vector("character", n)))
Test <- as.data.frame(list(Date = vector("character",n), Open = vector("number",n),
High = vector("number",n), Low = vector("number",n), Close = vector("number,n"),
HighAt = vector("character",n), LowAt = vector("character",n)))
x = 1
for (x in 1:length(time.date)) {
cur_day <- eu[eu[,1] == time.date[x],] #All the data for the current date
nHigh = max(cur_day[,4])
nLow = min(cur_day[,5])
nHighAtnr = which.max(cur_day[,4])
nLowAtnr = which.min(cur_day[,5])
nHighAt = cur_day[nHighAtnr,2]
nLowAt = cur_day[nLowAtnr,2]
Test[x,1] = time.date[x] #Date
Test[x,2] = cur_day[1,3] #Open
Test[x,3] = nHigh #High
Test[x,4] = nLow #Low
Test[x,5] = cur_day[length(cur_day),6] #Close
Test[x,6] = nHighAt #High occured at time
Test[x,7] = nLowAt #Low occured at time
}