Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (RealSerious3D, AndrewAMD, chsmac85, dr_panther, TedMar), 942 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Posted BabyPips Strategy #410313
11/01/12 07:37
11/01/12 07:37
Joined: Sep 2012
Posts: 99
T
TankWolf Offline OP
Junior Member
TankWolf  Offline OP
Junior Member
T

Joined: Sep 2012
Posts: 99
I found this strategy posted on BabyPips that had pretty simple rules and I thought would be a great practice. Here are the rules:

Quote:

So the rules are simple.
ATR (11) with MA (21)
ADX (14)

Trade rules:

BUY:

Entry:

1. ADX Is Over 25
2. ATR is above MA
3. +DI crosses -DI
4. SL = Last candles low + 2 pips if SL would be below 10 pips use 15 pips as SL

Exit:

1. Close When TP hits 20 pips


SELL:

Entry:

1. ADX Is Over 25
2. ATR is below MA
3. -DI crosses +DI
4. SL = Last candles high - 2 pips if SL would be below 10 pips use 15 pips as SL

Exit:

1. Close When TP hits 20 pips


Work time:

Start at : 8:00 GMT +0 (London opens)
End: 21:00 GMT +0 (NY closes)

I had back tested it by hand , last month on M5 chart was:
30 Trades
12 bad trades
18 good trades
60% wining

Read more: http://forums.babypips.com/free-forex-trading-systems/48196-simple-60-profitable.html#ixzz2AxCW78k3


The author claims on his backtest for last month that 30 trades would of occurred. In my next post is my code to replicate his strategy.

Re: Posted BabyPips Strategy [Re: TankWolf] #410314
11/01/12 07:39
11/01/12 07:39
Joined: Sep 2012
Posts: 99
T
TankWolf Offline OP
Junior Member
TankWolf  Offline OP
Junior Member
T

Joined: Sep 2012
Posts: 99
Quote:

function run()
{
set(PARAMETERS+FACTORS+TESTNOW);
BarPeriod = 5;
StartDate = 2006;
NumYears = 7;
NumWFOCycles = 6;
LookBack = 100;

var* Close = series(priceClose());
var* High = series(priceHigh());
var* Low = series(priceLow());
var* PLUSDI14 = series(PlusDI(14));
var* MINUSDI14 = series(MinusDI(14));
var* ADX14 = series(ADX(14));
var* ATR11 = series(ATR(11));
var* SMAATR11 = series(SMA(ATR11,21));
plot("ADX14",ADX14[0],NEW,0x0000CC);
plot("ATR11",ATR11[0],NEW,BLUE);
plot("SMAATR11",SMAATR11[0],NEW,BLUE);

if(hour(0) >= lhour(UTC,7) && hour(0) <= lhour(UTC,21))

if(ADX14[0] > 25 && ATR11[0] > SMAATR11[0] && crossOver(PLUSDI14,MINUSDI14) && NumOpenLong == 0) {
enterLong();
if(Low[1] + (2*PIP) < (10*PIP))
Stop = 15*PIP;
else
Stop = Low[1] + (2*PIP);
}
else if(ADX14[0] > 25 && ATR11[0] < SMAATR11[0] && crossOver(MINUSDI14,PLUSDI14) && NumOpenShort == 0) {
enterShort();
if(High[1] - (2*PIP) < (10*PIP))
Stop = 15*PIP;
else
Stop = Low[1] - (2*PIP);
}
}


This is my attempt at coding the strategy as per the rules, I think Ive got the logic all right but any assistance/advice would be great.

Re: Posted BabyPips Strategy [Re: TankWolf] #410315
11/01/12 07:40
11/01/12 07:40
Joined: Sep 2012
Posts: 99
T
TankWolf Offline OP
Junior Member
TankWolf  Offline OP
Junior Member
T

Joined: Sep 2012
Posts: 99
The results:
Quote:

Walk-Forward Test Vulture EUR/USD - performance report

Simulation period 03.01.2006-03.10.2012
Test period 10.08.2009-03.10.2012
WFO test cycles 5 x 46905 bars (33 weeks)
Training cycles 6 x 265795 bars (191 weeks)
Lookback time 100 bars (8 hours)
Assumed spread 2.6 PIP (roll -0.06/0.03)
Assumed slippage 10.0 sec
Contracts per lot 800

Gross win/loss 331$ / -107$ (+2797p)
Average profit 71$/year, 6$/month, 0$/day
Max drawdown -48$ (MAE -69$)
Max down time 77 weeks from Apr 2011
Largest margin 5$
Trade volume 72639$ (23070$/year)
Transaction costs -14$ spr, -1$ slp, -2$ rol
Capital required $100

