Yeah I don't know what I was thinking there. It should just be that price[0] is greater/lower than the SMA.

Ok so without the crossover and just the SMA220 I get the following. I thought it was a good test until I realised that it didn't take an long trades using this code.

BackTest First Strike portfolio

Simulated account AssetsFix.dta
Bar period 24 hours (avg 2180 min)
Test period 03.01.2006-16.07.2016 (2526 bars)
Lookback period 220 bars (45 weeks)
Monte Carlo cycles 200
Assumed slippage 10.0 sec
Capital invested 1000$

Gross win/loss 19984$ / -16179$ (+21500p)
Average profit 361$/year, 30$/month, 1.39$/day
Max drawdown -703$ 18% (MAE -768$ 20%)
Total down time 92% (TAE 75%)
Max down time 138 weeks from Jan 2006
Max open margin 471$
Max open risk 161$
Trade volume 4435744$ (421148$/year)
Transaction costs -213$ spr, -19$ slp, -272$ rol, -100$ com
Capital required 846$

Number of trades 2277 (217/year, 5/week, 1/day)
Percent winning 26%
Max win/loss 390$ / -40$
Avg trade profit 1.67$ 9.4p (+188.5p / -54.5p)
Avg trade slippage -0.01$ -0.0p (+0.7p / -0.3p)
Avg trade bars 1 (+3 / -1)
Max trade bars 16 (23 days)
Time in market 156%
Max open trades 10
Max loss streak 25 (uncorrelated 27)

Annual growth rate 16%
Profit factor 1.24 (PRR 1.16)
Sharpe ratio 0.66
Kelly criterion 1.20
R2 coefficient 0.388
Ulcer index 8.3%
Prediction error 32%

Confidence level AR DDMax Capital

10% 48% 536$ 757$
20% 46% 585$ 783$
30% 45% 638$ 812$
40% 43% 683$ 835$
50% 42% 747$ 869$
60% 40% 823$ 910$
70% 39% 865$ 933$
80% 37% 932$ 968$
90% 34% 1086$ 1051$
95% 31% 1281$ 1155$
100% 21% 2288$ 1692$

Portfolio analysis OptF ProF Win/Loss Wgt%

AUD/JPY avg .1000 1.27 55/147 13.8
AUD/USD avg .1000 1.34 59/123 13.7
EUR/AUD avg .1000 1.23 57/181 9.5
EUR/CHF avg .1000 1.24 35/70 3.6
EUR/GBP avg .1000 1.21 30/46 3.6
EUR/JPY avg .1000 1.74 59/189 31.5
EUR/USD avg .1000 1.22 49/152 10.1
GBP/AUD avg .1000 0.97 53/232 -1.3
GBP/USD avg .1000 1.04 50/202 1.7
NZD/USD avg .1000 1.16 46/106 6.5
USD/CHF avg .1000 0.94 51/113 -1.0
USD/JPY avg .1000 1.30 55/117 8.3

AUD/JPY .1000 1.27 55/147 13.8
AUD/JPY:L .1000 ---- 0/0 0.0
AUD/JPY:S .1000 1.27 55/147 13.8
AUD/USD .1000 1.34 59/123 13.7
AUD/USD:L .1000 ---- 0/0 0.0
AUD/USD:S .1000 1.34 59/123 13.7
EUR/AUD .1000 1.23 57/181 9.5
EUR/AUD:L .1000 ---- 0/0 0.0
EUR/AUD:S .1000 1.23 57/181 9.5
EUR/CHF .1000 1.24 35/70 3.6
EUR/CHF:L .1000 ---- 0/0 0.0
EUR/CHF:S .1000 1.24 35/70 3.6
EUR/GBP .1000 1.21 30/46 3.6
EUR/GBP:L .1000 ---- 0/0 0.0
EUR/GBP:S .1000 1.21 30/46 3.6
EUR/JPY .1000 1.74 59/189 31.5
EUR/JPY:L .1000 ---- 0/0 0.0
EUR/JPY:S .1000 1.74 59/189 31.5
EUR/USD .1000 1.22 49/152 10.1
EUR/USD:L .1000 ---- 0/0 0.0
EUR/USD:S .1000 1.22 49/152 10.1
GBP/AUD .1000 0.97 53/232 -1.3
GBP/AUD:L .1000 ---- 0/0 0.0
GBP/AUD:S .1000 0.97 53/232 -1.3
GBP/USD .1000 1.04 50/202 1.7
GBP/USD:L .1000 ---- 0/0 0.0
GBP/USD:S .1000 1.04 50/202 1.7
NZD/USD .1000 1.16 46/106 6.5
NZD/USD:L .1000 ---- 0/0 0.0
NZD/USD:S .1000 1.16 46/106 6.5
USD/CHF .1000 0.94 51/113 -1.0
USD/CHF:L .1000 ---- 0/0 0.0
USD/CHF:S .1000 0.94 51/113 -1.0
USD/JPY .1000 1.30 55/117 8.3
USD/JPY:L .1000 ---- 0/0 0.0
USD/JPY:S .1000 1.30 55/117 8.3