Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (alibaba, howardR, basik85278), 756 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
System´"jumps over" trades #416015
01/27/13 07:59
01/27/13 07:59
Joined: Jan 2013
Posts: 5
B
beerz Offline OP
Newbie
beerz  Offline OP
Newbie
B

Joined: Jan 2013
Posts: 5
Hi,

So, ive been playing around with different types of script in purpose to get mor exeperienced in programming. Right now, im doing this following script when I saw a problem occured:

function run ()


{

StartDate = 20110601;
EndDate = 20130120;
BarPeriod = 1440;

Stop = 50*PIP;
Trail = 40*PIP;
TrailLock = 1;


vars day_low = series(priceLow());
vars day_high = series(priceHigh());
vars day_close = series(priceClose());
vars EMA50 = series(EMA(day_close, 50));




if (day_close[0] < day_low[1] && day_close[0] < EMA50[1])
enterShort();


plot ("EMA50", EMA50[0], 0, RED);

}

It looks like it "jumps over" some trades, where (as i can see) it should've executed a trade since all conditions where true. Look at following link where I marked to see what I mean. http://postimage.org/image/kp13ttrmz/

Can someone explain why this is happening?

Thanks

Beerz

Re: System´"jumps over" trades [Re: beerz] #416026
01/27/13 12:31
01/27/13 12:31
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
Weekend, probably?

Re: System´"jumps over" trades [Re: Petra] #416143
01/28/13 10:18
01/28/13 10:18
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
It happens often that a trade does not execute as you expect - either due to a bug in your code, or because trading is not allowed due to weekend or other reasons. Your code, as far as I see, is ok.

You can often quickly find the reason when you activate LOGFILE, and/or use the printf function so that you see if you attempted to open a position on a Saturday, or if the if(..) condition was true or not.

Re: System´"jumps over" trades [Re: jcl] #416148
01/28/13 11:26
01/28/13 11:26
Joined: Sep 2012
Posts: 99
T
TankWolf Offline
Junior Member
TankWolf  Offline
Junior Member
T

Joined: Sep 2012
Posts: 99
Maybe due to lack of a long enough lookback period thats been the cause of problem trades for me before. Not only that but your code compares EMA(1) which is the value for yesterday's EMA and won't be the exact value as shown on your plot line I don't believe. Check your printf values as Jcl says to be sure though.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1