- 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.
- Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
- Do NOT use TickValue by itself - DeltaPerlot
- You must normalize lots properly and check against min and max.
- You must also check FreeMargin to avoid stop out
MarketInfo( SymName , MODE_TICKVALUE ) / ( MarketInfo( SymName , MODE_TICKSIZE ) / Point
I use MarketInfo to calculate the value of a (fractional) pip in the currency of the account. That way you can risk a percentage of your account balance per trade. There is one problem with it though. MODE_TICKVALUE and MODE_TICKSIZE are not stored in the history data. They hold simply the latest value received from the server. So when you backtest your lotsize calculations can be off depending on the currency pair you're testing on. A work around to this problem is to set the currency of the account to the base currency of the pair. So if you're testing EUR/USD you set the currency of the account in the Strategy Tester to USD.
- Account Balance * percent = RISK = (OrderOpenPrice - OrderStopLoss)*DIR * OrderLots * DeltaPerlot (Note OOP-OSL includes the SPREAD)
DIR?
The actual problem that i have is, when i try to calculate my stoploss i subtract the lowest price of the last candle from the highest price which gives me e.g. 0.00265 Points.
How do i convert this 5 digit double value to ~27 pips? Or can i just take the value of Low[1] as StopLoss?
string marketSymbol = Symbol(); int marketPrecision = MarketInfo(marketSymbol, MODE_DIGITS); double marketDivisor[] = {0.0, 0.1, 0.01, 0.001, 0.0001, 0.00001}; double marketPips = MathAbs((marketBid - marketPrice) / marketDivisor[marketPrecision]); // in your case place the variable holding 0.00265 here // double marketPips = MathAbs((0.00265) / marketDivisor[marketPrecision]);
Basicly this is copied 1:1 from my own code. There are probably better solutions. Hope this helps.
BTW: I calculate everything with points.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Guys,
im trying to calculate my risk dynamically but i dont really "like" my code and im pretty sure there has to be a better method of doing it but i cant really think of one.
Any Tips?
Thanks in Advance,
Ratio_O