SiamCafe.net Blog
Technology

what is support and resistance

what is support and resistance
what is support and resistance | SiamCafe Blog
2025-06-21· อ. บอม — SiamCafe.net· 9,634 คำ

Support and Resistance แนวรับแนวต้าน

Support แนวรับ ระดับราคาแรงซื้อหยุดราคาลง Resistance แนวต้าน ระดับราคาแรงขายหยุดราคาขึ้น จิตวิทยาตลาด วิเคราะห์ทางเทคนิค หุ้น Forex Crypto

วิธีหาลักษณะความแม่นยำเหมาะกับ
Swing High/Lowจุดกลับตัวในอดีตสูงทุก Timeframe
Moving AverageEMA 50, 200ปานกลางTrend Following
Fibonacci38.2% 50% 61.8%ปานกลางPullback Trading
Pivot Pointsคำนวณจาก OHLCสูงDay Trading
Volume Profileระดับ Volume สูงสูงมากทุกตลาด
Round Numbersราคาจำนวนกลมๆปานกลางจิตวิทยา

วิเคราะห์แนวรับแนวต้าน Python

# support_resistance.py — Support & Resistance Analysis
from dataclasses import dataclass
from typing import List, Tuple
import math

@dataclass
class OHLC:
    date: str
    open: float
    high: float
    low: float
    close: float
    volume: int

def find_swing_highs(data: List[OHLC], window: int = 5) -> List[Tuple[str, float]]:
    """หา Swing High (แนวต้าน)"""
    highs = []
    for i in range(window, len(data) - window):
        is_high = True
        for j in range(i - window, i + window + 1):
            if j != i and data[j].high >= data[i].high:
                is_high = False
                break
        if is_high:
            highs.append((data[i].date, data[i].high))
    return highs

def find_swing_lows(data: List[OHLC], window: int = 5) -> List[Tuple[str, float]]:
    """หา Swing Low (แนวรับ)"""
    lows = []
    for i in range(window, len(data) - window):
        is_low = True
        for j in range(i - window, i + window + 1):
            if j != i and data[j].low <= data[i].low:
                is_low = False
                break
        if is_low:
            lows.append((data[i].date, data[i].low))
    return lows

def calc_pivot_points(high: float, low: float, close: float) -> dict:
    """คำนวณ Pivot Points"""
    pivot = (high + low + close) / 3
    return {
        "R3": high + 2 * (pivot - low),
        "R2": pivot + (high - low),
        "R1": 2 * pivot - low,
        "Pivot": pivot,
        "S1": 2 * pivot - high,
        "S2": pivot - (high - low),
        "S3": low - 2 * (high - pivot),
    }

def calc_fibonacci(high: float, low: float) -> dict:
    """คำนวณ Fibonacci Retracement"""
    diff = high - low
    return {
        "0.0% (High)": high,
        "23.6%": high - diff * 0.236,
        "38.2%": high - diff * 0.382,
        "50.0%": high - diff * 0.500,
        "61.8%": high - diff * 0.618,
        "78.6%": high - diff * 0.786,
        "100% (Low)": low,
    }

# ตัวอย่างข้อมูล
sample_data = [
    OHLC("2024-01-01", 100, 105, 98, 103, 1000000),
    OHLC("2024-01-02", 103, 108, 101, 106, 1200000),
    OHLC("2024-01-03", 106, 112, 104, 110, 1500000),
    OHLC("2024-01-04", 110, 115, 108, 112, 1800000),
    OHLC("2024-01-05", 112, 118, 110, 115, 2000000),
    OHLC("2024-01-06", 115, 120, 113, 117, 1700000),
    OHLC("2024-01-07", 117, 119, 112, 114, 1300000),
    OHLC("2024-01-08", 114, 116, 108, 110, 1600000),
    OHLC("2024-01-09", 110, 113, 105, 107, 1400000),
    OHLC("2024-01-10", 107, 110, 103, 108, 1100000),
    OHLC("2024-01-11", 108, 112, 106, 111, 1300000),
]

# Pivot Points
last = sample_data[-1]
pivots = calc_pivot_points(last.high, last.low, last.close)
print("=== Pivot Points ===")
for level, price in pivots.items():
    print(f"  {level}: {price:.2f}")

# Fibonacci
high_price = max(d.high for d in sample_data)
low_price = min(d.low for d in sample_data)
fibs = calc_fibonacci(high_price, low_price)
print(f"\n=== Fibonacci Retracement ===")
print(f"  High: {high_price} | Low: {low_price}")
for level, price in fibs.items():
    print(f"  {level}: {price:.2f}")

Trading Strategy

# trading_strategy.py — S/R Trading Strategies
from dataclasses import dataclass
from typing import Optional

@dataclass
class TradeSetup:
    strategy: str
    entry: float
    stop_loss: float
    take_profit: float
    direction: str  # long / short

    @property
    def risk(self) -> float:
        return abs(self.entry - self.stop_loss)

    @property
    def reward(self) -> float:
        return abs(self.take_profit - self.entry)

    @property
    def rr_ratio(self) -> float:
        if self.risk == 0:
            return 0
        return self.reward / self.risk

    def position_size(self, account: float, risk_pct: float = 1.0) -> float:
        risk_amount = account * risk_pct / 100
        if self.risk == 0:
            return 0
        return risk_amount / self.risk

