I was trying the luxor.4.paramset.timespan.R to to find the best entry time for the luxor strategy and the script ran without error. However, when I examined the result using tradeGraphs(), the maximum Net.Trading.PL was only about 20k, whereas the luxor.1.basic.strategy.R using nFast = 1, nSlow = 44 without the timespan optimization results in 106k. I did not run the full 24x24 hour scan above, but instead used .nSamples = 80 and:
.timespans<-c('T06:00/T10:00', 'T07:00/T11:00', 'T08:00/T12:00',
'T09:00/T13:00', 'T10:00/T14:00', 'T11:00/T15:00', 'T12:00/T16:00')
I checked with the result from the full scan version in luxor.timespan.24x24.2002-2008.RData and the NetTrading.PL was also about the same 20k.
I am quite confused, was there anything wrong? or was adding the timespan distribution to the strategy and then apply.parmaset() actually decreases the Net.Trading.PL?
Can anyone help me out please?. Thanks in advance.
I am just beginning to learn R and did not change anything in the code really. Here is a subsection from the file luxor.2.add.paramsets.R
## Timespan paramset
add.distribution(strategy.st,
paramset.label = 'Timespan',
component.type = 'enter',
component.label = 'EnterLONG',
variable = list(timespan = .timespans),
label = 'EnterLong'
)
add.distribution(strategy.st,
paramset.label = 'Timespan',
component.type = 'enter',
component.label = 'EnterSHORT',
variable = list(timespan = .timespans),
label = 'EnterShort'
)
add.distribution(strategy.st,
paramset.label = 'Timespan',
component.type = 'exit',
component.label = 'Exit2LONG',
variable = list(timespan = .timespans),
label = 'ExitLong'
)
add.distribution(strategy.st,
paramset.label = 'Timespan',
component.type = 'exit',
component.label = 'Exit2SHORT',
variable = list(timespan = .timespans),
label = 'ExitShort'
)
add.distribution.constraint(strategy.st,
paramset.label = 'Timespan',
distribution.label.1 = 'EnterLong',
distribution.label.2 = 'EnterShort',
operator = '==',
label = 'EnterTimespan'
)
add.distribution.constraint(strategy.st,
paramset.label = 'Timespan',
distribution.label.1 = 'ExitLong',
distribution.label.2 = 'ExitShort',
operator = '==',
label = 'ExitTimespan'
)
add.distribution.constraint(strategy.st,
paramset.label = 'Timespan',
distribution.label.1 = 'EnterLong',
distribution.label.2 = 'ExitShort',
operator = '==',
label = 'EnterExitTimespan'
)
and here is a subsection from the file luxor.4.paramset.timespan.R
require(doParallel)
registerDoParallel(detectCores())
results <- apply.paramset(strategy.st, paramset.label = 'Timespan',
portfolio.st = portfolio.st, account.st = account.st,
nsamples = .nsamples, verbose = TRUE)
stats <- results$tradeStats
print(stats)
save(stats, file='luxor.4.paramset.timespan.RData')