From c2698851ed2f8994387f1bac790f47690014849b Mon Sep 17 00:00:00 2001 From: Sik Yoon Date: Tue, 12 Mar 2024 02:11:05 +0900 Subject: [PATCH] Redifine target profit percent --- src/strategy_team/strategy_006.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/strategy_team/strategy_006.rs b/src/strategy_team/strategy_006.rs index 2fc0539..d161d9c 100644 --- a/src/strategy_team/strategy_006.rs +++ b/src/strategy_team/strategy_006.rs @@ -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)