SiamCafe.net Blog
Technology

Timeframe คืออะไร

timeframe คอ
Timeframe คืออะไร | SiamCafe Blog
2025-07-04· อ. บอม — SiamCafe.net· 1,383 คำ

Timeframe คืออะไร — คู่มือการเลือก Timeframe สำหรับเทรด

Timeframe คือกรอบเวลาที่ใช้แสดงข้อมูลราคาบนกราฟ (chart) ในการเทรดหุ้น Forex คริปโต และสินทรัพย์อื่นๆ แต่ละแท่งเทียน (candlestick) แสดงการเปลี่ยนแปลงราคาภายในช่วงเวลาที่กำหนด เช่น 1 นาที 1 ชั่วโมง หรือ 1 วัน การเลือก timeframe ที่เหมาะสมส่งผลต่อ trading style, สัญญาณซื้อขาย และผลลัพธ์การเทรด บทความนี้อธิบายทุก timeframe พร้อม Python tools สำหรับวิเคราะห์หลาย timeframes พร้อมกัน

ประเภทของ Timeframe

# timeframes.py — Timeframe types and characteristics
import json

class TimeframeTypes:
    TIMEFRAMES = {
        "scalping": {
            "name": "Scalping Timeframes",
            "frames": ["M1 (1 นาที)", "M5 (5 นาที)", " (15 นาที)"],
            "holding_period": "วินาที - นาที",
            "trades_per_day": "10-100+ trades",
            "style": "เข้าออกเร็ว กำไรน้อยแต่บ่อย",
            "pros": "โอกาสเทรดเยอะ, ไม่ต้อง overnight risk",
            "cons": "เหนื่อย, ค่า spread/commission สูง, ต้องจ้องจอ",
        },
        "day_trading": {
            "name": "Day Trading Timeframes",
            "frames": [" (15 นาที)", "M30 (30 นาที)", "H1 (1 ชั่วโมง)"],
            "holding_period": "นาที - ชั่วโมง",
            "trades_per_day": "2-10 trades",
            "style": "เปิด-ปิด position ภายในวัน",
            "pros": "ไม่ overnight risk, มีเวลาวิเคราะห์",
            "cons": "ต้องจ้องจอ 4-8 ชั่วโมง, ต้องมี discipline",
        },
        "swing_trading": {
            "name": "Swing Trading Timeframes",
            "frames": ["H4 (4 ชั่วโมง)", " (1 วัน)"],
            "holding_period": "วัน - สัปดาห์",
            "trades_per_day": "1-5 trades/สัปดาห์",
            "style": "จับ swing ของราคา — ขึ้นลงหลายวัน",
            "pros": "ไม่ต้องจ้องจอ, work-life balance ดี",
            "cons": "overnight/weekend risk, ต้องอดทนรอ",
        },
        "position_trading": {
            "name": "Position Trading Timeframes",
            "frames": [" (1 วัน)", "W1 (1 สัปดาห์)", "MN (1 เดือน)"],
            "holding_period": "สัปดาห์ - เดือน - ปี",
            "trades_per_day": "1-5 trades/เดือน",
            "style": "ถือ position ยาว ตาม trend ใหญ่",
            "pros": "ใช้เวลาน้อยมาก, จับ trend ใหญ่",
            "cons": "ต้องทน drawdown, ต้องมีทุนเยอะ",
        },
    }

    def show_timeframes(self):
        print("=== Timeframe Types ===\n")
        for key, tf in self.TIMEFRAMES.items():
            print(f"[{tf['name']}]")
            print(f"  Frames: {', '.join(tf['frames'])}")
            print(f"  Holding: {tf['holding_period']}")
            print(f"  Style: {tf['style']}")
            print(f"  Pros: {tf['pros']}")
            print(f"  Cons: {tf['cons']}")
            print()

tf = TimeframeTypes()
tf.show_timeframes()

Multiple Timeframe Analysis (MTA)

