Skip to content
CN2.DEVBUKYA NARESH

CASE STUDY / 02

MULTI-TIMEFRAME TRADING & EXECUTION ARCHITECTURE

AUTOMATED TRADING OS

Multi-timeframe quantitative trading and execution architecture.

An operating-system-style architecture for systematic trading: higher-timeframe context flows down through mid- and lower-timeframe analysis into risk, trade management and execution — every stage bounded by structural controls: 1% per-trade risk cap, minimum 1:4 reward-to-risk, fee and slippage modelling, cost-budget filtering, profit lock and giveback limit.

DEVELOPMENTExecution architecture under active development.

EVIDENCE INSTRUMENT / PROJECT-SPECIFIC

INSTRUMENT / EXECUTION PIPELINE

ARCHITECTURE DIAGRAM — NOT A PERFORMANCE MEASUREMENT

HTF CONTEXTHigher timeframe directional bias & structure
● Daily / 4H trend
● Key levels
● Regime filter
MTF STRUCTUREMid timeframe pattern recognition
● Swing points
● Order blocks
● Liquidity zones
LTF ENTRYLower timeframe precision trigger
● Micro structure
● Entry signal
● Confirmation
SIGNAL VALIDATIONOne-way flow gate
● HTF alignment
● MTF confluence
● LTF trigger
RISK FIREWALLStructural risk enforcement
● 1% per-trade cap
● 1:4 R:R floor
● Cost budget filter
● Profit lock / giveback limit
EXECUTIONDeterministic order construction
● Fee / slippage model
● Position sizing
● Order routing
POSITIONActive trade management
● Trailing logic
● Partial scaling
● Time-based exit

One-way information flow: no lower timeframe can override a higher timeframe constraint. The risk firewall sits before order construction, so a setup that fails the 1% cap, the 1:4 R:R floor or the cost budget never becomes an order.

01/

PROBLEM

Most trading systems are built as a single indicator that prints buy/sell signals. That model collapses context, risk and execution into one fragile decision.

Real systematic trading is layered: what the higher timeframe permits, the mid timeframe structures, the lower timeframe triggers — and none of it matters if position size, costs and exit management are not governed explicitly.

02/

MOTIVATION

I wanted an architecture where the layers are honest about their role — where a lower-timeframe entry can never override higher-timeframe context, and where risk rules are structural rather than advisory.

The operating-system framing is deliberate: kernels schedule, enforce and isolate. A trading architecture should do the same for decisions.

03/

RESEARCH QUESTION

Does explicit multi-timeframe separation, with hard risk controls at every layer boundary, improve trade quality enough to survive modeled costs?

04/

OBJECTIVE

  • Separate HTF / MTF / LTF analysis into distinct pipeline stages with defined contracts
  • Enforce risk controls as structural invariants: 1% per-trade risk cap, minimum 1:4 R:R
  • Model fees and slippage at execution, and filter trades whose cost budget cannot support the setup
  • Manage open trades with profit lock and giveback limits instead of static stops only
05/

ARCHITECTURE

VISUAL METAPHOR — LAYERED EXECUTION PIPELINE

  1. 01

    HTF — HIGHER TIMEFRAME

    Directional context and regime

    • Establishes the permitted directional bias
    • Lower layers may not contradict it
  2. 02

    MTF — MID TIMEFRAME

    Structure and setup identification

    • Maps the structure the entry will live inside
    • Defines setup zones and invalidation
  3. 03

    LTF — LOWER TIMEFRAME

    Entry trigger

    • Times the execution within MTF structure
    • Emits trigger only when HTF and MTF agree
  4. 04

    RISK

    Position sizing and trade admission

    • 1% per-trade risk cap on capital
    • Minimum 1:4 reward-to-risk required
    • Cost-budget filter rejects setups that cannot pay for themselves
  5. 05

    TRADE MANAGEMENT

    Open-position governance

    • Profit lock secures gains as trade progresses
    • Giveback limit caps how much open profit may be surrendered
  6. 06

    EXECUTION

    Order construction and fills

    • Fee and slippage modelling applied to every fill
    • Orders constructed only after all gates pass
