SiamCafe.net Blog
Technology

Resistance and Support Lines — แนวรับแนวต้านสำหรับเทรด Forex

resistance and support lines
resistance and support lines | SiamCafe Blog
2025-12-29· อ. บอม — SiamCafe.net· 1,576 คำ

แนวรับแนวต้านคืออะไร

แนวรับ (Support) เป็นระดับราคาที่มี demand มากพอจะหยุดการลดลงของราคาได้ เมื่อราคาลงมาถึงแนวรับจะมีแรงซื้อเข้ามาดันราคาให้กลับขึ้น แนวต้าน (Resistance) เป็นระดับราคาที่มี supply มากพอจะหยุดการเพิ่มขึ้นของราคาได้ เมื่อราคาขึ้นไปถึงแนวต้านจะมีแรงขายเข้ามากดราคาให้กลับลง

หลักการพื้นฐานของแนวรับแนวต้าน ยิ่ง test บ่อยยิ่งแข็งแกร่ง ถ้าราคามาแตะแนวรับ 3-4 ครั้งแล้วเด้งขึ้นทุกครั้ง แนวรับนั้นถือว่าแข็งแกร่ง เมื่อแนวรับถูกทะลุจะกลายเป็นแนวต้าน (Role Reversal) และแนวต้านที่ถูกทะลุจะกลายเป็นแนวรับ Timeframe ใหญ่มีน้ำหนักมากกว่า แนวรับแนวต้านบน Weekly chart สำคัญกว่าบน 15-minute chart Volume ที่แนวรับแนวต้านยืนยันความแข็งแกร่ง ถ้า volume สูงขณะราคาเด้งจากแนวรับ แสดงว่าแนวรับนั้นมีน้ำหนัก

ประเภทของแนวรับแนวต้าน ได้แก่ Horizontal Support/Resistance ระดับราคาคงที่, Trendline Support/Resistance เส้นแนวโน้มลากจากจุด swing lows หรือ swing highs, Dynamic Support/Resistance Moving Averages เช่น SMA 50, SMA 200, Fibonacci Levels 23.6%, 38.2%, 50%, 61.8%, 78.6% และ Psychological Levels ราคาลงท้ายด้วย 00 หรือ 50 เช่น 1.1000, 1.1050

วิธีหาแนวรับแนวต้าน

เทคนิคหาแนวรับแนวต้าน

# === วิธีหาแนวรับแนวต้าน ===

# 1. Swing High / Swing Low Method
# ===================================
# ดูจุดที่ราคาเปลี่ยนทิศ:
# - Swing High: จุดสูงสุดที่ราคาไปถึงแล้วกลับลง → แนวต้าน
# - Swing Low: จุดต่ำสุดที่ราคาไปถึงแล้วกลับขึ้น → แนวรับ
#
# วิธีหา Swing Point:
# - Swing High: candle ที่ high สูงกว่า high ของ 2 candles ก่อนหน้า
#               และ high สูงกว่า high ของ 2 candles ถัดไป
# - Swing Low: candle ที่ low ต่ำกว่า low ของ 2 candles ก่อนหน้า
#              และ low ต่ำกว่า low ของ 2 candles ถัดไป

# 2. Volume Profile Method
# ===================================
# - ดูที่ราคาที่มี volume สูงสุด (High Volume Node - HVN)
# - HVN มักเป็นแนวรับแนวต้านที่แข็งแกร่ง
# - Low Volume Node (LVN) ราคามักวิ่งผ่านเร็ว

# 3. Round Numbers (Psychological Levels)
# ===================================
# EUR/USD: 1.0800, 1.0850, 1.0900, 1.0950, 1.1000
# Gold: 2000, 2050, 2100, 2150, 2200
# BTC: 40000, 45000, 50000, 55000, 60000
# ราคาลงท้าย 00 แข็งแกร่งกว่า 50

