Getting first digit of Account's balance
Hi hals69!
Try
long value = StringToInteger (StringSubstr (DoubleToString (AccountBalance ( )), 0, 1));
int d = int( AccountBalance() / 100); // 4xx.xx/100=4.xxx 5xx.xx/100=5What if the balance is 99, do you want zero? What if the balance is 1000, do you want 10? If not then eddie's idea works. If yes, then mine.
Hello,
I'm trying to do some mathematical equations within my EA , but the problem is one of equations requires the first number of account's balance . For example if the balance is 506.60 I want to get this value "5" , if it is 432.32 I want to get "4" . So how can it be done ?
Note : To get the current balance I use AccountBalance();