-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More Trading Strategies #1
Comments
Please disregard the first announcement. We will now be using ta-lib's indicator and be using a ranking system on them. Further on, we will be using parameters that are adjustable. Please help my contributing either by adding more strategies not already implemented or the AI portion |
Further idea - make a sentiment strategy - maybe apis from trending on reddit or seeking alpha |
I have a pretty robust sentiment tracker, will share later today |
This one shows good results, thought i would share. def euler_fibonacci_zone_strategy(ticker, data):
"""
Euler-Fibonacci Zone Trading Strategy.
This strategy combines Euler's number (e) with Fibonacci ratios to create trading zones.
Returns 'Buy', 'Sell', or 'Hold' based on the current price relative to the zones.
"""
window = 20 # Rolling window for calculating highs and lows
# Calculate Euler-Fibonacci zones
high = data['High'].rolling(window=window).max()
low = data['Low'].rolling(window=window).min()
range_size = high - low
euler = np.exp(1) # Euler's number
fib_ratios = [0.236, 0.382, 0.618, 1.0, 1.618] # Fibonacci ratios
zones = []
for ratio in fib_ratios:
zone = low + (range_size * ratio * euler) % range_size
zones.append(zone)
current_price = data['Close'].iloc[-1] # Current price
current_zone = zones[-1].iloc[-1] # Use the last calculated zone
# Determine sentiment based on current price relative to zones
if current_price < zones[0].iloc[-1]:
return 'Buy' # Strong buy signal
elif current_price < zones[1].iloc[-1]:
return 'Buy' # Buy signal
elif current_price > zones[4].iloc[-1]:
return 'Sell' # Strong sell signal
elif current_price > zones[3].iloc[-1]:
return 'Sell' # Sell signal
else:
return 'Hold' # Hold signal` |
This issue will remain. It is open to all contributors. Please make sure your trading strategy isn't already implemented - this can be checked with a quick scan in strategies in helper/client_helper.py - quick ctrl f
Strategies can be added i neither strategies/trading_strategies_v2.py or strategies/trading_strategies_v2_1.py. Please do not add to trading_strategies_v1.py as those strategies are no longer supported. If you wish you can make a new file titled strategies/trading_strategies_v2_2.py and add your strategies there, but this may require additional import statements to other files. When making your strategy, it must abide by these rules:
After adding your strategy, please test it in testing_client.py using test_strategies(). you can add your strategy there to test if it will work. If it does, that is great!. If it passes, please add your strategy name to the strategies list in helper/helper_files. That is it, and you can PR and I'll be happy to take a look.
For people interested in training: to add your strategy to MongoDB with appropriate profile, navigate to ranking_client. Run initialize_rank(). Now your strategy has had its profile made in your MongoDB. you may also need to run insert_rank_to_coefficient to initialize the coefficients so that it's on the format rank - coefficient which will help the trading bot retrieve the required voting coefficient for the current ranking it has. If you have any question about this process or the PR in general, please feel free to contact me
The text was updated successfully, but these errors were encountered: