force minimum 15 minutes (900 seconds) timeframe foor EMA/MACD calculations

This commit is contained in:
olli 2023-05-15 18:05:19 +02:00
parent fe591c169f
commit 3f07618e1f

View File

@ -109,7 +109,8 @@ function get_macd_indicator {
# calculate MACD Histogram relation
if [ $(tail -n36 "${f_hist_file}" | wc -l) -ge 35 ]
then
local f_macd_histogram_max=$(tail -n60 "${f_hist_file}" | cut -d"," -f8 | egrep "^[0-9]|^-[0-9]" | sed 's/^-//' | sort -n | tail -n1)
local f_last_macd_relation_period=$(echo "35*(900/${INTERVAL})" | bc -l | sed 's/\..*//')
local f_macd_histogram_max=$(tail -n${f_last_macd_relation_period} "${f_hist_file}" | cut -d"," -f8 | egrep "^[0-9]|^-[0-9]" | sed 's/^-//' | sort -n | tail -n1)
local f_macd_histogram_relation=$(echo "100+$(g_percentage-diff ${f_macd_histogram_max} ${f_macd_histogram})" | bc | sed 's/^\./0./; s/^-\./-0./' | cut -d\. -f1)
fi