# 4. Fibonacci Retracement
# ===================================
# หา Swing High และ Swing Low ที่ชัดเจน
# ลาก Fibonacci จาก Low ไป High (uptrend) หรือ High ไป Low (downtrend)
# Levels สำคัญ:
# - 23.6% — shallow retracement (strong trend)
# - 38.2% — moderate retracement
# - 50.0% — half retracement
# - 61.8% — golden ratio (strongest level)
# - 78.6% — deep retracement

# 5. Moving Average as Dynamic S/R
# ===================================
# Popular MAs for support/resistance:
# - EMA 20 — short-term trend
# - SMA 50 — medium-term trend (most watched)
# - SMA 100 — long-term trend
# - SMA 200 — major trend (institutional level)
#
# ใน uptrend: MA เป็นแนวรับ (ราคาลงมาแตะ MA แล้วเด้งขึ้น)
# ใน downtrend: MA เป็นแนวต้าน (ราคาขึ้นมาแตะ MA แล้วกลับลง)

# 6. Multi-Timeframe Analysis
# ===================================
# Weekly: หาแนวรับแนวต้านหลัก (major levels)
# Daily: หาแนวรับแนวต้านรอง (minor levels)
# H4/H1: หาจุดเข้าเทรด
#
# แนวรับแนวต้านที่ตรงกันหลาย timeframes = confluence zone
# Confluence zone มีน้ำหนักมากที่สุด

echo "Support/Resistance methods explained"

เทรดด้วยแนวรับแนวต้าน

กลยุทธ์เทรดด้วยแนวรับแนวต้าน

#!/usr/bin/env python3
# sr_trading.py — Support/Resistance Trading System
import json
import logging
from typing import Dict, List, Tuple

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("sr_trade")

class SRTradingSystem:
    def __init__(self):
        self.support_levels = []
        self.resistance_levels = []
        self.signals = []
    
    def find_swing_points(self, highs, lows, lookback=5):
        swing_highs = []
        swing_lows = []
        
        for i in range(lookback, len(highs) - lookback):
            # Swing High
            if all(highs[i] >= highs[i-j] for j in range(1, lookback+1)) and \
               all(highs[i] >= highs[i+j] for j in range(1, lookback+1)):
                swing_highs.append({"index": i, "price": highs[i]})
            
            # Swing Low
            if all(lows[i] <= lows[i-j] for j in range(1, lookback+1)) and \
               all(lows[i] <= lows[i+j] for j in range(1, lookback+1)):
                swing_lows.append({"index": i, "price": lows[i]})
        
        return swing_highs, swing_lows
    
    def cluster_levels(self, prices, tolerance_pct=0.1):
        """Group nearby price levels into zones"""
        if not prices:
            return []
        
        sorted_prices = sorted(prices)
        clusters = []
        current_cluster = [sorted_prices[0]]
        
        for price in sorted_prices[1:]:
            if abs(price - current_cluster[-1]) / current_cluster[-1] * 100 < tolerance_pct:
                current_cluster.append(price)
            else:
                clusters.append({
                    "level": sum(current_cluster) / len(current_cluster),
                    "touches": len(current_cluster),
                    "strength": "strong" if len(current_cluster) >= 3 else "moderate" if len(current_cluster) >= 2 else "weak",
                })
                current_cluster = [price]
        
        if current_cluster:
            clusters.append({
                "level": sum(current_cluster) / len(current_cluster),
                "touches": len(current_cluster),
                "strength": "strong" if len(current_cluster) >= 3 else "moderate",
            })
        
        return clusters
    
    def fibonacci_levels(self, swing_low, swing_high):
        diff = swing_high - swing_low
        fib_ratios = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0]
        
        return {
            f"{r*100:.1f}%": round(swing_high - diff * r, 5)
            for r in fib_ratios
        }
    
    def generate_signal(self, current_price, support, resistance, trend="neutral"):
        distance_to_support = (current_price - support) / current_price * 100
        distance_to_resistance = (resistance - current_price) / current_price * 100
        
        signal = {
            "price": current_price,
            "support": support,
            "resistance": resistance,
            "trend": trend,
            "signal": "neutral",
            "entry": None,
            "stop_loss": None,
            "take_profit": None,
        }
        
        # Buy at support in uptrend
        if distance_to_support < 0.3 and trend in ("bullish", "neutral"):
            signal["signal"] = "buy"
            signal["entry"] = support
            signal["stop_loss"] = round(support * 0.995, 5)  # 0.5% below support
            signal["take_profit"] = resistance
            signal["risk_reward"] = round(
                (resistance - support) / (support - signal["stop_loss"]), 2
            )
        
        # Sell at resistance in downtrend
        elif distance_to_resistance < 0.3 and trend in ("bearish", "neutral"):
            signal["signal"] = "sell"
            signal["entry"] = resistance
            signal["stop_loss"] = round(resistance * 1.005, 5)
            signal["take_profit"] = support
            signal["risk_reward"] = round(
                (resistance - support) / (signal["stop_loss"] - resistance), 2
            )
        
        # Breakout above resistance
        elif current_price > resistance * 1.002:
            signal["signal"] = "breakout_buy"
            signal["entry"] = current_price
            signal["stop_loss"] = resistance  # Previous resistance = new support
            signal["take_profit"] = round(current_price + (resistance - support), 5)
        
        self.signals.append(signal)
        return signal

import random
random.seed(42)

system = SRTradingSystem()

# Simulate price data
base = 1.0900
highs = [base + random.gauss(0.002, 0.001) + i * 0.00005 for i in range(100)]
lows = [h - random.uniform(0.001, 0.003) for h in highs]

swing_highs, swing_lows = system.find_swing_points(highs, lows, lookback=3)
print(f"Swing Highs: {len(swing_highs)}, Swing Lows: {len(swing_lows)}")

fib = system.fibonacci_levels(1.0850, 1.0950)
print("Fibonacci:", json.dumps(fib, indent=2))

signal = system.generate_signal(1.0855, support=1.0850, resistance=1.0950, trend="bullish")
print("Signal:", json.dumps(signal, indent=2))

เขียนโปรแกรมหาแนวรับแนวต้านอัตโนมัติ

Automated support/resistance detection

#!/usr/bin/env python3
# auto_sr.py — Automated Support/Resistance Finder
import json
import math
import logging
from typing import List, Dict

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("auto_sr")

class AutoSRFinder:
    def __init__(self, sensitivity=3):
        self.sensitivity = sensitivity
    
    def find_levels(self, closes, highs, lows, num_levels=5):
        """Find S/R levels using multiple methods and combine"""
        
        # Method 1: Swing Points
        swing_levels = self._swing_point_levels(highs, lows)
        
        # Method 2: Price Density (Volume Profile approximation)
        density_levels = self._price_density_levels(closes)
        
        # Method 3: Round Numbers
        round_levels = self._round_number_levels(closes[-1])
        
        # Combine all levels
        all_levels = swing_levels + density_levels + round_levels
        
        # Cluster nearby levels
        clustered = self._cluster_and_rank(all_levels, closes[-1])
        
        # Separate into support and resistance
        current = closes[-1]
        support = sorted([l for l in clustered if l["level"] < current],
                        key=lambda x: x["level"], reverse=True)[:num_levels]
        resistance = sorted([l for l in clustered if l["level"] > current],
                           key=lambda x: x["level"])[:num_levels]
        
        return {
            "current_price": round(current, 5),
            "support": support,
            "resistance": resistance,
        }
    
    def _swing_point_levels(self, highs, lows):
        levels = []
        n = self.sensitivity
        
        for i in range(n, len(highs) - n):
            if all(highs[i] >= highs[j] for j in range(i-n, i+n+1) if j != i):
                levels.append({"level": highs[i], "method": "swing_high", "weight": 2})
            
            if all(lows[i] <= lows[j] for j in range(i-n, i+n+1) if j != i):
                levels.append({"level": lows[i], "method": "swing_low", "weight": 2})
        
        return levels
    
    def _price_density_levels(self, closes, bins=50):
        if not closes:
            return []
        
        min_p = min(closes)
        max_p = max(closes)
        bin_size = (max_p - min_p) / bins
        
        if bin_size == 0:
            return []
        
        histogram = {}
        for p in closes:
            bin_idx = int((p - min_p) / bin_size)
            histogram[bin_idx] = histogram.get(bin_idx, 0) + 1
        
        avg_count = len(closes) / bins
        levels = []
        
        for bin_idx, count in histogram.items():
            if count > avg_count * 1.5:
                level = min_p + (bin_idx + 0.5) * bin_size
                levels.append({"level": level, "method": "density", "weight": count / avg_count})
        
        return levels
    
    def _round_number_levels(self, current_price, count=5):
        levels = []
        
        if current_price > 100:
            step = 50
        elif current_price > 10:
            step = 5
        elif current_price > 1:
            step = 0.05
        else:
            step = 0.005
        
        base = math.floor(current_price / step) * step
        
        for i in range(-count, count + 1):
            level = round(base + i * step, 5)
            weight = 1.5 if level % (step * 2) == 0 else 1.0
            levels.append({"level": level, "method": "round_number", "weight": weight})
        
        return levels
    
    def _cluster_and_rank(self, levels, current_price, tolerance_pct=0.15):
        if not levels:
            return []
        
        sorted_levels = sorted(levels, key=lambda x: x["level"])
        clusters = []
        current_cluster = [sorted_levels[0]]
        
        for lvl in sorted_levels[1:]:
            if current_cluster and \
               abs(lvl["level"] - current_cluster[-1]["level"]) / max(current_cluster[-1]["level"], 0.001) * 100 < tolerance_pct:
                current_cluster.append(lvl)
            else:
                avg_level = sum(l["level"] for l in current_cluster) / len(current_cluster)
                total_weight = sum(l.get("weight", 1) for l in current_cluster)
                clusters.append({
                    "level": round(avg_level, 5),
                    "strength": round(total_weight, 1),
                    "touches": len(current_cluster),
                    "methods": list(set(l["method"] for l in current_cluster)),
                })
                current_cluster = [lvl]
        
        if current_cluster:
            avg_level = sum(l["level"] for l in current_cluster) / len(current_cluster)
            total_weight = sum(l.get("weight", 1) for l in current_cluster)
            clusters.append({
                "level": round(avg_level, 5),
                "strength": round(total_weight, 1),
                "touches": len(current_cluster),
                "methods": list(set(l["method"] for l in current_cluster)),
            })
        
        return sorted(clusters, key=lambda x: x["strength"], reverse=True)

import random
random.seed(42)

finder = AutoSRFinder(sensitivity=3)

base = 1.0900
closes = [base + random.gauss(0, 0.003) + 0.00005 * i for i in range(200)]
highs = [c + random.uniform(0.0005, 0.002) for c in closes]
lows = [c - random.uniform(0.0005, 0.002) for c in closes]

result = finder.find_levels(closes, highs, lows, num_levels=3)
print(json.dumps(result, indent=2))

Advanced Techniques

เทคนิคขั้นสูงสำหรับแนวรับแนวต้าน

# === Advanced S/R Techniques ===

# 1. Supply and Demand Zones
# ===================================
# Supply Zone (แนวต้าน):
# - หาบริเวณที่ราคาลงแรง (strong bearish candle)
# - วาด zone จาก high ถึง open ของ bearish candle
# - เมื่อราคากลับมาที่ zone นี้ มักจะลงอีกครั้ง
#
# Demand Zone (แนวรับ):
# - หาบริเวณที่ราคาขึ้นแรง (strong bullish candle)
# - วาด zone จาก low ถึง open ของ bullish candle
# - เมื่อราคากลับมาที่ zone นี้ มักจะขึ้นอีกครั้ง

# Fresh Zone: ยังไม่เคยถูก test (แข็งแกร่งที่สุด)
# Tested Zone: ถูก test แล้ว 1-2 ครั้ง (ยังใช้ได้)
# Broken Zone: ถูกทะลุแล้ว (ไม่ใช้อีก)

