MengNotes
BlogTagsAbout
Home/Blog/66-Day Quant Training Journal: From SMA to Ichimoku — Building a Solid Technical Indicator Foundation in Seven Days
Quant-Trading

66-Day Quant Training Journal: From SMA to Ichimoku — Building a Solid Technical Indicator Foundation in Seven Days

Documenting the learning journey of Day 4 to Day 10 in a 66-day quantitative trading training program, covering SMA, Bollinger Bands, MACD, ADX, Ichimoku Cloud, and risk management.

March 8, 20262,369 words12 min read
#quant-trading#technical-indicators#backtesting#66-days-training#week-summary

66-Day Quant Training Journal: From SMA to Ichimoku — Building a Solid Technical Indicator Foundation in Seven Days

Summary

This post documents Day 4 through Day 10 of a 66-day quantitative trading training program. Over seven days, we progressed from the most fundamental Simple Moving Average (SMA) through Bollinger Bands, MACD, ADX, and the Ichimoku Cloud system, concluding with a million-dollar lesson in risk management. Every indicator was validated through actual backtesting — not just theory.


1. The Seven-Day Learning Map

DayCore TopicIndicator TypeKey Insight
Day 4SMA Strategy + IBKR IntegrationTrend FollowingMoving average crossovers, data extraction pipeline
Day 5SMA Intraday Trading AdaptationTrend Following (Short-term)Timeframe switching, SMA parameter sensitivity
Day 6Bollinger BandsVolatility + Mean ReversionThe 95% rule, the cost of overfitting
Day 7MACD Golden CrossMomentumLagging indicator behavior, histogram slope filter
Day 8ADX Trend StrengthTrend Strength FilterDirection vs. strength, false signal filtering
Day 9Ichimoku CloudAll-in-One SystemFive-line integration, the cloud as a no-trade zone
Day 10Risk Management MindsetPsychology & DisciplineIndependent stop-losses, risk of ruin, positive expectancy

2. Deep Dive into Each Indicator

Day 4–5: SMA — Where Every Trend Strategy Begins

The Simple Moving Average (SMA) is the most classic tool in technical analysis. Its logic is beautifully straightforward: compute the arithmetic mean of the past NNN closing prices.

SMAN=1N∑i=1NPiSMA_N = \frac{1}{N} \sum_{i=1}^{N} P_iSMAN​=N1​i=1∑N​Pi​
Core Concept

The SMA's value isn't in predicting the future — it's in smoothing out noise so you can see where price is actually heading. When price crosses the moving average, it may signal a trend shift.

What We Learned in Practice

  • Day 4: We used the IBKR API to extract historical data for the MAG7 stocks (MSFT, AAPL, TSLA, NVDA, META, GOOGL, AMZN) and found the optimal SMA window for each stock individually. This taught us that different assets have different optimal rhythms — one-size-fits-all rarely works.
  • Day 5: We converted a daily SMA 200 strategy into a 1-minute SMA 5 intraday script. Shortening the timeframe made signals more responsive but dramatically increased false signals — the double-edged sword of short-term trading.
Shorter Periods = More Noise

SMA 5 on a 1-minute chart is extremely jittery. Faster pace does not equal higher returns; it demands even stricter entry/exit discipline.


Day 6: Bollinger Bands — Measuring Volatility with Statistics

Bollinger Bands consist of three lines:

  • Middle Band: SMA (typically 20-day)
  • Upper Band: SMA + k×σk \times \sigmak×σ (typically k=2k = 2k=2)
  • Lower Band: SMA - k×σk \times \sigmak×σ

Where σ\sigmaσ is the standard deviation of closing prices.

The 95% Rule

Under a normal distribution, approximately 95% of price action falls within ±2 standard deviations. When price breaks through the bands, it enters what is statistically a "tail event." This doesn't guarantee a reversal, but it means the price is in an unusual position.

Backtest Results and Reflection

Using AAPL with a "buy at lower band, sell at upper band" mean-reversion logic over ten years:

MetricIn-Sample (2016–2021)Out-of-Sample (2022–2026)
CAGR25.99%8.85%
Sharpe1.200.59
Max Drawdown-31.43%-16.61%
  • The grid search's best parameters (SMA=20, σ=3.0) produced a Sharpe 2.05× above the mean — a classic overfitting red flag.
  • The 3σ bandwidth was rarely touched (only 1 trade out-of-sample), meaning the strategy sat in cash most of the time — low drawdown but also low returns.
  • AAPL exhibited a strong uptrend over 2016–2026; a pure mean-reversion strategy sold too early at the upper band, missing extended trend gains.
