This is an example trading expert that implements a Relative Strength Index (RSI) strategy for trading on Bybit.
The RSI strategy uses the Relative Strength Index indicator to identify overbought and oversold conditions:
- Buy signal when RSI crosses above 30 (oversold)
- Sell signal when RSI crosses below 70 (overbought)
-
Copy
.env.exampleto.envand fill in your Bybit API credentials:BYBIT_API_KEY="your_api_key" BYBIT_API_SECRET="your_api_secret" BYBIT_BASE_URL="your_base_url" # Optional
-
Adjust the strategy parameters in the
@expert.on_initdecorator as needed.
python main.py- Symbols: BTCUSDT
- Timeframe: 1 hour
- Leverage: 10x
- Position Sizing: Risk-based (1.5% of equity per trade)
- Stop Loss: 2%
- Take Profit: 4%
- Trailing Stop: 1%
The actual RSI calculation and trading logic need to be implemented in the bar() function. The necessary imports (numpy, etc.) are commented out and should be uncommented when implementing the strategy.