# mta.py — Multiple Timeframe Analysis
import json

class MultiTimeframeAnalysis:
    CONCEPT = {
        "description": "วิเคราะห์หลาย timeframes พร้อมกัน เพื่อเห็นภาพรวมและจุดเข้าเทรดที่ดี",
        "rule_of_3": "ใช้ 3 timeframes: Higher (trend) → Middle (signal) → Lower (entry)",
        "examples": {
            "scalper": "H1 (trend) →  (signal) → M5 (entry)",
            "day_trader": " (trend) → (signal) → H1 (entry)",
            "swing_trader": "W1 (trend) →  (signal) → (entry)",
            "position_trader": "MN (trend) → W1 (signal) →  (entry)",
        },
    }

    STEPS = [
        "1. Higher Timeframe: ดู trend หลัก — uptrend, downtrend, sideways",
        "2. Middle Timeframe: หา signal — pullback, breakout, pattern completion",
        "3. Lower Timeframe: หา entry point — trigger candle, support/resistance",
        "4. ทิศทางเทรด: เทรดตาม trend ของ higher timeframe เท่านั้น",
        "5. Confirmation: signal ต้อง align กันทั้ง 3 timeframes",
    ]

    def show_concept(self):
        print("=== Multiple Timeframe Analysis ===\n")
        print(f"  {self.CONCEPT['description']}")
        print(f"\n  Rule of 3: {self.CONCEPT['rule_of_3']}")
        print(f"\n  Examples:")
        for style, example in self.CONCEPT['examples'].items():
            print(f"    [{style}] {example}")

    def show_steps(self):
        print(f"\n=== MTA Steps ===")
        for step in self.STEPS:
            print(f"  {step}")

mta = MultiTimeframeAnalysis()
mta.show_concept()
mta.show_steps()

Python Timeframe Analyzer

# analyzer.py — Python timeframe analysis tool
import json

class TimeframeAnalyzer:
    CODE = """
# tf_analyzer.py — Multi-timeframe analysis tool
import pandas as pd
import numpy as np

class TimeframeAnalyzer:
    def __init__(self, data_1m: pd.DataFrame):
        '''Initialize with 1-minute OHLCV data'''
        self.data_1m = data_1m.copy()
        self.data_1m.index = pd.to_datetime(self.data_1m.index)
    
    def resample(self, timeframe):
        '''Resample to different timeframe'''
        ohlc = {
            'open': 'first',
            'high': 'max',
            'low': 'min',
            'close': 'last',
            'volume': 'sum',
        }
        return self.data_1m.resample(timeframe).agg(ohlc).dropna()
    
    def add_ema(self, df, periods=[20, 50, 200]):
        '''Add EMA indicators'''
        for p in periods:
            df[f'ema_{p}'] = df['close'].ewm(span=p).mean()
        return df
    
    def add_rsi(self, df, period=14):
        '''Add RSI indicator'''
        delta = df['close'].diff()
        gain = delta.where(delta > 0, 0).rolling(period).mean()
        loss = (-delta.where(delta < 0, 0)).rolling(period).mean()
        rs = gain / loss
        df['rsi'] = 100 - (100 / (1 + rs))
        return df
    
    def detect_trend(self, df):
        '''Detect trend using EMA'''
        last = df.iloc[-1]
        
        if last['close'] > last.get('ema_20', 0) > last.get('ema_50', 0):
            return 'uptrend'
        elif last['close'] < last.get('ema_20', float('inf')) < last.get('ema_50', float('inf')):
            return 'downtrend'
        return 'sideways'
    
    def multi_timeframe_analysis(self):
        '''Analyze multiple timeframes'''
        timeframes = {
            '': '15T',
            'H1': '1H',
            'H4': '4H',
            '': '1D',
        }
        
        results = {}
        for name, tf in timeframes.items():
            df = self.resample(tf)
            df = self.add_ema(df)
            df = self.add_rsi(df)
            
            trend = self.detect_trend(df)
            rsi = df['rsi'].iloc[-1] if 'rsi' in df.columns else None
            
            results[name] = {
                'trend': trend,
                'rsi': round(rsi, 1) if rsi else None,
                'close': round(df['close'].iloc[-1], 2),
                'ema_20': round(df['ema_20'].iloc[-1], 2) if 'ema_20' in df.columns else None,
            }
        
        # Trading signal
        higher_trend = results.get('', {}).get('trend', '')
        middle_trend = results.get('H4', {}).get('trend', '')
        
        signal = 'neutral'
        if higher_trend == 'uptrend' and middle_trend == 'uptrend':
            signal = 'buy'
        elif higher_trend == 'downtrend' and middle_trend == 'downtrend':
            signal = 'sell'
        
        return {
            'timeframes': results,
            'signal': signal,
            'alignment': higher_trend == middle_trend,
        }

# import yfinance as yf
# data = yf.download("USDJPY=X", period="60d", interval="1m")
# analyzer = TimeframeAnalyzer(data)
# result = analyzer.multi_timeframe_analysis()
"""

    def show_code(self):
        print("=== Timeframe Analyzer ===")
        print(self.CODE[:600])

