Part 1: Formula to calculate Stop Loss based on account variables
In part 1 I had trouble trying to get the formula correct to set a StopLoss at the right point. after weeks, I finally got it.
$$x = e-(p/L\times 0.01)\times e).$$
Now I have another related issue.
Lets say that I calculated my stoploss to be 9% of my account balance, and that worked, and the stoploss was hit. That means that my account just lost 9% and I am trying to verify that with a Profit/Loss % after the position is closed. This is what I have:
- Previous Account Balance = Current Account Balance - Loss
- Difference = Current Account Balance - Previous Account Balance
- StopLoss Percent = (Difference/Previous Account Balance) * 100
or in mathjax $$-x = {(a - (a-l))\over (a-l)} * 100$$
in this case, if x above equals 9% then x here should equal -9%, unless the position closed in a profit, then x should be something positive.
This isn't working as x comes in anywhere between -1 and -4
Note that your equation is $-x=\frac {-l}{a-l}\cdot 100%$ You should be dividing by $a$, the previous balance, not $a-l$. If you start with $100$ and lose $9\%$, you have $91$ left, but $\frac 9{91}\cdot 100%$ is about $10\%$.
$x$ should be coming out too large because you are dividing by too small a number. I don't know how you get between $1$ and $4$.