check for empty vars
This commit is contained in:
parent
d9398b4fcc
commit
103487790d
@ -113,6 +113,8 @@ function check_sell_conditions_strategy {
|
||||
|
||||
# check if the result (profit/loss until now) is lowering and sell if too low ()
|
||||
if [ -f ${f_TRADE_HIST_FILE_INTERIM} ]
|
||||
then
|
||||
if [ -n "$SELL_IF_LAST_RATE_LOWER_THEN" ]
|
||||
then
|
||||
local f_BUY_PRICE_2ND_LAST_RATE_DIFF=$(tail -n2 ${f_TRADE_HIST_FILE_INTERIM} | head -n1)
|
||||
local f_diff_result=$(echo "${f_BUY_PRICE_LAST_RATE_DIFF} - (${f_BUY_PRICE_2ND_LAST_RATE_DIFF})" | bc | sed 's/^\./0./; s/^-\./-0./')
|
||||
@ -120,7 +122,10 @@ function check_sell_conditions_strategy {
|
||||
then
|
||||
f_SELL="Loss between last (${f_BUY_PRICE_LAST_RATE_DIFF}%) and 2nd last (${f_BUY_PRICE_2ND_LAST_RATE_DIFF}%) rate/result more then ${SELL_IF_LAST_RATE_LOWER_THEN}% (${f_diff_result}%)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD" ]
|
||||
then
|
||||
# Sell if the last X time units is lower then FEE
|
||||
if [ $(cat ${f_TRADE_HIST_FILE_INTERIM} | wc -l) -ge ${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} ]
|
||||
then
|
||||
@ -132,13 +137,16 @@ function check_sell_conditions_strategy {
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Sell on MACD Condition
|
||||
if [ -n "$SELL_MACD_RELATION_FROM" ]
|
||||
then
|
||||
if [ $(echo "${f_macd_histogram_relation} < ${SELL_MACD_RELATION_FROM}" | bc -l) -ne 0 ]
|
||||
then
|
||||
f_SELL="MACD condition met"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Sell on RSI conditions
|
||||
if \
|
||||
|
Loading…
Reference in New Issue
Block a user