Negative Risk aka in Profit?


double Total_Current_Risk()
{

    double res = 0;
    for (int i = 0; i < OrdersTotal(); i++)
    {
        if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderStopLoss() != 0)
        {
            double m_point = MarketInfo(OrderSymbol(), MODE_POINT);
            double m_lotstep = MarketInfo(OrderSymbol(), MODE_LOTSTEP);
            double m_TickValue = MarketInfo(OrderSymbol(), MODE_TICKVALUE);
            double m_sl = 0;
            if (OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUYSTOP)
            {
                m_sl = (OrderOpenPrice() - OrderStopLoss()) / m_point;
            }
            else
            {
                m_sl = (OrderStopLoss() - OrderOpenPrice()) / m_point;
            }
            res += NormalizeDouble((OrderLots() * (m_sl * m_TickValue)) + OrderCommission() + OrderSwap(), 2);
        }
    }
    Print("Account Balance: ", AccountBalance(), " -- Total Current Risk (with swap and commission): ", res, " -- Net Balance: ", AccountBalance() - res);
    return res;
}

void OnTick()

Account Balance 500 USD
let say i buy instrument at 100 USD
stop loss 90
risk 100 - 90 = -10 USD

instrument goes up in my favor,
current price 120
open active trade is in profit,
trailing stop loss moved to 110

will Total_Current_Risk() return 100-110 = -10 ?

Net Balance: ", AccountBalance() - res

500 - -10 = 510 USD?

Correct on the assumption.

You’ll get stopped out at -10 pips 66.6% of the time, get to +20 pips 33.3% of the time. Half the time you’re in profit (16.7%) you’ll hit another +10 pips (30 pips total), half the time (16.7%) you’ll go back to +10 pips on the trade. Half that winning trade (8.33%) will go to another +10 pips (40pips). Half the time (8.33%) you’ll get stopped out at -10 (+20pips total) and so on until the variance is greater than the standard deviation of probabilities.

Run those scenarios through. To confirm. Be aware of size of spread/stop loss amount. If spread is 1 pip and SL is 10, a 9 pip stop loss throws a large negative EV on the trade.

1 Like

good note on spread, did not think of it
but in general risk can go negative aka good locked in profit with trailing stop loss

You may have to increase distances to minimize negative EV due to spread.

Same Expected Value with trailing stop or fixed stop/tp. Trailing stop won’t increase profitability.

5 Likes

This is absolutely definite. :slight_smile:

3 Likes

you are missing a point, it is about MM and locked-in floating profits

@EmeraldEyes and @TheodoreThring are doubtless well aware of that. It may be you who’s missing the point, here, my friend.

This (and 100 other similar posts) might help you:

2 Likes

you are not my friend