Skip to content

How Trading Works

This page walks through what your ships do behind the scenes when they're trading. Understanding the pipeline helps explain why a ship might be waiting, why it chose a particular route, or why it's idle when you expected it to be busy.

The Trading Cycle

Every Galaxy Trader ship follows the same basic cycle:

  1. Search for a trade
  2. Validate the trade
  3. Reserve the trade
  4. Execute the trade (buy, fly, sell)
  5. Repeat

Each step has some nuance worth understanding, especially when you're trying to figure out why a ship is doing what it's doing.

Step 1: Finding a Trade

When a ship needs a new trade, it goes through the search system:

Cache Search (fast path): The ship first checks the trade cache — a shared list of profitable routes discovered by other ships in the fleet. The cache is per home sector: ships with the same home sector share one cache; ships in different home sectors use separate caches. If fleet coordination is on in Global Settings and the cache has a valid entry for this ship's home sector, the ship can grab a trade almost instantly.

Live Search (full scan): If the cache is empty or nothing suitable is found, the ship performs a live search. This is the expensive path — it scans stations in range for buy and sell offers, matches them into trade pairs, scores them by profitability, and picks the best ones.

Fallback Search (relaxed filters): If both cache and live search find nothing, the ship tries a fallback search with relaxed price ranges and a shorter range (about 2 jumps). This helps ships in thin markets or when margins are tight. The Fallback price ranges are configurable in Global Settings. If fallback still finds nothing, the ship retries the full cycle after a cooldown.

Search Scheduling: To prevent all ships from searching at once (which would cause lag), the mod uses a scheduler. Ships queue up and take turns performing live searches. The number of simultaneous searches is configurable in Performance settings.

How trade scoring works (MK3)

When a live search (or cache refresh) finds many possible buy-and-sell pairs, Galaxy Trader does not simply pick the highest raw profit. Each candidate is filtered, scored, and ranked. This is what decides why one route wins over another that also looks profitable on paper.

Step A — Profit gates

Before scoring, trades must pass your minimum bars (from Global Settings — profit threshold scales with pilot level and ship cargo size):

  • Gross profit — (sell price − buy price) × amount, for the largest deal the stations can support.
  • Minimum profit and minimum ROI — pairs below these are discarded.
  • Ignore Player Pricing (MK3 order) — when the supplier is one of your stations: buy-side cost is treated as zero for scoring, min-profit/ROI gates are skipped for that pair, and sales to your player stations are blocked (NPC buyers only). Does not disable NPC-to-NPC trades — those still compete on normal profit scoring and can win if they score higher.

Step B — Base score

Surviving pairs get a trade score that balances money against travel:

  • Distance — jump count from home to the buy station, plus buy station to sell station (blacklist-aware).
  • Formula (simplified) — score ≈ profit in Credits ÷ (1 + distance × penalty factor).
  • Distance Penalty (MK3 order, default 50%) — controls how hard distance bites. At 0% only profit matters (long trips possible). At 50% balanced. At 100% nearby trades are strongly favoured.

Higher score = better. A smaller but closer deal can beat a larger distant one when distance penalty is high.

Step C — Bonuses and ranking

  • Priority Wares — listed wares get their score multiplied (Priority Score %, default 150% = +50%). Other wares can still win if they score much higher.
  • Prioritize Player Stations — when enabled, routes where either the buy station or the sell station is player-owned get a 2× score multiplier. This is a nudge, not a guarantee — the highest final score still wins, so a stronger NPC-to-NPC route can beat a weaker player-station route.
  • Cache entries — stored with a home-sector distance score. When a ship claims a cache hit, the score is recalculated from the ship’s current position (ship → buy → sell) so nearby cache rows rise to the top.
  • Final validation — a light global Ship Proximity Weight nudge can prefer slightly nearer buy stations among already-good candidates.

The highest-scoring trade that still passes docking, range, reservation, and offer checks is the one the ship attempts. See MK3 Galaxy Trader for the order settings that affect scoring.

MK1, MK2, and MK4 use their own selection rules (station logic, fixed routes, or supply-demand scoring) — the pipeline above applies to MK3-style roaming trade.

Step 2: Validating the Trade

Once a trade is found, the ship validates it before committing:

  • Are both stations still accessible? (Not destroyed, not in a blacklisted sector)
  • Can the ship dock at both stations?
  • Does the ship have enough cargo space for this ware?
  • Is the buy station within range? Is the sell station within range?
  • Are the trade offers still available? (Another ship might have taken them)
  • Is the trade reserved by another fleet member?

If validation fails, the ship tries the next trade in the list. If all trades fail validation, it goes back to searching.

Step 3: Reserving the Trade

Before executing, the ship creates a fleet reservation. This is a short-lived claim (10 seconds) that tells other ships "I'm about to do this trade — don't take it." This prevents two ships from racing to the same station for the same deal.

Once the ship actually creates its trade orders with the game, the reservation is released and the game's built-in capacity system takes over.

Step 4: Executing the Trade

The ship now has concrete orders:

  1. Buy: Fly to the seller station, dock, purchase the goods
  2. Sell: Fly to the buyer station, dock, sell the goods

During execution, the ship follows standard X4 trade behavior. If something goes wrong (station destroyed, offer expired, sector became hostile), the ship adapts — it may reroute, clear its cargo, or return to searching.

Step 5: After the Trade

When a trade completes:

  • The pilot earns XP based on the profit
  • The trade result may be cached for other ships
  • Profit is tracked for lifetime statistics
  • The ship checks if maintenance is needed (repair, resupply)
  • The cycle restarts

