fixes adjust sl on short position
This commit is contained in:
parent
6c0c786c70
commit
0ca094d353
@ -37,7 +37,7 @@ function run_strategies {
|
|||||||
g_echo_error "Error in ${f_strategy} $(cat $g_tmp/strat_bash_error)"
|
g_echo_error "Error in ${f_strategy} $(cat $g_tmp/strat_bash_error)"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
g_echo_note "Runnign strategy ${f_strategy}"
|
g_echo_note "Running strategy ${f_strategy}"
|
||||||
. "${f_strategy}" || g_echo_warn "Failed ${f_strategy}"
|
. "${f_strategy}" || g_echo_warn "Failed ${f_strategy}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -42,8 +42,17 @@ do
|
|||||||
# check for already existing stoploss
|
# check for already existing stoploss
|
||||||
if [ -n "${o[${asset}_sl_close_${side}_id]}" ]
|
if [ -n "${o[${asset}_sl_close_${side}_id]}" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
# do nothing if current stoploss price is already larger/equal then half of current pnl
|
# do nothing if current stoploss price is already larger/equal then half of current pnl
|
||||||
g_num_is_higher_equal ${o[${asset}_sl_close_${side}_stopprice]} $stoploss_price && continue
|
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
|
# cancel existing stoploss order
|
||||||
order_cancel_id "$symbol" "${o[${asset}_sl_close_${side}_id]}" || continue
|
order_cancel_id "$symbol" "${o[${asset}_sl_close_${side}_id]}" || continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user