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.
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:“MyThe 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.investment_per_buyis$50, but the bot just placed a buy for$15. Is something broken?”
The fundamental concept — tier stack
A tier is a sub-position within your position, with its own:Share of capital
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
+0.25%; Tier N at +5% or higher.Re-entry trigger
Inventory state
Mode 4 (BasicMode) — the canonical 7-tier stack
Forinvestment_per_buy = $50 in BasicMode:
| Tier | Share | Approx. $-value | Sell target |
|---|---|---|---|
| 1 | 1/7 | ~$7.14 | +0.25% |
| 2 | 1/7 | ~$7.14 | +0.5% |
| 3 | 1/7 | ~$7.14 | +1% |
| 4 | 1/7 | ~$7.14 | +1.5% |
| 5 | 1/7 | ~$7.14 | +2% |
| 6 | 1/7 | ~$7.14 | +3% |
| 7 | 1/7 | ~$7.14 | +5% |
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:| Mode | Approx. tier count | Sell-target range | Distinguishing feature |
|---|---|---|---|
| Mode 4 — BasicMode (default) | 7 tiers | 0.25% → 5% | Balanced; the verified canonical example |
| Mode 1 — FullBullMarket | Wider grid | Higher % targets | Holds longer for stronger uptrends |
| Mode 2 — LongTimeLongMoreProfit | Wider grid | Higher % targets | Patient, profit-maximizing |
| Mode 3 — LongTimeLong | Wider grid | Mid-range % | Patient, balanced |
| Mode 5 — LowMoney | Adjusted for smaller capital | Tighter range | Works on smaller slots |
| Mode 6 — MinimalMoney | Compressed | Tight range | Smallest capital footprint |
| Mode 7 — Tsl2Sell | Trailing-stop variant | Dynamic | Uses trailing stop logic on top tier |
| Mode 1001 — MarketMaker | Spread-based, FDUSD-only | Very tight | Different mechanic — see MarketMaker docs |
| Mode 1002 — MarketMakerMinimal | Spread-based, FDUSD-only | Very tight | Lighter version of MarketMaker |
The four buy types in unCoded
Reading your trade log requires recognizing which of four buy types each entry is.1. Initial buy (slot fill)
1. Initial buy (slot fill)
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.2. Tier refill buy (the most common type)
2. Tier refill buy (the most common type)
tier_size × number_of_empty_tiers_being_refilled. For Mode 4 with investment_per_buy = $50, refilling one tier is ~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.3. DCA / averaging-down buy
3. DCA / averaging-down buy
4. MarketMaker spread buy
4. MarketMaker spread buy
How tier weighting affects buy sizes
Not every mode uses uniform1/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 =$30buy) - Tier 2 =
$30 - Tier 3 =
$28 - Tier 4 =
$12
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.”
Buy lifecycle — full walkthroughs
Concrete scenarios with numbers, in the order they happen during a typical position lifecycle.Scenario A — calm market, single tier rotation
Scenario A — calm market, single tier rotation
investment_per_buy = $50, asset = ADA at $0.25.- Bot enters → Initial buy of
$50(200 ADA). All 7 tiers loaded. - Price moves to
$0.25 × 1.0025 = $0.25062→ Tier 1 sells (~28.5 ADA for ~$7.15). - Position is now 6/7 loaded (~171.5 ADA, ~$42.85 of asset).
- Price drops back to the Tier 1 re-entry trigger.
- Bot refills Tier 1 → Buy of
~$7.14(~28.5 ADA). - Position is back to 7/7 loaded.
$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.Scenario B — moderate move, multi-tier sells
Scenario B — moderate move, multi-tier sells
- Bot enters →
$50initial buy. - Price rises through Tiers 1, 2, 3 in sequence → 3 sells, total ~$21.45 cash returned.
- Position is now 4/7 loaded.
- Price stalls and drops back gradually.
- Price hits Tier 3’s re-entry trigger first → Buy of
~$7.14. Position 5/7. - Price drops further → Tier 2 refills → Buy of
~$7.14. Position 6/7. - Price drops further → Tier 1 refills → Buy of
~$7.14. Position 7/7.
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.Scenario C — strong rally, full position closes
Scenario C — strong rally, full position closes
- Bot enters →
$50initial buy. - Price rallies through all 7 sell targets up to
+5%→ All 7 tiers sell. - Total cash from sells:
~$52.50(initial$50+~5%average gain across tiers). - Position fully closed. 0/7 loaded.
- The pair is now waiting for the next entry signal (not just a re-buy trigger). The position is closed, not partially empty.
$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.Scenario D — partial fills during fast move
Scenario D — partial fills during fast move
- Bot enters →
$50initial buy. - Price spikes very fast — only Tier 1 fills before reversing.
- 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).
- Position is now 6/7 loaded (Tier 1 sold, others still in).
- Price drops → Tier 1 refills → Position 7/7.
Scenario E — extended drawdown, position never closes
Scenario E — extended drawdown, position never closes
- Bot enters →
$50initial buy. - Price drops
-10%and stays there. - No tier sells (all sell targets are above entry).
- Depending on mode: DCA buys may fire to average down, or position may sit waiting.
- Eventually price recovers → tiers begin selling normally.
Scenario F — operator restarts the bot mid-position
Scenario F — operator restarts the bot mid-position
- Bot reads current state from exchange (or state cache).
- Identifies which tiers are loaded vs empty based on inventory and order history.
- Re-establishes tier tracking — empty tiers retain their re-entry triggers, loaded tiers retain their sell targets.
- Operation continues as if no restart had happened.
Capital math — how slots, tiers, and reserves interact
Three numbers govern your capital deployment:investment_per_buy
max_positions
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
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 10K, so you'd want20K trading + $10K reserve`) max_positions = 100(example)investment_per_buy = $20,000 / 100 = $200- Tier size =
$200 / 7 ≈ $28.57per tier in Mode 4
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
Common operator misconceptions
❌ 'Each buy in my log should equal investment_per_buy'
❌ 'Each buy in my log should equal investment_per_buy'
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 small buy means the bot is malfunctioning'
❌ 'A small buy means the bot is malfunctioning'
~$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.❌ 'I should set investment_per_buy higher to make each buy bigger'
❌ 'I should set investment_per_buy higher to make each buy bigger'
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.❌ 'I'll see the full slot value being traded constantly'
❌ 'I'll see the full slot value being traded constantly'
~$7 buys and sells, with position size oscillating between fully-loaded and partially-empty.❌ 'A position keeps sitting at 5/7 loaded — that's broken'
❌ 'A position keeps sitting at 5/7 loaded — that's broken'
❌ 'The bot should have bought at this lower price too'
❌ 'The bot should have bought at this lower price too'
- 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.
❌ 'I can override the tier sizes per pair'
❌ 'I can override the tier sizes per pair'
Reading your trade log — the operator quick-reference
When investigating a buy in the log, ask in this order:- Is this the first buy on this pair after no prior activity?
- Yes → It’s an initial buy, expect
~investment_per_buysize. - No → Continue to step 2.
- Yes → It’s an initial buy, expect
- What is this buy’s size as a fraction of
investment_per_buy?~1/Nof the slot → 1 tier refill.~2/N,~3/N, etc. → multiple tier refills (in mode-specific weighting).
- 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.
- 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.
- 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
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 thaninvestment_per_buyunless 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_buyis 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
BasicMode (Mode 4)
All Pre-built Modes
Parameters Reference
Capital Allocation
investment_per_buy and max_positions correctly.