fix score, example trade balance inn % from complete balance, small fixes - thanks to andrius for hint(s)

This commit is contained in:
olli 2024-12-04 15:23:51 +01:00
parent f0c3303246
commit f66f1934a1

View File

@ -3,7 +3,8 @@
g_echo_note "EXAMPLE Strategy" g_echo_note "EXAMPLE Strategy"
##### WARNING! This strategy is only intended as an example and should not be used with real trades. Please develop your own strategy ###### ##### WARNING! This strategy is only intended as an example and should not be used with real trades. Please develop your own strategy ######
# if you want to use ist remove the next line with return 0
# if you want to use this remove the next line with return 0
return 0 return 0
# get vars with orders and positions # get vars with orders and positions
@ -15,7 +16,8 @@ unset s_score
unset s_score_hist unset s_score_hist
s_score=0 s_score=0
### Evaluate the traditional Market
### BEGIN market scoring ###
# correlation to crypto # correlation to crypto
for asset in DOWJONES SP500 NASDAQ MSCIEAFE GOLD MSCIWORLD KRE for asset in DOWJONES SP500 NASDAQ MSCIEAFE GOLD MSCIWORLD KRE
do do
@ -76,8 +78,6 @@ do
done done
### Evaluate BTC and ETH ### Evaluate BTC and ETH
for asset in BTC${CURRENCY} ETH${CURRENCY} for asset in BTC${CURRENCY} ETH${CURRENCY}
do do
@ -108,16 +108,23 @@ do
done done
### END market scoring ###
# save score until here
market_score=$s_score
market_score_hist=$s_score_hist
### Go through trading symbols ### Go through trading symbols
for symbol in ${f_symbols_array_trade[@]} for symbol in ${f_symbols_array_trade[@]}
do do
# restore market score as base
s_score=$market_score
s_score_hist=$market_score_hist
asset=${symbol//:$CURRENCY/} asset=${symbol//:$CURRENCY/}
asset=${asset//\//} asset=${asset//\//}
### Evaluate symbol ### Evaluate symbol
g_echo "scoring ${asset}" g_echo "scoring ${asset}"
@ -227,9 +234,16 @@ do
[[ $side = long ]] && g_calc "$entry_price+($entry_price/100*${takeprofitpercentage})" [[ $side = long ]] && g_calc "$entry_price+($entry_price/100*${takeprofitpercentage})"
[[ $side = short ]] && g_calc "$entry_price-($entry_price/100*${takeprofitpercentage})" [[ $side = short ]] && g_calc "$entry_price-($entry_price/100*${takeprofitpercentage})"
takeprofit=$g_calc_result takeprofit=$g_calc_result
# Use 100 of balace for trade
trade_balance=100
# altarnative calculate 2 percentage of available balace for trade
#get_balance
#g_calc "$f_CURRENCY_BALANCE/100*2"
#trade_balance=$g_calc_result
# place the order # place the order
order "$symbol" 100 "$side" "$entry_price" "$stoploss" "$takeprofit" order "$symbol" "$trade_balance" "$side" "$entry_price" "$stoploss" "$takeprofit"
done done