Key Lesson

Optimal parameters ≠ future-optimal parameters. The champion combination in backtesting often performs mediocrely in live trading. This is the textbook case of overfitting.


Day 7: MACD — Your Ticket into the World of Momentum

MACD stands for Moving Average Convergence Divergence. It measures momentum through the relationship between two exponential moving averages.

MACD=EMA12−EMA26MACD = EMA_{12} - EMA_{26}MACD=EMA12​−EMA26​ Signal=EMA9(MACD)Signal = EMA_9(MACD)Signal=EMA9​(MACD) Histogram=MACD−SignalHistogram = MACD - SignalHistogram=MACD−Signal
Golden Cross & Death Cross
  • Golden Cross: MACD line crosses above the signal line → bullish momentum is building
  • Death Cross: MACD line crosses below the signal line → bearish momentum is taking over

Advanced Technique: Histogram Slope Filter

Pure crossover signals are prone to whipsaws in ranging markets. Adding a histogram slope filter:

  • Only allow buy entries when the histogram is rising
  • Only allow sell entries when the histogram is falling

This extra confirmation layer effectively reduces false signals, but it also delays your entry — an inherent characteristic of lagging indicators. Trading is always a tradeoff between confirmation and timeliness.


Day 8: ADX — It Doesn't Tell You Where, It Tells You Whether It's Worth Going

The ADX (Average Directional Index) is a uniquely specialized indicator. Unlike SMA or MACD, which generate buy/sell signals, ADX answers a more fundamental question: "Is there a trend right now? Is it strong enough to trade?"

How ADX Is Calculated

ADX isn't derived directly from price — it goes through multiple layers of processing. The full calculation chain breaks down into five steps:

Step 1: Directional Movement (+DM / -DM)

For each bar, compare the current high/low against the previous bar:

