Back to Home

AI-workflow for liquidation cascades in trading

AI-workflow on Claude automates the search for liquidation cascades through monthly Pine strategies. Analysis of 15m candle dumps, negative news and code review ensures >1% TP profit without HOLD. Example for February 2026 with $700M liquidations.

AI agent for finding liquidations on the crypto market
Advertisement 728x90

Automated AI Workflow for Analyzing Liquidation Cascades in Trading

A liquidation cascade occurs when the price drops below a key level: the exchange closes positions with market orders, causing a sharp drop over 1-2 bars followed by a bounce. This pattern repeats dozens of times a year, but parameters change monthly—from support breakouts to spikes with 3% V-shaped reversals.

Manually updating criteria requires analyzing news about liquidated positions. An AI agent based on Claude with the /loop command automates the process, creating profitable Pine Script strategies for the current month.

To initiate: npx @backtest-kit/cli --init --output my-project.

Google AdInline article slot

System Prompt CLAUDE.md

The key element is the CLAUDE.md file with the agent's contract. It focuses on market thinking, not coding:

Mistakes in Strategy Development

  • Avoid reading the entire project and cluttering context.
  • Steer clear of brute force and incremental edits.
  • Don't sacrifice efficiency for universality.
  • Exclude var, na, side effects in Pine Script—calculate everything on each iteration.
  • Prohibit hacks like infinite trailing SL without final criteria.
  • Minimum 1 signal per day for statistical significance.

Correct Approach

  • One-month strategy: ./math/jan_2026.pine, ./content/jan_2026.strategy.ts.
  • Analyze negative news: "Bitcoin negative news March 2026 regulatory issues."
  • Candle dump: npm start -- --dump --timeframe 15m --limit 500 --when "2026-02-28T00:00:00.000Z" --jsonl.
  • Account for sideways markets, dynamic TP/SL (minimum TP 1% to cover 0.4% fees).
  • No HOLD strategies—only entry points with immediate profit.

Agent Workflow Algorithm

Planning

  • Analyze previous .pine and reasons for failure.
  • Search for negative news from the month.
  • Correlate news with candle dump (bounces, gaps, volatility).
  • Review candles: volumes, market gaps, risks.

Writing and Validation

  • New files from scratch, no copy-pasting.
  • Run: npm start -- --pine ./math/impulse_trend_15m.pine --timeframe 15m --limit 500 --when "2026-02-28T00:00:00.000Z" --jsonl.
  • Criterion: profit, not code for code's sake.
  • Save report: ./report/feb_2026.md with fundamental analysis.
  • Code review for HOLD, trailing SL, drawdowns.

Automation Example for February 2026

The agent received a task: January's strategy was unprofitable (bearish trend). A dump of 500 15m candles showed spikes and gaps. News: $700M liquidations on February 5-6, BTC drop to $60K.

The agent correlated events with data, generated a new .pine accounting for V-bounces, tested for profit >1% TP, >1 signal/day.

Google AdInline article slot

Results in Pine header:

  • Sharpe Ratio, avgPnl, stdDev.
  • Signals: 1+ per day.
  • Risk management without HOLD.

Key Takeaways

  • Monthly optimization based on news and candles eliminates whipsaw from fees.
  • Dump and --jsonl for visual trend analysis (bullish/bearish/sideways).
  • Negative news is key to correlating with liquidations.
  • Code review is mandatory: final SL/TP, no brute force.
  • Indicators only for predicting retail trader behavior.

— Editorial Team

Advertisement 728x90

Read Next