i need a code for selecting all deposit using Order Select() in the terminal
MQL5 jobs
- www.mql5.com
Orders for the development of automated trading programs
Try it.
double Deposit() {
double value =0 ;
for(int cnt=0;cnt<OrdersHistoryTotal();cnt++) {
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)) {
if(OrderType() <= 5 ) continue;
if( OrderProfit() > 0 ) value += OrderProfit();
}}
return (value);
}
double value =0 ;
for(int cnt=0;cnt<OrdersHistoryTotal();cnt++) {
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)) {
if(OrderType() <= 5 ) continue;
if( OrderProfit() > 0 ) value += OrderProfit();
}}
return (value);
}
tuoitrecuoi:
It gives Zero instead of deposit amount.
Try it.
double Deposit() {
double value =0 ;
for(int cnt=0;cnt<OrdersHistoryTotal();cnt++) {
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)) {
if(OrderType() <= 5 ) continue;
if( OrderProfit() > 0 ) value += OrderProfit();
}}
return (value);
}
double value =0 ;
for(int cnt=0;cnt<OrdersHistoryTotal();cnt++) {
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY)) {
if(OrderType() <= 5 ) continue;
if( OrderProfit() > 0 ) value += OrderProfit();
}}
return (value);
}
I think the problem remains the fact that some trades history has been removed from the terminal pool. For accounts with short time of activities, the deposit will be there but when there are too many order history or the account has been opened for long time, the initial deposit will not be seen in the terminal.
How do i work around this? I know that Metaquotes always get this history for calculation of account growth, Maximum DrawDown, Distribution and other Calculations. I think since they can get this from my Trading Account details, there should be a way of getting initial deposit and all other info from my account if it is no longer listed in the trading terminal.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register