I am running the Quantstrat package to backtest my strategy with parameter optimization on Linux.
What I do first is to set up my indicators, signals and rules in my strategy.
Then I try to optimize my parameters which have about 200,000 combos. So I randomly pick up 100 to do the optimization.
If the best combo is, for example, 2-day rsi = 15, I put the optimized parameter into backtesting again; however, I got a different statistical result from the optimized one. On the other hand, if I do the optimization with only one combo, the trade statistics outputs are the same.
###########################################
### custom transaction costs function ###
###########################################
### transaction costs
### Buying: 14.25 basis point for brokerage fee
### Selling: 14.25 basis point for brokerage fee and 30 basis point transaction tax
buyCost