macd check update for negative values

This commit is contained in:
olli 2023-05-17 10:58:47 +02:00
parent 9edcc7ed98
commit 11ade41d67

View File

@ -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 \