Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
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
2 registered members (AndrewAMD, howardR), 472 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
TRADE* pointer in TradeVar? #450543
04/17/15 03:49
04/17/15 03:49
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi jcl.

Is it possible to store a pointer in a TradeVar?

If not, is there another way to similarly link trades?

Also, it appears a for(open_trades) within a for(open_trades), even within a function, doesn't work. Is this a limitation or is there a workaround?

Thanks.

Re: TRADE* pointer in TradeVar? [Re: DdlV] #450563
04/17/15 16:36
04/17/15 16:36
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
For storing a pointer in a var, try *(TRADE**)&TradeVar - maybe this works. There is however no workaround that would make a double for(open_trades) loop work.

Re: TRADE* pointer in TradeVar? [Re: jcl] #450741
04/21/15 19:18
04/21/15 19:18
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline OP
Serious User
DdlV  Offline OP
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi jcl.

Re. nested for(open_trades), I've had some initial success with this workaround code:

Code:
void	sub(other paramenters,int TID) {
	TRADE	*SaveThisTrade	= ThisTrade;
	for(open_trades) {
		// anything that doesn't close TID
	}
	for(open_trades) if(TradeID==TID) break;
	ThisTrade	= SaveThisTrade;
}

void	run () {
	// do some stuff
	for(open_trades) {
		// do stuff
		sub(other parameters,TradeID);
		// do other stuff
	}
	// do more stuff
}



Of course, since I can't see "under the covers" I don't know if there are any pitfalls to this method, and would appreciate your comments!

Thanks.


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