Gamestudio Links
Zorro Links
Newest Posts
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
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TedMar, dr_panther), 1,049 guests, and 0 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 script #415723
01/22/13 20:23
01/22/13 20:23
Joined: Jan 2013
Posts: 5
B
beerz Offline OP
Newbie
beerz  Offline OP
Newbie
B

Joined: Jan 2013
Posts: 5
So im trying to do this simple script, but cant get it right:

function run ()


{

StartDate = 20120601;
EndDate = 20130120;
BarPeriod = 1440;

Stop = 50*PIP;


vars day_close = series(priceClose());
vars EMA20 = series(EMA(day_close,20));



if (day_close > EMA20)
enterLong();



I want this system to enter long when the daily bar CLOSES above EMA20. But when im checking the result-chart, this is clearly not what it does. Can anyone see what i am doing wrong here?

Thanks!

Beerz

Re: Help with script [Re: beerz] #415741
01/23/13 09:09
01/23/13 09:09
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Take this as a little puzzle: What is wrong with this comparison?

if (day_close > EMA20)
...

Re: Help with script [Re: jcl] #415759
01/23/13 12:30
01/23/13 12:30
Joined: Jan 2013
Posts: 5
B
beerz Offline OP
Newbie
beerz  Offline OP
Newbie
B

Joined: Jan 2013
Posts: 5
Originally Posted By: jcl
Take this as a little puzzle: What is wrong with this comparison?

if (day_close > EMA20)
...


Hmm,

My first thought is that maybe there's no differnece between day_close and EMA20 since I've typed "vars EMA20 = series(EMA(day_close,20));" before? So the computer doesn't understand what I mean. And by the looks of the result-chart... It enters a trade almost every day ^^.

Thanks jcl for helping me out.

Beerz

Re: Help with script [Re: beerz] #415766
01/23/13 13:16
01/23/13 13:16
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, I solve the puzzle:

You're comparing two series. What you wanted instead was comparing the two recent values of the series:

if(day_close[0] > EMA20[0])
...

Look here: http://manual.zorro-trader.com/series.htm

Re: Help with script [Re: jcl] #415784
01/23/13 16:35
01/23/13 16:35
Joined: Jan 2013
Posts: 5
B
beerz Offline OP
Newbie
beerz  Offline OP
Newbie
B

Joined: Jan 2013
Posts: 5
Originally Posted By: jcl
Ok, I solve the puzzle:

You're comparing two series. What you wanted instead was comparing the two recent values of the series:

if(day_close[0] > EMA20[0])
...

Look here: http://manual.zorro-trader.com/series.htm


Haha. Thanks jcl. I'm lucky you are here to save me all the time, so far laugh.
Ok, I will try with the code you showed me. And i'm also going to try to plot the ma too.

Thanks once again.

Beerz


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