Hello i´m new in trading with MT4, i have change my broker to ECN.
My previously broker havent Lot´s and the calculation is a little complicated, i miss a lot of trades coz i calculate to slow my risk value.
What i´m looking for is an tool with this i can input my balance and how many % i will risk, than i input how many pips my sl is and the tool show my how many lots i need
exemple:
acc balance: 10.000 EUR
Risk per trade: 0,5 %
StopLoss: 7 Pips
Lots i need: _____
Thank you very much! Sorry for my bad englisch i´m german
Here is such function : (open = ASK or BID, sl = sl in Pips * Point)
double GetVolume(double open,double sl, double ed_RiskOfBalancePerTrade) { double gd_MinLot = MarketInfo(Symbol(), MODE_MINLOT); double gd_MaxLot = MarketInfo(Symbol(), MODE_MAXLOT); double gd_LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); double tickval = MarketInfo(Symbol(), MODE_TICKVALUE); double dif = MathAbs(open - sl)/Point; if (dif==0) return(0); double balance = AccountBalance(); double res = MathFloor(balance * ed_RiskOfBalancePerTrade/100 / dif / tickval / gd_LotStep) * gd_LotStep; if (res < gd_MinLot) res = gd_MinLot; if (res > gd_MaxLot) res = gd_MaxLot; res = NormalizeDouble(res, 2); return(res); }
Thank you!
Can you explain me what i have to do with it
Thank you!
Can you explain me what i have to do with it
You shold call this functon in your EA...
Besides, it is possible to write separate program as the Tool, that can print the resulting Lot's size...if you trade manually....
Here is such function : (open = ASK or BID, sl = sl in Pips * Point)
Your code assumes that TickSize = Point so that TickValue is the value per Point in deposit currency. While this may be true for most currencies, it may not be true for other instruments.
double PositionSize_FixedFractional(int StoplossDistance_inPoints, double RiskPercent, double AcctBalance = 0) { double lotstep = MarketInfo(Symbol(), MODE_LOTSTEP), minlot = MarketInfo(Symbol(), MODE_MINLOT), maxlot = MarketInfo(Symbol(), MODE_MAXLOT); // validate passed parameters if (RiskPercent <= 0 || StoplossDistance_inPoints <= 0) return (minlot); else if (AcctBalance <= 0) AcctBalance = AccountBalance(); // calculate raw lotsize (my deposit currency is USD) double PointValue = MarketInfo(Symbol(), MODE_TICKVALUE) / (MarketInfo(Symbol(), MODE_TICKSIZE) / Point), RiskAmount = MathFloor(AcctBalance * RiskPercent / 0.01) * 0.01, StoplossValue = StoplossDistance_inPoints * PointValue, lotsize = RiskAmount / StoplossValue; // condition raw lotsize lotsize = MathFloor(lotsize / lotstep) * lotstep; if (lotsize < minlot) lotsize = minlot; if (lotsize > maxlot) lotsize = maxlot; // return conditioned lotsize return (lotsize); }
Your code assumes that TickSize = Point so that TickValue is the value per Point in deposit currency. While this may be true for most currencies, it may not be true for other instruments.
Well, it was idea, no more...
Well, it was idea, no more...
we know, you have given a try to help.....
that's no problem, it is something good
helping others, might give you more experience as you see now here happening
we know, you have given a try to help.....
that's no problem, it is something good
helping others, might give you more experience as you see now here happening
Can anyone take the code in an .ex4 file and upload it?
Thank you guys
Is it possible to show the lotsize for 0,5% risk for the actual currency pair based on balance not equity? thats what i´m looking for
Can anyone take the code in an .ex4 file and upload it?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello i´m new in trading with MT4, i have change my broker to ECN.
My previously broker havent Lot´s and the calculation is a little complicated, i miss a lot of trades coz i calculate to slow my risk value.
What i´m looking for is an tool with this i can input my balance and how many % i will risk, than i input how many pips my sl is and the tool show my how many lots i need
exemple:
acc balance: 10.000 EUR
Risk per trade: 0,5 %
StopLoss: 7 Pips
Lots i need: _____
Thank you very much! Sorry for my bad englisch i´m german