Hi codes, I have a technical problem to trigger a basket close action. Let's say I have the following conditions :-
1) Basket Close Target = 0.1 (10%)
2) Total Open Trades now = 20 Orders
3) Comparing the following :-
My mission is :-
- - - - - - - - -
The problem now is if there are 20 open trades, the moment my EA closes the 1st open trade (remaining 19 Open Trades), the values of eqtNow and balNow will start changing, resulting it may be less than 0.1 (10%) and finally my EA will stop basket close action, unable to proceed to basket close all the 20 Open Trades.
I'm thinking of how to make use of GlobalVariableGet / GlobalVariableSet / GlobalVariableDelete so that the moment the condition
is met, the EA will GlobalVariableSet and the EA will force / mandatory basket close all the 20 Open Trades completely ...
Kindly advise with your codes, thanks.
1) Basket Close Target = 0.1 (10%)
2) Total Open Trades now = 20 Orders
3) Comparing the following :-
Inserted Code
double balNow=AccountBalance(); double eqtNow=AccountEquity();
My mission is :-
Inserted Code
if( (eqtNow-balNow) / balNow > 0.1) Basket Close Action (Close All 20 Open Trdaes)
- - - - - - - - -
The problem now is if there are 20 open trades, the moment my EA closes the 1st open trade (remaining 19 Open Trades), the values of eqtNow and balNow will start changing, resulting it may be less than 0.1 (10%) and finally my EA will stop basket close action, unable to proceed to basket close all the 20 Open Trades.
I'm thinking of how to make use of GlobalVariableGet / GlobalVariableSet / GlobalVariableDelete so that the moment the condition
Inserted Code
(eqtNow-balNow) / balNow > 0.1
is met, the EA will GlobalVariableSet and the EA will force / mandatory basket close all the 20 Open Trades completely ...
Kindly advise with your codes, thanks.