Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, Edgar_Herrera), 804 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Newbie coding question. HELP Please! #475410
12/06/18 22:15
12/06/18 22:15
Joined: Dec 2018
Posts: 2
ON
N
Neil_G Offline OP
Guest
Neil_G  Offline OP
Guest
N

Joined: Dec 2018
Posts: 2
ON
Hi,

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:

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"))
	{
		if(Price<PriceLow)
			enterShort(); 
		else if(Price>PriceHigh)
			enterLong();
	}
}



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.

Thanks,

Neil

Re: Newbie coding question. HELP Please! [Re: Neil_G] #475418
12/07/18 11:43
12/07/18 11:43
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
When you're using price series instead of prices, it's Price[0] or PriceLow[0]. And 50 pips are 50*PIP.

Re: Newbie coding question. HELP Please! [Re: jcl] #475432
12/07/18 16:27
12/07/18 16:27
Joined: Dec 2018
Posts: 2
ON
N
Neil_G Offline OP
Guest
Neil_G  Offline OP
Guest
N

Joined: Dec 2018
Posts: 2
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.

Re: Newbie coding question. HELP Please! [Re: Neil_G] #475439
12/09/18 15:28
12/09/18 15:28
Joined: Apr 2017
Posts: 106
3
3dgamelight Offline
Member
3dgamelight  Offline
Member
3

Joined: Apr 2017
Posts: 106
This is not the wrong forum? This is non-interactive.


Moderated by  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) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1