CFD - How do you calculate the StopLoss range?
We allow the StopLoss to be in a range between the full investment amount down to a calculated amount as followed:
The reason why is, that if the user set 0$ as a stop loss and execute a trade, then the trade might be opened and closed automatically.
To prevent that we added a buffer to the min stop loss.
The stop loss formula boundary is:
roundup((limitDelta/pip) * pip value)
roundup((limitDelta/pip) * pip value)
limitDelta - is found in get-instrument -> instrument -> tradingConfig -> limitDelta
pip - in found in get-instrument -> instrument -> pip
pip value - is calculated and is displayed on the trading panel
the result should be rounded to the unit above.
pip - in found in get-instrument -> instrument -> pip
pip value - is calculated and is displayed on the trading panel
the result should be rounded to the unit above.
Example:
pip = 0.0001
limitDelta = 0.00007
pip value = 2433.24
pip = 0.0001
limitDelta = 0.00007
pip value = 2433.24
low stopLoss boundary = 0.00007/0.0001 * 2433.24 = 17032.68
rounded low stopLoss boundary = round(17032.68) = 17033
rounded low stopLoss boundary = round(17032.68) = 17033
17033 is then our stop loss boundary for the slider.
Please note that the stop loss boundaries will be updated if the user changes either the:
- Investment Amount
OR
- Multiplier