Skip to content

simoncampos1022/profitable-futures-trading-strategy-crypto-forex-stock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Botara 3.0 - Advanced Futures Trading Bot

Logo

A sophisticated algorithmic trading system designed for cryptocurrency and forex futures markets. This bot implements a multi-indicator strategy with advanced risk management, position tracking, and real-time monitoring capabilities.

Python License Status

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Overview

Botara 3.0 is the result of extensive research and development in algorithmic trading. It combines multiple technical indicators with sophisticated risk management to execute trades automatically on futures markets. The strategy has been thoroughly backtested using Bitget and Blofin candle data across multiple cryptocurrency and forex pairs, showing consistent profitability.

Supported Exchanges:

  • Cryptocurrency: Binance, Bitget, Blofin, Bybit, and more
  • Forex: MetaTrader4/5 platforms
  • Stock TradeStation and more

Current Status: Successfully live testing for 2+ months with positive results. Ongoing live testing continues.

๐Ÿ“Š Strategy Description

The bot employs a multi-indicator crossover strategy that combines:

Core Indicators

  1. Fisher Transform (FS) - Identifies potential trend reversals and momentum shifts
    https://www.tradingview.com/support/solutions/43000589141/
  2. RSI (Relative Strength Index) - Filters entries based on overbought/oversold conditions
    https://www.tradingview.com/support/solutions/43000502338/
  3. Volume Oscillator - Ensures trades are taken during periods of volume confirmation
    https://www.tradingview.com/support/solutions/43000591350/
  4. ATR (Average True Range) - Dynamically adjusts stop-loss and take-profit levels based on market volatility
    https://www.tradingview.com/support/solutions/43000501823/

Entry Logic

Long Positions:

  • FS crosses above TR (bullish crossover)
  • RSI deviates significantly from 50 (momentum confirmation)
  • FS/TR magnitude exceeds threshold (strong signal strength)
  • Volume oscillator is positive (volume confirmation)

Short Positions:

  • FS crosses below TR (bearish crossover)
  • RSI is near neutral (contrarian entry)
  • FS/TR magnitude exceeds threshold
  • Volume oscillator is positive

Exit Logic

  • Take Profit: ATR-based dynamic take-profit levels
  • Stop Loss: ATR-based dynamic stop-loss with trailing stop functionality
  • Half Exit: Automatic 50% position closure at first take-profit target
  • Trailing Stop: Activates after half exit to protect remaining position

Parameter Optimization with Optuna

The Entry/Exit Levels have been meticulously optimized using Optuna, a state-of-the-art hyperparameter optimization framework. The optimization process utilized several years of historical market data to ensure robust and reliable parameter sets.

Why Optuna?

Optuna provides significant advantages over traditional optimization methods:

  1. Tree-structured Parzen Estimator (TPE) - Advanced Bayesian optimization that efficiently explores the parameter space
  2. Pruning Mechanism - Automatically stops unpromising trials early, saving computational resources
  3. Parallel Optimization - Supports distributed optimization across multiple cores/machines
  4. Visualization Tools - Built-in tools for analyzing optimization history and parameter importance
  5. Flexible Search Spaces - Supports complex parameter distributions (uniform, log-uniform, categorical, etc.)
  6. Efficient Sampling - Intelligently samples parameter combinations based on previous trial results

Optimization Process

  • Historical Data: Several years of market data from multiple exchanges
  • Objective Function: Maximized Sharpe ratio, profit factor, and minimized drawdown
  • Validation: Walk-forward analysis to prevent overfitting
  • Result: Optimized parameters that balance profitability with risk management

This data-driven approach ensures that the Entry/Exit Levels are not arbitrary but are statistically validated against extensive historical market conditions.

โœจ Key Features

๐ŸŽฏ Trading Features

  • Automated Signal Detection - Monitors market conditions every hour
  • Dual Position Support - Can hold both long and short positions simultaneously
  • Dynamic Risk Management - ATR-based stop-loss and take-profit calculations
  • Trailing Stop Loss - Automatically adjusts stop-loss to lock in profits
  • Partial Position Exits - Takes profit on 50% of position while letting winners run
  • Position Replacement - Automatically replaces losing positions with better entry points

๐Ÿ“ˆ Monitoring & Analytics

  • Real-time Position Monitoring - Checks positions every second
  • Trade History Tracking - Complete CSV-based trade log
  • Performance Metrics - Win rate, drawdown, daily PnL tracking
  • Webhook Integration - Real-time notifications for trades and statistics
  • Daily PnL Reports - Automated performance summaries

๐Ÿ”ง Technical Features

  • Thread-safe Operations - Multi-threaded architecture for concurrent operations
  • State Persistence - Resumes from CSV on restart
  • Error Handling - Robust error handling and recovery
  • Command Interface - Interactive CLI for manual control
  • Multi-Exchange Support - Compatible with Binance, Bitget, Blofin, Bybit APIs
  • Forex Platform Support - Available for MT4 and MT5 platforms
  • Optuna-Optimized Parameters - Entry/Exit levels optimized using advanced hyperparameter optimization

๐Ÿ“ˆ Backtesting Results

The strategy has been extensively backtested using Bitget and Blofin candle data across multiple markets:

Backtesting Guide

Cryptocurrency Pairs

  • โœ… ETH/USDT - Strong performance
  • โœ… SOL/USDT - Excellent results
  • โœ… LINK/USDT - Profitable
  • โœ… UNI/USDT - Consistent gains
  • โœ… DOGE/USDT - Good performance
  • โœ… SUSHI/USDT - Positive returns
  • โœ… TAO/USDT - Strong results
  • โœ… ZEC/USDT - Profitable

Forex Pairs

  • โœ… EUR/USD - Consistent performance
  • โœ… GBP/USD - Strong results

