Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
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
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (Ayumi, Quad, rki, 7th_zorro), 482 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Lindencourt Daily System #410260
10/31/12 10:23
10/31/12 10:23
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
This has to be my most sophisticated script yet (which is not saying much). It trades the Lindencourt Daily system which can be found here...

http://www.lindencourt.net/daily_fx_system.html

I had the problem that the system trades a stoch cross up above the 100 ema but also waits for the stochs to be above the 20 level or reversed for a down trend. I got round this by first determining whether the cross was valid, ie above the 100 ema and stochs crossed up. Then I determined that if there was no trade open and the stochs were in the right direction and the stochs were over 20 then enter long. Similar for short.

There is one thing that the script does not do which is to move to break even after 100 pips. I don't know what difference this would make to the system. In my manual trading I have found that half the time moving to break even doesn't really improve your returns but that's part of the system so to give it a fair go we should try to code this exactly.

I wonder if JCL or anyone else would be able to tell me how to move to break even afer a certain pip amount? (also how to do the same with ATR which makes more sense to me).

Here is the code anyway, it returns about 20% a year, nothing to write home about.

Code:
function run()
{    
     StartDate = 2006;
     BarPeriod = 1440;
               
     while(asset(loop("EUR/USD","AUD/USD","GBP/USD","USD/CHF","USD/JPY","USD/CAD","XAU/USD","XAG/USD")))
     {
     	
     // Set up variables
     
     var crossupvalid = 0;
     var crossdownvalid = 0;
     var *ClosePrice = series(priceClose());
     
     // Set up Stochs and 100 ema
     
     Stoch(8,3,MAType_SMA,3,MAType_SMA);
     var *stochk = series(rSlowK);
     var *stochd = series(rSlowD);
     var *ema100 = series(EMA(ClosePrice,100));
     
     // Set Stop Loss
          	
     Stop = 2* ATR(20);
     
     // Check for cross up or down and which side of 100 ema
         
     if(ClosePrice[0] > ema100[0] && stochk[0] > stochd[0])
	    crossupvalid = 1;
	  else
	    crossupvalid = 0;
	  if(ClosePrice[0] < ema100[0] && stochk[0] < stochd[0])
	    crossdownvalid = 1;
	  else
	    crossdownvalid = 0;
	    
	  // Check Stochs position in relation to 20/80 and if no open trades then enter
     
     if(numLong(0) == 0 && crossupvalid == 1 && stochk[0] > 20)
       enterLong();
     if(numShort(0) == 0 && crossdownvalid == 1 && stochk[0] < 80)
       enterShort();
       
     // Check for exit conditions
          
     if(numLong(0) > 0 && stochk[0] < stochd[0])  
       exitLong();
     if(numShort(0) > 0 && stochk[0] > stochd[0])
       exitShort();     
     }
}


Re: Lindencourt Daily System [Re: hughbriss] #410294
10/31/12 18:57
10/31/12 18:57
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Hmm, as far as I see, the script is different to your description of it. You're not checking stochk/stochd crossings, you're only checking if one is higher than the other. This gives a different trade behavior.

For a crossing, use

if(... && crossOver(stochk,stochd)) ...

http://zorro-trader.com/manual/en/crossover.htm

Moving to breakeven after 100 pips profit would currently require a trade function. The next Zorro update, 1.04, will contain a special trailing mode that can be used to do that in a simpler way.

Re: Lindencourt Daily System [Re: jcl] #410300
10/31/12 20:38
10/31/12 20:38
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Yes but the system is not based just on the cross, the cross must happen and the stochk must be above 20 for an up cross and below 80 for a down cross so what the script does is determine if the price is above or below the 100 ema and that the stochs are in the right order, then as long as no other orders are open it will trade as long as the criteria are met. This means that if the price is above the 100 ema && the stochs are crossed && the stochs are above 20 that it will take a long order. Similar for short.

This prevents it from entering when the stochs cross below 20 and above 80. In testing this does make a difference to the profitability.

Re: Lindencourt Daily System [Re: hughbriss] #414235
12/27/12 10:38
12/27/12 10:38
Joined: Nov 2012
Posts: 209
S
SFF Offline
Member
SFF  Offline
Member
S

Joined: Nov 2012
Posts: 209
I have made another script from the above code and I don't understand the result - actually there is no result.
Please test it and explain why this happens.

Code:
function run(){
	
	int MA_Period = 34;
	
	int crossupvalid = 0;
   int crossdownvalid = 0;
	
	vars main_price = series(price());
	vars main_ma = series(SMA(main_price, MA_Period));
	
	Stoch(5,3,MAType_SMA,3,MAType_SMA);
	
     vars stochk = series(rSlowK);
     vars stochd = series(rSlowD);
	
	TakeProfit = 30*PIP;
	Stop = 20*PIP;
	
	    
	    if(numLong == 0 && main_price[0] > main_ma[0] && stochk[0] < 20)
         enterLong();
     if(numShort == 0 && main_price[0] < main_ma[0] && stochk[0] > 80)
       enterShort();
       
       if(numLong > 0 && stochk[0] < stochd[0])  
       exitLong();
     if(numShort > 0 && stochk[0] > stochd[0])
       exitShort();
}


Last edited by SFF; 12/27/12 12:59.
Re: Lindencourt Daily System [Re: SFF] #414272
12/28/12 05:01
12/28/12 05:01
Joined: Dec 2012
Posts: 14
P
Pipinator Offline
Newbie
Pipinator  Offline
Newbie
P

Joined: Dec 2012
Posts: 14
Yea.. I get that alot laugh If there is no trade, there is no result.
So somehow you have managed to be over-selective in your trade filter behavior.

I would plot your indicators to visually see what you are triggering on.

To get the price bars without a trade use
set(PLOTPRICE+LOGFILE);

The first one gets you the price bars, the second created a log file where you can printf out to do some reality checks.

Good luck!

Pipinator

Re: Lindencourt Daily System [Re: Pipinator] #414279
12/28/12 08:59
12/28/12 08:59
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
The reason is here not a too selective filter, but just wrong code. Look at the original system:

if(numLong(0) == 0 && ....

Your version is missing the (0). In C, a function without argument list is a function pointer, and can never be zero. So your system can never execute any trade.

Anyway better use the trade statistics variables, such as NumOpenLong and NumOpenShort. The old numLong() function is depreciated.


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