Isolated Mode

When all routes out of the ship's current sector are blocked (e.g. by threat blacklist or hostile factions), the ship enters isolated mode. It trades only within its current sector using relaxed price ranges. The ship name shows "IS" (Isolated) when this is active. Once a safe path becomes available, the ship resumes normal trading.

Cache Search vs. Live Search vs. Fallback

Understanding the three search paths helps explain ship behavior:

Cache hits are fast. If the fleet has been trading in an area, the cache fills up with known-good routes. Ships that find cache hits start trading almost immediately.

Cache misses trigger a live search, which takes longer because the ship has to scan the market. The first ship in a new area always does a live search. After that, its discoveries fill the cache for others.

Live and cache misses trigger a fallback search with relaxed filters. If that also finds nothing, the ship waits and retries the full cycle.

The cache is per home sector. Ships with the same home sector share one cache; ships in different home sectors maintain separate caches. This naturally spreads the fleet across different markets.

Why Isn't My Ship Trading?

Common reasons a ship might be idle:

  • No profitable routes: The market around the home sector doesn't have good margins right now. The ship retries with increasing cooldowns.
  • All trades reserved: Other fleet members claimed the available trades. The ship waits briefly and tries again.
  • Blacklisted sectors: Threat intelligence blocked the sectors where trades exist. Check the Diagnose Tool.
  • Skill too low: New pilots have very short range (1-3 jumps). There might not be enough stations in range.
  • Waiting for search slot: The scheduler is busy with other ships' live searches. This clears quickly.
  • Min Player Money: Your credit balance dropped below the configured minimum. Ships wait until you have enough funds.

Use the Diagnose Tool (right-click → GT Diagnose) to get a detailed breakdown of what's happening with any specific ship.

MK1 Station Trader Flow

The MK1 station trader does not use the shared MK3 trade list or the “take turns” live search queue. In plain terms it does this over and over:

  • Reads your order, applies pilot jump range, handles repair and resupply if needed.
  • If Return Home Between Cycles is on and the bay is empty, it goes home and docks before looking for the next deal; if that option is off, it stays where it is (older style).
  • If Station Supply is on and the factory is short on something important (and can pay), it buys that and delivers it first.
  • Otherwise it sells your station’s goods to NPCs in range. Cargo / Profit only changes which product it favours when several are possible.
  • If Allow Multi-Trade is on, it may load several products and do up to three sales on one trip when one sale would leave the bay too empty for your Sell Cargo Fill Target. It still prefers one big sale of a single product when that already fills the bay enough. Backtrack Tolerance limits how far apart those buyer systems can be on the same trip.

If Return Home is on and the ship sits at home with no work for about a minute, it may undock once so another ship can use the dock, then try again.

Trading Pipeline Flowchart

When Illegal Route Filter is on, route legality is checked before a trade is accepted and again before each sector crossing during the flight. If a sector on the path becomes illegal for the cargo, the ship aborts the leg and searches again.

flowchart TD
A[Next job] --> B[Read settings Autoscale may cap distance]
B --> C[Repair and upkeep]
C --> CL{Leftover cargo?}
CL -->|Yes| CLS[Sell leftover then retry]
CLS --> A
CL -->|No| RH{"Return Home on empty not at home?"}
RH -->|Yes| RHD[Fly home and dock]
RHD --> A
RH -->|No| E{Station needs supply and can pay?}
E -->|Yes| F[Buy from player or NPC suppliers and deliver]
F --> A
E -->|No| I[Find NPC buyers in range]
I --> J[Cargo or Profit priority]
J --> MT{"Multi-Trade and bay too empty?"}
MT -->|Yes| MT1[One product fill first]
MT1 --> MT2[Or up to 3 sales Backtrack limit]
MT -->|No| K[Single best sale]
MT2 --> K
K --> L{Bay full enough?}
L -->|No| W[Wait retry]
W --> IP{Idle Parking on repeated fail?}
IP -->|Yes| PARK[Park at home station or sector]
PARK --> A
IP -->|No| A
L -->|Yes| M[Load sell fly illegal route guard if on]
M --> X[Pilot XP logs]
X --> Z{Return Home on?}
Z -->|Yes| RHD
Z -->|No| A

MK1 Station Trader Flowchart

flowchart TD
M0(["Next job"]) --> M0a{"Return Home on ship empty not at home?"}
M0a -->|Yes| M0b["Fly home and dock"]
M0b --> M0
M0a -->|No| M1["Order settings upkeep"]
M1 --> CL2{Leftover cargo?}
CL2 -->|Yes| CLS2[Sell leftover then retry]
CLS2 --> M0
CL2 -->|No| M2{"Station needs supplies first?"}
M2 -->|Yes| M3["Buy from player or NPC suppliers and deliver"]
M3 --> M0
M2 -->|No| M4["Find NPC buyers"]
M4 --> M5["Choose sale Cargo or Profit"]
M5 --> M6{"Multi-Trade on bay too empty?"}
M6 -->|Yes| M6a["One product enough first"]
M6a --> M6b["Or up to 3 sales nearby buyers"]
M6 -->|No| M7["One sale only"]
M6b --> M8{"Bay full enough?"}
M7 --> M8
M8 -->|No| M9["Wait try again"]
M9 --> M0
M8 -->|Yes| M10["Load sell fly"]
M10 --> M11["Pilot XP logs"]
M11 --> M12{"Return Home on?"}
M12 -->|Yes| M0b
M12 -->|No| M0