Skip to main content

Documentation Index

Fetch the complete documentation index at: https://uncoded.ch/docs/llms.txt

Use this file to discover all available pages before exploring further.

Every unCoded position is a tier stack, not a single block of asset. When you set investment_per_buy = $50, the bot does not buy $50 of asset and treat it as one lump. It splits the slot internally into multiple tiers, each with its own sell target. The first buy loads all tiers at once. Every subsequent buy refills only the tiers that have previously sold. This page explains the mechanics, the math, and the operator implications — and is the conceptual foundation for reading your trade log correctly.

Why this concept matters

The single most common operator confusion in the first month of running unCoded sounds something like:
“My investment_per_buy is $50, but the bot just placed a buy for $15. Is something broken?”
The answer is always the same: no, it’s not broken — that buy refilled tiers that previously sold. Once you internalize the tier-stack mental model, every quirky-looking trade in your log becomes deterministic and interpretable. Without it, the bot looks like it’s making arbitrary decisions. This page makes the mental model explicit so you stop guessing.

The fundamental concept — tier stack

A tier is a sub-position within your position, with its own:

Share of capital

Each tier holds a fraction of investment_per_buy. Uniform splits assign each tier 1/N of the slot. Weighted splits assign uneven shares (e.g., 30%, 30%, 28%, 12%).

Sell target

Each tier has its own take-profit price, expressed as a percentage above the position’s average entry. Tier 1 might sell at +0.25%; Tier N at +5% or higher.

Re-entry trigger

Each tier has its own re-buy condition — typically a percentage drop from the price it sold at. When triggered, the bot refills only that specific tier.

Inventory state

A tier is either loaded (asset held, waiting to sell) or empty (asset sold, waiting to refill). The position’s current state is the union of all tier states.

Mode 4 (BasicMode) — the canonical 7-tier stack

For investment_per_buy = $50 in BasicMode:
TierShareApprox. $-valueSell target
11/7~$7.14+0.25%
21/7~$7.14+0.5%
31/7~$7.14+1%
41/7~$7.14+1.5%
51/7~$7.14+2%
61/7~$7.14+3%
71/7~$7.14+5%
When the position is freshly opened, all 7 tiers are loaded simultaneously. As the market moves up, tiers sell from bottom (closest target) to top. As the market moves back down, the empty tiers refill in reverse order.

Other modes have different stack shapes

The tier count, weighting, and target ranges differ by mode. Each mode is calibrated for a specific market regime:
ModeApprox. tier countSell-target rangeDistinguishing feature
Mode 4 — BasicMode (default)7 tiers0.25% → 5%Balanced; the verified canonical example
Mode 1 — FullBullMarketWider gridHigher % targetsHolds longer for stronger uptrends
Mode 2 — LongTimeLongMoreProfitWider gridHigher % targetsPatient, profit-maximizing
Mode 3 — LongTimeLongWider gridMid-range %Patient, balanced
Mode 5 — LowMoneyAdjusted for smaller capitalTighter rangeWorks on smaller slots
Mode 6 — MinimalMoneyCompressedTight rangeSmallest capital footprint
Mode 7 — Tsl2SellTrailing-stop variantDynamicUses trailing stop logic on top tier
Mode 1001 — MarketMakerSpread-based, FDUSD-onlyVery tightDifferent mechanic — see MarketMaker docs
Mode 1002 — MarketMakerMinimalSpread-based, FDUSD-onlyVery tightLighter version of MarketMaker
The exact tier definitions for each mode are configured in the mode JSON files. The principle — first buy loads the stack, subsequent buys refill empty tiers — is universal across all grid-based modes.

The four buy types in unCoded

Reading your trade log requires recognizing which of four buy types each entry is.
When it happens: The bot enters a pair from zero — there is no existing inventory in this trading pair.Size: Always the full investment_per_buy.Effect: All tiers in the stack become loaded. The position is at maximum size.Identifying it in the log: First buy after no prior activity on the pair, or first buy after the previous position fully closed (all tiers sold and not refilled).Frequency: Once per position lifecycle.
When it happens: One or more tiers have previously sold, the price drops to a re-entry trigger, and the bot refills the empty tier(s).Size: tier_size × number_of_empty_tiers_being_refilled. For Mode 4 with investment_per_buy = $50, refilling one tier is ~7.14,twotiers 7.14, two tiers ~14.28, and so on.Effect: The position moves back toward fully-loaded. Capital deployed increases by the buy size.Identifying it in the log: A buy smaller than investment_per_buy, occurring after one or more sells. Buy size aligns with a clean fraction of investment_per_buy.Frequency: This is the most common buy type during normal operation. Most trades in a healthy log are tier refills.
When it happens: The price drops further than expected and the bot adds capital to a position that hasn’t sold any tiers yet — averaging down the entry price.Size: Mode-specific. Some modes have explicit DCA buy steps; others rely on tier refills to average naturally.Effect: The position grows beyond its initial slot size. Average entry price decreases.Identifying it in the log: A buy that occurs before any sell on the position, at a lower price than the original entry.Frequency: Mode-dependent. Modes designed for trend-following use DCA more; tight-grid modes use it less.⚠️ Capital implication: DCA buys can push a single pair beyond its nominal slot size. Your reserve buffer absorbs this if configured correctly.
When it happens: Only in Modes 1001 / 1002 (MarketMaker / MarketMakerMinimal), which run a different mechanic — placing buy and sell orders on opposite sides of the spread continuously.Size: Configured per the MarketMaker spread strategy, not per the tier-stack model.Effect: Generates volume and small per-trade profit through spread capture rather than directional moves.Identifying it in the log: Many small, rapid buys and sells, all on FDUSD pairs.Frequency: Very high turnover. Different operational profile from grid modes.

How tier weighting affects buy sizes

Not every mode uses uniform 1/N weighting per tier. Some modes assign more capital to inner tiers (closer to entry) and less to outer tiers (further from entry), or vice versa.

Uniform weighting (e.g., Mode 4)

investment_per_buy = $50, 7 tiers, each 1/7:
  • Each tier = ~$7.14
  • Refilling 1 tier = ~$7.14
  • Refilling 3 tiers = ~$21.42
  • Refilling all 7 tiers = ~$50 (back to fully loaded)

Weighted (e.g., 30/30/28/12 split)

If a mode uses uneven weighting like $30, $30, $28, $12 for a $100 slot across 4 tiers:
  • Tier 1 = $30 (refilling Tier 1 alone = $30 buy)
  • Tier 2 = $30
  • Tier 3 = $28
  • Tier 4 = $12
You’d see refill buys of these specific dollar amounts as different tiers cycle. The exact numbers depend on the mode’s tier configuration.

Why weighted splits exist

Weighted splits let mode designers express opinions like:
  • “I want most capital in the inner tiers because shallow moves are most common.”
  • “I want a small outer tier as a ‘safety net’ that only fires in rare big moves.”
  • “I want capital concentrated in the lowest-target tier for fast turnover.”
Mode 4 uses uniform splits as a calibrated default. Other modes deviate where the strategy demands it.

Buy lifecycle — full walkthroughs

Concrete scenarios with numbers, in the order they happen during a typical position lifecycle.
Setup: Mode 4, investment_per_buy = $50, asset = ADA at $0.25.
  1. Bot enters → Initial buy of $50 (200 ADA). All 7 tiers loaded.
  2. Price moves to $0.25 × 1.0025 = $0.25062 → Tier 1 sells (~28.5 ADA for ~$7.15).
  3. Position is now 6/7 loaded (~171.5 ADA, ~$42.85 of asset).
  4. Price drops back to the Tier 1 re-entry trigger.
  5. Bot refills Tier 1 → Buy of ~$7.14 (~28.5 ADA).
  6. Position is back to 7/7 loaded.
Trade log shows: 1 buy at $50, 1 sell at ~$7.15, 1 buy at ~$7.14. Net result: tiny profit (~$0.01 minus fees).Pattern: This cycle can repeat dozens of times per day on ranging markets. Each cycle nets a sliver of profit; volume builds returns over time.
Setup: Same as Scenario A.
  1. Bot enters → $50 initial buy.
  2. Price rises through Tiers 1, 2, 3 in sequence → 3 sells, total ~$21.45 cash returned.
  3. Position is now 4/7 loaded.
  4. Price stalls and drops back gradually.
  5. Price hits Tier 3’s re-entry trigger first → Buy of ~$7.14. Position 5/7.
  6. Price drops further → Tier 2 refills → Buy of ~$7.14. Position 6/7.
  7. Price drops further → Tier 1 refills → Buy of ~$7.14. Position 7/7.
Trade log shows: 1 initial buy, 3 sells, 3 small refill buys. Net result: 3 tiers’ worth of profit captured (3 × ~0.5% average = ~$0.20+ minus fees).Pattern: Larger waves capture more profit per cycle. Bigger waves still are rare but high-value when they happen.
Setup: Same. Price rallies hard.
  1. Bot enters → $50 initial buy.
  2. Price rallies through all 7 sell targets up to +5% → All 7 tiers sell.
  3. Total cash from sells: ~$52.50 (initial $50 + ~5% average gain across tiers).
  4. Position fully closed. 0/7 loaded.
  5. The pair is now waiting for the next entry signal (not just a re-buy trigger). The position is closed, not partially empty.
Trade log shows: 1 buy at $50, 7 sells totaling ~$52.50. Position is closed; pair waits for next setup.Pattern: Full closes are the highest-profit cycles per pair. Rare in tight-range markets, frequent in trending markets.
Setup: Same. Sharp price spike.
  1. Bot enters → $50 initial buy.
  2. Price spikes very fast — only Tier 1 fills before reversing.
  3. Tiers 2-7 would have sold at their targets, but the price reversed before their sell orders could fill (or before the bot detected the move and placed orders).
  4. Position is now 6/7 loaded (Tier 1 sold, others still in).
  5. Price drops → Tier 1 refills → Position 7/7.
Trade log shows: 1 initial buy, 1 sell, 1 refill — even though the price visited the higher tier targets briefly.Pattern: Real markets don’t always give clean tier rotation. Liquidity, latency, and price gaps mean some tiers may not fire even when their target was momentarily touched. This is normal; the position simply continues with the unsold tiers in place.
Setup: Same. Price drops sharply after entry and stays below entry for weeks.
  1. Bot enters → $50 initial buy.
  2. Price drops -10% and stays there.
  3. No tier sells (all sell targets are above entry).
  4. Depending on mode: DCA buys may fire to average down, or position may sit waiting.
  5. Eventually price recovers → tiers begin selling normally.
Trade log shows: 1 initial buy, possibly DCA buys, no sells for an extended period, then a flurry of sells when price recovers.Pattern: Drawdown holding is part of grid trading. Position size matters — that’s why slot sizing and reserves are non-negotiable.
Setup: Position is 4/7 loaded. Operator restarts the bot.
  1. Bot reads current state from exchange (or state cache).
  2. Identifies which tiers are loaded vs empty based on inventory and order history.
  3. Re-establishes tier tracking — empty tiers retain their re-entry triggers, loaded tiers retain their sell targets.
  4. Operation continues as if no restart had happened.
Trade log shows: No anomalous trades. State is preserved.Pattern: Restarts are safe. The bot reconstructs tier state from on-exchange truth, not from in-memory caches alone.

Capital math — how slots, tiers, and reserves interact

Three numbers govern your capital deployment:

investment_per_buy

Slot size — the maximum capital one pair occupies when fully loaded. NOT the size of every buy.

max_positions

