Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 559 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 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: 24
Q
Qw3rty Offline OP
Newbie
Qw3rty  Offline OP
Newbie
Q

Joined: Jun 2019
Posts: 24
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: 390
Czech Republic
G
Grat Offline
Senior Member
Grat  Offline
Senior Member
G

Joined: May 2015
Posts: 390
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: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
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: 24
Q
Qw3rty Offline OP
Newbie
Qw3rty  Offline OP
Newbie
Q

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

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


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1