Stoploss placed automatically certain level (certain level is x% of account equity)

Created at 29 Sep 2022, 17:15
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
SA

Samm193

Joined 11.05.2020

Stoploss placed automatically certain level (certain level is x% of account equity)
29 Sep 2022, 17:15


Dear All,

 

I'm looking to code an automatic stoploss. 

Stoploss shall be place at certain level autmatically 

I will add a parameter for percentage of account equity which the max los. 

 

Thank you, 


@Samm193
Replies

r.stipriaan
01 Oct 2022, 23:22 ( Updated at: 01 Oct 2022, 23:32 )

Hi Samm193,

Use this variable:

        [Parameter(" Volume Percent", DefaultValue = 15, MinValue = 0)]
        public double VolumePercent { get; set; }

var Stoploss = Math.Floor(Account.Balance * 1 * VolumePercent / 1000) * 1000;

 


@r.stipriaan