strategies = {
    "Bounce Trading": {
        "desc": "ซื้อที่แนวรับ ขายที่แนวต้าน",
        "entry": "เมื่อราคาแตะแนวรับและมี Candlestick Reversal",
        "sl": "ใต้แนวรับ 1-2%",
        "tp": "แนวต้านถัดไป",
        "rr": "1:2 ขึ้นไป",
    },
    "Breakout Trading": {
        "desc": "ซื้อเมื่อทะลุแนวต้าน ขายเมื่อทะลุแนวรับ",
        "entry": "เมื่อ Close เหนือ/ใต้แนว + Volume สูง",
        "sl": "กลับเข้ามาใน Range เดิม",
        "tp": "ระยะทางเท่ากับ Range",
        "rr": "1:2 ขึ้นไป",
    },
    "Retest Trading": {
        "desc": "รอราคากลับมา Retest แนวที่ทะลุ",
        "entry": "เมื่อ Retest แนวต้านเดิม (เป็นแนวรับใหม่)",
        "sl": "ใต้แนว Retest",
        "tp": "แนวต้านถัดไป",
        "rr": "1:3 ขึ้นไป",
    },
}

print("=== S/R Trading Strategies ===")
for name, info in strategies.items():
    print(f"\n  [{name}]")
    for k, v in info.items():
        print(f"    {k}: {v}")

# ตัวอย่าง Trade Setup
trades = [
    TradeSetup("Bounce Buy", entry=105, stop_loss=102, take_profit=115, direction="long"),
    TradeSetup("Breakout Buy", entry=120, stop_loss=117, take_profit=130, direction="long"),
    TradeSetup("Retest Buy", entry=120, stop_loss=116, take_profit=132, direction="long"),
]

print(f"\n\n=== Trade Setups (Account: 100,000 บาท) ===")
for t in trades:
    size = t.position_size(100_000, 1.0)
    print(f"\n  [{t.strategy}] {t.direction.upper()}")
    print(f"    Entry: {t.entry} | SL: {t.stop_loss} | TP: {t.take_profit}")
    print(f"    Risk: {t.risk:.2f} | Reward: {t.reward:.2f} | RR: 1:{t.rr_ratio:.1f}")
    print(f"    Position Size (1% risk): {size:.0f} units")

# Risk Management
rules = [
    "Risk ไม่เกิน 1-2% ต่อ Trade",
    "Risk/Reward อย่างน้อย 1:2",
    "ตั้ง Stop Loss ทุกครั้ง ห้ามลบ",
    "ไม่เพิ่ม Position ที่ขาดทุน (Averaging Down)",
    "Win Rate 40%+ กับ RR 1:2 ก็กำไรได้",
    "ไม่เทรดเกิน 3 Positions พร้อมกัน",
]

print(f"\n\n=== Risk Management Rules ===")
for i, rule in enumerate(rules, 1):
    print(f"  {i}. {rule}")

เคล็ดลับ

การนำความรู้ไปประยุกต์ใช้งานจริง

แหล่งเรียนรู้ที่แนะนำ ได้แก่ Official Documentation ที่อัพเดทล่าสุดเสมอ Online Course จาก Coursera Udemy edX ช่อง YouTube คุณภาพทั้งไทยและอังกฤษ และ Community อย่าง Discord Reddit Stack Overflow ที่ช่วยแลกเปลี่ยนประสบการณ์กับนักพัฒนาทั่วโลก

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

Support แนวรับ แรงซื้อหยุดราคาลง Resistance แนวต้าน แรงขายหยุดราคาขึ้น จิตวิทยาตลาด วิเคราะห์ทางเทคนิค

วิธีหาแนวรับแนวต้านทำอย่างไร

Swing High Low Moving Average Fibonacci Retracement Pivot Points Volume Profile Round Numbers หลายวิธีรวมกัน Confluence

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

Breakout ทะลุแนว แนวต้านเดิมเป็นแนวรับใหม่ Role Reversal Volume มาก น่าเชื่อถือ Fake Breakout ทะลุแล้วกลับ

ใช้แนวรับแนวต้านเทรดอย่างไร

Buy แนวรับ SL ใต้แนว Sell แนวต้าน SL เหนือแนว Breakout Trading Retest Trading Risk Reward 1:2 ขึ้นไป

สรุป

Support Resistance แนวรับแนวต้าน Swing High Low Moving Average Fibonacci Pivot Points Volume Profile Bounce Breakout Retest Trading Risk Reward Stop Loss Position Size

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

xauusd support resistance levels may 6 2025อ่านบทความ → resistance line and support lineอ่านบทความ → xauusd support resistance levels may 1 2025อ่านบทความ → xauusd support and resistance todayอ่านบทความ → stocks resistance and supportอ่านบทความ →

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