Auto Stoploss Calculation based on the percentage of Equity/Balance

 

Hello there, have a good time.

As you know, we have various tools in the market that adjust stoploss automatically. But the problem for me is that I do not want to set it as pips / points. Instead, it should calculate all the positions, and based on the total asset risk, for example, set a stop loss of 15% for all positions. (Collectively!)

If a new deal opens, update everyone.

Thanks for guiding me.

Fast traslate
Icon translate
 
Hamoon Soleimani:

Hello there, have a good time.

As you know, we have various tools in the market that adjust stoploss automatically. But the problem for me is that I do not want to set it as pips / points. Instead, it should calculate all the positions, and based on the total asset risk, for example, set a stop loss of 15% for all positions. (Collectively!)

If a new deal opens, update everyone.

Thanks for guiding me.

Fast traslate
Icon translate

As you have more than one positions, and only one risk limit (15% of balance), there are infinite combinations reaching that total risk so you can't place a hard stop loss in the positions themselves.

What's left is checking the floating loss on each tick and close all positions.

something like

   if(AccountInfoDouble(ACCOUNT_BALANCE)*0.85 > AccountInfoDouble(ACCOUNT_EQUITY))
      CloseAll();