Never risk more than a small percentage of your account, certainly less than 2%
per trade, 6% total.
In code (MT4): Risk depends on your initial stop loss, lot size, and the
value of the pair.
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
-
Do NOT use TickValue by itself - DeltaPerLot and
verify that MODE_TICKVALUE is returning a value in your deposit currency,
as promised by the documentation, or whether it is returning a value in the
instrument's base currency.
MODE_TICKVALUE is not reliable on non-fx instruments with many brokers. - You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
William Roeder:
Never risk more than a small percentage of your account, certainly less than 2% per trade, 6% total. In code (MT4): Risk depends on your initial stop loss, lot size, and the value of the pair.
Never risk more than a small percentage of your account, certainly less than 2% per trade, 6% total. In code (MT4): Risk depends on your initial stop loss, lot size, and the value of the pair.
- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
-
Do NOT use TickValue by itself - DeltaPerLot and
verify that MODE_TICKVALUE is returning a value in your deposit currency,
as promised by the documentation, or whether it is returning a value in the
instrument's base currency.
MODE_TICKVALUE is not reliable on non-fx instruments with many brokers. - You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5=0.1 Lots maximum.
Thanks a lot for the formula it looks like its working pretty good.
At the moment im using ATR value as stop, wich was working fine at minute chart. Most of the time i dont came in cross with any support or bounce line, but if so i would change the stop manually to get behind support.
Maybe later i will add a secondary function to calculate lot size on stop wouldnt be hard.
As i understood correctly DeltaPerLot in your linked function does TICKVALUE/TICKSIZE, atm its working for eur/usd, ger30, dow jones, gold.
Thanks for the tips with FreeMargin i included in my indicator.
Per Get "balance",
"leverage", "sum last 5-10 historie", "minimal lot size".. own management
indicator - Profit Trading - Technical Indicators -
MQL5 programming forum #5
Why did you post your MT4 question in the
Root /
MT5 General section
instead of the MQL4 section,
(bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.
// Calculate volume based on $ risk and SL distance double CalculateVolume(double InValue=0, double InStopDist=0) { double tick = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE) / SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE); double calc1 = InStopDist*tick*_Point; double calc2 = (calc1>0) ? InValue/calc1 : SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); // Prevent zero divide return(calc2); }
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
Hi im making my own "indicator" to calculate lot quantity so i can handle fast trades witouth using calculator.
An example, i got following:
Dax30
ASK: 12000.00
Tick value: 0.1
Tick size: 0.1
Stop loss pip: 1000 (11990.00)
Risk percentage: 3%
Balance: 250€
Stop loss max risk: 7,5€
Cost per pip: 0,0075€
Leverage: 30
Can you please share me the formula how to calculate the the lot quantity. Thanks.