Thank you for your patience and open mind.
How about this one? Please look at Max open trades
Avg trade bars 7 (+10 / -4)
Max trade bars 41 (29 days)
Time in market 1508%
Max open trades 45
45 is greater than |assets| x TradesPerBar x ExitTIme = 3 x 2 x 2 = 12.
#define BANK 50000.0
string selected_asset;
function run() {
BarPeriod = 720;
LookBack = 501;
StartDate = 20121021;
EndDate = 20140421;
set(TICKS + LOGFILE + MUTE);
set(RULES + FACTORS + TESTNOW + PLOTNOW);
if (Train) {
Hedge = 2;
} else {
set(NFA + MARGINLIMIT + ACCUMULATE);
Hedge = 4;
}
TradesPerBar = 2;
Weekend = 1;
ExitTime = 2;
NumSampleCycles = 2;
NumWFOCycles = 4;
Confidence = 75;
float max_margin_per_trade = BANK / ((ExitTime + 1) * TradesPerBar);
while(selected_asset = loop("EUR/CAD", "EUR/GBP", "EUR/USD")) {
asset(selected_asset);
var atrx = ATR(100);
var v00 = WillR(100);
vars Price = series(price());
BBands(Price, 322, 0.2, 2.7, MAType_SMA);
var v01 = (rRealUpperBand - priceClose()) / PIP;
var v02 = DCOsc(Price, 265);
var v03 = ATR(27);
Stop = 4.0 * atrx;
Trail = 2.0 * atrx;
TrailLock = 25.0;
if (adviseLong(PERCEPTRON, 0, v00, v01, v02, v03) > 0) {
Margin = OptimalFLong * max_margin_per_trade;
enterLong();
}
if (adviseShort(PERCEPTRON, 0, v00, v01, v02, v03) > 0) {
Margin = OptimalFShort * max_margin_per_trade;
enterShort();
}
}
}
Here I will grep the test.log for all the info about an interesting trade, l0517.
$ grep -n '^\[13\|l0517' Log/ATR_027test.log
1886:[1300: Fri 20.12. 00:00] 2: 618071p 144/174
1897:[1301: Fri 20.12. 12:00] 2: 622308p 142/178
1912:[1302: Sat 21.12. 00:00] 2: 634420p 139/185
1918:[1303: Mon 23.12. 00:00] 2: 642495p 142/183
1929:[1304: Mon 23.12. 12:00] 2: 638180p 138/189
1940:[1305: Tue 24.12. 00:00] 2: 636735p 140/189
1941:{EUR/CAD::l0517} Long 52@1.4543 Risk 1211$ tl at 00:00
1955:[1306: Tue 24.12. 12:00] 2: 639212p 143/190
1966:[1307: Thu 26.12. 00:00] 2: 641653p 144/191
1981:[1308: Thu 26.12. 12:00] 2: 646319p 149/190
1992:[1309: Fri 27.12. 00:00] 2: 642485p 159/182
2007:[1310: Fri 27.12. 12:00] 2: 647875p 173/172
2016:[1311: Sat 28.12. 00:00] 2: 634939p 174/172
2021:[1312: Mon 30.12. 00:00] 2: 642462p 174/172
2031:[1313: Mon 30.12. 12:00] 2: 654585p 174/174
2041:[1314: Tue 31.12. 00:00] 2: 666632p 174/176
2053:[1315: Tue 31.12. 12:00] 2: 659308p 172/180
2064:[1316: Thu 02.01. 00:00] 2: 667192p 174/181
2076:[1317: Thu 02.01. 12:00] 2: 674020p 168/189
2087:[1318: Fri 03.01. 00:00] 2: 674275p 170/190
2101:[1319: Fri 03.01. 12:00] 2: 688707p 160/202
2126:[1320: Sat 04.01. 00:00] 2: 673513p 161/203
2134:[1321: Mon 06.01. 00:00] 2: 657504p 162/203
2151:[1322: Mon 06.01. 12:00] 2: 670989p 162/206
2163:[1323: Tue 07.01. 00:00] 2: 666948p 166/204
2174:[1324: Tue 07.01. 12:00] 2: 665118p 177/196
2184:[1325: Wed 08.01. 00:00] 2: 662717p 187/188
2203:[1326: Wed 08.01. 12:00] 2: 670251p 191/186
2214:[1327: Thu 09.01. 00:00] 2: 689896p 194/184
2227:[1328: Thu 09.01. 12:00] 2: 711168p 193/187
2238:[1329: Fri 10.01. 00:00] 2: 721878p 193/189
2249:[1330: Fri 10.01. 12:00] 2: 729789p 196/188
2262:[1331: Sat 11.01. 00:00] 2: 750193p 193/193
2269:[1332: Mon 13.01. 00:00] 2: 763385p 194/193
2279:[1333: Mon 13.01. 12:00] 2: 776403p 194/194
2289:[1334: Tue 14.01. 00:00] 2: 794747p 194/196
2299:[1335: Tue 14.01. 12:00] 2: 810897p 194/198
2309:[1336: Wed 15.01. 00:00] 2: 828849p 196/198
2319:[1337: Wed 15.01. 12:00] 2: 852294p 205/191
2331:[1338: Thu 16.01. 00:00] 2: 885232p 208/190
2347:[1339: Thu 16.01. 12:00] 2: 905654p 207/193
2359:[1340: Fri 17.01. 00:00] 2: 930072p 207/195
2369:[1341: Fri 17.01. 12:00] 2: 948683p 214/190
2379:[1342: Sat 18.01. 00:00] 2: 955352p 217/188
2386:[1343: Mon 20.01. 00:00] 2: 959631p 218/188
2396:[1344: Mon 20.01. 12:00] 2: 979306p 217/190
2406:[1345: Tue 21.01. 00:00] 2: 992740p 219/190
2418:[1346: Tue 21.01. 12:00] 2: 1006122p 222/188
2430:[1347: Wed 22.01. 00:00] 2: 1027716p 217/194
2440:[1348: Wed 22.01. 12:00] 2: 1032914p 218/194
2445:{EUR/CAD::l0517} Sell 52@1.4857: +1466$ at 12:00
2478:[1349: Thu 23.01. 00:00] 2: 1111751p 221/199
2489:[1350: Thu 23.01. 12:00] 2: 1122354p 217/205
2499:[1351: Fri 24.01. 00:00] 2: 1154772p 217/206
2507:[1352: Fri 24.01. 12:00] 2: 1154562p 217/207
2517:[1353: Sat 25.01. 00:00] 2: 1190357p 217/208
Why does Zorro wait until bar 1348 to close l0517? That's the entry point + 43 bars, many multiples of my ExitTime, 2. It's not that there isn't an opportunity to exit at market before that. There is EUR/CAD action two bars before that, in 1346. See?
$ grep -n -A10 '^\[134[67]' Log/ATR_027test.log
2418:[1346: Tue 21.01. 12:00] 2: 1006122p 222/188
2419-[EUR/CAD::S] Skipped: Lots/Margin = 0
2420-[EUR/GBP::L] Skipped: Lots/Margin = 0
2421-{EUR/USD::l4663} Long 81@1.3524 Risk 1731$ tl at 12:00
2422-[EUR/USD::S2389] Cover 81@1.3524: +638$ at 12:00
2423-{EUR/CAD::l0412} Sell 52@1.4892: +1774$ at 12:00
2424-[EUR/CAD::L1457] Sell 52@1.4892: +893$ at 12:00
2425-{EUR/USD::s1458} Cover 76@1.3524: +2120$ at 12:00
2426-[EUR/USD::S4154] Cover 76@1.3524: +537$ at 12:00
2427-{EUR/USD::l4356} Sell 81@1.3524: -56.52 at 00:00
2428-[EUR/USD::S4764] Short 81@1.3524 Net trade at 00:00
--
2430:[1347: Wed 22.01. 00:00] 2: 1027716p 217/194
2431-[EUR/CAD::S] Skipped: Lots/Margin = 0
2432-[EUR/GBP::L] Skipped: Lots/Margin = 0
2433-{EUR/USD::l4765} Long 81@1.3558 Risk 1738$ tl at 00:00
2434-[EUR/USD::S2494] Cover 81@1.3558: +567$ at 00:00
2435-{EUR/USD::s0415} Cover 76@1.3558: +944$ at 00:00
2436-[EUR/USD::S4459] Cover 76@1.3558: -46.92 at 00:00
2437-{EUR/USD::l4561} Sell 81@1.3558: +72.13 at 12:00
2438-[EUR/USD::S4866] Short 81@1.3558 Net trade at 12:00
2439-
2440-[1348: Wed 22.01. 12:00] 2: 1032914p 218/194
And by they way, since I've just shown a trade that was held open for 43 bars, shouldn't Max trade bars be at least 43 in the Performance report? It says 41.
The attached gz file contains the Strategy, learned parameters, fac, test.log, and train.log.
The Strategy earns alot in Dec-Feb by ignoring my ExitTime. That's great. Perhaps it knows something I don't ! But, it's my robot. It should do what I tell it to do.