# 2. Order Block Analysis
# ===================================
# Bullish Order Block:
# - candle แดง (bearish) สุดท้ายก่อนราคาวิ่งขึ้นแรง
# - ใช้เป็นแนวรับ
#
# Bearish Order Block:
# - candle เขียว (bullish) สุดท้ายก่อนราคาวิ่งลงแรง
# - ใช้เป็นแนวต้าน

# 3. Market Structure
# ===================================
# Uptrend: Higher Highs (HH) + Higher Lows (HL)
# Downtrend: Lower Highs (LH) + Lower Lows (LL)
# Ranging: Equal Highs + Equal Lows
#
# Break of Structure (BOS):
# - ใน uptrend: ราคาทำ new HH → BOS (continuation)
# - ใน uptrend: ราคาทำ LL → Change of Character (ChoCH)
#
# S/R จาก structure:
# - HL ใน uptrend = support level
# - LH ใน downtrend = resistance level

# 4. Confluence Trading
# ===================================
# รวมหลาย methods เพื่อหา high-probability zones:
#
# ตัวอย่าง Confluence Zone:
# 1. Horizontal support ที่ 1.0850
# 2. SMA 200 อยู่ที่ 1.0848
# 3. Fibonacci 61.8% อยู่ที่ 1.0852
# 4. Previous resistance (role reversal) ที่ 1.0845
# 5. Round number 1.0850
#
# → Zone 1.0845-1.0855 = Strong Confluence Support
# → High probability buy zone

# 5. Price Action at S/R
# ===================================
# Confirmation patterns ที่แนวรับ (buy signals):
# - Pin Bar (long lower wick) ที่ support
# - Bullish Engulfing ที่ support
# - Morning Star ที่ support
# - Double Bottom ที่ support
#
# Confirmation patterns ที่แนวต้าน (sell signals):
# - Pin Bar (long upper wick) ที่ resistance
# - Bearish Engulfing ที่ resistance
# - Evening Star ที่ resistance
# - Double Top ที่ resistance

echo "Advanced S/R techniques"

Risk Management กับแนวรับแนวต้าน

จัดการความเสี่ยงด้วยแนวรับแนวต้าน

#!/usr/bin/env python3
# sr_risk.py — Risk Management with S/R
import json
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("risk")

class SRRiskManager:
    def __init__(self, balance, risk_pct=1.0):
        self.balance = balance
        self.risk_pct = risk_pct
    
    def plan_trade(self, direction, entry, support, resistance, pair="EURUSD"):
        pip_value = 10  # per standard lot for USD pairs
        
        if direction == "buy":
            sl = support - 0.0010  # 10 pips below support
            tp1 = resistance
            tp2 = resistance + (resistance - support) * 0.618
            
            sl_pips = (entry - sl) * 10000
            tp1_pips = (tp1 - entry) * 10000
            tp2_pips = (tp2 - entry) * 10000
        else:
            sl = resistance + 0.0010
            tp1 = support
            tp2 = support - (resistance - support) * 0.618
            
            sl_pips = (sl - entry) * 10000
            tp1_pips = (entry - tp1) * 10000
            tp2_pips = (entry - tp2) * 10000
        
        risk_amount = self.balance * (self.risk_pct / 100)
        lot_size = round(risk_amount / (sl_pips * pip_value), 2)
        lot_size = max(0.01, lot_size)
        
        return {
            "pair": pair,
            "direction": direction,
            "entry": entry,
            "stop_loss": round(sl, 5),
            "take_profit_1": round(tp1, 5),
            "take_profit_2": round(tp2, 5),
            "sl_pips": round(sl_pips, 1),
            "tp1_pips": round(tp1_pips, 1),
            "tp2_pips": round(tp2_pips, 1),
            "risk_reward_tp1": round(tp1_pips / sl_pips, 2),
            "risk_reward_tp2": round(tp2_pips / sl_pips, 2),
            "lot_size": lot_size,
            "risk_amount": round(risk_amount, 2),
            "potential_profit_tp1": round(tp1_pips * pip_value * lot_size, 2),
            "potential_profit_tp2": round(tp2_pips * pip_value * lot_size, 2),
        }

