TRADE* pointer in TradeVar?

Posted By: DdlV

TRADE* pointer in TradeVar? - 04/17/15 03:49

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.
Posted By: jcl

Re: TRADE* pointer in TradeVar? - 04/17/15 16:36

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.
Posted By: DdlV

Re: TRADE* pointer in TradeVar? - 04/21/15 19:18

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.
© 2024 lite-C Forums