From 11ade41d671b3aa8f57fe581e9de8fc9cf6557d2 Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 17 May 2023 10:58:47 +0200 Subject: [PATCH] macd check update for negative values --- dabo/functions/check_buy_conditions.sh | 32 ++++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/dabo/functions/check_buy_conditions.sh b/dabo/functions/check_buy_conditions.sh index 4ae7b9d..b83c5f3 100644 --- a/dabo/functions/check_buy_conditions.sh +++ b/dabo/functions/check_buy_conditions.sh @@ -48,19 +48,31 @@ function check_buy_conditions { return 0 fi - # no negative or empty values - if echo "${f_macd_histogram_relation}" | grep -q "^[0-9]" + # Check MACD + if [ $(echo "${f_macd_histogram_relation} < ${BUY_MACD_RELATION_FROM}" | bc -l) -ne 0 ] then - # check for conditions - if [ ${f_macd_histogram_relation} -le ${BUY_MACD_RELATION_FROM} ] || [ ${f_macd_histogram_relation} -ge ${BUY_MACD_RELATION_TO} ] - then - g_echo_note "${f_echo_prefix}MACD conditions NOT met" - return 0 - fi - else - g_echo_note "${f_echo_prefix}f_macd_histogram_relation empty or negative" + g_echo_note "${f_echo_prefix}MACD Relation with ${f_macd_histogram_relation}% under BUY_MACD_RELATION_FROM ${BUY_MACD_RELATION_FROM}%" return 0 fi + if [ $(echo "${f_macd_histogram_relation} > ${BUY_MACD_RELATION_TO}" | bc -l) -ne 0 ] + then + g_echo_note "${f_echo_prefix}MACD Relation with ${f_macd_histogram_relation}% over BUY_MACD_RELATION_TO ${BUY_MACD_RELATION_TO}%" + return 0 + fi + + ## no negative or empty values + #if echo "${f_macd_histogram_relation}" | grep -q "^[0-9]" + #then + # # check for conditions + # if [ ${f_macd_histogram_relation} -le ${BUY_MACD_RELATION_FROM} ] || [ ${f_macd_histogram_relation} -ge ${BUY_MACD_RELATION_TO} ] + # then + # g_echo_note "${f_echo_prefix}MACD conditions NOT met" + # return 0 + # fi + #else + # g_echo_note "${f_echo_prefix}f_macd_histogram_relation empty or negative" + # return 0 + #fi # RSI if \