Gamestudio Links
Zorro Links
Newest Posts
Votes for future features
by 7th_zorro
Today at 01:57
Open WMB file
by Superku
Yesterday at 23:37
Stopping and resuming sessions without interrupting trade statis
by jcl
Yesterday at 08:14
Best Devlopment Experience
by j45p41
03/20/19 23:04
Blog Post: Continuous Futures Data in Zorro
by chsmac85
03/20/19 15:59
Error message : Closing Order Quantity
by OptimusPrime
03/20/19 12:49
script can work but no result(Profit and loss)
by jcl
03/20/19 09:12
AUM Magazine
Latest Screens
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Who's Online
3 registered (AndrewAMD, 7th_zorro, 1 invisible), 658 Guests and 8 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
FrankFred, QuartzLoop, Conchip, danatrader, ilikezorro
18190 Registered Users
Topic Options
Rate This Topic
#475410 - 12/06/18 23:15 Newbie coding question. HELP Please!
Neil_G Offline

Registered: 12/06/18
Posts: 2
Loc: ON

Newbie here.

As an exercise in learning Zorro, I'm trying to code a youtube strategy (yes, I know it won't make me any money :-) ).

The strategy:

  • entry after first hour of forex session (EUR session starts at 0800h UTC)
  • if 2nd hour of session goes above high of first hour, enter long
  • if 2nd hour of session goes below low of first hour, enter short
  • exit after 4 hours
  • TP=50 PIPs

Here is my code:

function run()
	BarPeriod = 60;
	LifeTime = 4;
	int LondonOpen = timeOffset(UTC,0,9,0); 
	vars PriceHigh = series(priceHigh(1));
	vars PriceLow = series(priceLow(1));
	vars Price = series(price());

	TakeProfit = 50;
	if((LondonOpen==0) && (Asset="GBP/USD"))
		else if(Price>PriceHigh)

Am I even close?

Problems (that I've noticed so far):
  • trades don't enter at high or low of bar
  • trades don't go in proper direction

Any help/suggestions would be appreciated.



#475418 - 12/07/18 12:43 Re: Newbie coding question. HELP Please! [Re: Neil_G]
jcl Offline

Chief Engineer

Registered: 07/22/00
Posts: 26788
Loc: Frankfurt
When you're using price series instead of prices, it's Price[0] or PriceLow[0]. And 50 pips are 50*PIP.

#475432 - 12/07/18 17:27 Re: Newbie coding question. HELP Please! [Re: jcl]
Neil_G Offline

Registered: 12/06/18
Posts: 2
Loc: ON
I had the 50*PIP in my code (accidentally deleted it from post when I removed some comments).

I had it in my head that Zorro worked on sets (which, given that I got results, I guess it sort of does). I changed the code to reflect your comment (and changed the BarPeriod = 1 and LifeTime) and it appears I'm getting what I want.

Thanks jcl.

#475439 - 12/09/18 16:28 Re: Newbie coding question. HELP Please! [Re: Neil_G]
3dgamelight Offline

Registered: 04/24/17
Posts: 106
This is not the wrong forum? This is non-interactive.


Moderator:  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at)