From c0cef48c5075d15fdd1cf27c868b32030c31f95d Mon Sep 17 00:00:00 2001 From: Sik Yoon Date: Thu, 6 Jun 2024 14:40:37 +0900 Subject: [PATCH] Update filtering --- src/strategy_team/future_strategy_long.rs | 6 +++++- src/strategy_team/future_strategy_short.rs | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/strategy_team/future_strategy_long.rs b/src/strategy_team/future_strategy_long.rs index bf5e42a..aed4a2f 100644 --- a/src/strategy_team/future_strategy_long.rs +++ b/src/strategy_team/future_strategy_long.rs @@ -401,7 +401,11 @@ pub async fn list_up_for_sell(all_data: &AllData, futures_exchange_info_map: &Ha if element.pure_profit_percent.is_sign_positive() && lr_vec.last().unwrap().r_squared >= 0.7 { is_sell = true; - } else if lr_vec[lr_vec.len()-1].lr_value < lr_vec[lr_vec.len()-2].lr_value { + } else if lr_vec[lr_vec.len()-1].lr_value < lr_vec[lr_vec.len()-2].lr_value { + is_sell = true; + } else if lr_vec[lr_vec.len()-1].r_squared < lr_vec[lr_vec.len()-2].r_squared + && lr_vec[lr_vec.len()-2].r_squared > lr_vec[lr_vec.len()-3].r_squared + && lr_vec[lr_vec.len()-3].r_squared > lr_vec[lr_vec.len()-4].r_squared { is_sell = true; } diff --git a/src/strategy_team/future_strategy_short.rs b/src/strategy_team/future_strategy_short.rs index 38f01a2..3d694e3 100644 --- a/src/strategy_team/future_strategy_short.rs +++ b/src/strategy_team/future_strategy_short.rs @@ -408,6 +408,10 @@ pub async fn list_up_for_sell(all_data: &AllData, futures_exchange_info_map: &Ha is_sell = true; } else if lr_vec[lr_vec.len()-1].lr_value > lr_vec[lr_vec.len()-2].lr_value { is_sell = true; + } else if lr_vec[lr_vec.len()-1].r_squared < lr_vec[lr_vec.len()-2].r_squared + && lr_vec[lr_vec.len()-2].r_squared > lr_vec[lr_vec.len()-3].r_squared + && lr_vec[lr_vec.len()-3].r_squared > lr_vec[lr_vec.len()-4].r_squared { + is_sell = true; } let minimum_candles = 5;