06/

DATA FLOW

PIPELINE — 7 STAGES, IN ORDER

  1. 01HTF analysis establishes directional context and regime classification
  2. 02MTF analysis maps structure and defines the setup and its invalidation
  3. 03LTF timing emits a trigger only inside MTF structure and HTF direction
  4. 04Risk stage sizes the position from stop distance under the 1% cap and rejects sub-1:4 setups
  5. 05Cost-budget filtering removes trades whose fees and slippage cannot be supported by target
  6. 06Trade management governs the open position: profit lock and giveback limits
  7. 07Execution constructs and simulates the order with explicit fee and slippage models
07/

METHODS

  • Layered pipeline architecture with one-way information flow — downstream cannot override upstream
  • Structural risk invariants enforced at layer boundaries
  • Explicit cost modelling: fees and slippage priced into every admission decision
  • Before/after experimentation comparing trades with and without each control
08/

RISK / VALIDATION

  • 1% maximum account risk per trade — position size derives from stop distance
  • Minimum 1:4 reward-to-risk — setups below the threshold are never admitted
  • Cost budget filter — if modeled costs exceed what the setup can carry, the trade is rejected
  • Profit lock and giveback limit — open profit is protected by rule, not discretion
09/

EXPERIMENTS

Control ablation

ONGOING

What does each risk control individually contribute to trade quality?

Before/after comparisons isolating the effect of each gate on admitted trade sets.

R:R threshold sweep

ONGOING

How does the admitted-trade population change as the minimum R:R threshold moves?

Strategy matrix across R:R thresholds under fixed 1% risk.

Timeframe alignment study

ONGOING

How often do HTF, MTF and LTF agree, and what is the character of those windows?

Timeframe explorer mapping agreement windows across instrument history.

10/

RESULTS

1%

MAX RISK PER TRADE

STRUCTURAL CAP

1:4

MINIMUM R:R

ADMISSION THRESHOLD

6

PIPELINE STAGES

HTF → EXECUTION

100%

FILLS COST-MODELED

FEES + SLIPPAGE

The results here are architectural: the controls exist, are enforced structurally, and are experiment-ready. Performance figures from this architecture will be published only as labeled backtests when runs complete.

11/

LIMITATIONS

  • Execution architecture is in development — forward results are not yet published
  • Control ablation experiments are ongoing; per-control contribution figures are not yet final
  • Cost models approximate fills and do not capture all extreme-liquidity scenarios
12/

CURRENT STATUS

DEVELOPMENT

Execution architecture under active development.

13/

EVIDENCE

REPOSITORY

Architecture and control implementations on GitHub

OPEN THE SOURCE →

CONTROLS IN CODE

Risk cap, R:R floor, cost filter, profit lock, giveback limit - enforced structurally and exercised by local tests; no CI runs yet

PIPELINE MODEL

HTF → MTF → LTF → RISK → TRADE MANAGEMENT → EXECUTION

14/

INTERACTIVE LAB

TRADE DISTRIBUTION — SEEDED ILLUSTRATION UNDER THE 1:4 R:R FLOOR

Seeded illustrative distribution of trade R-multiples shaped by the structural one-to-four minimum reward-to-risk floor. Losers truncate near minus one R; runners concentrate between three and nine R.-3R-2R512-1R1670R+1R155+2R146+3R83+4R76+5R9+6R15+7R17+8R20+9R

EQUITY SHAPE — SEEDED ILLUSTRATION OF A RISK-CAPPED PIPELINE

Seeded illustrative equity curve for a risk-capped multi-timeframe pipeline with tight, shallow drawdowns.0.0%+48.3%+96.5%DRAWDOWNMAX 50.6% (NORMALIZED TRACE)
15/

GITHUB

PythonMulti-timeframe analysisRisk enginePaper execution