I am using the code below to test a system for 1Hr Eur/USD and 1 Hr USD/JPY. When I run the optimization with both short and long EMAs set for 1 to 50 in steps of 1 I always get a result where the short EMA has the longest period and vice versa. Why should this be and can it be used as a successful strategy.Thank you
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = ExponentialAverage[short](close)
indicator2 = ExponentialAverage[long](close)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator3 = ExponentialAverage[short](close)
indicator4 = ExponentialAverage[long](close)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator5 = ExponentialAverage[long](close)
indicator6 = ExponentialAverage[short](close)
c3 = (indicator5 CROSSES OVER indicator6)
IF c3 THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator7 = ExponentialAverage[long](close)
indicator8 = ExponentialAverage[short](close)
c4 = (indicator7 CROSSES UNDER indicator8)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
If the optimizer returns you good results cases when the faster EMA has a period longer than the slow EMA, this is obviously because it gives the best results. So if you need to have a short term period for your short EMA, you can restrict the range of periods in the variables optimizations window if you like.