string selected_asset;
function run() {
if (is(INITRUN)) {
BarPeriod = 348;
LookBack = 501;
StartDate = 20131020;
EndDate = 20140420;
set(RULES);
set(PARAMETERS);
if (Train) {
Hedge = 2;
Detrend = 1;
} else {
set(NFA);
Hedge = 4;
Detrend = 0;
}
TradesPerBar = 2;
Weekend = 1;
EntryTime = 1;
ExitTime = 24 * 60 / BarPeriod;
NumOptCycles = 2;
NumSampleCycles = 2;
NumWFOCycles = 22;
Confidence = 75;
}
while(selected_asset = loop("CAD/JPY", "CHF/JPY")) {
asset(selected_asset);
var atrx = ATR(238);
TakeProfit = 3 * atrx;
Stop = 2 * atrx;
vars Price = series(price());
var p00 = optimize(174, 87, 348, -100);
var v00 = StdDev(Price, p00);
if (adviseLong(PERCEPTRON, 0, v00) > 0) {
enterLong();
}
if (adviseShort(PERCEPTRON, 0, v00) > 0) {
enterShort();
}
}
}