← BrainX Hub
Algorithmic Playbook · XV Models

Strategy Library

Fifteen trading models — from capital-protecting trend systems to account-destroying loss-recovery schemes — each wired to TradingView alerts and executable on Delta Exchange India through the BrainX bridge.

!

Live auto-execution moves real money. Martingale, anti-martingale and averaging-down can compound losses fast. The bridge ships in dry-run with every strategy disabled and hard caps (max_step, MAX_SINGLE_SIZE, DAILY_LOSS_KILL). Confirm a dry-run log before flipping anything live.

I · Loss Recovery

Martingale

AutomatableHigh Riskkey: martingale

Double the trade size after every loss, so a single win recovers all prior losses plus a small profit.

Example
Lose ₹100 → lose ₹200 → lose ₹400 → win ₹800. Net result: profit.
Risk
Very dangerous in long losing streaks — can wipe an account quickly. The max_step cap is the circuit breaker that stops the doubling.
TradingView → exec.php
{"token":"YOUR_TOKEN","strategy":"martingale","action":"entry","symbol":"BTCUSD","side":"buy"}
// on each closed trade, send result so the streak + kill switch update:
{"token":"YOUR_TOKEN","strategy":"martingale","action":"close","symbol":"BTCUSD","pnl":-100}
II · Win Scaling

Anti-Martingale

AutomatableMedium Riskkey: anti_martingale

The opposite of Martingale: increase size after wins, cut size after losses.

Used by
Trend followers and professional traders.
Benefit
Protects capital during bad conditions — you risk most when the system is already winning.
TradingView → exec.php
{"token":"YOUR_TOKEN","strategy":"anti_martingale","action":"entry","symbol":"BTCUSD","side":"buy"}
{"token":"YOUR_TOKEN","strategy":"anti_martingale","action":"close","symbol":"BTCUSD","pnl":800}
III · Range Harvesting

Grid Trading

AutomatableMedium Riskkey: grid

Place buy/sell orders at fixed price intervals; take profit automatically as price rebounds between levels.

Example
BTC — buy at 100, buy at 95, buy at 90; sell as price ticks back up.
Best for
Sideways / range markets.
Risk
Strong trends fill every rung against you → heavy drawdown. max_step caps the number of rungs.
TradingView → exec.php · one alert per rung
{"token":"YOUR_TOKEN","strategy":"grid","action":"entry","symbol":"BTCUSD","side":"buy","order_type":"limit_order","limit_price":"95000"}
IV · Scheduled Accumulation

Dollar-Cost Averaging

AutomatableLow Riskkey: dca

Invest a fixed amount on a regular schedule regardless of price.

Example
Buy ₹1000 of BTC every week.
Benefit
Removes emotion and smooths the average entry price.
Best for
Long-term investors.
TradingView scheduled alert → exec.php
{"token":"YOUR_TOKEN","strategy":"dca","action":"entry","symbol":"BTCUSD","side":"buy","size":1}
V · Cost-Basis Reduction

Averaging Down

AutomatableHigh Riskkey: averaging_down

Add to a position as price falls, lowering the average entry.

Example
Buy BTC at 100, add at 90, add at 80 — average drops.
Risk
Dangerous if the downtrend continues; you scale into a loser. max_step limits the number of adds.
TradingView → exec.php
{"token":"YOUR_TOKEN","strategy":"averaging_down","action":"entry","symbol":"BTCUSD","side":"buy"}
VI · Micro-Timeframe

Scalping

SignalMedium Riskkey: scalp

Very short-term trading to take many small profits.

Timeframe
1-minute to 5-minute charts.
Needs
  • Fast execution
  • Tight stop loss
  • High discipline
Signal alert → exec.php (size = base)
{"token":"YOUR_TOKEN","strategy":"scalp","action":"entry","symbol":"BTCUSD","side":"buy"}
VII · Multi-Day Holds

Swing Trading

SignalLow Riskkey: swing

Hold trades for days or weeks to capture medium-size moves.

Common tools
RSI · MACD · Support / Resistance.
Signal alert → exec.php
{"token":"YOUR_TOKEN","strategy":"swing","action":"entry","symbol":"BTCUSD","side":"buy"}
VIII · Directional

Trend Following

SignalLow Riskkey: trend

Trade in the direction of the prevailing market trend — “the trend is your friend.” Buy in uptrends, sell in downtrends.

