Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (Grant), 999 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
user function #462004
09/02/16 13:28
09/02/16 13:28
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

is a possible this construction?
Code:
...
enterLong(StopLong);
...
...
int StopLong()
{
	static bool lHit=false;
	if(TradeIsOpen and TradeProfit > 0){
		var nPom = TradeProfit/TradeLots;
		//printf("\nProfit: %f mod: %f",TradeProfit,TradeLots);
		if (nPom>20) lHit=true;
		if (lHit && nPom < 18) return 1;		
	}
	
 return 0;
}



My question is this value:
static bool lHit=false;
is for every order different or for all trade is the same...

thanks

Re: user function [Re: Grat] #462005
09/02/16 14:02
09/02/16 14:02
Joined: Jul 2016
Posts: 64
G
gtell Offline
Junior Member
gtell  Offline
Junior Member
G

Joined: Jul 2016
Posts: 64
I am not sure, but I think that you are using a static variable, so it would be the same for all the orders.
You probably need to use an array to have different variables for each order.
Please wait for confirmation from some one with more experience.
Thanks.

Re: user function [Re: gtell] #462080
09/07/16 08:53
09/07/16 08:53
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
I'm making test, and for all trade is the same value. This way is blind.

This is the idea for a new version. Every trade in the separately namespace

Re: user function [Re: Grat] #462081
09/07/16 09:11
09/07/16 09:11
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
So,

maybe is way thru TradeVar, but I don't know, how to use:


int myLONG(){
if (TradeIsOpen)
if (TradeVar[0] == 0){
TradeVar[0] = (var)TradeID; <=== This line is a SYNTAX ERROR
printf("\n+++++++++++Init LONG");
}
printf("\nLONG Open order: %f",TradeVar[0]);
return 0;
}
...
enterLong(myLONG); <---- enter order
...


Please, how to use.
Thanks

Re: user function [Re: Grat] #462083
09/07/16 11:58
09/07/16 11:58
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Your idea is mostly right. Only TradeID is in fact a macro, not a variable, and I suppose the (var) invalidates the macro - remove it.

Re: user function [Re: jcl] #462086
09/07/16 18:00
09/07/16 18:00
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Ok,

this is correct. array TradeVar is unique for each order.

grat

Last edited by Grat; 09/07/16 20:28.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1