fixes adjust sl on short position

This commit is contained in:
olli 2024-12-17 17:21:45 +01:00
parent 6c0c786c70
commit 0ca094d353
2 changed files with 11 additions and 2 deletions

View File

@ -37,7 +37,7 @@ function run_strategies {
g_echo_error "Error in ${f_strategy} $(cat $g_tmp/strat_bash_error)"
continue
fi
g_echo_note "Runnign strategy ${f_strategy}"
g_echo_note "Running strategy ${f_strategy}"
. "${f_strategy}" || g_echo_warn "Failed ${f_strategy}"
done

View File

@ -42,8 +42,17 @@ do
# check for already existing stoploss
if [ -n "${o[${asset}_sl_close_${side}_id]}" ]
then
# do nothing if current stoploss price is already larger/equal then half of current pnl
if [[ $side = long ]]
then
g_num_is_higher_equal ${o[${asset}_sl_close_${side}_stopprice]} $stoploss_price && continue
fi
if [[ $side = short ]]
then
g_num_is_lower_equal ${o[${asset}_sl_close_${side}_stopprice]} $stoploss_price && continue
fi
# cancel existing stoploss order
order_cancel_id "$symbol" "${o[${asset}_sl_close_${side}_id]}" || continue
fi