
Originally Posted by
begu
hello finyoo
is it possible to code close all open trades after every x profit:
example:
begin balance= 1000
extern double = 200; (USD)
if (AccountProfit()>=1200 close all open trades (for close all positions i have a call function)
if (AccountProfit()>=1400.- close all open trades
"
"
if (AccountProfit()>=1600.- close all open trades
"
"
and so on ....
thanks for help
begu
Hi begu,
Yes that's possible. You have to study GlobalVariableSet/GlobalVariableGet.
With something like this :
Code:
extern double MinProfit=200;
Code:
int init()
{
GlobalVariableSet("Balance",AccountBalance());
return(0);
}
Code:
if(AccountBalance()>GlobalVariableGet("Balance"))GlobalVariableSet("Balance",AccountBalance());
if(AccountEquity()>=(GlobalVariableGet("Balance")+MinProfit))Close all open trades