|
Lindencourt Daily System
#410260
10/31/12 10:23
10/31/12 10:23
|
Joined: Oct 2012
Posts: 75
hughbriss
OP
Junior Member
|
OP
Junior Member
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.htmlI 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.
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,986 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,986
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: hughbriss]
#414235
12/27/12 10:38
12/27/12 10:38
|
Joined: Nov 2012
Posts: 209
SFF
Member
|
Member
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.
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
Pipinator
Newbie
|
Newbie
Joined: Dec 2012
Posts: 14
|
Yea.. I get that alot 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
|
|
|
|