When the regime changes, the strategy changes — designing day trading around five market states
A trading system that classifies the market into five regimes — strong bull, weak bull, sideways, weak bear and crash — and switches strategies, stop multipliers and risk controls to match each one.

The market opened strong this morning. Completely different from yesterday. Does your trading bot know that?
Most day trading bots run the same strategy regardless of the mood of the market. Breakout strategy in a range-bound market, breakout strategy in a crash. Buy when the condition is met, wait when it isn't. That's all. So they make money in a bull market and then take consecutive losses on identical settings the moment conditions shift. The program isn't bad. It simply was never designed to read the market.
We went straight at that structural flaw. Read the regime first, pick the strategy that suits it, then scale risk dynamically to market volatility. Every 60 seconds, the system decides what state the market is in and reconfigures its strategies.
The market isn't one thing — reading five faces
Our system's first question is always the same: what state is the market in right now?
To answer it, the system checks each morning where the KOSPI 20-day moving average sits relative to the 60-day, plus V-KOSPI, the fear index. Together those two put the market into one of five regimes.
Strong bullish is when the KOSPI 20-day sits above the 60-day and V-KOSPI is at or below 20. The market is rising steadily and there is no fear in it. This is when you can ride momentum aggressively.
Weak bullish is when the trend is alive but conviction is thin. The market is going up but something feels unsettled. You follow the trend carefully.
Sideways means no direction at all — the 20-day and 60-day tangled together. Breakout strategies get faked out repeatedly here. A different approach is needed.
Weak bearish means the market is heading down. In this regime the day trading system does not trade. Doing nothing is the strategy.
Crash is the market collapsing on the spot: V-KOSPI above 35, or KOSPI down more than 5% intraday. This is panic. And yet there is opportunity inside it — very selectively, and very briefly.
Regime detection uses hysteresis. A single signal does not flip the state. The same signal must be confirmed across two consecutive trading days before the regime changes — a safeguard so market noise doesn't rattle the strategy.
Each regime brings out a different strategy
Once the regime is decided, the system automatically selects the strategies tuned to it. No user intervention. No changing strategies every morning.
In a strong bull market, momentum strategies step up.
ORB (Opening Range Breakout) records the highs of the 09:00 and 09:05 bars, the first ten minutes of the session. After 09:10, when the current close breaks above that high while volume runs at twice its usual rate, the system enters. It rides the flow as institutions and foreign investors set direction early in the session.
GapAndGo targets names that open at least 2% above the previous close. If the first five-minute bar closes green on triple-plus volume, the system reads the gap as strong buying rather than noise. Between 09:05 and 09:35, it rides the early leg of the gap.
In a weak bull market, VWAP becomes the reference line.
VWAP is the day's volume-weighted average price. When a name that has been trading below it breaks back above on volume, that says buying pressure has reclaimed the intraday average. Even in a market without conviction, that turn is relatively reliable.
In a sideways market, contrarian strategies take over.
Where breakout strategies fail, other approaches work. VWAP Reversion enters when price has fallen more than 1.5 ATR away from VWAP, then turns green with RSI at or below 40 — catching the move back to the mean after an excessive push down.
RSI Extreme waits for RSI below 30 and a break beneath the lower Bollinger band, then enters on the first green bar. A technical bounce from an extreme oversold reading.
In a crash, exactly one strategy runs.
StockPanicBounce enters only when a name that has dropped 5%+ from its intraday high closes, after 2pm, as a hammer whose lower wick is at least 60% of the bar's range, on double volume. It targets the technical bounce that appears once panic settles, and it fires only when both the timing and the shape conditions are met.
And in a weak bear market, it does nothing at all. That is one of the most important strategies of the lot.
Stops that breathe with the market
You've bought. Now where do you sell? Fixed-percentage stops and targets are simple but crude. On a volatile day, the stop is too tight and normal price noise takes you out. On a quiet day, the stop is too wide and losses get big.
Our system uses ATR (Average True Range), calculated over the last fourteen five-minute bars — the market's actual range of movement. If Samsung Electronics swings 200 to 400 won a day, ATR reflects that. It shrinks on quiet days and expands on violent ones.
Three lines are drawn from the entry price using ATR multiples.
- Stop loss (SL): entry − ATR × multiplier. Touch it and the position is cut, no exceptions.
- Take profit (TP): entry + ATR × multiplier. Reach it and the gain is booked.
- Trailing stop: a stop that rises with each new high.
And those multipliers vary by regime. In a strong bull market the stop is given a little more room (ATR × 0.8) and the target is set further out (ATR × 2.5). In a sideways market both are tight (SL × 0.6, TP × 1.5). Narrow when the market is quiet, wide when it is strong — risk parameters adjusting themselves to the state of the market.
A concrete example. Strong bull market, entry at 70,000 won, ATR of 300 won:
Stop loss = 70,000 − 300 × 0.8 = 69,760 won
Take profit = 70,000 + 300 × 2.5 = 70,750 won
Trailing = 70,000 − 300 × 1.5 = 69,550 won
If price rises to 70,400, the trailing stop moves up to 70,400 − 450 = 69,950. Should price fall back, the position sells automatically at 69,950. The structure guarantees you keep part of the gain.
When losses run consecutively, the system stops itself
Day trading is fast — and losses stack up just as fast. On a day of back-to-back stops, a human trader's judgement wavers. The urge to make it back leads to bigger positions and broken rules. An automated system is no different: as long as conditions are met it keeps buying and keeps losing.
Our system has automatic protection against consecutive losses built in.
Three stop-outs in a day and new entries are suspended for the rest of it. We don't fight any more today. Two consecutive losing days and the next session runs at 50% of the capital. Three consecutive days triggers a 24-hour cooldown. The goal isn't to beat the market — it's to survive its worst phases.
When the market starts breaking, a two-stage response
An intraday collapse neutralises any day trading strategy. It isn't that there's no direction; it's that everything is heading down.
Level 1 is the alarm. If V-KOSPI passes 25 or KOSPI drops more than 3% intraday, new entries stop. Existing positions are left alone, but nothing new is bought.
Level 2 is the exit. If V-KOSPI passes 35 or KOSPI falls more than 5%, every open day trading position is liquidated at market immediately. No questions asked. Survive first, think later.
Opened today, closed today
Day trading does not carry overnight risk. Bad news overnight or a gap-down open makes a stop loss meaningless.
At 3:15pm the system sounds an alert. Within fifteen minutes, every position opened with trading_style = "daytrading" is closed at market. Profit or loss, what opened today closes today. Every seat is empty by the 3:20pm close.
What the system does over a day
09:00 — the market opens. The regime call is already made; today's strategy set is already decided.
09:05–09:35 — GapAndGo scans for gap-up names and enters as soon as conditions are met.
09:10–11:00 — ORB waits for a break above the opening range high, entering on volume confirmation.
After that — every 60 seconds, SL/TP/trailing levels on open positions are checked. VWAP breakout, VWAP reversion and RSI extreme strategies scan for signals live.
After 14:00 — in a crash regime, StockPanicBounce hunts for hammer candles.
15:15 — the forced-liquidation countdown starts.
15:20 — all positions closed. The day is done.
Why this holds up better
The problem with conventional day trading bots isn't that they have only one strategy. It's that they always use the same one — same conditions, same multipliers, same criteria in a bull market, a range and a crash alike.
Our system behaves differently depending on which face the market is showing. It attacks when it should attack, defends when it should defend, and sits still when it shouldn't be fighting at all. Stops are set against today's volatility, and when losses accumulate the system hits the brakes on its own. When the day ends, the positions end with it.
There's no need to change strategy every morning. When the regime changes, the strategy changes with it. The only thing left for the user is checking that the bot is running.
Technical foundations
Regime detection runs daily at 08:50 KST and each result is stored as history in the database. All strategy signals are generated from five-minute OHLCV data via yfinance, using the most recent 100 bars (roughly a day and a half) as the analysis window. ATR is computed on a Wilder EMA over 14 five-minute periods. Cooldown state and crash-defence levels live in Redis and are managed in real time. Every entry and exit is written to the trade record along with entry_strategy, exit_reason and market_regime fields, so you can trace which strategy produced which result in which regime.
Closing
Predicting the market is impossible. Reading its state and responding in a way that fits is not. Attack when it's strong, stay conservative when it's uncertain, step back when it's dangerous. This is not a high-return strategy. It is a survival strategy.
And only a system that survives gets to enjoy compounding.
What regime is the market in today? The system already knows.