AccountBalance problem
That is because OnInit() is called before the account info has had a chance to load.
I have never tried putting IndicatorShortName() anywhere but OnInit() but you could try it after a few new ticks arrive in OnCalculate() or in OnTimer().
Other than that, just change the chart time-frame and then change it back and that will re-initialize the indicator.
I solved putting all initialization inside OnStart()
Indicators do not use OnStart(), Scripts use that.
I don't think that it would be a good idea to have the initialization run every tick when you only need to check IndicatorShortName() .
Hi everyone
Using the code above, if I insert indicator in chart it works correctly, when I close and reopen MT4, the indicator display balance 0, I must delete indicator and re-insert it into the chart...
How I can fix it?
it make the same with
AccountCurrency()
AccountLeverage()
MarketInfo(Symbol(),MODE_MARGINREQUIRED)