Bryan Chang Wey Nerng:
void OnStart() { //--- RiskPercentageByAccountBalance(); } //+------------------------------------------------------------------+ void RiskPercentageByAccountBalance() { double accBalance = AccountInfoDouble(ACCOUNT_BALANCE); Alert("Your Account Balance is: $", accBalance); Alert("Max Risk is: $", 0.01 * accBalance);
If you don't clearly state what you want to do, no one can help you. I fixed it so it can compile
void OnStart() { RiskPercentageByAccountBalance(); }; void RiskPercentageByAccountBalance() { double dbBalance = AccountInfoDouble( ACCOUNT_BALANCE ), dbRisk = dbBalance * 0.01; Alert( "Your Account Balance is: $", DoubleToString( dbBalance, 2 ) ); Alert( "Max Risk is: $", DoubleToString( dbRisk, 2 ) ); };

Bryan Chang Wey Nerng #: thank you so much. still new to mql5edit, may I know why is it needed to put DoubleToString instead of just string? and what is the "2" for in the parameters for dbBalance and dbRisk?
Using DoubleToString sets the exact number of decimal digits to display.
Please reference the documentation, available on MetaEditor via the menu or F1 key, or online on this website:

Documentation on MQL5: Conversion Functions / DoubleToString
- www.mql5.com
DoubleToString - Conversion Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Unfortunately you can't run a script through the debugger. But if you build it into the OnInit function of an EA you can.

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