Hi CemCalim,
Today is your lucky day. Your strategy caught my eye partly because it seemed promising, but mostly because of having 14 parameters and a very large solution space, impossible for the exhaustive optimizer. This made it a good strategy to test my new WL AddIn Particle Swarm Optimizer. (Advertisement:
http://www.wealth-lab.com/Extensions/Details/56)
But your strategy had some logic problems, so I thought I'd try to fix it. Here's what I did...
1. Gave Slider1-14 meaningful tags and reworked Default/Start/Stop/Step values
2. Conditioned Sell vs. Cover by "if( LastPosition.PositionType == PositionType.Long ) {"
3. Restructured a few ifs and elses, especially to fix long/short imbalance
4. Incorporated Eugene's "for(int bar = GetTradingLoopStartBar(20); ..." (TODO "20" should be at least max of indicator periods)
5. Pre-calculated ATR.Series, unstead of using ATR.Value (long and short) for efficiency
6. Ran my new PSO optimizer (optimizing :Net Profit" on 430 S&P 500 non-financial symbols for 10 years)
Best parameters so far (it's still running) {8,0.3,16,26,178.1,24,19,17,19.5,13,16,69.4,12,-54}
Here is the source after my changes:
CODE:
Please log in to see this code.