Redifine target profit percent
This commit is contained in:
parent
b95a194e84
commit
c2698851ed
|
|
@ -170,7 +170,7 @@ pub async fn list_up_for_sell(
|
|||
let supertrend_1d = supertrend(14, 1.2, true, &all_data.rt_price_1d_vec, &filtered_symbols).await?;
|
||||
for element in filled_buy_orders {
|
||||
let mut is_sell = false;
|
||||
let opclo_sample_length: usize = 10; // 10 candle samsples
|
||||
let opclo_sample_length: usize = 15; // 15 candle samsples
|
||||
let mut target_profit_percent = 0.0;
|
||||
if let Some(price_1d_vec) = all_data
|
||||
.rt_price_1d_vec
|
||||
|
|
@ -191,11 +191,11 @@ pub async fn list_up_for_sell(
|
|||
|
||||
let windows = candles.windows(2);
|
||||
for window in windows {
|
||||
amplitude_variance += ((((window.last().unwrap().high_price - window.last().unwrap().low_price) * 100.0) / window.first().unwrap().close_price) - average_amplitude).powi(2);;
|
||||
amplitude_variance += ((((window.last().unwrap().high_price - window.last().unwrap().low_price) * 100.0) / window.first().unwrap().close_price) - average_amplitude).powi(2);
|
||||
}
|
||||
amplitude_variance = amplitude_variance / (opclo_sample_length - 1) as f64;
|
||||
let standard_deviation_amplitude = amplitude_variance.sqrt();
|
||||
|
||||
target_profit_percent = average_amplitude + (standard_deviation_amplitude * 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ pub async fn list_up_for_sell(
|
|||
is_sell = true;
|
||||
} else if element.current_price >= element.target_price {
|
||||
is_sell = true;
|
||||
} else if (element.pure_profit_percent >= target_profit_percent * 3.0) && (target_profit_percent != 0.0 && target_profit_percent.is_sign_positive()) { // absolute sell profit percent
|
||||
} else if (element.pure_profit_percent >= target_profit_percent * 2.5) && (target_profit_percent != 0.0 && target_profit_percent.is_sign_positive()) { // absolute sell profit percent
|
||||
is_sell = true;
|
||||
} else if server_epoch - element.transact_time > (86_400_000) * 5 &&
|
||||
(target_profit_percent != 0.0 && target_profit_percent.is_sign_positive() && target_profit_percent * 2.0 <= element.pure_profit_percent){ // scaled selling with time up selling (5 days)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user