negative risk and net balance | Forex Factory

HeroPoker_HeroPoker扑克_HeroPoker德扑圈官网

negative risk and net balance

Inserted Code
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?

eg locked in proits?
It's not really clear what you're asking or explaining.

If your trade is up at 120 with SL at 110 you do have +10 locked in if your open price was 100. You should probably put your code (EA?) in the tester or on demo to check the values are printing correctly.

You will see some difference due to spread, commission & swap.

Regards.
ok i read what you wrote and it makes sense. you are asking about trailing stop and how it affects risk. you bought instrument at 100, stop loss 90, so initial risk is 10 USD. price goes up to 120, you move trailing stop to 110. now your trade is in profit and risk is reduced.
about your calculation:
if your Total_Current_Risk() is using trailing stop = it would be 110 - current price 120 = -10 in some platforms logic, meaning your risk is effectively negative, because if price hits stop you still make 10 USD profit.
so yes your Net Balance:
AccountBalance() - (-10) = 500 + 10 = 510 USD = that basically represents locked in profits.
negative risk/reward like this is actually common practice among experienced traders, but only for proven systems with high win rate, usually above 70%, otherwise it can backfire fast. trailing stops are mainly for protecting profits, not for increasing risk