Number of trades 67 (21/year)
Percent winning 39%
Max win/loss 105$ / -21$
Avg trade profit 3$ 41.7p (+13$ / -3$)
Avg trade bars 1135 (+2399 / -333)
Max trade bars 21147 (15 weeks)
Time in market 32%
Max open trades 1
Max win/loss streak 3 / 11 (71.76% / 9.05% per year)

Annual return 71%
Profit factor 3.09 (PRR 2.15)
Sharpe ratio 1.14
Kelly criterion 1.81
OptimalF .557
Ulcer index 12%
Prediction error 60%

Trade details OptF ProF Win/Loss Cycles

EUR/USD:L .096 2.87 20/34 ///\/
EUR/USD:S .999 13.75 6/7 /\\//

Re: Posted BabyPips Strategy [Re: TankWolf] #410316
11/01/12 07:43
11/01/12 07:43
Joined: Sep 2012
Posts: 99
T
TankWolf Offline OP
Junior Member
TankWolf  Offline OP
Junior Member
T

Joined: Sep 2012
Posts: 99
Notice how in my results over the test period of nearly 3 years it only took 67 trades (21 per year). That doesnt look right to me, and according to the strategy creator he had 30 trades alone last month. Perhaps its something to do with the PlusDI & MinusDI functions or the moving average of the ATR. If you check the babypips thread the creator of the strategy combines the two indicators together so I figured that I had to make a moving average of the ATR to replicate that. Also the only difference I forgot to mention in my attempted code for this strategy is I took out the TakeProfit target because it seemed to make the results worse.

As I said above if anyone wants to play around, use this strategy or better it any way please feel free to contribute.

Re: Posted BabyPips Strategy [Re: TankWolf] #410328
11/01/12 10:07
11/01/12 10:07
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
As far as I see, your script matches your description with following exceptions -

- TP is missing and the description says nothing about a limitation to only one open position.

- Stop is set after the trade was already entered - must be set before.

- the hour calculation looks wrong. Correct: if(lhour(UTC) >= 7 and lhour(UTC) <= 21) { ... put the rest here ... }


Re: Posted BabyPips Strategy [Re: jcl] #410333
11/01/12 10:28
11/01/12 10:28
Joined: Feb 2012
Posts: 37
S
stevegee58 Offline
Newbie
stevegee58  Offline
Newbie
S

Joined: Feb 2012
Posts: 37
Originally Posted By: jcl

- Stop is set after the trade was already entered - must be set before.


That's an interesting point. With American ECN rules you're required to enter the SL and TP after the trade is entered. They're not allowed to be attached to a pending order.

ZT doesn't seem to handle this distinction natively.

Last edited by stevegee58; 11/01/12 10:30.
Re: Posted BabyPips Strategy [Re: stevegee58] #410334
11/01/12 10:30
11/01/12 10:30
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Syntax rules in a programming language and the American ECN rules have not much in common. laugh

Re: Posted BabyPips Strategy [Re: jcl] #410336
11/01/12 11:15
11/01/12 11:15
Joined: Feb 2012
Posts: 37
S
stevegee58 Offline
Newbie
stevegee58  Offline
Newbie
S

Joined: Feb 2012
Posts: 37
I have an include file of functions I used in MT4 that act as an extension to the platform and automatically handle the ECN nonsense. It was a pain to implement but now it's transparent.

I could see someone doing something similar in ZT.

Re: Posted BabyPips Strategy [Re: stevegee58] #410338
11/01/12 11:24
11/01/12 11:24
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
No, this is not necessary. The current version is not NFA compliant anyway. NFA compliance will be implemented in one of the next updates. In fact it's already programmed and we're just testing it for release with version 1.04. This has no effect on your script and you won't need to include a file of extension functions.

Re: Posted BabyPips Strategy [Re: jcl] #410340
11/01/12 11:50
11/01/12 11:50
Joined: Oct 2012
Posts: 16
Aix en Provence, France
Squalou Offline
Newbie
Squalou  Offline
Newbie

Joined: Oct 2012
Posts: 16
Aix en Provence, France
Hi,

i'm currently practicing ZT , so i thought i would try this strategy example posted here.
However, the script as posted by TankWolf won't compile with the (supposedly most recent ?) ZT version i downloaded a few days ago, which is 1.01.

It complains about "NumOpenShort" and "NumOpenLong" that do not exist.
Indeed, i cannot find them in the header files (trading structures and macros).
The editor's Command Help does not show them either.
However, the Online User Manual does list them in the "Trade statistics parameters " section.

I replaced them with "NumLongTotal" and "NumShortTotal" respectively to make it work.

Am i missing something ?

Sq

Page 1 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1