examples
This commit is contained in:
parent
e3602cc7b8
commit
e15740900a
46
strategies/example.strategy.sh
Normal file
46
strategies/example.strategy.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Example strategy
|
||||||
|
|
||||||
|
g_echo_note "EXAMPLE Strategy"
|
||||||
|
|
||||||
|
|
||||||
|
for f_symbol in ${f_symbols_array_trade[@]}
|
||||||
|
do
|
||||||
|
|
||||||
|
echo "=== $f_symbol"
|
||||||
|
f_asset=${f_symbol//:$CURRENCY/}
|
||||||
|
f_asset=${f_asset//\//}
|
||||||
|
echo "asset:${f_asset}"
|
||||||
|
for check_var in price levels_1w_next_up levels_1w_next_down
|
||||||
|
do
|
||||||
|
echo "$check_var:${v[${f_asset}_$check_var]}"
|
||||||
|
if [ -z "${v[${f_asset}_$check_var]}" ]
|
||||||
|
then
|
||||||
|
g_echo_warn "var \${v[${f_asset}_$check_var]} does not exist!!!"
|
||||||
|
continue 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "level_1w_next_up:${v[${f_asset}_levels_1w_next_up]}"
|
||||||
|
#position_close "$f_symbol"
|
||||||
|
#f_ccxt "print(${STOCK_EXCHANGE}.cancelAllOrders('$f_symbol'))"
|
||||||
|
|
||||||
|
# stoploss 2% under ${v[${f_asset}_levels_1w_next_down]}
|
||||||
|
g_calc "${v[${f_asset}_levels_1w_next_down]}-(${v[${f_asset}_levels_1w_next_down]}/100*2)"
|
||||||
|
stoploss=$g_calc_result
|
||||||
|
|
||||||
|
|
||||||
|
# takeprofit 2% under ${v[${f_asset}_levels_1w_next_up]} or +0.5%
|
||||||
|
#g_calc "${v[${f_asset}_levels_1w_next_up]}-(${v[${f_asset}_levels_1w_next_up]}/100*2)"
|
||||||
|
#echo "g_num_is_lower_equal $g_calc_result ${v[${f_asset}_price]} && g_calc \"${v[${f_asset}_price]}/100*100.5\""
|
||||||
|
g_calc "${v[${f_asset}_price]}/100*100.5"
|
||||||
|
takeprofit=$g_calc_result
|
||||||
|
|
||||||
|
grep -q "^$f_symbol" CCXT_POSITIONS CCXT_ORDERS || order "$f_symbol" 100 long "${v[${f_asset}_levels_1w_next_down]}" "$stoploss" "$takeprofit"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# example scoring
|
||||||
|
#g_num_is_higher $v_ECONOMY_SP500_1d_rsi14 55 && score -2 "SP500 RSI14 $f_rsi14"
|
||||||
|
#g_num_is_lower $v_ECONOMY_SP500_1d_rsi14 45 && score 2 "SP500 RSI14 $f_rsi14"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user