Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
PlusEV Wiki Page
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Component:Multi Timeframe Analysis
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Multi-Timeframe Analysis [MTF]= '''Layer:''' 1 (Foundation)<br/> ---- == Purpose == '''"Are all timeframes pointing the same direction?"''' Before entering a trade, we need confirmation that 1D, 4H, 1H, 15M, and 5M timeframes agree on direction. This component calculates a weighted alignment score and determines if we have sufficient confluence to trade. <div style="border-left:6px solid #87BCFF; background-color:#F5FAFF; padding:14px 16px; margin:16px 0; font-size:95%;"> <strong>THIS IS THE FOUNDATION</strong>. Everything else builds on top of MTF alignment. If timeframes disagree, we donot trade. </div> == Trading Market Principle == '''"Trade with the trend across multiple timeframes?"''' *Higher timeframes are more reliable. They get higher weights because big players operate on higher timeframes & dictate market direction. Lower timeframe traders follow. *We need agreement, not perfection. 70% alignment is sufficient *15-minute confirmation prevents premature entries, whipsaws ---- == How It Works == === Step 1: Analyze Each Timeframe === For each timeframe [1D, 4H, 1H, 15M, 5M]: * Uses Component:Trend_Analysis_Core to determine direction (up/down/sideways) * Checks if price is above or below MA21 * Detects if MA is trending or flat === Step 2: Determine Expected Direction === The '''primary timeframe''' (default: 1H) sets the expected direction: * 1H trending UP β expected direction = "up" * 1H trending DOWN β expected direction = "down" === Step 3: Check Alignment === Each timeframe is marked as "aligned" if its direction matches the expected direction: <pre> aligned = (timeframe_direction == expected_direction) </pre> === Step 4: Calculate Weighted Score === <pre> Alignment_Score = Ξ£(Weight_i Γ Aligned_i) / Ξ£(Weight_i) Where: Weight_i = hierarchical weight for timeframe i Aligned_i = 1 if aligned, 0 if not </pre> === Step 5: 15-Minute Confirmation (Confirmation) === checks that 70% of recent 15M bars [last 2 bars] confirm the direction: <pre> For LONG: bullish_bars >= min_bars Γ 0.70 For SHORT: bearish_bars >= min_bars Γ 0.70 </pre> === Step 6: Final Decision === <pre> is_aligned = (alignment_score >= min_alignment_score) AND (15m_confirmed) </pre> ---- == Weight Formula == Default hierarchical weights formula: <pre> weight(i) = 1.0 - (i / N) Γ 0.7 Where: i = timeframe index (0-based) N = total timeframes (5) 0.7 = scaling factor </pre> '''Calculated Weights:''' {| class="wikitable" |- ! Timeframe !! Index !! Calculation !! Weight |- | 1D || 0 || 1.0 - (0/5 Γ 0.7) || '''1.000''' |- | 4H || 1 || 1.0 - (1/5 Γ 0.7) || '''0.860''' |- | 1H || 2 || 1.0 - (2/5 Γ 0.7) || '''0.720''' |- | 15M || 3 || 1.0 - (3/5 Γ 0.7) || '''0.580''' |- | 5M || 4 || 1.0 - (4/5 Γ 0.7) || '''0.440''' |} ---- == Example Calculation == '''Scenario:''' 1D, 4H, 1H aligned UP. 15M and 5M are DOWN. <pre> Expected direction: UP (from 4H) Timeframe Direction Aligned Weight Contribution βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 1D up β 1.000 1.000 4H up β 0.860 0.860 1H up β 0.720 0.720 15M down β 0.580 0.000 5M down β 0.440 0.000 βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Total: 3.600 2.580 Alignment Score = 2.580 / 3.600 = 0.717 (71.7%) </pre> With min_alignment_score = 0.70, this PASSES (71.7% >= 70%). ---- == Configuration == {| class="wikitable" |- ! Parameter !! Default !! Description |- | <code>min_alignment_score</code> || 0.70 || Minimum weighted score required (0-1) |- | <code>require_all_timeframes_aligned</code> || False || If True, ALL timeframes must align |- | <code>wait_for_15min_alignment</code> || True || Enable 15-minute confirmation |- | <code>min_15min_confirmation_bars</code> || 2 || Bars to check for 15M confirmation |- | <code>primary_ma_period</code> || 21 || Primary moving average period |- | <code>secondary_ma_period</code> || 200 || Secondary moving average period |} ---- == Input == Dictionary of market data by timeframe: <pre> { TimeframeValue.DAILY: { "close": pd.Series, "open": pd.Series, "high": pd.Series, "low": pd.Series, "volume": pd.Series, "ma21": pd.Series, "ma200": pd.Series }, TimeframeValue.FOUR_HOUR: { ... }, TimeframeValue.ONE_HOUR: { ... }, TimeframeValue.FIFTEEN_MIN: { ... }, TimeframeValue.FIVE_MIN: { ... } } </pre> ---- == Output == '''TimeframeAnalysisResult:''' {| class="wikitable" |- ! Field !! Type !! Description |- | <code>aligned</code> || bool || Final alignment decision |- | <code>alignment_score</code> || float || Weighted score (0-1) |- | <code>primary_direction</code> || Direction || LONG or SHORT |- | <code>sufficient_alignment</code> || bool || Score >= threshold |- | <code>fifteen_min_aligned</code> || bool || 15M confirmation result |- | <code>timeframe_results</code> || Dict || Per-timeframe analysis details |} ---- == Key Methods == === process() === Main entry point. Called for each 5-minute bar. === _generate_default_weights() === Creates hierarchical weights using formula: <code>1.0 - (i/N Γ 0.7)</code> === _calculate_weighted_alignment() === Calculates: <code>Ξ£(Weight Γ Aligned) / Ξ£(Weight)</code> === _check_15min_alignment() === Checks if 70% of recent 15M bars confirm direction. ---- == Dependencies == '''Upstream:''' * [[Component:Data_Manager|data_manager.py]] - Provides OHLC data per timeframe '''Internal:''' * [[Component:Trend_Analysis_Core|trend_analysis_core.py]] - Per-timeframe trend direction analysis '''Downstream:''' * [[Component:Market_State_Analysis|market_state_analysis.py]] - Receives alignment result * [[Component:Setup_Quality_Detection|setup_quality_detection.py]] - Uses alignment score (30% weight) ----
Summary:
Please note that all contributions to PlusEV Wiki Page may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Component:Multi Timeframe Analysis
(section)
Add topic