Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, SBGuy, Petra), 801 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
YenTrader System #461642
08/15/16 19:13
08/15/16 19:13
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
Hi! I have found a simple system which works on the USD/JPY pair.

Once daily go long or short depending on two moving averages and use a stop loss.

It gives positive returns in the long run but a very low win rate.

Code:
bool UseEquityFilter = false;

function TradeYenTrader() 
{
	vars Price = series(price());
	vars SMASlow = series(SMA(Price, optimize(100, 5, 200, 5)));
	vars SMAFast = series(SMA(Price, optimize(50, 5, 200, 5)));
	
	Stop = optimize(15, 5, 50) * PIP;
	Trail = optimize(1, 1, 20) * PIP;
	
	// Equity curve filter
	var LotsBackup = Lots;
	
	if (UseEquityFilter)
	{	
		vars EquityCurve = series(EquityLong+EquityShort);
	  	vars EquityLP = series(LowPass(EquityCurve,75));
	  	if(EquityLP[0] < LowPass(EquityLP,100) && falling(EquityLP))
	  		Lots = -1;
	  	else
	    	Lots = 1;
	}
	
	if (NumOpenShort + NumOpenLong == 0) 
	{
		if (SMAFast[0] > SMASlow[0]) 
		{
			Margin = 0.5 * OptimalFLong * Capital * sqrt(max(1, Balance/Capital));
			enterLong();
		}
		else
		{
			Margin = 0.5 * OptimalFShort * Capital * sqrt(max(1, Balance/Capital));
			enterShort();
		}
	}
	
	Lots = LotsBackup;
}

function run() 
{
	set(PARAMETERS+FACTORS);
	
	BarPeriod = 1440;
	LookBack = 200;
	StartDate = 20010101;
	EndDate = 20160601;
	MonteCarlo = 1000;
	Confidence = 100;
	Capital = 10000;
	NumWFOCycles = 10;
	
	asset("USD/JPY");
	TradeYenTrader();	
}



I tried to optimize it with an equity filter. The filter reduced the drawdown but unfortunately also the total return.

Is this system any good? How could it be improved. Would you trade it or is it not usable?

For some reason I also get completely different results when using

Code:
BarPeriod = 60;
TimeFrame = 24;
LookBack = 200;



I dont understand why that is. Using set(TICKS) gives different results again.

Last edited by trenki2; 08/16/16 06:25.
Re: YenTrader System [Re: trenki2] #462009
09/02/16 16:19
09/02/16 16:19
Joined: May 2016
Posts: 180
Prague
pcz Offline
Member
pcz  Offline
Member

Joined: May 2016
Posts: 180
Prague
Originally Posted By: trenki2

Is this system any good? How could it be improved. Would you trade it or is it not usable?


I think this is not possible to judge unless we know the whole development process. You could have introduced a bias during the strategy design but we can't possibly know from the code and results only.

Originally Posted By: trenki2

For some reason I also get completely different results when using

Code:
BarPeriod = 60;
TimeFrame = 24;
LookBack = 200;



I dont understand why that is. Using set(TICKS) gives different results again.


I guess it's because the run function is called at the end of every bar. So when changing the BarPeriod the call frequency also changes. The TICKS flag further increases the testing precision as the price curve inside each bar is considered too (not just the OHLC values).

Re: YenTrader System [Re: pcz] #462018
09/03/16 14:59
09/03/16 14:59
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline OP
Junior Member
trenki2  Offline OP
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
Originally Posted By: pcz

I think this is not possible to judge unless we know the whole development process. You could have introduced a bias during the strategy design but we can't possibly know from the code and results only.


The development process was actually quite short. All I did was experiment with dual SMA crossover on some pairs with not much success and then tried to simply enter one trade per day with stoploss and trailing in the direction that depended on the relation between the two SMAs. And of course I optimized the parameters. This resulted in the code above.
It turned out that this worked in the past for USD/JPY but not really for the others.

Anyway, the equity curve does look quite ugly. The ulcer index is unbearably high and the win rate way too low. I think this is psychologially untradable.

Re: YenTrader System [Re: trenki2] #462020
09/03/16 17:48
09/03/16 17:48
Joined: May 2016
Posts: 180
Prague
pcz Offline
Member
pcz  Offline
Member

Joined: May 2016
Posts: 180
Prague
Originally Posted By: trenki2

Anyway, the equity curve does look quite ugly. The ulcer index is unbearably high and the win rate way too low. I think this is psychologially untradable.


Tried to run it with my asset params and I agree with you - wouldn't run it based solely on the results.


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