+DM={Hight−Hight−1if Hight−Hight−1>Lowt−1−Lowt and >00otherwise+DM = \begin{cases} High_t - High_{t-1} & \text{if } High_t - High_{t-1} > Low_{t-1} - Low_t \text{ and } > 0 \\ 0 & \text{otherwise} \end{cases}+DM={Hight​−Hight−1​0​if Hight​−Hight−1​>Lowt−1​−Lowt​ and >0otherwise​ −DM={Lowt−1−Lowtif Lowt−1−Lowt>Hight−Hight−1 and >00otherwise-DM = \begin{cases} Low_{t-1} - Low_t & \text{if } Low_{t-1} - Low_t > High_t - High_{t-1} \text{ and } > 0 \\ 0 & \text{otherwise} \end{cases}−DM={Lowt−1​−Lowt​0​if Lowt−1​−Lowt​>Hight​−Hight−1​ and >0otherwise​

In plain terms: +DM captures the magnitude of "upward breakouts," while -DM captures "downward breakouts."

Step 2: True Range (TR)

TR=max⁡(Hight−Lowt,  ∣Hight−Closet−1∣,  ∣Lowt−Closet−1∣)TR = \max(High_t - Low_t,\; |High_t - Close_{t-1}|,\; |Low_t - Close_{t-1}|)TR=max(Hight​−Lowt​,∣Hight​−Closet−1​∣,∣Lowt​−Closet−1​∣)

TR measures each bar's actual volatility range, accounting for gap openings.

Step 3: Wilder's Smoothing

Apply Wilder's smoothed moving average (typically N=14N = 14N=14) to +DM, -DM, and TR separately:

Smoothedt=Smoothedt−1−Smoothedt−1N+ValuetSmoothed_{t} = Smoothed_{t-1} - \frac{Smoothed_{t-1}}{N} + Value_tSmoothedt​=Smoothedt−1​−NSmoothedt−1​​+Valuet​
Wilder's Smoothing vs Regular EMA

Wilder's smoothing is equivalent to a 2N−12N - 12N−1 period EMA. So ADX 14 actually decays at roughly the same rate as EMA 27 — slower than you might intuitively expect.

Step 4: Directional Indicators (+DI / -DI) and DX

+DI=Smoothed(+DM)Smoothed(TR)×100+DI = \frac{Smoothed(+DM)}{Smoothed(TR)} \times 100+DI=Smoothed(TR)Smoothed(+DM)​×100 −DI=Smoothed(−DM)Smoothed(TR)×100-DI = \frac{Smoothed(-DM)}{Smoothed(TR)} \times 100−DI=Smoothed(TR)Smoothed(−DM)​×100 DX=∣+DI−(−DI)∣+DI+(−DI)×100DX = \frac{|+DI - (-DI)|}{+DI + (-DI)} \times 100DX=+DI+(−DI)∣+DI−(−DI)∣​×100

+DI represents the proportion of upward momentum relative to total volatility; -DI represents the downward proportion. DX measures the "divergence" between the two.

Step 5: ADX = Smoothed DX

ADX=1N∑i=1NDXi(initial value)ADX = \frac{1}{N} \sum_{i=1}^{N} DX_i \quad \text{(initial value)}ADX=N1​i=1∑N​DXi​(initial value) ADXt=ADXt−1×(N−1)+DXtN(subsequent values)ADX_t = \frac{ADX_{t-1} \times (N-1) + DX_t}{N} \quad \text{(subsequent values)}ADXt​=NADXt−1​×(N−1)+DXt​​(subsequent values)

The final ADX applies one more round of smoothing to DX, making the trend-strength reading more stable and less reactive to single-day spikes.

No Need to Calculate by Hand!

In practice, one line of Python does the job: ta.trend.ADXIndicator(high, low, close, window=14). Understanding the math helps you appreciate why it's slow — after two layers of smoothing, ADX is inherently a lagging indicator, better suited for confirmation than prediction.

ADX Value Interpretation

ADX ValueTrend StrengthSuggested Action
0–20Weak / No TrendStay on the sidelines
20–40Moderate TrendTrend is forming
40–60Strong TrendSuitable for trend-following
60–100Extreme TrendExceptionally strong momentum

ADX works alongside +DI (Positive Directional Indicator) and -DI (Negative Directional Indicator):

  • Buy: ADX > 25 and +DI crosses above -DI
  • Sell: ADX > 25 and -DI crosses above +DI
The Real Value of ADX

ADX is best used as a filter, not a signal generator. Think of it as a traffic light: green (ADX > 25) means you can proceed, but you still need other indicators to tell you which direction to go.


Day 9: Ichimoku Cloud — An Entire Trading System on One Chart

The Ichimoku Kinko Hyo is one of the few indicators that simultaneously displays trend direction, momentum strength, and support/resistance levels on a single chart. It consists of five lines:

ComponentCalculationRole Analogy
Tenkan-sen (Conversion Line)(9-day High + 9-day Low) ÷ 2The Scout — quick, responsive short-term detection
Kijun-sen (Base Line)(26-day High + 26-day Low) ÷ 2The General — stable, authoritative medium-term anchor
Senkou Span A (Leading Span A)(Tenkan + Kijun) ÷ 2, shifted forward 26 periodsUpper or lower edge of the cloud
Senkou Span B (Leading Span B)(52-day High + 52-day Low) ÷ 2, shifted forward 26 periodsThe other edge of the cloud
Chikou Span (Lagging Span)Current close, shifted backward 26 periodsThe Second Confirmer
The Cloud (Kumo) = No-Trade Zone

The area between Senkou Span A and B forms the "cloud."

  • Price above the cloud → bullish environment
  • Price below the cloud → bearish environment
  • Price inside the cloud → direction unclear, best to wait

Compared to a Single MA Strategy

While SMA only tells you "where price is relative to the average," Ichimoku simultaneously provides:

  1. Forward-looking perspective: The cloud extends into the future, letting you anticipate support and resistance zones
  2. Multi-dimensional confirmation: Tenkan/Kijun crossover + cloud position + Chikou Span — triple confirmation reduces false signals
  3. Built-in momentum reading: The distance between price and cloud indicates momentum strength; convergence signals weakening momentum

The tradeoff: signals are more conservative, trading frequency is lower, and opportunities in choppy markets are often missed.


Day 10: A Million-Dollar Lesson — The Risk Management Mindset

No code on this day. Just a real story: a trader built a quantitative strategy called Imhotep. His account ballooned to $1.88 million. Then, because his stop-loss code was untested, monitoring was absent, he was trading 100% of his capital with leverage, it all vanished overnight in a single liquidation event.

His Fatal Mistakes
  1. Using leverage
  2. Not testing the stop-loss logic
  3. No proper monitoring or alert system
  4. Trading with 100% of his capital
  5. Believing he was invincible when things were going well

My Safety Net Framework

Drawing from The Trading Bible's core philosophy, I distilled three survival principles:

Principle 1: Drive Single-Trade Risk Toward Zero

  • Maximum risk per trade ≤ 1% of total capital
  • Calculate leverage based on actual exposure, not nominal position size

Principle 2: Maximize Your Survival in the Market

  • Even after 20 consecutive stop-losses, the account retains 80%+ of its capital
  • Separate "trading capital" from "reserve capital" — the reserve is never touched

Principle 3: Ensure Positive Expected Value

E=(W×Gˉ)−(L×Lˉ)>0E = (W \times \bar{G}) - (L \times \bar{L}) > 0E=(W×Gˉ)−(L×Lˉ)>0

Where WWW = win rate, Gˉ\bar{G}Gˉ = average gain, LLL = loss rate, Lˉ\bar{L}Lˉ = average loss. Only strategies with positive expected value are worth executing.

Quote

Code can execute your logic, but only your risk awareness can keep you in the game.


3. Common Findings Across Seven Days of Backtesting

Overfitting Is Your Greatest Enemy

Every parameter optimization is a battle against overfitting. Across Day 6 (Bollinger Bands), Day 7 (MACD), Day 8 (ADX), and Day 9 (Ichimoku), we repeatedly confirmed the same truth:

The best parameters in-sample are almost never the best parameters out-of-sample.

How to cope:

  1. Always split data into in-sample (training) and out-of-sample (validation) periods
  2. When reading Sharpe heatmaps, choose the "plateau" over the "peak" — a stable parameter region is more reliable than a single optimal point
  3. When in-sample Sharpe dramatically exceeds out-of-sample, that's the overfitting red flag

The R.E.A.L. Backtesting Framework

All backtests followed the R.E.A.L. principles:

  • Realistic: Include commissions ($0.005/share) and slippage (0.05%)
  • Evidence-based: Validate phase by phase, never skip steps
  • Avoiding Bias: Apply signal.shift(1) — execute on the next bar's open to prevent look-ahead bias
  • Logged: Document observations in Markdown at every phase for reproducibility

4. Indicator Selection Quick Reference

Market ConditionWell-Suited IndicatorsLess Suitable Indicators
Clear TrendSMA, MACD, IchimokuBollinger Bands (mean reversion)
Range-BoundBollinger Bands, RSIMACD, ADX
Uncertain DirectionADX (to confirm whether it's worth trading)All signal-type indicators
Need Comprehensive ViewIchimoku (trend + momentum + S/R)Any single indicator alone
No Universal Indicator Exists

Every indicator excels in specific market conditions. True skill isn't finding the strongest indicator — it's recognizing "what kind of market are we in right now" and then choosing the right tool.


5. Mindset Takeaways to Remember

  1. Simple strategies tend to be more robust. The more complex the system, the more likely it breaks in live trading.
  2. Backtests are maps, not territories. Historical data is perfect; markets are not.
  3. Risk management comes before everything. Survive first, profit second.
  4. Lagging isn't a flaw — it's a feature. An extra layer of confirmation means fewer false signals.
  5. Don't chase "optimal" — chase "robust." Peaks on a Sharpe heatmap are traps; plateaus are where you want to be.

What's Next

Day 11 onward dives into RSI divergence and more advanced strategy combinations. With seven days of foundation laid, the journey continues.

Table of Contents

1. The Seven-Day Learning Map2. Deep Dive into Each IndicatorDay 4–5: SMA — Where Every Trend Strategy BeginsDay 6: Bollinger Bands — Measuring Volatility with StatisticsDay 7: MACD — Your Ticket into the World of MomentumDay 8: ADX — It Doesn't Tell You Where, It Tells You Whether It's Worth GoingDay 9: Ichimoku Cloud — An Entire Trading System on One ChartDay 10: A Million-Dollar Lesson — The Risk Management Mindset3. Common Findings Across Seven Days of BacktestingOverfitting Is Your Greatest EnemyThe R.E.A.L. Backtesting Framework4. Indicator Selection Quick Reference5. Mindset Takeaways to Remember
← Back to all posts

© 2024-2026 MengNotes | All Rights Reserved