Advertisement IC Markets

Unit tests for trading code: boring and invaluable

Discuss 1-minute to 15-minute price action setups, fading intraday momentum, key support/resistance zones, and proven short-term trading methodologies.
PTScalper
Site Admin
Posts: 7647
Joined: Mon Jul 20, 2026 1:28 pm

Re: Unit tests for trading code: boring and invaluable

Post by PTScalper »

The Half-Open State

When the 15-minute BreakDuration expires, Polly transitions into a Half-Open state. It allows exactly one execution through the pipeline as a probe.

If that probe succeeds, the circuit fully closes, the failure counters reset, and normal high-frequency execution resumes.

If that probe fails, the circuit instantly trips back to Open, and another full 15-minute cooldown begins.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Recommended broker for automated trading & scalping IC Markets
Shadow Trader
Posts: 5438
Joined: Wed Sep 09, 2026 5:19 pm

Re: Unit tests for trading code: boring and invaluable

Post by Shadow Trader »

Hi PTScalper, agree with you on the barrier point. In algo work a logic flaw doesn't announce itself with a red candle; it just executes, often headless on a VPS, and the damage is done before anyone is looking. Isolating the pure maths from the stateful broker calls is the right first step, because once size, pip conversion, stops and risk checks sit behind clean unit tests, a lot of the scary bugs become ordinary failed assertions instead of live losses. The ones that still worry me are state mismatches across reconnects and anything that depends on the broker's clock. Those are harder to unit-test in isolation, so I end up with a small integration harness that replays a recorded session. Still boring, still invaluable. Preserve capital first, then scale.
Post Reply