Download MetaTrader 5

How to gat AccountBalance of an specific time?

To add comments, please log in or register
Farrokh Faghih
316
Farrokh Faghih  
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
10250
Bambang Sugianto  

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
14785
whroeder1  
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  
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