Stock Pairs

  • Working now

๐Ÿ“Š Detailed backtesting results with charts and trade logs are available in the crypto_symbols/ and forex_symbols/ directories.

๐Ÿš€ Live Testing

Current Status: โœ… Live testing in progress

  • Duration: 2+ months of successful live trading
  • Performance: Positive results with consistent profitability
  • Ongoing: Continuous live testing and optimization

The bot is currently running live trades and demonstrating strong performance in real market conditions.

๐Ÿ› ๏ธ Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Step 1: Clone the Repository

git clone https://github.com/simoncampos1022/botara_profitable_futures_trading_strategy_crypto_forex_stock.git
cd botara_strategy

Step 2: Install Dependencies

pip install -r requirements.txt

If requirements.txt doesn't exist, install manually:

pip install requests pandas numpy

โš™๏ธ Configuration

Trading Parameters

Parameter Description Default
INITIAL_BALANCE Starting capital 10000
LEVERAGE Trading leverage 5x
POSITION_SIZE_RATIO Position size as % of balance 0.4 (40%)
INTERVAL Candle timeframe 1H
FEE_PERCENT Trading fee percentage 0.0006 (0.06%)

Indicator Settings

Indicator Length Description
ATR_LENGTH 14 Average True Range period
FS_LENGTH 10 Fisher Transform period
RSI_LENGTH 14 RSI calculation period

Entry/Exit Levels

โš™๏ธ Note: These parameters have been optimized using Optuna framework with several years of historical data. The optimization process utilized advanced Bayesian optimization techniques to find optimal parameter combinations that maximize profitability while minimizing risk.

Long Positions:

  • FS Entry Level: ? (Optuna-optimized)
  • RSI Entry Level: ? (Optuna-optimized)
  • Stop Loss: ? ร— ATR (Optuna-optimized)
  • Take Profit: ? ร— ATR (Optuna-optimized)
  • Trailing Stop: ? ร— ATR (Optuna-optimized)

Short Positions:

  • FS Entry Level: ? (Optuna-optimized)
  • RSI Entry Level: ? (Optuna-optimized)
  • Stop Loss: ? ร— ATR (Optuna-optimized)
  • Take Profit: ? ร— ATR (Optuna-optimized)
  • Trailing Stop: ? ร— ATR (Optuna-optimized)

๐ŸŽฎ Usage

Starting the Bot

python botara3_bot.py

Interactive Commands

Once running, you can use these commands:

help                    - Show available commands
force open long         - Manually open a long position
force open short        - Manually open a short position
force close long        - Manually close long position
force close short       - Manually close short position
force half close long    - Close 50% of long position
force half close short  - Close 50% of short position
balance                 - Show current balance
price                   - Show current price
exit                    - Shutdown the bot

Strategy Loop

The bot automatically:

  1. Updates indicators every hour (at :00:05 UTC)
  2. Checks for entry/exit signals
  3. Monitors positions every second
  4. Updates trailing stops in real-time
  5. Saves all trades to CSV

๐Ÿ›ก๏ธ Risk Management

Position Sizing

  • Uses 40% of available balance per position
  • Leverage: 5x (configurable)
  • Maximum 1 long and 1 short position simultaneously

Stop Loss Protection

  • Dynamic ATR-based stop-loss levels
  • Trailing stop activates after take-profit hit
  • Real-time monitoring every second

Take Profit Strategy

  • First target: Close 50% of position
  • Remaining 50%: Protected by trailing stop
  • Maximizes profit while securing gains

Risk Controls

  • Position replacement logic (replaces losing positions)
  • Volume confirmation required for entries
  • Multiple indicator confirmation before entry

๐Ÿ“Š Performance Metrics

The bot tracks comprehensive performance metrics:

  • Total PnL - Overall profit/loss percentage
  • Win Rate - Percentage of profitable trades
  • Max Drawdown - Maximum peak-to-trough decline
  • Daily PnL - Daily profit/loss tracking
  • Total Trades - Number of completed trades
  • Last Trade PnL - Most recent trade performance

All metrics are automatically sent via webhook after each closed trade.

๐Ÿ“ Project Structure

botara_strategy/
โ”œโ”€โ”€ blofin_eth_bot.py          # Main trading bot
โ”œโ”€โ”€ eth_blofin_history.csv     # Trade history (auto-generated)
โ”œโ”€โ”€ crypto_symbols/             # Crypto backtesting results
โ”‚   โ”œโ”€โ”€ case_ETHUSDT_chart.html
โ”‚   โ”œโ”€โ”€ case_ETHUSDT_trades.csv
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ forex_symbols/              # Forex backtesting results
โ”‚   โ”œโ”€โ”€ case_EURUSD_chart.html
โ”‚   โ”œโ”€โ”€ case_EURUSD_trades.csv
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ logo.png                    # Project logo
โ”œโ”€โ”€ html_guide.gif              # Visualization guide
โ””โ”€โ”€ README.md                   # This file

๐Ÿ”— Contact & Support

Need Help?

As a senior software engineer and trading expert with extensive experience in:

  • Algorithmic trading automation
  • Backtesting strategies
  • Strategy optimization
  • Python development

I'm available to help with:

  • ๐Ÿš€ Trading Automation - Custom bot development
  • ๐Ÿ“Š Backtesting - Strategy validation and testing
  • โš™๏ธ Optimization - Parameter tuning and strategy refinement
  • ๐Ÿ’ป Development - Python trading system development

Get in Touch

Feel free to reach out for collaboration, consulting, or any questions about algorithmic trading!

Happy Trading!

About

A sophisticated algorithmic trading system designed for cryptocurrency and forex futures markets. This bot implements a multi-indicator strategy with advanced risk management, position tracking, and real-time monitoring capabilities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages