Inventory Logic vs Indicator Logic: A Different Way to Think About Gold Positions

Inventory Logic vs Indicator Logic: A Different Way to Think About Gold Positions

3 June 2026, 02:50
Hoai Nam Trinh
0
33

I spent about three years building indicator-based EAs. RSI crossovers, MACD divergence, Bollinger squeeze - the whole playbook. Backtests were beautiful. 97% win rate, drawdown under 3%, equity curve so smooth it looked fake.

Then I ran them live.

Six weeks. Two systems in serious drawdown. Not because the indicators fired wrong - they didn't. Spread spiked to 4 - 5 pips on London open, partial fills during news, VPS lagging 200 - 400ms so the indicator was reading a completely different candle by the time the order actually hit. The logic was right. The execution reality wasn't.


That took me embarrassingly long to understand. I kept going back to the entry parameters, tweaking, re-optimizing, running more backtests. Probably wasted two months chasing the wrong problem before I finally accepted it: the indicators weren't the issue. The position management model underneath them was.

🌟 Where This Actually Broke For Me

When most traders think about an EA, they think signals. RSI below 30 → buy. Price above 200 EMA → bullish bias. MACD crosses → entry.

Fine for simple setups. One position, fixed SL, fixed TP, close it, move on.

Gold doesn't work like that. Not the way most retail algo traders actually run it. You're layering, scaling, managing floating drawdown across multiple open positions simultaneously. Sometimes you've got a position from Tuesday sitting at -$180 while three positions from Thursday are up $90 combined. Net is still negative. You can't just flatten everything - the Thursday positions haven't finished their move.

Indicator logic has nothing for that situation. It sees price, outputs a signal. The Tuesday position doesn't exist in its world.

Live accounts are messier than signal logic assumes. That's where the breakdown happens.

🌟 The Inventory Frame

At some point I stopped thinking in signals and started thinking in exposure.

I don't remember exactly where this clicked - probably some prop desk writeup or someone's forum post I half-read at 1am. But market makers don't care about RSI. They care about what they're holding, at what average cost, and what the current spread allows them to do with that inventory. Decisions come from the book, not from an external trigger.

When I started applying that to Gold position management, things made more sense.

Instead of "what does the signal say" - what does my position book look like right now? Net long or short? Average cost basis? How much unrealized drawdown am I carrying, and can I actually absorb more before I hit margin pressure? What can I realistically close at current spread without opening a new risk?

None of that needs an indicator. It needs an honest read of what you're already holding.


🌟 Gold Makes This Ugly

Normal conditions, XAUUSD spread at a retail broker is 20 - 35 points. NFP comes in, CPI prints hot - spread blows out to 80, sometimes 150 points for 10 - 30 seconds. Some brokers just freeze. I've had terminal locks during Fed announcements where nothing went through for nearly a minute. You're sitting there watching the chart move and the EA is doing nothing because the connection is garbage.

If your EA fires a signal during that window, you're entering 80 - 100 points worse than the chart shows. Indicator logic doesn't know that. It sees a crossover, it fires. Inventory logic at least asks: given what I'm already carrying, is the cost of opening here actually justified?

Session transitions are another one. Gold thins out badly around 17:00 - 19:00 EST. Slippage increases, spread widens, and any position management running through that window is working with conditions the backtester basically never models correctly.

I remember waking up one morning and seeing the EA had been running on a corrupted position count for most of the US session. Broker feed had stuttered at session close the night before, two orders fired simultaneously at wrong prices, and the EA was reading stale tick data. It thought it had two positions open. It had three. Spent hours making decisions off a broken map.

Indicator logic just keeps firing. It has no idea anything is wrong underneath it.

🌟 What This Looks Like In Practice

Three longs open: 4,455, 4,460, 4,465. Average cost around 4,460. Current price 4,444.

Indicator-based EA sees RSI oversold, MACD divergence. Signal says add another long.

Inventory-based EA stops first: I'm carrying roughly 1,600 points of unrealized loss across three positions - at 0.10 lots each that's around $480 floating. Spread is 35 points right now. Adding a fourth shifts average cost down slightly but total exposure goes up. Am I already at my layer limit? What happens if price drops another 50 points before reversing?

Maybe the signal is still right. Maybe it is a good entry. But the inventory frame forces those questions before the order goes out. Not after.

🌟 The Part Backtests Don't Show

Inventory logic is not a clean solution. I want to be upfront about that. It's harder to build, and when it breaks it breaks in messier, more consequential ways than indicator logic does.

The main failure mode is inventory drift - the EA's internal position model diverging from what the broker is actually holding. This happens more than you'd expect, and it's absolute nightmare to track down.

VPS restart mid-session. Connection drop during a close operation. Broker rejection the EA doesn't catch correctly. Partial fill that gets logged wrong. Suddenly the EA thinks it has two positions open. It has three. It's been making decisions off that miscount for the last two hours and you're only finding out now because something downstream finally broke.

Indicator logic fails silently. It just keeps digging - more signals, more entries, deeper hole. It has no idea the state underneath it is broken. Inventory logic fails loudly. When the position map is wrong, the decisions built on top are wrong in a deliberate, structured way. That's worse.

This is why reconciliation code - checking PositionsTotal() filtered by magic number against the EA's internal count on every tick or every bar - isn't optional. It's boring to write and annoying to maintain and if you skip it you will eventually pay for it in live conditions.

Also: two EAs running on the same account, both reading PositionsTotal() without magic number isolation, their inventory counts contaminate each other. One EA thinks it has five positions. It has three of its own and two from the other bot. Took me nearly a week of late nights to trace that one. Stupid bug. Expensive lesson.


🌟 Where Indicators Still Fit

This isn't an argument to strip indicators out of everything.

Indicators are useful for context - volatility regime, trend direction, session bias. They help define when to engage. That's legitimate.

Where I landed: indicators define the environment, inventory logic defines the action.

200 MA bullish? Fine. That just means the engine is allowed to lean long. Doesn't mean buy immediately. The actual decision - open a position, close a partial, harvest a small winner, sit flat - that comes from reading the current position book against defined limits, not from what the oscillator is showing at that moment.

When I separated those two layers in the architecture, things got more stable. Not better entries. Just less stupid position management.

🌟 Why the Strategy Tester Is Useless For This

Single-symbol, single-pass simulation. Spread spikes barely modeled. VPS reconnection scenarios don't exist. The specific failure mode I care most about - inventory model getting corrupted mid-session and having to recover - is basically impossible to test in the tester.

Demo is the real test environment for inventory logic. Not because backtests are worthless, but because a clean backtest can fall apart in the first week live once you hit real execution conditions.

Demo bugs are annoying. Live bugs are expensive.

🌟 Why I'm Writing This

Most MQL5 blogs are either basic tutorials or marketing dressed up as analysis. I spent time looking for anyone else writing about position management from an inventory perspective and mostly came up empty.

The tools I ended up building - Inventory Control Tool, Episode Health Monitor, Master Decision Engine - exist because I needed them and they didn't exist anywhere else. They came out of frustration more than anything. The Inventory Control Tool started as a debug panel I slapped together to see what the EA was actually holding versus what I thought it was holding. Episode Health Monitor came after one too many sessions where something went sideways mid-cycle and I had no visibility into why.

They're not indicators. They don't tell you when to buy or sell. They tell you what you're carrying and whether the EA's decisions still make sense given that reality.

Less exciting than "proprietary signal with 94% accuracy." But after enough live deployments, it's the thing that actually matters.

Gold Algo Lab builds practical, risk-first MT5 tools for serious XAUUSD traders - shaped by 8 years of building and trading real systems, with no hype, no profit guarantees, and no unrealistic promises.

🚀 Tools mentioned: