default max_loss relative to min_profit

This commit is contained in:
Giulio De Pasquale 2021-02-22 11:27:25 +00:00
parent 4df9e38569
commit 5e39f2767f

View File

@ -148,8 +148,8 @@ impl Default for HiddenTrailingStop {
let leverage = 15.0; let leverage = 15.0;
// in percentage // in percentage
let capital_max_loss = 15.0; let capital_min_profit = 4.0;
let capital_min_profit = 8.5; let capital_max_loss = capital_min_profit * 1.65;
let capital_good_profit = capital_min_profit * 2.0; let capital_good_profit = capital_min_profit * 2.0;
let weighted_min_profit = capital_min_profit / leverage; let weighted_min_profit = capital_min_profit / leverage;
@ -281,7 +281,7 @@ impl PositionStrategy for HiddenTrailingStop {
.next().map_or_else(|| 0.0, |&x| x); .next().map_or_else(|| 0.0, |&x| x);
// we need to consider possible slippage when executing the stop order // we need to consider possible slippage when executing the stop order
let slippage_percentage = self.max_loss_percentage * 0.05; let slippage_percentage = self.max_loss_percentage * 0.085;
// calculating the stop price based on short/long position // calculating the stop price based on short/long position
let stop_loss_price = { let stop_loss_price = {