analyzer = TimeframeAnalyzer()
analyzer.show_code()

การเลือก Timeframe ที่เหมาะสม

# choosing.py — How to choose the right timeframe
import json

class ChoosingTimeframe:
    FACTORS = {
        "personality": {
            "name": "บุคลิกภาพ",
            "patient": "อดทน → Swing/Position trading (, W1)",
            "active": "ชอบ action → Day trading/Scalping (M5, , H1)",
        },
        "time_available": {
            "name": "เวลาที่มี",
            "full_time": "เทรดเต็มเวลา → Scalping, Day trading",
            "part_time": "มีงานประจำ → Swing trading (ดูกราฟวันละ 2-3 ครั้ง)",
            "minimal": "เวลาน้อยมาก → Position trading (ดูสัปดาห์ละครั้ง)",
        },
        "capital": {
            "name": "ทุน",
            "small": "ทุนน้อย → Scalping/Day trading (กำไรเร็ว compound)",
            "medium": "ทุนปานกลาง → Swing trading",
            "large": "ทุนเยอะ → Position trading (ทน drawdown ได้)",
        },
        "experience": {
            "name": "ประสบการณ์",
            "beginner": "มือใหม่ → H4,  (ข้อมูลน้อย วิเคราะห์ง่าย noise น้อย)",
            "intermediate": "มีประสบการณ์ → H1,  (เพิ่ม timeframe เล็กลง)",
            "advanced": "เทรดเป็น → ทุก timeframe (ตาม strategy)",
        },
    }

    COMMON_MISTAKES = [
        "เปลี่ยน timeframe บ่อยเพราะ FOMO — ยึด timeframe เดิม",
        "ดู timeframe เล็กเกินไป → noise เยอะ สัญญาณหลอก",
        "ไม่ดู higher timeframe → เทรดสวน trend ใหญ่",
        "ใช้ indicator เดิมทุก timeframe — ปรับ parameters ตาม timeframe",
        "Over-analyze — ดู 5+ timeframes → สับสน ตัดสินใจไม่ได้",
    ]

    def show_factors(self):
        print("=== ปัจจัยการเลือก Timeframe ===\n")
        for key, factor in self.FACTORS.items():
            print(f"[{factor['name']}]")
            for k, v in factor.items():
                if k != 'name':
                    print(f"  • {v}")
            print()

    def show_mistakes(self):
        print("=== Common Mistakes ===")
        for m in self.COMMON_MISTAKES:
            print(f"  ❌ {m}")

choose = ChoosingTimeframe()
choose.show_factors()
choose.show_mistakes()

Timeframe สำหรับแต่ละตลาด

