Gamestudio Links
Zorro Links
Newest Posts
Idx calculated every tick
by Grat. 11/13/19 04:30
using random()
by felixfx. 11/13/19 04:17
Moving Average crossover
by gra9. 11/12/19 17:00
Can't Connect..IG Plugin
by TTT. 11/12/19 14:35
IG Plugin
by TTT. 11/12/19 14:03
Login 0 IG ..
by TTT. 11/12/19 12:59
trade idea - your inputs needed
by Brax. 11/12/19 11:26
IG plugin initial release
by TTT. 11/12/19 10:27
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
5 registered members (Grat, felixfx, RealSerious3D, Dooley, AndrewAMD), 586 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Dev_ill, Ryu, andrews825, KKelk, TTT
18327 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: 164
Czech Republic
Grat Online
Member
Grat  Online
Member

Joined: May 2015
Posts: 164
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: 788
Chicago
AndrewAMD Online
User
AndrewAMD  Online
User

Joined: Feb 2017
Posts: 788
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