https://www.mql5.com/en/forum/138613.
case 'r': if(Switch=='r'){Ans=AB*Flexable*_2Pct/Stop__Loss/Pip_Values;}
//Dont Want To Lose AnyMore Than *F% ... Where (F%_Flexable)= My_Risk_Per =2.0
thanks, I will try that :-)
That helped thanks, my solution for anyone who is interested was:
double lotsize = MarketInfo(Symbol(),MODE_LOTSIZE) / 1; double pipsize = 100 * 10; double maxlots = AccountEquity() / 100 * CurrentRisk; if (StopLoss == 0) Print("OrderSend() error - stoploss can not be zero"); double lots = maxlots / StopLoss / PipValue;
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
I have been trying to edit my code to use an exact % of the account balance and it nearly does, but is always slightly off... I have tried many different edits and the following code is the closest that I can get... An example would be that on a $50,000 size account a 2% risk loss is $1,500 when it should be around $1,000. Can anyone see what I am doing wrong and if so please advise?