# markets.py — Timeframes for different markets
import json

class MarketTimeframes:
    MARKETS = {
        "forex": {
            "name": "Forex",
            "popular": "H1, H4, ",
            "reason": "ตลาดเปิด 24/5, liquidity สูง, trend ชัด",
            "recommended": "Day trading: H1 +  | Swing:  + H4",
        },
        "stocks_th": {
            "name": "หุ้นไทย (SET)",
            "popular": ", W1",
            "reason": "ตลาดเปิด 10:00-16:30, volume ไม่สูงมากใน timeframe เล็ก",
            "recommended": "Swing:  | Position: W1 | Day trade:  (สำหรับหุ้น big cap)",
        },
        "crypto": {
            "name": "Crypto",
            "popular": "H4, ",
            "reason": "ตลาดเปิด 24/7, volatile มาก, M1-M5 noise เยอะ",
            "recommended": "Swing: +  | Day: H1 +  | ไม่แนะนำ scalping สำหรับมือใหม่",
        },
        "futures": {
            "name": "Futures / Options",
            "popular": "M5, , H1",
            "reason": "Leverage สูง, ต้อง precise entry, time decay (options)",
            "recommended": "Day trading:  + H1 | Scalping: M5 + M1",
        },
    }

    def show_markets(self):
        print("=== Timeframes by Market ===\n")
        for key, market in self.MARKETS.items():
            print(f"[{market['name']}]")
            print(f"  Popular: {market['popular']}")
            print(f"  Reason: {market['reason']}")
            print(f"  Recommended: {market['recommended']}")
            print()

markets = MarketTimeframes()
markets.show_markets()

FAQ - คำถามที่พบบ่อย

Q: มือใหม่ควรใช้ Timeframe อะไร?

A: แนะนำ หรือ เพราะ: noise น้อย สัญญาณชัดกว่า timeframe เล็ก ไม่ต้องจ้องจอตลอด มีเวลาคิดวิเคราะห์ ค่า spread/commission กระทบน้อย เริ่มจาก → เมื่อชำนาญค่อยลง → H1

Q: Timeframe เล็ก กับ Timeframe ใหญ่ อันไหนแม่นกว่า?

A: Timeframe ใหญ่ แม่นกว่า เพราะ: noise น้อยกว่า, สัญญาณหลอกน้อยกว่า ตัวอย่าง: Support/Resistance บน แข็งกว่า M5 มาก Trend บน W1 น่าเชื่อถือกว่า H1 แต่: Timeframe ใหญ่ = กำไร/ขาดทุนต่อ trade มากกว่า (stop loss กว้างกว่า)

Q: ต้องดูกี่ Timeframes?

A: 2-3 timeframes เพียงพอ: Higher TF: ดู trend ( หรือ W1) Middle TF: ดู signal (H4 หรือ H1) Lower TF: ดู entry ( หรือ M5) มากกว่า 3: สับสน ตัดสินใจช้า — ข้อมูล conflict กัน น้อยกว่า 2: ขาดมุมมอง — อาจเทรดสวน trend ใหญ่

Q: เปลี่ยน Timeframe ระหว่างถือ position ได้ไหม?

A: ได้ แต่ระวัง: ดู timeframe เล็กลง → เห็น noise → panic close ก่อนเวลา กฎ: ถ้าเข้า position บน → manage position บน ดู timeframe เล็กได้เพื่อ fine-tune exit — แต่ไม่เปลี่ยน plan หลัก Tip: ตั้ง stop loss ตาม timeframe ที่เข้า → ไม่ต้องจ้องจอ

📖 บทความที่เกี่ยวข้อง

best timeframe for fibonacci retracementอ่านบทความ → timeframe mql4อ่านบทความ → which timeframe is best for swing tradingอ่านบทความ → xauusd price 3396.6 m5 timeframeอ่านบทความ →

📚 ดูบทความทั้งหมด →