Download MetaTrader 5
To add comments, please log in or register
Are you a real pro? Share your knowledge with millions of traders!
Farrokh Faghih
316
Farrokh Faghih 2014.05.17 11:20 
Is there any code, function or something which is able to return Account Balance of an specific time? For example at the beginning of the day.
Bambang Sugianto
10183
Bambang Sugianto 2014.05.17 11:56  

count your current balance with your today profit

   
    double todayprofit=0;
    datetime Openday= iTime(Symbol(),PERIOD_D1,0); 
 
 for(int xx=OrdersHistoryTotal()-1;xx>=0;xx--)
 { if(!OrderSelect(xx,SELECT_BY_POS,MODE_HISTORY))continue;
   if(OrderCloseTime()<Openday)break;
   if(OrderType()<2)todayprofit+=OrderProfit()+OrderSwap()+OrderCommission(); 
 }  
 
whroeder1
14230
whroeder1 2014.05.18 13:52  
farrokhfa: Is there any code, function or something which is able to return Account Balance of an specific time? For example at the beginning of the day.
Could EA Really Live By Order_History Alone? - MQL4 forum
Herbie
8
Herbie 2015.05.10 21:53  
WDholic:

count your current balance with your today profit

I tried this, but it does not work for me...

   Alert( "aaaaa1",TimeToStr(TimeCurrent()),AccountBalance() );

   Print( "1Time=",TimeToStr(TimeCurrent()),AccountBalance() );

 

I see no alerts with my values in,

What I was trying to do is to display my balance on a tick by tick where the current price of the instrument is printed at the top left of my screen...

 

GBPUSD,M15 1.15234 1.15756 1.52013 1.152320 

/
To add comments, please log in or register