How many pairs can run simultaneously. slots × investment_per_buy = maximum total deployed capital.

Tier size

investment_per_buy / tier_count (uniform) or per the mode’s weighting. The unit of refill buys.

Reserve buffer

Recommended: 50% of trading capital held in reserve, NOT counted in slots × investment_per_buy. Absorbs DCA expansion, fee impact, and price drift.

Worked example

You have $30,000 total. You want to run BasicMode.
  • Trading capital: $20,000 (the recommended for BasicMode)
  • Reserve: $10,000 (the 50% rule — actually 50% of the 20Ktradingcapitalis20K trading capital is `10K, so you'd want 30Ktotal=30K total = 20K trading + $10K reserve`)
  • max_positions = 100 (example)
  • investment_per_buy = $20,000 / 100 = $200
  • Tier size = $200 / 7 ≈ $28.57 per tier in Mode 4
When all 100 pairs are simultaneously fully loaded, 100 × $200 = $20,000 is deployed. Reserve sits unused, available for DCA expansion or volatility absorption. When pairs cycle (some 4/7, some 7/7, some 0/7 between positions), actual deployed capital fluctuates between $10K and $20K. Reserve cushions the worst case.

What buy splits are NOT

  • NOT a bug or malfunction. Small buys are tier refills, not “the bot under-buying.”
  • NOT random. Every buy size corresponds to a deterministic combination of empty tiers being refilled.
  • NOT the same as “buy the dip.” Buy splits are the structured refill of a known tier ladder, not opportunistic adds based on indicator signals.
  • NOT applicable to MarketMaker modes. Modes 1001/1002 use spread-based buy mechanics, not tier-stack splits.
  • NOT a substitute for stop-loss. The tier ladder caps profit per cycle but does not protect against sustained drawdown. Stop-loss / kill-switch / reserve sizing handle that risk.
  • NOT modifiable per-trade. The tier structure is defined by the mode JSON. To change tier behavior, change modes — don’t try to override individual buy sizes mid-trade.

Common operator misconceptions

Wrong. Only the initial buy on a fresh pair equals investment_per_buy. Every subsequent buy refills one or more empty tiers and will be smaller — sometimes much smaller (~1/7 of the slot if just one tier sold).The right framing: investment_per_buy is the slot size, not the buy size. Slot size is the maximum capital a single pair can occupy when fully loaded.
A ~$7 or ~$15 buy on a $50 slot is the bot working correctly — refilling 1 or 2 tiers that just sold. If you check the recent trade history for the same pair, you’ll see matching prior sells of similar size.Quick check: recent buy size ≈ recent sell size. If yes, the bot is doing tier rotation. If no, look at position state in the dashboard.
Raising investment_per_buy raises the slot size — meaning each tier holds more, the position commits more capital per pair, and you can run fewer pairs simultaneously.The right way to size: decide how many simultaneous positions you want, then divide your trading capital by that number to get investment_per_buy. Don’t reverse-engineer it from desired buy size.
No. The full slot value is only traded once — at initial entry. After that, the bot trades in tier-sized chunks until the position fully closes (all tiers sell within one cycle, which is uncommon outside fast rallies).Expected pattern: many small ~$7 buys and sells, with position size oscillating between fully-loaded and partially-empty.
Not broken. The bot is waiting for either (a) the market to drop enough to retrigger empty tiers’ re-buys, or (b) the market to move up enough that remaining loaded tiers sell at their targets.Persistent half-loaded state is a market-condition signal, not a bot fault. The market is in a range that hits some tiers but not others.
Possible reasons it didn’t:
  • All tiers were already loaded (no empty tier to refill).
  • The price didn’t quite hit a tier’s re-entry trigger before reversing.
  • Liquidity at that price was insufficient and the order didn’t fill.
  • A separate condition (kill-switch, daily limit, max-positions cap) blocked new buys.
