blind-monkeys / templates /algorithm.html
deanpowers's picture
Sync workspace source: rank tracker module + routes, Grid DB admin page, flaskfactory AI probe + analytics zone, nav.js v16 Blog pill, template refresh
c8c30b4
Raw History Blame Contribute Delete
11.8 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Algorithm β€” Blind Monkeys</title>
<meta name="description" content="Every gate, score weight, and blocking indicator used by the Blind Monkeys automated trading algorithm: scan criteria, grid-opportunity gates, futures gates, exit rules, and Telegram channel markers.">
<link rel="stylesheet" href="/css/nav.css?v=4">
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<style>
* { box-sizing: border-box; }
body { background: #0d1117; color: #e6edf3; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin: 0; line-height: 1.65; }
.page-content { max-width: 860px; margin: 0 auto; padding: 48px 24px 80px; }
h1 { font-size: 32px; margin: 0 0 6px; letter-spacing: -0.5px; }
.tagline { color: #f0b90b; font-size: 16px; font-weight: 600; margin: 0 0 32px; }
.summary { background: #1e2329; border-left: 4px solid #f0b90b; padding: 18px 22px; border-radius: 8px; margin: 0 0 40px; font-size: 15px; color: #c9d1d9; }
.group { margin-bottom: 40px; }
.group h2 { font-size: 14px; color: #f0b90b; margin: 0 0 18px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid #21262d; }
table { width: 100%; border-collapse: collapse; margin: 0 0 14px; }
th { text-align: left; padding: 10px 8px; color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #30363d; }
td { padding: 10px 8px; border-bottom: 1px solid #21262d; font-size: 14px; vertical-align: top; }
tr:last-child td { border-bottom: none; }
a { color: #f0b90b; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'SF Mono', Monaco, monospace; font-size: 13px; background: #1e2329; padding: 2px 6px; border-radius: 4px; }
.mut { color: #8b949e; }
.gold { color: #f0b90b; font-weight: 700; }
.green { color: #4ade80; }
.red { color: #f87171; }
.blue { color: #58a6ff; }
.note { color: #8b949e; font-size: 13px; font-style: italic; margin-top: 6px; }
.back { margin-top: 40px; padding-top: 24px; border-top: 1px solid #21262d; color: #8b949e; font-size: 13px; text-align: center; }
.breadcrumbs { margin: 0 0 14px 0; font-size: 13px; color: #8b949e; }
.breadcrumbs a { color: #8b949e; text-decoration: none; }
.breadcrumbs .bc-sep { margin: 0 6px; color: #484f58; }
.breadcrumbs .bc-current { color: #e6edf3; }
@media (max-width: 640px) { .breadcrumbs { display: none; } }
</style>
</head>
<body>
<nav class="nav-bar">
<a href="/" class="nav-brand">πŸ™ˆ Blind Monkeys</a>
<div class="nav-links">
<a href="/scan/" class="nav-link">πŸ” Scan</a>
<a href="/settings/" class="nav-link">βš™οΈ Settings</a>
</div>
</nav>
<div class="page-content">
<div class="breadcrumbs">
<a href="/">Home</a><span class="bc-sep">β€Ί</span><span class="bc-current">Algorithm</span>
</div>
<h1>βš™οΈ Algorithm</h1>
<p class="tagline">Every gate, score weight, and blocking indicator the application uses.</p>
<div class="summary">
The system is defense-first: a coin (or a range) must pass every gate in its flow before any position opens. Scores rank candidates; gates are hard rules with no compensation. All weights below are learned from real trading outcomes via the feedback loop and update automatically.
</div>
<div class="group">
<h2>1. Scan Gates β€” Conservative &amp; Risk-Taker</h2>
<p>All four must pass simultaneously. A coin that fails any gate is listed in the scan message with the exact blocking indicator (πŸ”΄).</p>
<table>
<tr><th>Gate</th><th>Conservative</th><th>Risk-Taker</th><th>Blocking indicator (πŸ”΄ shown when)</th></tr>
<tr><td>Z-score (dip depth)</td><td>must be &lt; βˆ’1.0</td><td>must be &lt; βˆ’1.5</td><td><code>Z-score β‰₯ threshold</code></td></tr>
<tr><td>Momentum</td><td>must be &gt; 5.0</td><td>must be &gt; 10.0</td><td><code>momentum ≀ threshold</code></td></tr>
<tr><td>Volatility</td><td>must be &lt; 8.0</td><td>must be &lt; 25.0</td><td><code>volatility β‰₯ threshold</code></td></tr>
<tr><td>RSI</td><td>must be &lt; 70</td><td>must be &lt; 60</td><td><code>RSI β‰₯ threshold</code></td></tr>
</table>
<p class="note">Indicators are computed over a 20-day lookback. The score ranks how strongly a coin embodies "oversold but rebounding"; the gates are pass/fail.</p>
</div>
<div class="group">
<h2>2. Score Weights (Feedback-Learned)</h2>
<p>Each factor starts at an equal weight of 0.25 and is updated after every closed position: factors that predicted successful trades gain weight, factors that misled lose weight (multiplicative exponential update, normalized).</p>
<table>
<tr><th>Flow</th><th>Factors</th><th>Current weights</th></tr>
<tr>
<td><span class="gold">Futures</span> (upward / conservative / risk scans)</td>
<td>RSI Β· Momentum Β· Z-score Β· Volatility</td>
<td id="fut-weights">loading…</td>
</tr>
<tr>
<td><span class="gold">Grids</span> (sideways regime)</td>
<td>Oscillations Β· ADX Β· Drift Β· 24h width</td>
<td id="grid-weights">loading…</td>
</tr>
</table>
<p class="note">Futures weights refresh with every closed position; grid weights with every closed grid. History is snapshotted daily.</p>
</div>
<div class="group">
<h2>3. Grid-Opportunity Gates (Sideways Regime)</h2>
<table>
<tr><th>Gate</th><th>Rule</th></tr>
<tr><td>Market cap</td><td>Top 100 coins only</td></tr>
<tr><td>7-day range width</td><td>between 3% and 25%</td></tr>
<tr><td>Oscillations (bounces)</td><td>β‰₯ 4 crossings of the range midpoint over 7 days; Β±3% band touches over 24h</td></tr>
<tr><td>Low drift</td><td>net 7-day drift must be &lt; 60% of range width</td></tr>
<tr><td>Composite score</td><td>β‰₯ the score threshold in settings (auto-open at 15)</td></tr>
<tr><td>No duplicates</td><td>coins with a grid bot already running are excluded</td></tr>
<tr><td>Regime pause</td><td>no new grids (auto) while BTC 7-day drift ≀ βˆ’5% (configurable; manual opens stay free)</td></tr>
<tr><td>Daily cap</td><td>max $ invested in new grids per day (settings)</td></tr>
</table>
</div>
<div class="group">
<h2>4. Futures Gates (Upward &amp; Rising-Coin Flows)</h2>
<table>
<tr><th>Gate</th><th>Rule</th></tr>
<tr><td>Score threshold</td><td>score β‰₯ the auto-open value in futures settings</td></tr>
<tr><td>Regime gate (upward)</td><td>ETH must be &lt; 0.5% below its 24h high</td></tr>
<tr><td>Market gate (rising coins)</td><td>only fires when BTC + ETH are both declining (downward regime); rise β‰₯ 2% on $5M+ volume with relative strength β‰₯ 2.0Γ—</td></tr>
<tr><td>Funding gate</td><td>coin's funding rate ≀ Max Funding Rate (default 0% β€” longs get paid); skips like <code>skip BTCUSDT β€” funding 0.006% exceeds 0% (longs would pay)</code></td></tr>
<tr><td>Stablecoin exclusion</td><td>USDC, DAI, TUSD, FDUSD and other pegged pairs never open futures</td></tr>
<tr><td>Position limit</td><td>max 3 concurrent positions (shared across flows)</td></tr>
<tr><td>Per-run cap</td><td>1 new position per scan run</td></tr>
<tr><td>Daily cap</td><td>max $ invested per day (settings)</td></tr>
</table>
</div>
<div class="group">
<h2>5. Exit Gates (Every Position)</h2>
<table>
<tr><th>Gate</th><th>Rule</th></tr>
<tr><td>Take profit</td><td>TP % of invested margin (default 4%); triggers arm a trailing TP</td></tr>
<tr><td>Trailing retrenchment</td><td>once TP is armed, closes when profit retraces by the retrenchment setting (default 1%) from its peak β€” worst case is the TP level minus the retrenchment</td></tr>
<tr><td>Stop loss</td><td>hard close at SL % of invested margin (default 4%) β€” no trailing</td></tr>
<tr><td>Compounding</td><td>next order grows 25% after a TP, shrinks 25% after an SL ($10 floor, daily-cap ceiling); resets only when the Amount setting changes</td></tr>
</table>
</div>
<div class="group">
<h2>6. Telegram Channel Indicators</h2>
<table>
<tr><th>Channel</th><th>Events</th><th>Markers &amp; blocking indicators</th></tr>
<tr><td>Blind Monkey (Scanner)</td><td>Scan results</td><td>πŸ”΄ in front of every blocking criterion: <code>Z-score βˆ’0.59 (must be below βˆ’1.5)</code>, <code>momentum 6.16 (must be above 10.0)</code>, volatility, RSI</td></tr>
<tr><td>Futures New</td><td>Positions opened</td><td>🟒 <b>OPENED</b>; skips show the gate that blocked (funding, already holding, daily cap, stablecoin)</td></tr>
<tr><td>Futures Close</td><td>Positions closed</td><td>🟒 profit / πŸ”΄ loss on the P&amp;L line</td></tr>
<tr><td>Futures Funding</td><td>Funding events</td><td>β€”</td></tr>
<tr><td>Grid New</td><td>Grid bots opened</td><td>🟒 <b>OPENED</b></td></tr>
<tr><td>Grid Profit</td><td>Grid profit events</td><td>πŸ’° 🟒</td></tr>
<tr><td>Grid Closures</td><td>Grids closed</td><td>reason (take profit / stop loss / manual)</td></tr>
<tr><td>Ka-ching</td><td>Profit-only events</td><td>πŸ’° 🟒 β€” plays the ka-ching sound</td></tr>
<tr><td>Loss Events</td><td>Loss-only events</td><td>😒 with πŸ”΄ link to <a href="/performance">/performance</a> β€” plays the boohoo sound</td></tr>
</table>
</div>
<div class="back">
<a href="/">← Back to home</a> &middot; <a href="/glossary/learned_weights">Learned weights</a> &middot; <a href="/faq">FAQ</a> &middot; <a href="/regimes">Regimes</a>
</div>
</div>
<script src="/css/nav.js?v=16"></script>
<script>
(function () {
fetch('/api/futures-weights').then(function (r) { return r.json(); }).then(function (d) {
var w = (d && d.weights) || {};
var el = document.getElementById('fut-weights');
el.innerHTML = 'RSI <b>' + (w.rsi != null ? w.rsi.toFixed(2) : 'β€”') + '</b> Β· '
+ 'Momentum <b>' + (w.momentum != null ? w.momentum.toFixed(2) : 'β€”') + '</b> Β· '
+ 'Z-score <b>' + (w.zscore != null ? w.zscore.toFixed(2) : 'β€”') + '</b> Β· '
+ 'Volatility <b>' + (w.volatility != null ? w.volatility.toFixed(2) : 'β€”') + '</b>'
+ ((d && d.outcomes != null) ? ' <span class="mut">(' + d.outcomes + ' outcomes learned)</span>' : '');
}).catch(function () { document.getElementById('fut-weights').textContent = 'unavailable'; });
fetch('/api/grid-score-weights-history').then(function (r) { return r.json(); }).then(function (h) {
var keys = Object.keys(h || {}).sort().reverse();
var el = document.getElementById('grid-weights');
if (!keys.length) { el.textContent = 'β€”'; return; }
var w = h[keys[0]] || {};
el.innerHTML = 'OSC <b>' + (w.osc != null ? w.osc.toFixed(2) : 'β€”') + '</b> Β· '
+ 'ADX <b>' + (w.adx != null ? w.adx.toFixed(2) : 'β€”') + '</b> Β· '
+ 'Drift <b>' + (w.drift != null ? w.drift.toFixed(2) : 'β€”') + '</b> Β· '
+ '24h width <b>' + (w.w24 != null ? w.w24.toFixed(2) : 'β€”') + '</b>'
+ ' <span class="mut">(as of ' + keys[0] + ')</span>';
}).catch(function () { document.getElementById('grid-weights').textContent = 'unavailable'; });
})();
</script>
</body>
</html>