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

This commit is contained in:
olli 2023-05-15 15:37:49 +02:00
parent fdadf53051
commit 436dfe602e
3 changed files with 13 additions and 2 deletions

View File

@ -188,6 +188,10 @@ docker compose logs -f
Update: Update:
``` ```
# Optinal: Remove local data
git reset --hard HEAD^ # Remove local commits
git clean -fd # Remove local uncommited files
git pull -f --all git pull -f --all
``` ```

View File

@ -7,7 +7,14 @@ function get_ema {
local f_lastvalue="$5" local f_lastvalue="$5"
f_ema="" f_ema=""
# force minimum 15min timeframe
if [ $(echo "${INTERVAL} < 900" | bc -l) -ne 0 ]
then
f_period=$(echo "${f_period}*(900/${INTERVAL})" | bc -l | sed 's/\..*//')
g_echo "ATTENTION!!!! Period lower then 15 minutes - correcting to $f_period"
fi
# calculate EMA if last EMA is given # calculate EMA if last EMA is given
if [ -n "$f_last_ema" ] if [ -n "$f_last_ema" ]
then then

View File

@ -42,7 +42,7 @@ function get_macd_indicator {
f_macd_last_ema9_signal=$(echo "$f_second_lastline" | cut -d, -f7) f_macd_last_ema9_signal=$(echo "$f_second_lastline" | cut -d, -f7)
f_macd_last_histogram=$(echo "$f_second_lastline" | cut -d, -f8) f_macd_last_histogram=$(echo "$f_second_lastline" | cut -d, -f8)
# calc EMA12 # calc EMA12
get_ema "${f_hist_file}" 2 12 "${f_macd_last_ema12}" "${f_macd_lastprice}" get_ema "${f_hist_file}" 2 12 "${f_macd_last_ema12}" "${f_macd_lastprice}"
if [ -z "${f_ema}" ] if [ -z "${f_ema}" ]
then then