Indicators
Moving averages · Supertrend · EMA crossover.
Pairs cleanly with your Supertrend stack → exec.php
{"token":"YOUR_TOKEN","strategy":"trend","action":"entry","symbol":"BTCUSD","side":"buy"}
IX · Pull-to-Average

Mean Reversion

SignalMedium Riskkey: mean_reversion

Assumes price returns to its average. When BTC strays too far from the mean, a pullback is expected.

Used with
Bollinger Bands · RSI.
Signal alert → exec.php
{"token":"YOUR_TOKEN","strategy":"mean_reversion","action":"entry","symbol":"BTCUSD","side":"sell"}
X · Risk Offset

Hedging

AutomatableLow Riskkey: hedge

Open opposite trades to neutralise risk — e.g. long BTC spot while short BTC futures — to protect against sudden moves.

Fire the offsetting leg → exec.php
{"token":"YOUR_TOKEN","strategy":"hedge","action":"entry","symbol":"BTCUSD","side":"sell"}
XI · Cross-Venue

Arbitrage

Manual / Multi-VenueMedium Risk

Profit from the same asset pricing differently across exchanges — buy where it is cheaper, sell where it is dearer.

Example
BTC at 100,000 on Binance vs 100,500 on Bybit → buy Binance, sell Bybit.
Note
Needs simultaneous orders on two venues, so it isn’t driven by a single Delta webhook. Run it from a dedicated cross-exchange bot rather than this bridge.
XII · Level Break

Breakout

SignalMedium Riskkey: breakout

Trade when price breaks an important level — BTC clears resistance → buy. Works best in high volatility.

Breakout alert → exec.php
{"token":"YOUR_TOKEN","strategy":"breakout","action":"entry","symbol":"BTCUSD","side":"buy"}
XIII · Precision Entry

Sniper Entry

SignalLow Riskkey: sniper

Wait for high-probability, precise entries — low risk, high reward.

Used with
Liquidity zones · Support / Resistance · Smart-money concepts.
Confirmed-zone alert → exec.php
{"token":"YOUR_TOKEN","strategy":"sniper","action":"entry","symbol":"BTCUSD","side":"buy"}
XIV · Add to Winners

Pyramid

AutomatableMedium Riskkey: pyramid

Add positions to a trade that is already winning to maximise strong trends — buy 1 lot, price rises, add another.

Sizing
Each add is fixed (or smaller, if mult < 1); the bridge stops after max_step adds.
Add-on-strength alert → exec.php
{"token":"YOUR_TOKEN","strategy":"pyramid","action":"entry","symbol":"BTCUSD","side":"buy"}
XV · Compounding Hybrid

Reverse Martingale Pyramid

AutomatableMedium Riskkey: reverse_pyramid

A combination model: increase size on wins, reduce risk on losses, and compound profits while a trend runs.

Behaviour
Scales up with the win streak (capped at max_step) and resets to base after any loss.
TradingView → exec.php · remember the close/pnl alert
{"token":"YOUR_TOKEN","strategy":"reverse_pyramid","action":"entry","symbol":"BTCUSD","side":"buy"}
{"token":"YOUR_TOKEN","strategy":"reverse_pyramid","action":"close","symbol":"BTCUSD","pnl":450}
Execution Layer

TradingView → Delta Bridge

A single PHP endpoint receives your alerts, applies the strategy’s sizing model, resolves the live product ID, and places the signed order on Delta Exchange India.

Pine alert() Webhook POST exec.php sizing + caps signed /v2/orders Delta India

Endpoint: https://brainxalgo.com/brainx-strategies/strategy-exec/exec.php — paste this as the Webhook URL in the TradingView alert dialog, and one of the JSON payloads above as the Message.

  1. Upload the brainx-strategies/ module into public_html; keep Delta keys in the web-blocked secrets.php.
  2. Set a long random WEBHOOK_TOKEN in config.php.
  3. Leave LIVE → false; fire a test alert; confirm side/size in state/exec.log.
  4. Enable one strategy (on → true); tune base, mult, max_step.
  5. Always send a close (or flat) alert with realised pnl — the streak engine and the DAILY_LOSS_KILL switch depend on it.
  6. Flip LIVE → true only when the dry-run log is correct. Start with the smallest base and lowest max_step.