All work
Pine Script

Candle-to-Candle Recovery Ladder Strategy

A Pine v6 strategy from a hand sketch: trade each candle's colour with a loss-recovery quantity ladder, verified on every one of 8,999 trade pairs.

Three recovery modes (step list, multiplier, auto cover-last-loss), colour-versus-P&L loss basis, JSON alert messages per order, a diagnostics table, and an honest backtest that showed no edge.

Candle-to-Candle Recovery Ladder Strategy — illustration
What makes it serious
  • Ladder verified on 8,999/8,999 trade pairs
  • Three recovery modes and configurable loss basis
  • JSON alert payload per order
  • No-edge result reported, not hidden

The client specification arrived as a photographed sketch and a paragraph: go long on a green close and short on a red one, exit after one candle or on an opposite-colour close, and after each losing candle step the next order quantity up a fixed ladder, resetting to the base after a win. The implementation uses its own state bookkeeping with orders processed on close and no pyramiding, offers three recovery modes, lets the user define a loss by candle colour or by realised P&L, emits a JSON alert message per order for downstream automation, and shows a diagnostics table.

Verification was exhaustive rather than sampled: the ladder was correct on 8,999 of 8,999 consecutive trade pairs, holds were one candle, there were zero overlaps, and same-bar close-and-re-enter worked. The backtest with defaults on Nifty 15-minute showed a profit factor under one, which was expected for a martingale-style ladder and stated to the client plainly.

One ambiguity in the sketch (an extra step after a winning candle that contradicted the text) was followed per the text and flagged as the single change to make if the client meant otherwise.

Client strategy tool; shared as engineering work, not financial advice.

How it works

  1. Candle colour decides direction on close
  2. Position exits after N candles or on an opposite close
  3. Loss advances the quantity ladder; win resets it
  4. Each order emits a JSON alert for automation
  5. Diagnostics table shows ladder state and verification counts
Stack
Pine Script v6TradingViewPython compile checker

Software and automation are infrastructure, not financial advice. No performance guarantees. Every live system needs staged testing, risk limits, and owner approval.

#pine-script#strategy#martingale#nifty#client#alerts