Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 7th_zorro), 1,203 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Help with a script #409133
10/11/12 23:49
10/11/12 23:49
Joined: Oct 2012
Posts: 10
Mexico
S
sabgto Offline OP
Newbie
sabgto  Offline OP
Newbie
S

Joined: Oct 2012
Posts: 10
Mexico
I’m just trying to understand the mechanics of “Zorro”. I took “the7 strategy” http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=408401#Post408401 and simplifying de code I have this:

function run(){
BarPeriod = 1440;
StartDate = 20120701;
NumDays = 60; // only two months in order to limit the output

var *pH = series(priceHigh());
var *pL = series(priceLow());
var *EMA5H = series(EMA(pH,5));
var *EMA5L = series(EMA(pL,5));

Stop = (HH(2) - LL(2));

if(priceOpen() > *EMA5H && priceClose() < *EMA5H && priceLow() > *EMA5L){
Entry = priceLow(0) - (5*PIP);
enterShort();
} else if(priceOpen() < *EMA5L && priceClose() > *EMA5L && priceHigh() < *EMA5H){
Entry = priceHigh(0) + (5*PIP);
enterLong();
}

plot("EMA5H", *EMA5H, 0, BLUE);
plot("EMA5L", *EMA5L, 0, BLUE);
}

When priceOpen < EMA5L and priceClose > EMA5L and priceHigh < EMA5H it should enterLong(). In the result chart I found this.



It seems to be that the condition to enterLong is satisfied however no enterLong order is executed. Could someone tell me if I have a mistake in the code or what is going on ?.

What should I do to post my code in a "code box" ?

Thanks.

Re: Help with a script [Re: sabgto] #409140
10/12/12 07:16
10/12/12 07:16
Joined: Sep 2012
Posts: 24
G
Gattaca Offline
Newbie
Gattaca  Offline
Newbie
G

Joined: Sep 2012
Posts: 24
That's interesting. I took your script and put in some printfs for debugging, and I think too, it should trigger at this bar.

Code:
function run(){
BarPeriod = 1440;
StartDate = 20120701;
NumDays = 60; // only two months in order to limit the output
set(LOGFILE);
var *pH = series(priceHigh());
var *pL = series(priceLow());
var *EMA5H = series(EMA(pH,5));
var *EMA5L = series(EMA(pL,5));

Stop = (HH(2) - LL(2));

printf("#\n%d %d   %f %f %f  %f  %f\n",day(0),month(0),priceOpen(),priceClose(),priceHigh(),*EMA5L,*EMA5H);
if(priceOpen() > *EMA5H && priceClose() < *EMA5H && priceLow() > *EMA5L){
printf("#\n %s" ,"EnterShort");
Entry = priceLow(0) - (5*PIP);

enterShort();
}
 if((priceOpen() < *EMA5L) && (priceClose() > *EMA5L) && (priceHigh() < *EMA5H)){
printf("#\n %s ","EnterLong");
Entry = priceHigh(0) + (5*PIP);

enterLong();
}

plot("EMA5H", *EMA5H, 0, BLUE);
plot("EMA5L", *EMA5L, 0, BLUE);
}


Last edited by Gattaca; 10/12/12 08:42.
Re: Help with a script [Re: Gattaca] #409148
10/12/12 11:04
10/12/12 11:04
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
July 14 was a saturday. The FXCM simulation does not accept trades on weekends, so no trade was executed.

Add the line

g->nWeekend = 0;

for executing trades also on weekends.

BTW, for a code box click on "Switch to full reply screen", then you have all the format options.

Re: Help with a script [Re: sabgto] #409157
10/12/12 16:02
10/12/12 16:02
Joined: Oct 2012
Posts: 10
Mexico
S
sabgto Offline OP
Newbie
sabgto  Offline OP
Newbie
S

Joined: Oct 2012
Posts: 10
Mexico
Thanks for your fast answer. No trades on weekand is fine. Congratulations JCL I think Zorro is a very very good job.


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