Position ในการเทรดคืออะไร
Position ในการเทรด Forex หุ้น หรือ Crypto หมายถึงจำนวนหน่วยของสินทรัพย์ที่ถือครองอยู่ ณ เวลาใดเวลาหนึ่ง เมื่อเปิด order ซื้อหรือขาย จะเรียกว่ามี open position เมื่อปิด order จะเรียกว่า closed position
Position มีความสำคัญเพราะเป็นตัวกำหนดว่า trader มี exposure ต่อตลาดมากน้อยแค่ไหน Position ใหญ่เกินไปเสี่ยงต่อการขาดทุนมาก Position เล็กเกินไปกำไรน้อย การจัดการ Position Size อย่างเหมาะสมเป็นหัวใจของ Risk Management
คำศัพท์ที่เกี่ยวข้อง Long Position เปิด buy order คาดว่าราคาจะขึ้น, Short Position เปิด sell order คาดว่าราคาจะลง, Position Size จำนวน lot หรือ units ที่เทรด, Net Position ผลรวมของ long และ short positions, Flat Position ไม่มี open position (อยู่นอกตลาด)
ประเภทของ Position
ประเภท Position ในการเทรด
# === ประเภทของ Position ===
# 1. ตาม Direction
# ===================================
# Long Position (Buy):
# - ซื้อสินทรัพย์ที่ราคาปัจจุบัน
# - คาดว่าราคาจะขึ้น
# - กำไรเมื่อราคาขึ้น ขาดทุนเมื่อราคาลง
# - ตัวอย่าง: Buy 0.1 lot EUR/USD ที่ 1.0900
# - ราคาขึ้นเป็น 1.0950 → กำไร 50 pips
#
# Short Position (Sell):
# - ขายสินทรัพย์ที่ราคาปัจจุบัน (ยืมจาก broker)
# - คาดว่าราคาจะลง
# - กำไรเมื่อราคาลง ขาดทุนเมื่อราคาขึ้น
# - ตัวอย่าง: Sell 0.1 lot EUR/USD ที่ 1.0900
# - ราคาลงเป็น 1.0850 → กำไร 50 pips
# 2. ตาม Duration
# ===================================
# Scalping Position:
# - ถือ: วินาที ถึง นาที
# - Target: 5-20 pips
# - ความถี่: 10-50 trades/day
#
# Day Trading Position:
# - ถือ: นาที ถึง ชั่วโมง
# - Target: 20-100 pips
# - ปิดทุก position ก่อนตลาดปิด
#
# Swing Trading Position:
# - ถือ: วัน ถึง สัปดาห์
# - Target: 100-500 pips
# - ใช้ และ Daily chart
#
# Position Trading:
# - ถือ: สัปดาห์ ถึง เดือน
# - Target: 500-2000+ pips
# - ใช้ Daily และ Weekly chart
# - อิง Fundamental Analysis เป็นหลัก
# 3. ตาม Size
# ===================================
# Standard Lot: 100,000 units (1 pip = $10)
# Mini Lot: 10,000 units (1 pip = $1)
# Micro Lot: 1,000 units (1 pip = $0.10)
# Nano Lot: 100 units (1 pip = $0.01)
#
# ตัวอย่าง EUR/USD:
# 1 standard lot = 100,000 EUR
# 0.1 lot (mini) = 10,000 EUR
# 0.01 lot (micro) = 1,000 EUR
# 4. ตาม Strategy
# ===================================
# Single Position: เปิด 1 position ต่อ 1 signal
# Scaled Position: เพิ่ม position ทีละน้อย (pyramiding)
# Hedged Position: เปิดทั้ง long และ short พร้อมกัน
# Correlated Position: เปิด positions ในคู่เงินที่ correlate กัน
echo "Position types overview"
Position Sizing คำนวณอย่างไร
คำนวณ Position Size ที่เหมาะสม
#!/usr/bin/env python3
# position_sizing.py — Position Size Calculator
import json
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("position")
class PositionSizeCalculator:
def __init__(self, balance, risk_pct=1.0):
self.balance = balance
self.risk_pct = risk_pct
def fixed_risk(self, sl_pips, pair="EURUSD"):
"""Fixed percentage risk per trade"""
pip_values = {
"EURUSD": 10, "GBPUSD": 10, "USDJPY": 9.1,
"AUDUSD": 10, "USDCAD": 7.5, "XAUUSD": 1,
}
pip_value = pip_values.get(pair, 10)
risk_amount = self.balance * (self.risk_pct / 100)
lot_size = risk_amount / (sl_pips * pip_value)
lot_size = max(0.01, round(lot_size, 2))
return {
"balance": self.balance,
"risk_pct": self.risk_pct,
"risk_amount": round(risk_amount, 2),
"pair": pair,
"sl_pips": sl_pips,
"pip_value_per_lot": pip_value,
"lot_size": lot_size,
"actual_risk": round(lot_size * sl_pips * pip_value, 2),
}
def kelly_criterion(self, win_rate, avg_win, avg_loss):
"""Kelly Criterion for optimal position sizing"""
if avg_loss == 0:
return {"kelly_pct": 0, "recommendation": "Cannot calculate"}
b = avg_win / avg_loss # Win/Loss ratio
p = win_rate
q = 1 - win_rate
kelly = (b * p - q) / b
half_kelly = kelly / 2 # Conservative approach
return {
"win_rate": f"{win_rate*100:.0f}%",
"avg_win_loss_ratio": round(b, 2),
"full_kelly_pct": round(kelly * 100, 2),
"half_kelly_pct": round(half_kelly * 100, 2),
"recommended_risk_pct": round(min(half_kelly * 100, 3.0), 2),
"profitable": kelly > 0,
}
def volatility_adjusted(self, atr_pips, atr_multiplier=2.0):
"""ATR-based position sizing"""
sl_pips = atr_pips * atr_multiplier
risk_amount = self.balance * (self.risk_pct / 100)
lot_size = risk_amount / (sl_pips * 10)
lot_size = max(0.01, round(lot_size, 2))
return {
"atr_pips": atr_pips,
"atr_multiplier": atr_multiplier,
"sl_pips": round(sl_pips, 1),
"lot_size": lot_size,
"risk_amount": round(risk_amount, 2),
"note": "Higher ATR = smaller position (auto-adjusts to volatility)",
}
def multi_position_risk(self, positions):
"""Calculate total risk across multiple positions"""
total_risk = 0
details = []
for pos in positions:
risk = pos["lot_size"] * pos["sl_pips"] * 10
total_risk += risk
details.append({
"pair": pos["pair"],
"lot_size": pos["lot_size"],
"sl_pips": pos["sl_pips"],
"risk_usd": round(risk, 2),
})
return {
"total_positions": len(positions),
"total_risk_usd": round(total_risk, 2),
"total_risk_pct": round(total_risk / self.balance * 100, 2),
"max_recommended_pct": 5.0,
"within_limits": total_risk / self.balance * 100 <= 5.0,
"positions": details,
}
calc = PositionSizeCalculator(balance=5000, risk_pct=1.0)
# Fixed risk
fixed = calc.fixed_risk(sl_pips=30, pair="EURUSD")
print("Fixed Risk:", json.dumps(fixed, indent=2))
# Kelly Criterion
kelly = calc.kelly_criterion(win_rate=0.45, avg_win=60, avg_loss=30)
print("\nKelly:", json.dumps(kelly, indent=2))
# ATR-based
atr = calc.volatility_adjusted(atr_pips=15, atr_multiplier=2.0)
print("\nATR-based:", json.dumps(atr, indent=2))
# Multi-position
multi = calc.multi_position_risk([
{"pair": "EURUSD", "lot_size": 0.05, "sl_pips": 30},
{"pair": "GBPUSD", "lot_size": 0.03, "sl_pips": 40},
])
print("\nMulti:", json.dumps(multi, indent=2))
เขียนโปรแกรม Position Management
ระบบจัดการ Position อัตโนมัติ
#!/usr/bin/env python3
# position_manager.py — Position Management System
import json
import logging
from datetime import datetime
from typing import Dict, List
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("manager")
class PositionManager:
def __init__(self, balance):
self.balance = balance
self.positions = []
self.closed_positions = []
self.max_positions = 5
self.max_risk_pct = 5.0
def open_position(self, pair, direction, lot_size, entry_price, sl_price, tp_price):
if len(self.positions) >= self.max_positions:
return {"error": "Max positions reached"}
# Calculate risk
if direction == "buy":
sl_pips = (entry_price - sl_price) * 10000
tp_pips = (tp_price - entry_price) * 10000
else:
sl_pips = (sl_price - entry_price) * 10000
tp_pips = (entry_price - tp_price) * 10000
risk_usd = lot_size * sl_pips * 10
current_risk = sum(p["risk_usd"] for p in self.positions)
if (current_risk + risk_usd) / self.balance * 100 > self.max_risk_pct:
return {"error": f"Total risk would exceed {self.max_risk_pct}%"}
position = {
"id": f"pos_{len(self.positions)+1}",
"pair": pair,
"direction": direction,
"lot_size": lot_size,
"entry_price": entry_price,
"sl_price": sl_price,
"tp_price": tp_price,
"sl_pips": round(sl_pips, 1),
"tp_pips": round(tp_pips, 1),
"risk_reward": round(tp_pips / sl_pips, 2),
"risk_usd": round(risk_usd, 2),
"opened_at": datetime.utcnow().isoformat(),
"status": "open",
}
self.positions.append(position)
return position
def close_position(self, position_id, close_price):
pos = next((p for p in self.positions if p["id"] == position_id), None)
if not pos:
return {"error": "Position not found"}
if pos["direction"] == "buy":
pnl_pips = (close_price - pos["entry_price"]) * 10000
else:
pnl_pips = (pos["entry_price"] - close_price) * 10000
pnl_usd = pos["lot_size"] * pnl_pips * 10
pos["close_price"] = close_price
pos["pnl_pips"] = round(pnl_pips, 1)
pos["pnl_usd"] = round(pnl_usd, 2)
pos["status"] = "closed"
pos["closed_at"] = datetime.utcnow().isoformat()
self.positions.remove(pos)
self.closed_positions.append(pos)
self.balance += pnl_usd
return pos
def get_portfolio_summary(self):
total_risk = sum(p["risk_usd"] for p in self.positions)
total_pnl = sum(p.get("pnl_usd", 0) for p in self.closed_positions)
return {
"balance": round(self.balance, 2),
"open_positions": len(self.positions),
"closed_positions": len(self.closed_positions),
"total_risk_usd": round(total_risk, 2),
"total_risk_pct": round(total_risk / self.balance * 100, 2),
"realized_pnl": round(total_pnl, 2),
"win_rate": self._calc_win_rate(),
}
def _calc_win_rate(self):
if not self.closed_positions:
return 0
wins = sum(1 for p in self.closed_positions if p.get("pnl_usd", 0) > 0)
return round(wins / len(self.closed_positions) * 100, 1)
pm = PositionManager(balance=5000)
# Open positions
p1 = pm.open_position("EURUSD", "buy", 0.05, 1.0900, 1.0870, 1.0960)
print("Opened:", json.dumps(p1, indent=2))
p2 = pm.open_position("GBPUSD", "sell", 0.03, 1.2700, 1.2740, 1.2620)
print("Opened:", json.dumps(p2, indent=2))
# Close position
closed = pm.close_position("pos_1", 1.0950)
print("Closed:", json.dumps(closed, indent=2))
# Summary
summary = pm.get_portfolio_summary()
print("Summary:", json.dumps(summary, indent=2))
Position Trading Strategy
กลยุทธ์ Position Trading
# === Position Trading Strategy ===
# 1. Trend Following Position Trade
# ===================================
# Timeframe: Daily + Weekly
# Entry:
# - Weekly trend: ใช้ SMA 50 weekly บ่งบอกทิศทางหลัก
# - Daily entry: รอ pullback ไปแตะ EMA 20 daily
# - Confirmation: RSI > 50 (buy) หรือ RSI < 50 (sell)
#
# Position Management:
# - SL: Below last swing low (buy) / Above last swing high (sell)
# - TP: Trail ด้วย ATR x 3 หรือ SMA 50 daily
# - Add position: เมื่อราคาเบรค new high/low พร้อม confirmation
#
# Risk: 1% per entry, max 3% total per trade (including add-ons)
# 2. Pyramiding Strategy
# ===================================
# Initial entry: 1% risk, 0.05 lot
# Add 1 (ราคาวิ่ง 100 pips): 0.75% risk, 0.04 lot
# Add 2 (ราคาวิ่ง 200 pips): 0.50% risk, 0.03 lot
# Add 3 (ราคาวิ่ง 300 pips): 0.25% risk, 0.02 lot
#
# Total exposure: 0.14 lot, 2.5% total risk
# Move SL to breakeven after Add 1
# Trail SL with each add-on
#
# Key rule: ทุก add-on ต้อง SL อยู่เหนือ breakeven
# ถ้าราคากลับตัว ไม่ขาดทุน (หรือขาดทุนน้อย)
# 3. Position Trading Checklist
# ===================================
# Before entry:
# [ ] Weekly trend identified
# [ ] Daily pullback to support/EMA
# [ ] Fundamental backdrop supports direction
# [ ] Risk/Reward > 3:1
# [ ] Position size calculated (1% risk)
# [ ] SL and TP levels set
# [ ] No major news events within 24 hours
#
# During trade:
# [ ] Check daily: still in trend?
# [ ] Move SL to breakeven when +1R
# [ ] Add position only with confirmation
# [ ] Trail SL with ATR or moving average
# [ ] Review weekly: fundamental change?
#
# Exit criteria:
# [ ] TP hit
# [ ] Trailing SL hit
# [ ] Weekly trend reversal signal
# [ ] Fundamental change (central bank, geopolitical)
# [ ] Max holding period reached (3 months)
echo "Position trading strategy"
Risk Management สำหรับ Position
จัดการความเสี่ยงของ Position
# === Risk Management Rules ===
# 1. Position Sizing Rules
# ===================================
# Rule 1: Never risk more than 1-2% per trade
# Rule 2: Total open risk never exceeds 5%
# Rule 3: Max 3 correlated positions at once
# Rule 4: Reduce position size during drawdown
# - Drawdown > 5%: reduce risk to 0.5% per trade
# - Drawdown > 10%: reduce risk to 0.25% per trade
# - Drawdown > 15%: stop trading, review strategy
# 2. Stop Loss Rules
# ===================================
# Always set SL BEFORE opening position
# SL types:
# - Fixed pips: 30-50 pips (not recommended)
# - ATR-based: 2x ATR(14) (adjusts to volatility)
# - Structure-based: below support / above resistance
# - Percentage-based: 1-2% of account
#
# Never move SL further from entry (widen)
# Only move SL toward entry (tighten) or to breakeven
# 3. Correlation Risk
# ===================================
# EUR/USD and GBP/USD: correlation +0.80
# → Treating as same direction = double risk
# EUR/USD and USD/CHF: correlation -0.85
# → Treating as opposite = hedged
#
# Rule: Max 2 positions in same correlation group
# Groups:
# USD strength: EUR/USD short, GBP/USD short, AUD/USD short
# Risk-on: AUD/JPY long, NZD/JPY long
# Safe haven: USD/JPY short, Gold long
# 4. Drawdown Management
# ===================================
# Track daily equity curve
# If 3 consecutive losses:
# - Review last 3 trades for mistakes
# - Reduce next position by 50%
# If 5 consecutive losses:
# - Stop trading for 1-2 days
# - Review entire strategy
# If max drawdown > 20%:
# - Stop trading
# - Back to demo for 2 weeks
# - Review and adjust strategy
echo "Risk management rules"
FAQ คำถามที่พบบ่อย
Q: Position Size ที่เหมาะสมคือเท่าไหร?
A: ขึ้นกับขนาดบัญชีและ risk tolerance กฎทั่วไป risk ไม่เกิน 1-2% ของบัญชีต่อ trade สำหรับบัญชี $1,000 risk 1% = $10 ต่อ trade ถ้า SL 30 pips lot size = $10 / (30 x $0.10) = 0.03 lot (micro) สำหรับบัญชี $10,000 risk 1% = $100 lot size = $100 / (30 x $1) = 0.33 lot ปัดลงเป็น 0.30 lot มือใหม่แนะนำ 0.5-1% risk ที่มีประสบการณ์แล้วใช้ 1-2%
Q: Long Position กับ Short Position ต่างกันอย่างไร?
A: Long Position (Buy) ซื้อก่อนขายทีหลัง กำไรเมื่อราคาขึ้น ขาดทุนเมื่อราคาลง potential loss จำกัดที่ราคา 0 (สำหรับหุ้น) Short Position (Sell) ขายก่อนซื้อคืนทีหลัง (ยืมจาก broker) กำไรเมื่อราคาลง ขาดทุนเมื่อราคาขึ้น potential loss ไม่จำกัด (ราคาขึ้นได้เรื่อยๆ) ใน Forex ทั้ง long และ short มี risk เท่ากันเพราะเทรดเป็นคู่สกุลเงิน Buy EUR/USD = Long EUR + Short USD
Q: ควรเปิดกี่ Position พร้อมกัน?
A: แนะนำ 3-5 positions พร้อมกันเป็นอย่างมาก สำหรับมือใหม่เริ่มจาก 1-2 positions เหตุผล total risk ต้องไม่เกิน 5% ของบัญชี, ถ้าเปิด 5 positions x 1% risk = 5% total, หลาย positions ต้องดูแลมากขึ้น อาจพลาด, correlated positions นับเป็นเหมือน position เดียว สำหรับ position trading ที่ถือนาน 2-3 positions เพียงพอ สำหรับ day trading อาจเปิดมากกว่าแต่ปิดภายในวัน
Q: เมื่อไหร่ควรปิด Position?
A: ปิดเมื่อ TP (Take Profit) ถึงเป้าหมาย, SL (Stop Loss) ถูก hit, Trailing Stop ถูก hit, สัญญาณ reversal จาก technical analysis, ข่าวสำคัญที่เปลี่ยน fundamental, ถือครบเวลาที่กำหนด (position trading 1-3 เดือน), drawdown เกิน threshold ไม่ควรปิดเพราะ กลัวขาดทุนเพิ่ม (ให้ SL ทำหน้าที่), เห็นราคาขยับนิดหน่อย (noise), อารมณ์ (panic, greed) ให้ยึดตาม trading plan ที่วางไว้ก่อนเปิด position
