Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 677 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 5 1 2 3 4 5
Re: My Take on A Mega Script [Re: ] #435248
01/04/14 18:49
01/04/14 18:49

L
liftoff
Unregistered
liftoff
Unregistered
L



So I this is the zorro translation I came up with. Took me a little while to realise I had to compare the current price close to the previous highest in the last 100 based on the way the code is set. Learning with each day. The system seems to perform well in trending markets but not post 2008.
Code:
function run()
{
	set(TICKS);
	StartDate = 2002;
	EndDate = 2013;
	BarPeriod = 1440;
	LookBack = 200;
	
	
	
	//edge trading logic
	vars rHigh = series(HH(100)); 
	vars rLow = series(LL(100));
	vars Price = series(price());
	vars PriceClose = series(priceClose());
	vars PriceHigh = series(priceHigh());
	vars PriceLow = series(priceLow());
			
	// Pending buy order placed at the previous day High.	
	if(PriceClose[0]>rHigh[1] && NumOpenLong == 0){
		exitShort();
		Entry = PriceHigh[0];
		enterLong();
	}
	// Pending sell order placed at the previous day High.
	else if(PriceClose[0]<rLow[1]& NumOpenShort == 0){
		exitLong();
		Entry = PriceLow[0];
		enterShort();
	}
}



Code:
BackTest: PZ_ReversalTrendFollowingEA EUR/USD 2002..2013
Profit 490$  MI 4$  DD 52$  Capital 32$
Trades 11  Win 82%  Avg +585.9p  Bars 259
AR 136%  PF 9.79  SR 0.41  UI 14.5%  Error 151%


Another one to file under potential.

Re: My Take on A Mega Script [Re: ] #435249
01/04/14 19:05
01/04/14 19:05

A
acidburn
Unregistered
acidburn
Unregistered
A



I see a bigger problem with that strategy. 11 years -> 11 trades. The strategy as presented looks like it was designed for long term stock investors. Try it on AAPL, GOOG... grin

Re: My Take on A Mega Script [Re: ] #435251
01/04/14 20:15
01/04/14 20:15

L
liftoff
Unregistered
liftoff
Unregistered
L



@Acidburn. yeah, would really have caught those big moves on Apple and Google. But then again, one could lower the timeframe to 1H or 4H and add in some filters.

Re: My Take on A Mega Script [Re: ] #435391
01/07/14 10:00
01/07/14 10:00

L
liftoff
Unregistered
liftoff
Unregistered
L



Well I am going to have to park Tsey's Analysis of Financial Time Series on the to do list. I went through the first 60 pages and I have a headache already. I will be taken time series this semester in school so might be a good idea to sit through class and work along with the book. I will therefore jump to Urban and Emilio's Trading Systems. Its a 250 page book so I should have some free time to work on more script translations.

Re: My Take on A Mega Script [Re: ] #437485
02/18/14 11:58
02/18/14 11:58

L
liftoff
Unregistered
liftoff
Unregistered
L



I want to write a grid trading system similar to the Z5. I have been exploring trend following systems for awhile and I haven't had much luck with them. With the fundamental play on the EUR/CHF still on, might not be too much of a bad idea to put together a grid system that explores this market inefficiency. Who knows, in the process we might learn a thing or two about programming.

Re: My Take on A Mega Script [Re: ] #437759
02/25/14 07:19
02/25/14 07:19
Joined: Jan 2013
Posts: 68
I
ibra Offline
Junior Member
ibra  Offline
Junior Member
I

Joined: Jan 2013
Posts: 68
Hey Liftoff,

"Hucks trendcatcher", it reminds me of the same strat you presented over at babypips laugh Has it improved?

Re: My Take on A Mega Script [Re: ibra] #437761
02/25/14 09:24
02/25/14 09:24

L
liftoff
Unregistered
liftoff
Unregistered
L



Not really. I tried different variants but they all seem to give way worse results than she keeps posting on her blog. I think she might just be faking the results.

Re: My Take on A Mega Script [Re: ] #437866
02/27/14 15:26
02/27/14 15:26
Joined: Jan 2013
Posts: 68
I
ibra Offline
Junior Member
ibra  Offline
Junior Member
I

Joined: Jan 2013
Posts: 68
Alright!

Yesterday I was messing with the srategy you presented at babypips.
I replaced the RSI with a highpass filter instead.

