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

This commit is contained in:
olli 2023-05-15 16:43:35 +02:00
parent d54815b4f8
commit fe591c169f

View File

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