Gamestudio Links
Zorro Links
Newest Posts
script() function that sets Script
by AndrewAMD. 07/20/19 14:18
Beginners Workshop
by danatrader. 07/20/19 07:54
ANet and GSTsqlite files
by TheDynamit. 07/20/19 06:38
What are you working on?
by rayp. 07/19/19 20:34
missing trade variables
by sarmasboy. 07/19/19 15:54
histdata to t1
by sarmasboy. 07/19/19 14:26
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
6 registered members (danatrader, Dalla, AndrewAMD, TheDynamit, Zheka, Seymour), 641 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
ChrPr, fclaros, maxwellreturn, chtostoic, Charttrader
18259 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Help with calculation #477340
06/17/19 09:10
06/17/19 09:10
Joined: Jun 2019
Posts: 2
Q
Qw3rty Offline OP
Guest
Qw3rty  Offline OP
Guest
Q

Joined: Jun 2019
Posts: 2
Hi,

I am new to Zorro and C. I have been going through the manual and forums to get an idea of how the program and functions work.

How do I divide the close price of an asset by an indicator value?

function run()
{

vars c_euro= asset("EUR/USD");
var shortma = 20; //think I should use var not vars on this line
vars euro_ema= series(EMA(c_euro,shortma));

vars euro = (c_euro / euro_ema); // Not working
}

Do I need to use a loop or pointer (now is where I get lost)?

Any help would be awesome.

Qw3rty

Re: Help with calculation [Re: Qw3rty] #477343
06/17/19 11:45
06/17/19 11:45
Joined: May 2015
Posts: 146
Czech Republic
Grat Offline
Member
Grat  Offline
Member

Joined: May 2015
Posts: 146
Czech Republic
This is a totally wrong

a) first set the asset - select the symbol

asset("EUR/USD");

b) prepare price set

vars c_euro= series(price());

Re: Help with calculation [Re: Qw3rty] #477344
06/17/19 11:59
06/17/19 11:59
Joined: Feb 2017
Posts: 688
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 688
Chicago
Way off. You need to learn the difference between vars, var, and int.

Also, read the manual and verify what each function returns, and why.

For example, asset() does **not** return a vars.

Code
function run()
{
	asset("EUR/USD");
	vars c_euro= series(price());
	int shortma = 20;
	vars euro_ema= series(EMA(c_euro,shortma));
	vars euro = series(c_euro[0]/ euro_ema[0]);
}

Re: Help with calculation [Re: Qw3rty] #477349
06/18/19 08:01
06/18/19 08:01
Joined: Jun 2019
Posts: 2
Q
Qw3rty Offline OP
Guest
Qw3rty  Offline OP
Guest
Q

Joined: Jun 2019
Posts: 2
Thank you both for the replies. That makes sense.

I have gone through the manual as needed but not thorough enough I guess.


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