diff --git a/dabo/functions/get_macd_indicator.sh b/dabo/functions/get_macd_indicator.sh index ff1463a..046f78b 100644 --- a/dabo/functions/get_macd_indicator.sh +++ b/dabo/functions/get_macd_indicator.sh @@ -19,7 +19,10 @@ function get_macd_indicator { # read last two lines local f_lastline=$(tail -n1 "$f_hist_file" | grep ^2) - local f_second_lastline=$(tail -n2 "$f_hist_file" | head -n1 | grep ^2) + + # force min 15min 2 last lines + local f_last_macd_period=$(echo "2*(900/${INTERVAL})" | bc -l | sed 's/\..*//') + local f_second_lastline=$(tail -n${f_last_macd_period} "$f_hist_file" | head -n1 | grep ^2) # Try to get current MACD values local f_macd_lastprice=$(echo "$f_lastline" | cut -d, -f2)