The NIJA Apex Strategy v7.1 is a sophisticated, high-probability trading strategy designed for professional-grade automated trading. It combines market filters, precise entry triggers, dynamic risk management, and intelligent exit logic to maximize profits while protecting capital.
Only trades when market conditions are favorable:
Entry Execution: Only on candle close (no mid-candle entries)
Position size adapts to trend strength (based on ADX):
| Trend Quality | ADX Range | Position Size |
|---|---|---|
| Weak | 20-25 | 2% of account |
| Good | 25-30 | 5% of account |
| Strong | 30-40 | 7% of account |
| Very Strong | 40+ | 10% of account |
Progressive profit-taking with trailing:
| Stage | Profit (R) | Exit % | Action |
|---|---|---|---|
| TP1 | 1R | 33% | Move stop to break-even |
| TP2 | 2R | 33% | Activate trailing stop |
| TP3 | 3R | 34% | Final exit or continue trailing |
Positions close on:
Trading blocked when:
bot/
├── apex_strategy_v7.py # Main strategy implementation
├── apex_indicators.py # Technical indicators (ADX, ATR, MACD, etc.)
├── apex_config.py # Configuration parameters
├── apex_risk_manager.py # Position sizing and risk management
├── apex_filters.py # Smart filters
├── apex_trailing_system.py # Trailing stop logic
├── apex_ai_engine.py # Optional AI scoring
└── apex_backtest.py # Backtesting engine
Implemented:
Placeholders:
pip install pandas numpy
pip install coinbase-advanced-py # For Coinbase
pip install alpaca-py # For Alpaca (optional)
For Coinbase (primary):
export COINBASE_API_KEY="your_api_key"
export COINBASE_API_SECRET="your_api_secret"
export COINBASE_PEM_CONTENT="your_base64_pem"
For Alpaca (optional):
export ALPACA_API_KEY="your_api_key"
export ALPACA_API_SECRET="your_api_secret"
export ALPACA_PAPER="true" # true for paper trading
from apex_strategy_v7 import ApexStrategyV7
import pandas as pd
# Initialize strategy
strategy = ApexStrategyV7(account_balance=10000.0, enable_ai=False)
# Analyze entry opportunity
df = pd.DataFrame(...) # Your OHLCV data
analysis = strategy.analyze_entry_opportunity(df, symbol="BTC-USD")
if analysis['should_enter']:
print(f"Entry Signal: {analysis['side']}")
print(f"Entry Price: ${analysis['entry_price']:.2f}")
print(f"Stop Loss: ${analysis['stop_loss']:.2f}")
print(f"Position Size: ${analysis['position_size_usd']:.2f}")
print(f"Trend Quality: {analysis['trend_quality']}")
from apex_backtest import ApexBacktest
import pandas as pd
# Load historical data
df = pd.read_csv('historical_data.csv') # OHLCV format
# Initialize backtest
backtest = ApexBacktest(initial_balance=10000.0, enable_ai=False)
# Run backtest
results = backtest.run_backtest(df, symbol="BTC-USD", commission=0.001)
# Print results
backtest.print_results(results)
from apex_strategy_v7 import ApexStrategyV7
from broker_manager import BrokerManager, CoinbaseBroker
# Setup broker
broker_manager = BrokerManager()
coinbase = CoinbaseBroker()
coinbase.connect()
broker_manager.add_broker(coinbase)
# Get balance
balance = broker_manager.get_total_balance()
# Initialize strategy
strategy = ApexStrategyV7(account_balance=balance, enable_ai=False)
# Main trading loop
while True:
for symbol in ['BTC-USD', 'ETH-USD', 'SOL-USD']:
# Fetch candles
candles = coinbase.get_candles(symbol, '5m', 100)
df = pd.DataFrame(candles)
# Analyze entry
analysis = strategy.analyze_entry_opportunity(df, symbol)
if analysis['should_enter']:
# Place order
broker_manager.place_order(
symbol,
analysis['side'],
analysis['position_size_usd']
)
time.sleep(300) # Wait 5 minutes
All parameters can be customized in apex_config.py:
MARKET_FILTER = {
'adx_threshold': 20,
'volume_threshold': 0.5,
# ...
}
POSITION_SIZING = {
'trend_quality': {
'weak': {'position_size': 0.02},
'strong': {'position_size': 0.07},
# ...
}
}
RISK_LIMITS = {
'max_daily_loss': 0.025, # 2.5%
'max_exposure': 0.30, # 30%
'max_positions': 5,
# ...
}
The strategy is designed to be modular for both:
Backtest Mode:
Live Mode:
⚠️ TRADING RISK WARNING
This strategy involves real financial risk. You can lose your entire account balance. This is not financial advice. Use at your own risk. Always:
MIT License - Free to use and modify
For issues, questions, or contributions, please refer to the main NIJA repository documentation.
NIJA Apex Strategy v7.1 is a unified, production-ready trading system designed for high-probability, multi-confirmation trade execution with aggressive capital protection.
Only trades in clean, strong trends with favorable conditions:
Requires 4 out of 6 confirmations for trade entry:
Position size adapts to trend strength:
Signal quality also affects size:
bot/
├── nija_apex_strategy.py # Core strategy class
├── indicators_apex.py # Enhanced indicators (ADX, ATR, MACD, momentum)
├── risk_management.py # Position sizing, stops, take-profits
├── market_filters.py # Chop detection, volume, news, timing filters
├── broker_integration.py # Multi-broker adapter framework
├── ai_momentum.py # AI momentum scoring (skeleton)
└── apex_config.py # Configuration (no secrets!)
All parameters are centralized in apex_config.py:
MARKET_FILTERING = {
'min_adx': 20, # Minimum trend strength
'min_volume_multiplier': 1.5, # Min volume vs average
}
ENTRY_CONFIG = {
'min_signal_score': 4, # Min confirmations (out of 6)
'require_ema_alignment': True,
'require_vwap_alignment': True,
}
RISK_CONFIG = {
'max_risk_per_trade': 0.02, # 2% per trade
'max_daily_loss': 0.025, # 2.5% daily limit
'max_total_exposure': 0.30, # 30% max exposure
'max_drawdown': 0.10, # 10% max drawdown
}
POSITION_SIZING = {
'base_position_size': 0.03, # 3% base
'min_position_size': 0.01, # 1% minimum
'max_position_size': 0.10, # 10% maximum
'use_adx_weighting': True,
}
STOP_LOSS_CONFIG = {
'atr_stop_multiplier': 1.5,
'min_stop_pct': 0.003,
}
TAKE_PROFIT_CONFIG = {
'tp1': {'pct': 0.008, 'exit_size': 0.50},
'tp2': {'pct': 0.015, 'exit_size': 0.30},
'tp3': {'pct': 0.025, 'exit_size': 0.20},
}
from nija_apex_strategy import NijaApexStrategyV71
import pandas as pd
# Initialize strategy with account balance
strategy = NijaApexStrategyV71(account_balance=10000.0)
# Get market data (OHLCV DataFrame)
df = get_market_data('BTC-USD', timeframe='5m', limit=100)
# Check if we should enter a trade
should_enter, trade_plan = strategy.should_enter_trade(df)
if should_enter:
print(f"✅ TRADE SIGNAL: {trade_plan['signal'].upper()}")
print(f" Score: {trade_plan['score']}/6")
print(f" Entry: ${trade_plan['entry_price']:.2f}")
print(f" Size: ${trade_plan['position_size_usd']:.2f} ({trade_plan['position_size_pct']*100:.1f}%)")
print(f" Stop: ${trade_plan['stop_loss']:.2f}")
print(f" TP1: ${trade_plan['take_profits']['tp1']['price']:.2f}")
print(f" TP2: ${trade_plan['take_profits']['tp2']['price']:.2f}")
print(f" TP3: ${trade_plan['take_profits']['tp3']['price']:.2f}")
else:
print("❌ No trade signal")
.env file for local development (never commit to git).env files to version controlCOINBASE_API_KEY=your_api_key
COINBASE_API_SECRET=your_api_secret
COINBASE_PEM_CONTENT=your_base64_encoded_pem
LIVE_MODE=true # Set to "false" for paper trading
# Optional for other brokers
BINANCE_API_KEY=your_binance_key
BINANCE_API_SECRET=your_binance_secret
ALPACA_API_KEY=your_alpaca_key
ALPACA_API_SECRET=your_alpaca_secret
The strategy supports multiple brokers through a unified interface:
from broker_integration import BrokerFactory
broker = BrokerFactory.create_broker('coinbase')
broker.connect()
balance = broker.get_account_balance()
broker = BrokerFactory.create_broker('binance', testnet=True)
# TODO: Implement full Binance integration
broker = BrokerFactory.create_broker('alpaca', paper=True)
# TODO: Implement full Alpaca integration
Framework in place for ML integration:
from ai_momentum import MomentumScorer, AIRegimedDetector
# Market regime detection
regime_detector = AIRegimedDetector()
regime = regime_detector.detect_regime(df, adx, atr_pct)
# Momentum scoring (currently rule-based)
scorer = MomentumScorer(use_ml=False)
score = scorer.calculate_momentum_score(indicators, market_data)
Future capabilities:
MIT License - Use freely, no warranty provided.
LIVE TRADING RISK: This bot executes REAL trades with REAL money. You can lose your entire account balance.
USE AT YOUR OWN RISK
“Discipline, precision, and protection generate consistent profits.”
Core principles:
Version: 7.1 Last Updated: December 2024 Status: Production Ready (Coinbase), Placeholder (Binance) Last Updated: December 12, 2025 Status: Production-Ready Architecture