Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (rki), 405 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Enter bid price #474611
10/25/18 14:39
10/25/18 14:39
Joined: Sep 2018
Posts: 29
K
kerplunk1899 Offline OP
Newbie
kerplunk1899  Offline OP
Newbie
K

Joined: Sep 2018
Posts: 29
Hi guys,

I'm currently facing a problem scripting my code.
This is about the retrieving of the right Entering prices of my trades.
I'm working on a portfolio strategy.

In order to get the Enter and Close (or actual) prices I'm using the variables:
- TradePriceOpen
- TradePriceClose

As written in the manual these give the AskPrice of a trade at the moment it was opened.
Also, I know that if I want to get the Bid one I simply have to subtract the Spread of that moment.
BUT, what if I want to obtain this some candels after the trade got opened???
Is there a way to accomplished this?



To work around this issue I also thought of self saving the variable into an array.
But I'm getting stuck again. Here's an extract of the code I'm using:

Code:
assetList("AssetsFix");
int Nasset, N;

for(N = 0; Assets[N]; N++);
Nasset = N;
N=0;

var Spreads[Nasset]; /* Spread Array */


while(asset(loop(Assets))){
	
	Spread[N] = Spread;

	if(/*something happened*/)
		enterLong();
	else
		enterShort();

N++
}




Unluckly when I put "var Spreads[Nasset];" Zorro gives me error frown
If I simply put a static number, it works instead.


Could you please, please, please help to figure this all out??
Thanks you soooooo much!!!

Last edited by kerplunk1899; 10/25/18 14:40.
Re: Enter bid price [Re: kerplunk1899] #474662
10/28/18 13:59
10/28/18 13:59
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
In C you generate a dynamic array with malloc. The trade bid is simply TradePriceOpen - TradeSpread. In old Zorro versions you must define the tradespread:

#define TradeSpread ((var)g->tr->fSpread)

Re: Enter bid price [Re: Spirit] #474667
10/28/18 16:02
10/28/18 16:02
Joined: Sep 2018
Posts: 29
K
kerplunk1899 Offline OP
Newbie
kerplunk1899  Offline OP
Newbie
K

Joined: Sep 2018
Posts: 29
Thankssssssssssss


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