Check the bot’s logs for explicit decline reasons before assuming a missed opportunity.
Tier structure is defined by the mode configuration, not per pair. To change tier behavior, change modes (or build a custom mode). Don’t try to adjust individual buys — the bot won’t honor it because tier tracking is internal.

Reading your trade log — the operator quick-reference

When investigating a buy in the log, ask in this order:
  1. Is this the first buy on this pair after no prior activity?
    • Yes → It’s an initial buy, expect ~investment_per_buy size.
    • No → Continue to step 2.
  2. What is this buy’s size as a fraction of investment_per_buy?
    • ~1/N of the slot → 1 tier refill.
    • ~2/N, ~3/N, etc. → multiple tier refills (in mode-specific weighting).
  3. Are there matching prior sells of similar size on this pair?
    • Yes → Tier rotation, working as designed.
    • No → Inspect position state. Possible DCA buy or unusual condition.
  4. After this buy, is the position fully loaded (all tiers in)?
    • Yes → Slot is back to maximum. Wait for the next sell trigger.
    • No → More tiers remain empty. Bot will continue to refill as triggers fire, or sell remaining loaded tiers if price rises.
  5. Does the dashboard’s position-state display match what you see in the log?
    • Yes → Mental model is calibrated. Trust the bot.
    • No → Reload state, check for state-sync issues, or escalate to support.

Best practices for buy-split-aware operation

  • Mentally translate investment_per_buy to “slot size,” not “buy size.” Every operator confusion traces back to this.
  • Expect refill buys to be the majority of your log entries. Initial buys are rare; refills are constant.
  • Validate buy size against tier math before assuming a problem. 1/N, 2/N, etc. are normal; arbitrary fractions are not.
  • Don’t change investment_per_buy to chase desired buy sizes — it’s the slot size, and you’ll affect concurrency too.
  • Match modes to market regime, not buy-size aesthetics. Tight-range markets reward tight-grid modes; trending markets reward wider grids. Buy sizes follow from this choice.
  • Backtest the mode you plan to run — the tier-stack behavior is fully simulated, so backtest results show the same buy/sell pattern you’ll see live.
  • Use the dashboard’s position-state view — it shows current tier loading per pair so you don’t have to reconstruct it from the log.
  • Reserve buffer is non-optional — DCA buys, slippage, and fee compounding can push real deployed capital 5-10% above nominal slot allocation. Reserves absorb this.

TL;DR

  • A position is a stack of tiers — each tier has its own share of investment_per_buy, sell target, and re-entry trigger.
  • Initial buy loads all tiers at once — full investment_per_buy. This anchors the average entry price and keeps slot sizing deterministic.
  • Refill buys load only empty tiers — size = tier_size × empty_tier_count. Always smaller than investment_per_buy unless all tiers are empty.
  • Buy size in your log = empty tiers × tier size. If math doesn’t match this pattern, investigate; if it does, the bot is fine.
  • Mode 4 (BasicMode) uses 7 uniform tiers from +0.25% to +5% — the canonical example. Other modes have different tier counts, weights, and target ranges.
  • MarketMaker modes (1001/1002) do NOT use this model — they use spread-based buy mechanics. Different page, different mental model.
  • investment_per_buy is slot size, not buy size. Internalize this and most “weird trade” questions disappear.
  • Reserves are non-optional — DCA expansion, slippage, and fee compounding push deployed capital above nominal allocation. The 50% reserve rule absorbs this.

What’s next

Initial vs Re-Buy Mechanics

Focused walkthrough of “why is my first buy full but later buys smaller?” — the most-asked support question.

BasicMode (Mode 4)

The default mode and canonical 7-tier stack example.

All Pre-built Modes

Compare tier configurations across all 9 modes.

Parameters Reference

Every parameter that affects tier behavior, with worked examples.

Capital Allocation

Sizing investment_per_buy and max_positions correctly.

Reserves

Why the 50% reserve rule exists and what it absorbs.
Last modified on May 6, 2026