Leverage: Porting the Foresight Signal Stack to Crypto Perpetuals
The signal stack I built for prediction markets turns out to work on perpetual futures — with modifications. Here's how a 9-factor scoring engine, conviction-scaled leverage, and six independent risk gates become a perps trading system.

The Foresight bot trades prediction markets. Binary outcomes, short windows, fixed-size bets. It evaluates whether BTC will close up or down in the next five minutes and places a TAKER order on Polymarket's CLOB. The signal stack behind it — nine weighted factors feeding a conviction score — was built specifically for that context.
Then I asked a question that changed the next three months of work: what happens if you point that same signal architecture at perpetual futures?
The answer isn't "it works." The answer is "the scoring translates, but everything downstream — sizing, risk, position management — has to be rebuilt from scratch." Prediction markets have binary payoffs and zero leverage. Perpetual swaps have continuous P&L and up to 125x leverage on some exchanges. Same signal, completely different execution environment.
Leverage is the system I built to bridge that gap.
Why Perpetuals
Prediction markets are elegant but constrained. You're betting on discrete outcomes in fixed windows. The edge is real — Foresight's signal stack finds mispriced binary options consistently — but the position sizes are small and the markets are thin. Polymarket's BTC binary markets might have $50K-$200K in daily volume on a given window. That's enough to validate a signal architecture. It's not enough to scale it.
Perpetual futures on Phemex trade billions in daily volume. You can enter and exit positions at any price with minimal slippage. And the instrument itself — a USDT-margined perpetual swap — lets you express a directional view with leverage, meaning you can scale conviction into position size in a way binary markets don't allow.
Prediction markets answer "is this signal correct?" Perpetual futures answer "how much do you believe it?" Leverage is the bridge between those two questions.
The thesis was straightforward: if the InDecision Framework produces a directional bias with measurable conviction, and that bias has demonstrated accuracy on binary markets, then the same bias should produce edge on perpetuals — provided the execution layer respects the risk profile of leveraged instruments.
The Signal Engine: 9 Factors
The core of Leverage is a SignalEngine that evaluates nine independent factors and produces a composite score from 0 to 100. Each factor addresses a specific failure mode in directional trading.
price_momentum (0-35 pts) — ATR-adjusted price velocity. Raw price change is meaningless without volatility context. A $500 BTC move in a low-volatility regime is a signal. The same move during a liquidation cascade is noise. ATR normalization ensures momentum scores reflect relative magnitude, not absolute dollar amounts.
technical_analysis (0-30 pts) — RSI, MACD, Bollinger Bands, candlestick pattern recognition, and TD Sequential counts. This is the densest factor — it combines trend indicators, mean-reversion signals, and structural pattern detection into a single directional read. TD Sequential in particular catches exhaustion points that momentum alone misses.
indecision_bias (0-35 pts) — the InDecision Engine's directional bias, injected as the macro anchor. This is the most heavily weighted single factor in the system. It calls the InDecision API at 127.0.0.1:8081 and translates the framework's conviction percentage into a 0-35 score. When InDecision says BEARISH with 78% conviction, that becomes approximately 27 points of directional weight.
The indecision_bias factor is what makes Leverage more than a technical trading bot. It's the macro directional view — the swing-trading anchor that prevents the system from taking counter-trend scalps against the prevailing regime. Without it, the bot trades every crossover. With it, the bot trades crossovers that align with the larger picture.
volume_confirmation (0-10 pts) — volume profile validates the move. A breakout on declining volume is suspect. A breakout on 2x average volume is confirmation. This factor prevents the system from chasing thin moves that reverse on the first real order flow.
trend_alignment (-10 to +5 pts) — multi-timeframe trend agreement. This is the only factor that can go negative. When the 5-minute signal says long but the 4-hour trend says short, trend_alignment penalizes the score. When all timeframes agree, it adds a bonus. The asymmetric range (-10 to +5) reflects a core principle: counter-trend trades should be harder to trigger than with-trend trades.
news_sentiment (0-10 pts) — news context via Perplexity. Not a primary driver — 10 points max — but a useful filter. If every technical indicator says bullish but breaking news is reporting an exchange hack, the sentiment score suppresses the composite. It's a sanity check, not a signal generator.
funding_rate (0-10 pts) — penalizes positions when the funding rate is adverse. If funding is highly positive and the bot wants to go long, that means longs are paying shorts — the crowd is already positioned in your direction and paying for the privilege. The funding rate factor doesn't block the trade, but it deducts points, making the composite score harder to pass threshold.
The weighting isn't arbitrary. Price momentum and InDecision bias together account for 70 of 100 possible points. These are the two factors that answer the fundamental question: is price moving, and does the macro framework agree? The remaining 30 points come from confirmation and risk-adjustment factors that modulate conviction but don't drive it.
Conviction-Scaled Leverage
Here's where Leverage diverges most from Foresight. In prediction markets, every bet is the same size — you buy tokens at a price that implies a probability, and the payout is binary. In perpetuals, you choose your leverage.
Most trading bots use fixed leverage. Pick 5x or 10x and leave it. Leverage does the opposite: it scales leverage to conviction.
| Conviction | Min Score | Leverage | Position Size |
|---|---|---|---|
| STRONG | >=80 | 10x | 3% of balance |
| MODERATE | >=70 | 5x | 2% of balance |
| WEAK | >=65 | 3x | 1% of balance |
The logic is: if your signal stack produces a score of 85, you have high factor alignment across multiple independent indicators. That's not a 5x trade — that's a 10x trade with 3% of your balance. If the score is 71, you have a marginal edge with some factors disagreeing. That's 5x with 2%.
Conservative mode — which is how the bot runs in production — disables WEAK conviction entirely. Nothing below 70 trades. This means every position that opens has at least five of nine factors in agreement and a composite score that clears a meaningful threshold.
More signal does not mean more size. More signal means more leverage. The position size stays bounded by balance percentage. The leverage amplifies the return on that bounded position. This is the distinction between scaling conviction and scaling risk.
The Six Risk Gates
Every trade passes through six independent risk gates before execution. Each gate exists because a specific failure mode will eventually occur, and the question is whether the system catches it before the exchange does.
1. Max margin check. Never risk more than a configured percentage of the account balance on a single position. This is absolute — it doesn't care about conviction or signal quality. If the margin required exceeds the limit, the trade is blocked. This prevents a single position from threatening the account.
2. Circuit breaker. After N consecutive losses, the bot halts. Not for a cooldown period — it halts until manually reset. Consecutive losses indicate either a regime change the signal stack hasn't adapted to, or a structural issue in execution. Either way, the correct response is to stop trading and investigate, not to keep firing.
3. Daily loss limit. If cumulative daily P&L hits -10% of the starting balance, the bot stops for the day. This is the portfolio-level equivalent of the circuit breaker — it catches scenarios where individual losses are within tolerance but the aggregate drawdown is not.
4. Funding rate gate. If the funding rate is too adverse — longs paying an outsized premium, or shorts paying to stay short — the bot skips the trade entirely. This is independent of the funding_rate scoring factor. The scoring factor deducts points; the gate blocks execution. They operate at different thresholds because the gate is a hard stop, not a score adjustment.
5. Position cap. Maximum two concurrent positions. This prevents the bot from spreading margin across too many trades during high-signal periods. Two positions is enough to capture correlated moves across BTC and ETH without overextending margin.
6. Max leverage hard cap. 20x. Regardless of what the conviction-scaling formula produces, leverage never exceeds 20x. This is the "even if everything else agrees, this is the ceiling" guard. Phemex supports up to 100x on some pairs. The hard cap exists because tail risk at 100x is account-ending.
ATR-Based Stop-Loss and Take-Profit
Fixed-pip stops are the most common and most broken approach to position management. A 2% stop on BTC during a 0.5% daily range is loose. The same 2% stop during a 5% daily range is tight. The stop hasn't changed, but its relationship to actual price behavior has.
Leverage uses ATR — Average True Range — to set stops and targets dynamically.
Stop-loss: 1.5x ATR below entry (long) / above entry (short). ATR measures recent volatility. A 1.5x ATR stop sits just outside the normal noise range — close enough to limit damage, wide enough to avoid getting stopped out by ordinary price fluctuation.
Take-profit: 2.5x ATR above entry (long) / below entry (short). The ratio matters: 2.5 / 1.5 = 1.67:1 reward-to-risk. Every trade has a structural edge in its payout ratio before the signal quality is even considered. You can be wrong 40% of the time and still profit if the R:R holds.
Trailing stop. After price moves 1x ATR in your favor, the stop-loss begins trailing. It follows price at a fixed offset, locking in gains while letting the trade run. This converts winning trades from fixed-target exits into trend-following positions.
Partial take-profit. At 1.5x ATR profit, the system closes 50% of the position. This does two things: it banks real P&L, and it reduces the position size exposed to reversal risk. The remaining 50% runs with the trailing stop. The result is a position management strategy that captures quick wins and rides extended moves simultaneously.
ATR-based stops are adaptive but not infallible. During gap moves or flash crashes, price can blow through a 1.5x ATR stop before the exchange processes the order. The risk gates — particularly the daily loss limit — exist as the backstop for scenarios where stop-loss execution fails.
The InDecision Connection
Strip away the risk gates, the ATR stops, the leverage scaling, and the position management — and what's left is a directional signal that originates from the InDecision Framework.
The indecision_bias factor (0-35 points) isn't a technical indicator. It's the output of a macro analysis engine that builds independent bull and bear cases, measures the spread between them, and produces a conviction-weighted directional bias. When InDecision says BEARISH 74% with a spread of 48, that's not RSI or MACD — that's five independent scorers agreeing on direction with minimal counter-evidence.
This is what makes Leverage different from a standard technical trading bot. Standard bots trade signals. Leverage trades regime-aligned signals. The indecision_bias factor acts as a directional filter that prevents the system from taking technically valid trades that fight the macro trend. A golden cross on the 15-minute chart doesn't trigger a long if InDecision's daily bias is BEARISH with high conviction. The technical signal is real. The macro context says it's a counter-trend bounce.
Foresight proved the signal stack works on prediction markets. Leverage proves it works on perpetuals — with the right execution layer. The scoring engine is the constant. Everything around it — how trades are sized, how risk is managed, how positions are monitored — adapts to the instrument.
The name is the thesis: leverage is mechanical advantage. The same force, amplified. The InDecision Framework provides the force. Leverage provides the amplification. And the six risk gates ensure the amplification doesn't become destruction.
That's the system. Nine factors. Six gates. ATR-adaptive exits. Conviction-scaled leverage. And at the center of it all, a macro directional engine that started as a spreadsheet in 2019 and now runs perpetual futures on Phemex 24/7.
The signal was always the hard part. The execution layer is just engineering.
Explore the Invictus Labs Ecosystem
Follow the Signal
If this was useful, follow along. Daily intelligence across AI, crypto, and strategy — before the mainstream catches on.

Foresight v5.0: How I Rebuilt a Prediction Market Bot Around Candle Boundaries
The bot was right. The timing was wrong. v4.x had a fundamental reactive architecture problem — by the time signals scored, the CLOB asks were too expensive. v5.0 solved it with event-driven candle boundaries and predictive early-window scoring.

Hermes: A Political Oracle That Bets on Polymarket Using AI News Intelligence
Political prediction markets don't move on charts — they move on information. Hermes is a Python bot that scores political markets using Grok sentiment, Perplexity probability estimation, and calibration consensus from Metaculus and Manifold. Here's how it works.

I Built a Sports Prediction Bot That Bets Against the Market — Here's the Architecture
Sports prediction is a solved problem for the books. It's wide open on Polymarket. Here's how I built Shiva — a 6-factor probability engine that finds edge in NBA and MLB markets using free public APIs and adaptive weights.