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
2 registered members (AndrewAMD, Imhotep), 567 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
Page 3 of 3 1 2 3
Re: Multicurrency Currency Strength [Re: JJ95] #486727
09/22/22 17:22
09/22/22 17:22
Joined: Sep 2022
Posts: 13
J
JJ95 Offline OP
Newbie
JJ95  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 13
I see what you are saying.

I would like to ask a question reagarding the ccyIdx function found in the indicator source code:

Quote

char CNames[128]; // MAXCURRENCIES * 4
int NumCurrencies = 0;
char* CURRENCY_NAME = "EUR";

ccyIdx(CURRENCY_NAME )


If we placed the function in a live example:

Inside the parenthesis, we are expecting to pass only 1 currency name. If we pass a currency such as EUR, the function will add EUR0 to CNames, then add 1 to NumCurrencies. If we wanted to add another currency, we will have to call the function again and pass another currency. Am I correct?

Thank you so much for your earliest replies

Re: Multicurrency Currency Strength [Re: JJ95] #486728
09/22/22 18:10
09/22/22 18:10
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Let me refer you to the documentation:
https://zorro-project.com/manual/en/ccy.htm

Notice that ccyIdx() is not documented. This is intentional. The script writer is not supposed to access it, since it is a helper function designed for the documented functions to use from Zorro's backend.

Really, the source code for ccyIdx is for your reference only. It's already compiled.

Scroll down to the bottom of the page to see an excellent example of how to use the currency strength functions from the script-side. It loops through your forex assets (pairs like "EUR/USD"), and it generates strength values for all currencies (like "USD" or "EUR"). Then it selects a strongest and weakest pair based on those values. Then it goes long on the strongest pair and short on the weakest pair, given a minimum strength threshold value is crossed.

Re: Multicurrency Currency Strength [Re: AndrewAMD] #486729
09/22/22 18:39
09/22/22 18:39
Joined: Sep 2022
Posts: 13
J
JJ95 Offline OP
Newbie
JJ95  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 13
Understood.

I will skip it and proceed to understanding ccySet function.

Re: Multicurrency Currency Strength [Re: JJ95] #486735
09/26/22 14:52
09/26/22 14:52
Joined: Sep 2022
Posts: 13
J
JJ95 Offline OP
Newbie
JJ95  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 13
Hello,

I need a small explanation regarding adding strength to currency and subtracting it from counter currency.

Code

void ccySet(var Strength)
{
	if(!isForex(g->asset)) return; 
	int n = ccyIdx(g->asset->sName);
	CStrenSum[n] += Strength; 
	CNum[n]++;
	CStren[n] = CStrenSum[n]/CNum[n];
	g->asset->vStrength = CStren[n];
	
	n = ccyIdx(g->asset->sName+4); // counter currency
	CStrenSum[n] -= Strength; 
	CNum[n]++;
	CStren[n] = CStrenSum[n]/CNum[n];
	g->asset->vStrength -= CStren[n];
}



Regarding the function isForex().
I am assuming it is checking if what is inside the parenthesis is a forex or not. However, I was unable to find it in the trading manual. Can I please receive an explanation about it or reference to it (link) that explains it's process?

Also, I would like to ask about the arrow (->) and how it works in Zorro. For instance, g->asset. To my knowledge we use arrow with pointers, correct? So, g is a pointer to a struct. But that has not been defined, correct? So, how is it operating then?

Thank you for your responses

Re: Multicurrency Currency Strength [Re: JJ95] #486736
09/26/22 15:13
09/26/22 15:13
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
Zorro knows whether or not it is forex based on the asset name. "EUR/USD" has seven characters and a slash in the middle.

g is defined in the headers. Pretty much everything in Zorro is defined in the headers.

On structs and pointers:
https://zorro-project.com/manual/en/structs.htm
https://zorro-project.com/manual/en/apointer.htm

Re: Multicurrency Currency Strength [Re: AndrewAMD] #486737
09/26/22 15:31
09/26/22 15:31
Joined: Sep 2022
Posts: 13
J
JJ95 Offline OP
Newbie
JJ95  Offline OP
Newbie
J

Joined: Sep 2022
Posts: 13
I see.

Where can I see how g is defined?

I apologize for the questions I ask. But I am trying to learn C, I feel that I am progressing.

But I cannot understand the codes, if I cannot see how the codes are written and how are they defined. Part of understanding the codes is to read through the logic, and I have failed to see the logic, because I cannot read it.

Is there any reference available, where can I read the definitions?

Once again, I thank you for your response

Re: Multicurrency Currency Strength [Re: JJ95] #486739
09/26/22 15:52
09/26/22 15:52
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
The header files are the ones in the include directory. Do a control-F search on all of them. Notepad++ also has a "find in files" feature which is also useful.

g is a pointer to a GLOBAL struct. That struct is also defined. Many macros are set up in the headers so that you can avoid pointer logic for simple scripts.

Page 3 of 3 1 2 3

Moderated by  Petra 

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