function tradeOneNightStand() { vars Price = series(price()); vars SMAShort = series(SMA(Price, optimize(10,5,20))); vars SMALong = series(SMA(Price, optimize(40,30,80,5))); Stop = optimize(100,100,500,10) * PIP; var BuyStop,SellStop; BuyStop = HH(10) + 1*PIP; SellStop = LL(10) - 1*PIP; if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMAShort[0] > SMALong[0] && rising(SMAShort) && rising(SMALong)) { Margin = 0.1 * OptimalFLong * Capital; enterLong(0,BuyStop); } else if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMAShort[0] < SMALong[0] && falling(SMAShort) && falling(SMALong)) { Margin = 0.1 * OptimalFShort * Capital; enterShort(0,SellStop); } if (dow() != 5 && dow() != 6 && dow() != 7) { exitLong(); exitShort(); } } function run() { set(PARAMETERS+FACTORS); BarPeriod = 1440; StartDate = 2005; NumWFOCycles = 5; Capital = 50000; LookBack = 120; while(asset(loop("USD/CHF","USD/JPY","GBP/USD","EUR/USD","EUR/JPY","USD/CAD"))) tradeOneNightStand(); }
Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy
oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de