Code:
function run()
{
	LookBack = 200;
	Hedge = 2;
	BarPeriod = 240;
	StartDate = 20030101;
	EndDate = 20140101;
	var Threshold = 0.0;
	
	set(PARAMETERS);
	
	
	
	var Timecycle = optimize(5,1,10);
	var Scaling = optimize(2,1,3);
	
	
	var *Price = series(price());
	var *LP5 = series (LowPass(Price,Timecycle));
	var *LP10 = series(LowPass(Price, Timecycle*Scaling));
	Trail = optimize(50,25,100)*PIP;
	Stop = optimize(4,2,6) *ATR(30);

	
   var hp = optimize(50,25,75);
   var *RSI10 = series(HighPass(Price,hp));
	
	static int crossed = 0;
	
	if(crossOver(LP5,LP10))
		crossed = 3;
		
	else if (crossUnder(LP5,LP10))
		crossed = -3;
	
   if(crossed > 0 && crossOver(RSI10, Threshold))
	{
		enterLong();
		crossed = 0;
	}

	else if(crossed < 0 && crossUnder(RSI10, Threshold))
	{
		enterShort();
		crossed = 0;
		
	}
	else crossed -= sign(crossed);
	

	
	plot ("LP1", LP5[0], 0, RED);
	plot ("LP2", LP10[0], 0, BLUE);
	plot ("RSI", RSI10[0], NEW, BLACK);
	plot ("Thres", Threshold, 0, RED);
   plot ("Thres1", -Threshold, 0, RED);
}



There are pretty many optimized parameters...

Backtest looks decent (I guess) on for example EURUSD and GBPUSD.
But I don't know if I like the looks of the equity curves...
And I haven't done any WFO yet. Feel free to improve it.

Equity curve EURUSD:
http://sv.tinypic.com/view.php?pic=ifweg6&s=8

Equity curve GBPUSD:
http://sv.tinypic.com/view.php?pic=161dxsl&s=8#.Uw9Y9fl5N5E

Re: My Take on A Mega Script [Re: ibra] #438045
03/05/14 15:42
03/05/14 15:42

L
liftoff
Unregistered
liftoff
Unregistered
L



@Ibra I haven't really looked to this system in a very long time. But I think I will play around with it tonight.

Re: My Take on A Mega Script [Re: ] #438471
03/15/14 10:17
03/15/14 10:17

L
liftoff
Unregistered
liftoff
Unregistered
L



So I managed to put together a grid trading system for the EUR/CHF and it seems to be holding things together. As long as the inefficiency is prevalent in that pair it should continue to make money. Here is the code. I used the grid script that comes with Zorro and made a couple of changes.
Code:
// Grid trader (needs hedging - non-US accounts only)
 
// find all trades at a grid line
bool findTrade(var Price,var Grid,bool IsShort)
{
	for(open_trades)
		if((TradeIsShort == IsShort)
			and between(TradeEntryLimit,Price-Grid/2,Price+Grid/2))
				return true;
	return false;
}

int run() 
{
	set(TICKS);					// Test using 1 minute Bars
	StartDate = 2012;					// Start trading from 2012
	BarPeriod = 240;              // Trade the 4 Hour chart
	Hedge = 2;                    // allow long & short trades at the same time
	EntryTime = ExitTime = 500;   // close trades that have been opened for 3 months
	asset("EUR/CHF");
	var Price;							
	var Grid = 25*PIP;            // set grid siz to 25 pips
	var Close = priceClose();		// Use the price close of bars
	
// place pending trades at 5 grid lines 
// above and below the current price
	for(Price = 0; Price < Close+5*Grid; Price += Grid)
	{
// find the lowest grid line
		if(Price < Close-5*Grid) continue;
// place not more than 200 trades		
		if(NumOpenTotal + NumPendingTotal > 200) break;
// place short trades below the current price
		if(Price < Close and !findTrade(Price,Grid,true))
			enterShort(1,Price,20*Grid,Grid);  		
// place long trades above the current price
		else if(Price > Close and !findTrade(Price,Grid,false))
			enterLong(1,Price,20*Grid,Grid);
	}
}




Attached Files
eurchfgrid.png (30 downloads)
Last edited by liftoff; 03/15/14 10:18.
Page 4 of 5 1 2 3 4 5

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