rm = SRRiskManager(balance=5000, risk_pct=1.0)

# Buy at support
buy_plan = rm.plan_trade("buy", entry=1.0855, support=1.0850, resistance=1.0950)
print("Buy Plan:", json.dumps(buy_plan, indent=2))

# Sell at resistance
sell_plan = rm.plan_trade("sell", entry=1.0945, support=1.0850, resistance=1.0950)
print("Sell Plan:", json.dumps(sell_plan, indent=2))

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

Q: แนวรับแนวต้านที่ดีควรมีลักษณะอย่างไร?

A: แนวรับแนวต้านที่ดีมีลักษณะ ถูก test หลายครั้ง (2-3 ครั้งขึ้นไป) แต่ยังไม่ถูกทะลุ, มองเห็นได้ชัดบน chart (ไม่ต้องบีบบังคับ), ตรงกันหลาย timeframes (confluence), มี volume สูงที่ระดับนั้น, เป็น round number หรือ psychological level, ตรงกับ Fibonacci level หรือ Moving Average ยิ่ง confluence มากยิ่งแข็งแกร่ง

Q: เมื่อแนวรับถูกทะลุควรทำอย่างไร?

A: เมื่อแนวรับถูกทะลุ (breakdown) มี 2 สถานการณ์ False Breakout ราคาทะลุแนวรับไปเล็กน้อยแล้วกลับขึ้นมาเหนือแนวรับ ให้รอ confirmation ว่าราคากลับมาเหนือแนวรับจริงก่อนเข้า buy True Breakout ราคาทะลุแนวรับและ close ใต้แนวรับด้วย volume สูง แนวรับเดิมจะกลายเป็นแนวต้านใหม่ (role reversal) สามารถรอ retest แนวรับเดิม (ตอนนี้เป็นแนวต้าน) แล้วเข้า sell ตั้ง SL เหนือแนวต้านใหม่

Q: ควรใช้แนวรับแนวต้านแบบ exact level หรือ zone?

A: ใช้แบบ zone ดีกว่า เพราะราคาไม่เคยหยุดที่ exact level ทุกครั้ง อาจห่าง 5-20 pips จาก level ที่คาด วิธีวาด zone ใช้ candle body ไม่ใช่ wick สำหรับขอบเขต zone, zone ควรกว้าง 10-30 pips สำหรับ Forex (ขึ้นกับ timeframe), ถ้า timeframe ใหญ่ (weekly) zone กว้างกว่า (50-100 pips) SL ควรอยู่นอก zone ไม่ใช่ที่ขอบ zone

Q: Indicator ไหนช่วยยืนยันแนวรับแนวต้าน?

A: RSI ดู oversold (< 30) ที่แนวรับ = buy signal แข็งแกร่ง, overbought (> 70) ที่แนวต้าน = sell signal แข็งแกร่ง Volume ดู volume spike ที่แนวรับแนวต้านยืนยันว่า level นั้นสำคัญ MACD divergence ที่แนวรับแนวต้านยืนยัน reversal Bollinger Bands ราคาชนขอบ band ที่แนวรับแนวต้านเพิ่มน้ำหนัก ไม่ใช้ indicator เดียว ใช้ 2-3 ตัวยืนยันกัน

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

metatrader support and resistance indicatorอ่านบทความ → indicator for support and resistanceอ่านบทความ → best support and resistance indicator tradingviewอ่านบทความ → trade support and resistanceอ่านบทความ → xauusd key support resistance levelsอ่านบทความ →

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