Thứ Ba, 01/12/202601/12/2026

Hướng Dẫn Sử Dụng Bot CNPS72 - Linear Regression Slope cho VN30F1M

Hướng dẫn chi tiết Bot CNPS72 Linear Regression Slope trên TradingView: đo độ dốc hồi quy tuyến tính chuẩn hóa theo ATR, bắt nhịp Pullback và quản trị SL/TP 5–15 điểm cho VN30F1M.

Hướng dẫn sử dụng Bot CNPS72 cho VN30F1M
Hướng dẫn sử dụng Bot CNPS72 cho VN30F1M
Mục lục
Mục lục

Trong giao dịch phái sinh VN30F1M, việc vào lệnh đuổi theo giá (FOMO) giữa nhịp tăng hoặc bán tháo giữa nhịp giảm thường khiến nhà đầu tư chịu mức dừng lỗ rộng và dễ bị quét khi thị trường điều chỉnh kỹ thuật. Ngược lại, nếu chỉ bắt đáy hoặc bắt đỉnh theo cảm tính khi chưa có sự xác nhận của xu hướng chủ đạo, rủi ro đi ngược dòng rất cao.

CNPS72 LINEAR REGRESSION SLOPE (strategy(title="CNPS72 LINEAR REGRESSION SLOPE", shorttitle="CNPS72 LINREG")) được viết bằng Pine Script v6 trên TradingView nhằm giải quyết bài toán này theo cấu trúc 3 bước chặt chẽ: Regression Trend → Pullback → Confirmation. Bot tự động đo lường xu hướng khách quan bằng đường hồi quy tuyến tính, chờ giá hồi về vùng cân bằng rồi mới kích hoạt lệnh khi có nến xác nhận.

Những điểm nổi bật cốt lõi của Bot CNPS72:

  • Chuẩn hóa độ dốc hồi quy theo ATR (Slope / ATR): Loại bỏ các giai đoạn thị trường đi ngang (sideway) nhiễu động, chỉ xác nhận xu hướng khi độ dốc đạt ngưỡng tối thiểu 0.05 ATR mỗi nến.
  • Máy trạng thái Pullback thông minh: Ghi nhận nhịp chạm đường hồi quy trong vùng đệm 0.20 × ATR, tự động hủy nếu xu hướng gãy hoặc quá hạn 5 nến chờ xác nhận.
  • Hệ thống bộ lọc đa tầng tùy chọn: Hỗ trợ lọc gia tốc độ dốc (Slope Acceleration), đột biến khối lượng (Volume Spike), Trend EMA và xu hướng đa khung H1 EMA từ nến H1 đã đóng.
  • Quản trị rủi ro kỷ luật R:R 1:3: Cố định cắt lỗ 5.0 điểm và chốt lời 15.0 điểm, giới hạn tối đa 2 lệnh/ngày và tự động đóng toàn bộ vị thế cuối phiên lúc 14:45.

1. CNPS72 Linear Regression Slope là gì?

CNPS72 Linear Regression Slope là hệ thống giao dịch tự động theo xu hướng kết hợp bắt nhịp hồi quy (Trend-Following Pullback). Chiến lược vận hành dựa trên 4 trụ cột kỹ thuật chính:

  1. Động cơ hồi quy tuyến tính (Linear Regression & Slope Engine): Tính đường hồi quy tuyến tính ta.linreg(close, 50, 0) và độ dốc tức thời so với điểm trước đó (offset=1), sau đó làm mượt bằng SMA (slopeLookback) và chuẩn hóa theo ATR(14) để đánh giá sức mạnh xu hướng.
  2. Bộ phát hiện & quản lý trạng thái Pullback (Pullback State Machine): Theo dõi khi giá chạm hoặc tiến vào vùng biên ± 0.20 × ATR quanh đường hồi quy, kích hoạt cửa sổ chờ xác nhận từ 1 đến 5 nến (pullbackBarsMax).
  3. Bộ xác nhận nến & bộ lọc tùy chọn: Kiểm tra hướng nến (close > open cho Long, close < open cho Short), lấy lại đường hồi quy (Regression Reclaim), cùng các tùy chọn lọc gia tốc độ dốc, Volume Spike, Trend EMA và H1 EMA Bias.
  4. Kiểm soát phiên & quản trị rủi ro: Giới hạn 1 vị thế tại một thời điểm (pyramiding=0), tối đa 2 lệnh/ngày, bảo vệ bằng SL/TP cố định 5.0 / 15.0 điểm và ép đóng vị thế lúc 14:45 theo múi giờ Asia/Ho_Chi_Minh.

Bảng thông số mặc định

Nhóm thông sốTên tham số trong CodeGiá trị mặc địnhÝ nghĩa
Linear RegressionregressionLength50Chu kỳ tính đường hồi quy tuyến tính
slopeLookback1Số nến làm mượt độ dốc hồi quy (ta.sma)
requireMinimumSlopetrueBật/tắt yêu cầu độ dốc tối thiểu
minimumSlopeATR0.05Ngưỡng độ dốc tối thiểu tính theo tỷ lệ Slope / ATR
PullbackpullbackBarsMax5Số nến tối đa chờ xác nhận sau khi chạm Pullback
pullbackToleranceATR0.20Biên độ dung sai chạm đường hồi quy (0.20 × ATR)
requireCandleDirectiontrueYêu cầu nến xác nhận đồng màu xu hướng
requirePreviousCloseBreakfalseYêu cầu giá đóng cửa vượt giá đóng cửa nến trước
requireRegressionReclaimtrueYêu cầu giá đóng cửa vượt qua đường hồi quy
Slope FilterrequireSlopeAccelerationfalseYêu cầu độ dốc đang tăng tốc so với nến trước
VolumerequireVolumeSpikefalseBật/tắt bộ lọc đột biến khối lượng
volumeAverageLength20Chu kỳ tính khối lượng trung bình (ta.sma)
volumeSpikeFactor1.20Hệ số nhân khối lượng đột biến (1.20 × AvgVol)
EMA TrenduseEMATrendfalseBật/tắt bộ lọc Trend EMA trên khung hiện tại
trendEMALength50Chu kỳ đường Trend EMA
H1 TrenduseH1EMABiasfalseBật/tắt bộ lọc xu hướng khung H1 (request.security)
h1EMALength50Chu kỳ đường EMA trên khung H1
ATRatrLength14Chu kỳ tính chỉ báo biến động ATR
Risk ManagementstopLossPoints5.0Khoảng cách cắt lỗ cố định (điểm)
takeProfitPoints15.0Khoảng cách chốt lời cố định (điểm)
Trade ControlmaximumTradesPerDay2Số lệnh tối đa được phép vào trong ngày
tradeDirection"Long"Chế độ hướng giao dịch (Long, Short, Both)
SessionuseSessionFilterfalseBật/tắt bộ lọc khung giờ vào lệnh
strategyTimezone"Asia/Ho_Chi_Minh"Múi giờ vận hành chiến lược
sessionStartHour / Minute9 / 0Giờ bắt đầu phiên vào lệnh (09:00)
lastEntryHour / Minute14 / 30Giờ cuối cùng được phép mở lệnh mới (14:30)
sessionEndHour / Minute14 / 45Giờ ép đóng toàn bộ vị thế cuối phiên (14:45)
AlertsdisableSLTPAlertsfalseTắt cảnh báo khi chạm SL hoặc TP
DisplayshowRegression / showActiveSLTPtrue / trueHiển thị đường hồi quy và đường SL/TP đang chạy
showTrendEMA, showH1EMA, showPullbackMarkers, showSignalMarkers, showDiagnosticsfalseCác tùy chọn hiển thị EMA, marker và bảng chẩn đoán

Source Code CNPS72 Linear Regression Slope

Bạn có thể sao chép toàn bộ mã nguồn Pine Script v6 dưới đây để dán trực tiếp vào Pine Editor trên TradingView:

//@version=6
strategy(title="CNPS72 LINEAR REGRESSION SLOPE", shorttitle="CNPS72 LINREG", overlay=true, initial_capital=100000000, default_qty_type=strategy.fixed, default_qty_value=1, pyramiding=0, margin_long=0, margin_short=0, slippage=0, commission_type=strategy.commission.cash_per_contract, commission_value=0, fill_orders_on_standard_ohlc=true, process_orders_on_close=true, calc_on_order_fills=true, max_labels_count=300, max_lines_count=300, max_bars_back=5000)

// ============================================================================
// CNPS72 LINEAR REGRESSION SLOPE
// REGRESSION TREND -> PULLBACK -> CONFIRMATION
//
// LONG:
// Positive regression slope
// -> Price touches regression line
// -> Bullish confirmation within N bars
// -> Optional filters
// -> LONG
//
// SHORT:
// Negative regression slope
// -> Price touches regression line
// -> Bearish confirmation within N bars
// -> Optional filters
// -> SHORT
//
// DEFAULT SL: 5 POINTS
// DEFAULT TP: 15 POINTS
// ============================================================================
// ============================================================================
// SECTION 1: LINEAR REGRESSION SETTINGS
// ============================================================================
regressionLength = input.int(50, "Linear Regression Length", minval=5, maxval=500, group="Linear Regression")
slopeLookback = input.int(1, "Slope Lookback Bars", minval=1, maxval=50, group="Linear Regression")
requireMinimumSlope = input.bool(true, "Require Minimum Slope?", group="Linear Regression")
minimumSlopeATR = input.float(0.05, "Minimum Slope / ATR Per Bar", minval=0.0, step=0.01, group="Linear Regression")

// ============================================================================
// SECTION 2: PULLBACK SETTINGS
// ============================================================================
pullbackBarsMax = input.int(5, "Maximum Bars After Pullback", minval=1, maxval=30, group="Pullback")
pullbackToleranceATR = input.float(0.20, "Pullback Tolerance / ATR", minval=0.0, step=0.05, group="Pullback")
requireCandleDirection = input.bool(true, "Require Bullish / Bearish Confirmation Candle?", group="Pullback")
requirePreviousCloseBreak = input.bool(false, "Require Close Beyond Previous Close?", group="Pullback")
requireRegressionReclaim = input.bool(true, "Require Close Beyond Regression Line?", group="Pullback")

// ============================================================================
// SECTION 3: SLOPE FILTER
// ============================================================================
requireSlopeAcceleration = input.bool(false, "Require Slope Acceleration?", group="Slope Filter")

// ============================================================================
// SECTION 4: VOLUME FILTER
// ============================================================================
requireVolumeSpike = input.bool(false, "Require Volume Spike?", group="Volume")
volumeAverageLength = input.int(20, "Volume Average Length", minval=2, group="Volume")
volumeSpikeFactor = input.float(1.20, "Volume Spike Factor", minval=0.1, step=0.1, group="Volume")

// ============================================================================
// SECTION 5: EMA TREND FILTER
// ============================================================================
useEMATrend = input.bool(false, "Use EMA Trend Filter?", group="EMA Trend")
trendEMALength = input.int(50, "Trend EMA Length", minval=1, group="EMA Trend")

// ============================================================================
// SECTION 6: H1 TREND FILTER
// ============================================================================
useH1EMABias = input.bool(false, "Use Confirmed H1 EMA Bias?", group="H1 Trend")
h1EMALength = input.int(50, "H1 EMA Length", minval=1, group="H1 Trend")

// ============================================================================
// SECTION 7: ATR SETTINGS
// ============================================================================
atrLength = input.int(14, "ATR Length", minval=1, group="ATR")

// ============================================================================
// SECTION 8: RISK MANAGEMENT
// ============================================================================
stopLossPoints = input.float(5.0, "Stop Loss (Points)", minval=0.1, step=0.5, group="Risk Management")
takeProfitPoints = input.float(15.0, "Take Profit (Points)", minval=0.1, step=0.5, group="Risk Management")

// ============================================================================
// SECTION 9: TRADE CONTROL
// ============================================================================
maximumTradesPerDay = input.int(2, "Maximum Trades Per Day", minval=1, maxval=20, group="Trade Control")
tradeDirection = input.string("Long", "Trade Direction", options=["Long", "Short", "Both"], group="Trade Control")
bool allowLong = (tradeDirection == "Long" or tradeDirection == "Both")
bool allowShort = (tradeDirection == "Short" or tradeDirection == "Both")

// ============================================================================
// SECTION 10: SESSION
// ============================================================================
useSessionFilter = input.bool(false, "Use Entry Session Filter?", group="Session")
strategyTimezone = input.string("Asia/Ho_Chi_Minh", "Strategy Timezone", group="Session")
sessionStartHour = input.int(9, "Session Start Hour", minval=0, maxval=23, group="Session")
sessionStartMinute = input.int(0, "Session Start Minute", minval=0, maxval=59, group="Session")
lastEntryHour = input.int(14, "Last Entry Hour", minval=0, maxval=23, group="Session")
lastEntryMinute = input.int(30, "Last Entry Minute", minval=0, maxval=59, group="Session")
sessionEndHour = input.int(14, "Force Close Hour", minval=0, maxval=23, group="Session")
sessionEndMinute = input.int(45, "Force Close Minute", minval=0, maxval=59, group="Session")

// ============================================================================
// SECTION 11: ALERT CONTROL
// ============================================================================
disableSLTPAlerts = input.bool(false, "Disable SL / TP Alerts?", group="Alerts")

// ============================================================================
// SECTION 12: DISPLAY
// ============================================================================
showRegression = input.bool(true, "Show Regression Line?", group="Display")
showTrendEMA = input.bool(false, "Show Trend EMA?", group="Display")
showH1EMA = input.bool(false, "Show Confirmed H1 EMA?", group="Display")
showPullbackMarkers = input.bool(false, "Show Pullback Markers?", group="Display")
showSignalMarkers = input.bool(false, "Show Setup Markers?", group="Display")
showActiveSLTP = input.bool(true, "Show Active SL / TP?", group="Display")
showDiagnostics = input.bool(false, "Show Diagnostics?", group="Display")

// ============================================================================
// SECTION 13: TIME ENGINE
// ============================================================================
int currentMinute = (hour(time, strategyTimezone) * 60 + minute(time, strategyTimezone))
int currentCloseMinute = (hour(time_close, strategyTimezone) * 60 + minute(time_close, strategyTimezone))
int sessionStartTotal = (sessionStartHour * 60 + sessionStartMinute)
int lastEntryTotal = (lastEntryHour * 60 + lastEntryMinute)
int sessionEndTotal = (sessionEndHour * 60 + sessionEndMinute)
bool entrySession = (currentMinute >= sessionStartTotal and currentCloseMinute <= lastEntryTotal)
bool sessionOK = (not useSessionFilter or entrySession)

// ============================================================================
// SECTION 14: TRADING DAY
// ============================================================================
int tradingDayKey = (year(time, strategyTimezone) * 10000 + month(time, strategyTimezone) * 100 + dayofmonth(time, strategyTimezone))
bool newTradingDay = (bar_index == 0 or tradingDayKey != tradingDayKey[1])
var int tradesToday = 0
if newTradingDay
    tradesToday := 0

// ============================================================================
// SECTION 15: LINEAR REGRESSION ENGINE
// ============================================================================
//
// ta.linreg(source, length, offset)
//
// Regression line uses the current rolling window.
//
// Regression slope is calculated from the fitted
// values at offset 0 and offset 1.
//
// ============================================================================
float regressionLine = ta.linreg(close, regressionLength, 0)
float regressionPreviousPoint = ta.linreg(close, regressionLength, 1)
float regressionSlope = (regressionLine - regressionPreviousPoint)

// ============================================================================
// SECTION 16: REGRESSION SLOPE ENGINE
// ============================================================================
float averageRegressionSlope = ta.sma(regressionSlope, slopeLookback)
bool bullishSlope = (not na(averageRegressionSlope) and averageRegressionSlope > 0)
bool bearishSlope = (not na(averageRegressionSlope) and averageRegressionSlope < 0)

// ============================================================================
// SECTION 17: ATR ENGINE
// ============================================================================
float atr = ta.atr(atrLength)

// ============================================================================
// SECTION 18: NORMALIZED SLOPE
// ============================================================================
//
// Normalized slope allows comparing the slope
// with current market volatility.
//
// ============================================================================
float normalizedSlope = (not na(atr) and atr > 0 ? averageRegressionSlope / atr : na)
bool longSlopeStrengthOK = (not requireMinimumSlope or (not na(normalizedSlope) and normalizedSlope >= minimumSlopeATR))
bool shortSlopeStrengthOK = (not requireMinimumSlope or (not na(normalizedSlope) and normalizedSlope <= -minimumSlopeATR))

// ============================================================================
// SECTION 19: SLOPE ACCELERATION
// ============================================================================
bool bullishAcceleration = (not na(averageRegressionSlope[1]) and averageRegressionSlope > averageRegressionSlope[1])
bool bearishAcceleration = (not na(averageRegressionSlope[1]) and averageRegressionSlope < averageRegressionSlope[1])
bool longAccelerationOK = (not requireSlopeAcceleration or bullishAcceleration)
bool shortAccelerationOK = (not requireSlopeAcceleration or bearishAcceleration)

// ============================================================================
// SECTION 20: VOLUME FILTER
// ============================================================================
float averageVolume = ta.sma(volume, volumeAverageLength)
bool volumeSpike = (not na(averageVolume) and volume >= averageVolume * volumeSpikeFactor)
bool volumeOK = (not requireVolumeSpike or volumeSpike)

// ============================================================================
// SECTION 21: EMA TREND FILTER
// ============================================================================
float trendEMA = ta.ema(close, trendEMALength)
bool longEMAOK = (not useEMATrend or close > trendEMA)
bool shortEMAOK = (not useEMATrend or close < trendEMA)

// ============================================================================
// SECTION 22: CONFIRMED H1 EMA
// ============================================================================
//
// Previous completed H1 candle.
// Intended for chart timeframes below H1.
//
// ============================================================================
float h1EMA = request.security(syminfo.tickerid, "60", ta.ema(close, h1EMALength)[1], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)
float h1Close = request.security(syminfo.tickerid, "60", close[1], gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on)
bool longBiasOK = (not useH1EMABias or (not na(h1EMA) and not na(h1Close) and h1Close > h1EMA))
bool shortBiasOK = (not useH1EMABias or (not na(h1EMA) and not na(h1Close) and h1Close < h1EMA))

// ============================================================================
// SECTION 23: TREND STATE
// ============================================================================
bool bullishTrend = (bullishSlope and longSlopeStrengthOK)
bool bearishTrend = (bearishSlope and shortSlopeStrengthOK)

// ============================================================================
// SECTION 24: PULLBACK DETECTION
// ============================================================================
//
// Long:
// Positive slope.
// Candle touches or approaches regression line.
//
// Short:
// Negative slope.
// Candle touches or approaches regression line.
//
// ============================================================================
float pullbackTolerance = (atr * pullbackToleranceATR)
bool bullishPullback = (bullishTrend and not na(pullbackTolerance) and low <= regressionLine + pullbackTolerance and high >= regressionLine - pullbackTolerance)
bool bearishPullback = (bearishTrend and not na(pullbackTolerance) and high >= regressionLine - pullbackTolerance and low <= regressionLine + pullbackTolerance)

// ============================================================================
// SECTION 25: PULLBACK STATE
// ============================================================================
//
// One pending setup per direction.
// Repeated touches do not reset the countdown.
//
// ============================================================================
var bool pendingBull = false
var bool pendingBear = false
var int bullPullbackBar = na
var int bearPullbackBar = na
var int bullPullbackCount = 0
var int bearPullbackCount = 0
var int bullConfirmationCount = 0
var int bearConfirmationCount = 0
var int lastStateBar = na
bool processState = (barstate.isconfirmed and (na(lastStateBar) or lastStateBar != bar_index))
if processState
    lastStateBar := bar_index
    if newTradingDay
        pendingBull := false
        pendingBear := false
        bullPullbackBar := na
        bearPullbackBar := na

    // Cancel invalid or expired setups.
    if pendingBull
        bool invalidBull = (not bullishTrend or close < regressionLine - atr)
        bool expiredBull = (bar_index - bullPullbackBar > pullbackBarsMax)
        if invalidBull or expiredBull
            pendingBull := false
            bullPullbackBar := na
    if pendingBear
        bool invalidBear = (not bearishTrend or close > regressionLine + atr)
        bool expiredBear = (bar_index - bearPullbackBar > pullbackBarsMax)
        if invalidBear or expiredBear
            pendingBear := false
            bearPullbackBar := na

    // Register new pullback once.
    if not pendingBull and bullishPullback
        pendingBull := true
        bullPullbackBar := bar_index
        bullPullbackCount += 1
    if not pendingBear and bearishPullback
        pendingBear := true
        bearPullbackBar := bar_index
        bearPullbackCount += 1

// ============================================================================
// SECTION 26: VALID PULLBACK WINDOW
// ============================================================================
int barsSinceBullPullback = (na(bullPullbackBar) ? -1 : bar_index - bullPullbackBar)
int barsSinceBearPullback = (na(bearPullbackBar) ? -1 : bar_index - bearPullbackBar)
bool validBullPullback = (pendingBull and barsSinceBullPullback >= 1 and barsSinceBullPullback <= pullbackBarsMax)
bool validBearPullback = (pendingBear and barsSinceBearPullback >= 1 and barsSinceBearPullback <= pullbackBarsMax)

// ============================================================================
// SECTION 27: CANDLE CONFIRMATION
// ============================================================================
bool bullishCandle = (close > open)
bool bearishCandle = (close < open)
bool longCandleOK = (not requireCandleDirection or bullishCandle)
bool shortCandleOK = (not requireCandleDirection or bearishCandle)
bool longPreviousCloseOK = (not requirePreviousCloseBreak or close > close[1])
bool shortPreviousCloseOK = (not requirePreviousCloseBreak or close < close[1])
bool longReclaimOK = (not requireRegressionReclaim or close > regressionLine)
bool shortReclaimOK = (not requireRegressionReclaim or close < regressionLine)

// ============================================================================
// SECTION 28: BASE LONG SETUP
// ============================================================================
bool longBase = (bullishTrend and validBullPullback and longCandleOK and longPreviousCloseOK and longReclaimOK)

// ============================================================================
// SECTION 29: BASE SHORT SETUP
// ============================================================================
bool shortBase = (bearishTrend and validBearPullback and shortCandleOK and shortPreviousCloseOK and shortReclaimOK)

// ============================================================================
// SECTION 30: RAW SIGNALS
// ============================================================================
bool rawLongSignal = (longBase and longAccelerationOK and volumeOK and longEMAOK and longBiasOK)
bool rawShortSignal = (shortBase and shortAccelerationOK and volumeOK and shortEMAOK and shortBiasOK)

// ============================================================================
// SECTION 31: POSITION STATE
// ============================================================================
bool positionFlat = (strategy.position_size == 0)
bool positionLong = (strategy.position_size > 0)
bool positionShort = (strategy.position_size < 0)
bool positionJustClosed = (positionFlat and strategy.position_size[1] != 0)

// ============================================================================
// SECTION 32: TRADE CONTROL
// ============================================================================
bool dailyTradeLimitOK = (tradesToday < maximumTradesPerDay)
bool canTrade = (positionFlat and dailyTradeLimitOK and sessionOK and currentCloseMinute < sessionEndTotal and barstate.isconfirmed)

// ============================================================================
// SECTION 33: SIGNAL PROTECTION
// ============================================================================
bool ambiguousSignal = (rawLongSignal and rawShortSignal)
var int lastEntryBar = na
bool notEnteredThisBar = (na(lastEntryBar) or bar_index != lastEntryBar)
bool finalLongSignal = (canTrade and notEnteredThisBar and allowLong and rawLongSignal and not ambiguousSignal)
bool finalShortSignal = (canTrade and notEnteredThisBar and allowShort and rawShortSignal and not ambiguousSignal)

// ============================================================================
// SECTION 34: ENTRY COUNTERS
// ============================================================================
var int longEntryCount = 0
var int shortEntryCount = 0
var int lastConfirmationBar = na
if (barstate.isconfirmed and (na(lastConfirmationBar) or lastConfirmationBar != bar_index))
    lastConfirmationBar := bar_index
    if longBase
        bullConfirmationCount += 1
    if shortBase
        bearConfirmationCount += 1

// ============================================================================
// SECTION 35: LONG ENTRY
// ============================================================================
if finalLongSignal
    strategy.entry("Long", strategy.long, comment="Linear Regression Long", alert_message="🟢 VÀO VỊ THẾ LONG (CNPS72 Linear Regression)\\n🎯 Giá vào: " + str.tostring(close, format.mintick) + "\\n🛑 Cắt lỗ (SL): " + str.tostring(close - stopLossPoints, format.mintick) + "\\n💰 Chốt lời (TP): " + str.tostring(close + takeProfitPoints, format.mintick))
    tradesToday += 1
    longEntryCount += 1
    lastEntryBar := bar_index
    pendingBull := false
    bullPullbackBar := na

// ============================================================================
// SECTION 36: SHORT ENTRY
// ============================================================================
if finalShortSignal
    strategy.entry("Short", strategy.short, comment="Linear Regression Short", alert_message="🔴 VÀO VỊ THẾ SHORT (CNPS72 Linear Regression)\\n🎯 Giá vào: " + str.tostring(close, format.mintick) + "\\n🛑 Cắt lỗ (SL): " + str.tostring(close + stopLossPoints, format.mintick) + "\\n💰 Chốt lời (TP): " + str.tostring(close - takeProfitPoints, format.mintick))
    tradesToday += 1
    shortEntryCount += 1
    lastEntryBar := bar_index
    pendingBear := false
    bearPullbackBar := na

// ============================================================================
// SECTION 37: ACTIVE RISK LEVELS
// ============================================================================
var float activeLongSL = na
var float activeLongTP = na
var float activeShortSL = na
var float activeShortTP = na

// ============================================================================
// SECTION 38: LONG SL / TP
// ============================================================================
if positionLong
    float entryPrice = (strategy.position_avg_price)
    activeLongSL := (entryPrice - stopLossPoints)
    activeLongTP := (entryPrice + takeProfitPoints)
    strategy.exit("Long Exit", from_entry="Long", stop=activeLongSL, limit=activeLongTP, comment_profit="TP Long", comment_loss="SL Long", alert_profit="💰 CHỐT LỜI LONG (TP HIT)\\n🎯 Giá chốt: " + str.tostring(activeLongTP, format.mintick), alert_loss="🛑 CẮT LỖ LONG (SL HIT)\\n🎯 Giá cắt: " + str.tostring(activeLongSL, format.mintick), disable_alert=disableSLTPAlerts)

// ============================================================================
// SECTION 39: SHORT SL / TP
// ============================================================================
if positionShort
    float entryPrice = (strategy.position_avg_price)
    activeShortSL := (entryPrice + stopLossPoints)
    activeShortTP := (entryPrice - takeProfitPoints)
    strategy.exit("Short Exit", from_entry="Short", stop=activeShortSL, limit=activeShortTP, comment_profit="TP Short", comment_loss="SL Short", alert_profit="💰 CHỐT LỜI SHORT (TP HIT)\\n🎯 Giá chốt: " + str.tostring(activeShortTP, format.mintick), alert_loss="🛑 CẮT LỖ SHORT (SL HIT)\\n🎯 Giá cắt: " + str.tostring(activeShortSL, format.mintick), disable_alert=disableSLTPAlerts)

// ============================================================================
// SECTION 40: POSITION CLEANUP
// ============================================================================
if positionJustClosed
    activeLongSL := na
    activeLongTP := na
    activeShortSL := na
    activeShortTP := na

// ============================================================================
// SECTION 41: SESSION END
// ============================================================================
bool finalSessionBar = (currentMinute < sessionEndTotal and currentCloseMinute >= sessionEndTotal)
if finalSessionBar
    if strategy.position_size != 0
        strategy.close_all(immediately=true, comment="Session End", alert_message="⏰ ĐÓNG VỊ THẾ HẾT PHIÊN (Session End)\\n🎯 Giá đóng: " + str.tostring(close, format.mintick))

// ============================================================================
// SECTION 42: REGRESSION DISPLAY
// ============================================================================
plot(showRegression ? regressionLine : na, title="Linear Regression", color=bullishSlope ? color.green : bearishSlope ? color.red : color.gray, linewidth=2)

// ============================================================================
// SECTION 43: TREND DISPLAY
// ============================================================================
plot(showTrendEMA and useEMATrend ? trendEMA : na, title="Trend EMA", color=color.orange, linewidth=1)
plot(showH1EMA and useH1EMABias ? h1EMA : na, title="Confirmed H1 EMA", color=color.blue, linewidth=1)

// ============================================================================
// SECTION 44: ACTIVE SL / TP DISPLAY
// ============================================================================
plot(showActiveSLTP and positionLong ? activeLongSL : na, title="Long SL", color=color.red, linewidth=2, style=plot.style_linebr)
plot(showActiveSLTP and positionLong ? activeLongTP : na, title="Long TP", color=color.green, linewidth=2, style=plot.style_linebr)
plot(showActiveSLTP and positionShort ? activeShortSL : na, title="Short SL", color=color.red, linewidth=2, style=plot.style_linebr)
plot(showActiveSLTP and positionShort ? activeShortTP : na, title="Short TP", color=color.green, linewidth=2, style=plot.style_linebr)

// ============================================================================
// SECTION 45: PULLBACK MARKERS
// ============================================================================
plotshape(showPullbackMarkers and bullishPullback, title="Bullish Regression Pullback", style=shape.circle, location=location.belowbar, color=color.aqua, size=size.tiny, text="PB")
plotshape(showPullbackMarkers and bearishPullback, title="Bearish Regression Pullback", style=shape.circle, location=location.abovebar, color=color.orange, size=size.tiny, text="PB")

// ============================================================================
// SECTION 46: SIGNAL MARKERS
// ============================================================================
plotshape(showSignalMarkers and rawLongSignal, title="Regression Long Setup", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny, text="L", textcolor=color.white)
plotshape(showSignalMarkers and rawShortSignal, title="Regression Short Setup", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny, text="S", textcolor=color.white)

// ============================================================================
// SECTION 47: DIAGNOSTICS
// ============================================================================
var table diagnostics = table.new(position.top_right, 2, 19, border_width=1)
if showDiagnostics and barstate.islast
    string trendText = (bullishTrend ? "UP" : bearishTrend ? "DOWN" : "NEUTRAL")
    string positionText = (positionLong ? "LONG" : positionShort ? "SHORT" : "FLAT")
    table.cell(diagnostics, 0, 0, "CNPS72")
    table.cell(diagnostics, 1, 0, timeframe.period)
    table.cell(diagnostics, 0, 1, "Regression")
    table.cell(diagnostics, 1, 1, str.tostring(regressionLine, format.mintick))
    table.cell(diagnostics, 0, 2, "Slope")
    table.cell(diagnostics, 1, 2, str.tostring(averageRegressionSlope, "#.####"))
    table.cell(diagnostics, 0, 3, "Slope / ATR")
    table.cell(diagnostics, 1, 3, str.tostring(normalizedSlope, "#.####"))
    table.cell(diagnostics, 0, 4, "Trend")
    table.cell(diagnostics, 1, 4, trendText)
    table.cell(diagnostics, 0, 5, "ATR")
    table.cell(diagnostics, 1, 5, str.tostring(atr, "#.##"))
    table.cell(diagnostics, 0, 6, "Bull Pullbacks")
    table.cell(diagnostics, 1, 6, str.tostring(bullPullbackCount))
    table.cell(diagnostics, 0, 7, "Bear Pullbacks")
    table.cell(diagnostics, 1, 7, str.tostring(bearPullbackCount))
    table.cell(diagnostics, 0, 8, "Bull Confirms")
    table.cell(diagnostics, 1, 8, str.tostring(bullConfirmationCount))
    table.cell(diagnostics, 0, 9, "Bear Confirms")
    table.cell(diagnostics, 1, 9, str.tostring(bearConfirmationCount))
    table.cell(diagnostics, 0, 10, "Pending Long")
    table.cell(diagnostics, 1, 10, pendingBull ? "YES" : "NO")
    table.cell(diagnostics, 0, 11, "Pending Short")
    table.cell(diagnostics, 1, 11, pendingBear ? "YES" : "NO")
    table.cell(diagnostics, 0, 12, "Volume OK")
    table.cell(diagnostics, 1, 12, volumeOK ? "YES" : "NO")
    table.cell(diagnostics, 0, 13, "Long Bias")
    table.cell(diagnostics, 1, 13, longBiasOK ? "YES" : "NO")
    table.cell(diagnostics, 0, 14, "Short Bias")
    table.cell(diagnostics, 1, 14, shortBiasOK ? "YES" : "NO")
    table.cell(diagnostics, 0, 15, "Long Entries")
    table.cell(diagnostics, 1, 15, str.tostring(longEntryCount))
    table.cell(diagnostics, 0, 16, "Short Entries")
    table.cell(diagnostics, 1, 16, str.tostring(shortEntryCount))
    table.cell(diagnostics, 0, 17, "Trades Today")
    table.cell(diagnostics, 1, 17, str.tostring(tradesToday) + " / " + str.tostring(maximumTradesPerDay))
    table.cell(diagnostics, 0, 18, "Position")
    table.cell(diagnostics, 1, 18, positionText)

2. Những khái niệm kỹ thuật cốt lõi trong CNPS72

2.1. Đường hồi quy tuyến tính và Độ dốc chuẩn hóa (Normalized Slope)

Bot sử dụng hàm ta.linreg(close, regressionLength, 0) (mặc định 50 nến) để dựng đường hồi quy tuyến tính tại nến hiện tại (regressionLine), đồng thời tính giá trị tại offset = 1 (regressionPreviousPoint). Độ dốc thô mỗi nến được xác định bởi:

regressionSlope = regressionLine - regressionPreviousPoint

Để giảm nhiễu, bot lấy trung bình động giản đơn của độ dốc qua slopeLookback nến (averageRegressionSlope = ta.sma(regressionSlope, slopeLookback)), rồi chia cho ATR(14) nhằm chuẩn hóa theo biến động thị trường:

normalizedSlope = averageRegressionSlope / atr

Nhờ bước chuẩn hóa này, ngưỡng minimumSlopeATR = 0.05 giữ nguyên ý nghĩa dù biên độ dao động của VN30F1M đang hẹp (1–2 điểm/nến) hay mở rộng mạnh (5–10 điểm/nến).

2.2. Máy trạng thái Pullback & Cửa sổ xác nhận (Pullback State Machine)

Thay vì vào lệnh ngay tại nến chạm đường hồi quy, CNPS72 tách biệt pha Chạm Pullback và pha Nến xác nhận:

  • Vùng dung sai Pullback: pullbackTolerance = atr * pullbackToleranceATR (mặc định 0.20 × ATR). Nến được tính là chạm Pullback khi dải [low, high] giao với dải [regressionLine - pullbackTolerance, regressionLine + pullbackTolerance].
  • Cơ chế chống reset: Khi pendingBull hoặc pendingBear đã bật, các nến chạm lại liên tiếp sẽ không làm mới bộ đếm bullPullbackBar / bearPullbackBar.
  • Điều kiện hủy Setup: Trạng thái chờ bị hủy ngay lập tức nếu xu hướng đảo chiều (not bullishTrend / not bearishTrend), giá đóng cửa xuyên thủng quá 1.0 × ATR khỏi đường hồi quy (close < regressionLine - atr với Long hoặc close > regressionLine + atr với Short), hoặc vượt quá pullbackBarsMax (5 nến).

2.3. Hệ thống bộ lọc mở rộng (Optional Filters)

Bên cạnh lõi Regression Pullback, mã nguồn tích hợp 4 bộ lọc tùy chọn độc lập:

  • Slope Acceleration (requireSlopeAcceleration): Đòi hỏi độ dốc hiện tại mạnh hơn nến liền trước (averageRegressionSlope > averageRegressionSlope[1] cho Long và < cho Short).
  • Volume Spike (requireVolumeSpike): Khối lượng nến xác nhận phải đạt từ 1.20 × SMA(volume, 20) trở lên.
  • Trend EMA (useEMATrend): Giá đóng cửa phải nằm trên EMA(50) đối với Long và dưới EMA(50) đối với Short.
  • Confirmed H1 EMA Bias (useH1EMABias): Truy xuất dữ liệu khung 60 phút qua request.security(..., "60", ...[1], lookahead=barmerge.lookahead_on) để đảm bảo nến H1 đã đóng gần nhất nằm đúng phía so với EMA(50) trên H1 (tránh repaint).

3. Nguyên lý hoạt động của CNPS72

Quy trình vận hành của CNPS72 diễn ra tuần tự qua 5 bước trên mỗi nến đóng cửa (barstate.isconfirmed):

  1. Khởi tạo phiên và ngày giao dịch mới: Khi phát hiện newTradingDay theo múi giờ Asia/Ho_Chi_Minh, bot reset bộ đếm tradesToday := 0 và xóa sạch các trạng thái pendingBull, pendingBear còn tồn đọng từ phiên trước.
  2. Đánh giá xu hướng hồi quy: Tính regressionLine, averageRegressionSlope, atr và normalizedSlope. Xác định thị trường đang ở trạng thái bullishTrend, bearishTrend hay trung tính.
  3. Theo dõi và cập nhật trạng thái Pullback: Kiểm tra xem setup chờ hiện tại có bị vô hiệu hóa hoặc hết hạn (> 5 nến) hay không; nếu chưa có setup chờ và giá chạm vùng regressionLine ± 0.20 × ATR, ghi nhận pendingBull hoặc pendingBear.
  4. Kiểm tra nến xác nhận & bộ lọc rủi ro: Trong khoảng 1 đến 5 nến sau Pullback, nếu xuất hiện nến xác nhận thỏa mãn longBase/shortBase cùng các bộ lọc bổ sung, bot kiểm tra tiếp điều kiện canTrade (đang Flat, chưa vượt maximumTradesPerDay = 2, hợp lệ phiên giao dịch và chưa đến giờ đóng phiên 14:45) và chống trùng lặp notEnteredThisBar, not ambiguousSignal trước khi gửi lệnh strategy.entry.
  5. Quản trị vị thế và đóng cuối phiên: Ngay khi khớp lệnh, strategy.exit thiết lập SL và TP cố định theo strategy.position_avg_price. Nếu vị thế vẫn còn mở khi nến kết thúc chạm hoặc vượt mốc 14:45 (finalSessionBar), strategy.close_all(immediately=true) sẽ đóng toàn bộ lệnh và dọn dẹp biến giá SL/TP khi vị thế về Flat.

4. Điều kiện vào lệnh Long và Short của CNPS72

4.1. Điều kiện vào lệnh Long

Lệnh Long (finalLongSignal) chỉ được kích hoạt khi thỏa mãn đồng thời toàn bộ các điều kiện sau:

  1. Chế độ cho phép Long: tradeDirection là "Long" hoặc "Both" (mặc định là "Long").
  2. Xu hướng hồi quy tăng (bullishTrend): averageRegressionSlope > 0 và (khi bật requireMinimumSlope) normalizedSlope >= 0.05.
  3. Trong cửa sổ Pullback hợp lệ (validBullPullback): Đã có nhịp chạm vùng regressionLine ± 0.20 × ATR và số nến trôi qua nằm trong khoảng 1 <= barsSinceBullPullback <= 5.
  4. Xác nhận nến (longBase):
    • Nếu bật requireCandleDirection (mặc định true): Nến tăng (close > open).
    • Nếu bật requirePreviousCloseBreak (mặc định false): close > close[1].
    • Nếu bật requireRegressionReclaim (mặc định true): close > regressionLine.
  5. Các bộ lọc tùy chọn (nếu được bật): Gia tốc độ dốc dương (longAccelerationOK), đột biến khối lượng (volumeOK), close > trendEMA (longEMAOK), và nến H1 đã đóng nằm trên H1 EMA (longBiasOK).
  6. An toàn tín hiệu: Không xảy ra tín hiệu 2 chiều đồng thời (not ambiguousSignal) và thỏa mãn canTrade + notEnteredThisBar.

4.2. Điều kiện vào lệnh Short

Lệnh Short (finalShortSignal) được kích hoạt theo cơ chế đối xứng hoàn toàn:

  1. Chế độ cho phép Short: tradeDirection là "Short" hoặc "Both".
  2. Xu hướng hồi quy giảm (bearishTrend): averageRegressionSlope < 0 và (khi bật requireMinimumSlope) normalizedSlope <= -0.05.
  3. Trong cửa sổ Pullback hợp lệ (validBearPullback): Đã có nhịp chạm vùng regressionLine ± 0.20 × ATR và 1 <= barsSinceBearPullback <= 5.
  4. Xác nhận nến (shortBase):
    • Nếu bật requireCandleDirection (mặc định true): Nến giảm (close < open).
    • Nếu bật requirePreviousCloseBreak (mặc định false): close < close[1].
    • Nếu bật requireRegressionReclaim (mặc định true): close < regressionLine.
  5. Các bộ lọc tùy chọn (nếu được bật): Gia tốc độ dốc âm (shortAccelerationOK), đột biến khối lượng (volumeOK), close < trendEMA (shortEMAOK), và nến H1 đã đóng nằm dưới H1 EMA (shortBiasOK).
  6. An toàn tín hiệu: not ambiguousSignal, canTrade và notEnteredThisBar.

4.3. Điều kiện kiểm soát giao dịch chung

Biến canTrade kiểm soát chặt chẽ kỷ luật giao dịch trong ngày:

  • Trạng thái tài khoản: strategy.position_size == 0 (chỉ vào lệnh mới khi đang FLAT, pyramiding=0).
  • Giới hạn lệnh trong ngày: tradesToday < maximumTradesPerDay (mặc định tối đa 2 lệnh/ngày).
  • Khung giờ giao dịch:
    • Khi useSessionFilter = false (mặc định): Cho phép vào lệnh miễn là thời điểm đóng nến chưa chạm giờ đóng phiên (currentCloseMinute < 14:45).
    • Khi useSessionFilter = true: Thời gian mở nến phải từ 09:00 trở đi và thời gian đóng nến không quá 14:30.
  • Xác nhận đóng nến: Bắt buộc barstate.isconfirmed == true để tránh tín hiệu giả trong lúc nến đang chạy.

5. Quản trị Stop Loss, Take Profit và Thoát lệnh

5.1. Cơ chế Stop Loss và bộ lọc Risk

CNPS72 áp dụng cơ chế dừng lỗ cố định theo điểm số từ giá khớp lệnh trung bình (strategy.position_avg_price):

  • Lệnh Long: activeLongSL = entryPrice - stopLossPoints (mặc định entryPrice - 5.0 điểm).
  • Lệnh Short: activeShortSL = entryPrice + stopLossPoints (mặc định entryPrice + 5.0 điểm).
  • Bảo vệ cấu trúc trước khi vào lệnh: Trong thời gian chờ xác nhận Pullback, nếu giá đóng cửa đi lệch quá 1.0 × ATR ngược hướng xu hướng so với regressionLine, setup sẽ tự động bị hủy trước khi kịp phát sinh lệnh.

5.2. Cơ chế Take Profit và Thoát lệnh cuối phiên

  • Chốt lời cố định (Take Profit):
    • Lệnh Long: activeLongTP = entryPrice + takeProfitPoints (mặc định entryPrice + 15.0 điểm).
    • Lệnh Short: activeShortTP = entryPrice - takeProfitPoints (mặc định entryPrice - 15.0 điểm).
  • Không sử dụng Break Even hay Trailing Stop: Trong mã nguồn hiện tại, bot giữ nguyên mức SL/TP cố định để đảm bảo tỷ lệ R:R 1:3 nhất quán, giúp tối ưu kỳ vọng toán học khi bắt đúng nhịp Pullback.
  • Thoát lệnh hết phiên (Session End): Tại nến mà currentMinute < 14:45 và currentCloseMinute >= 14:45 (finalSessionBar), nếu vẫn còn vị thế đang mở, bot gọi strategy.close_all(immediately=true) để đóng toàn bộ vị thế trước phiên ATC, tránh rủi ro gap qua đêm.

5.3. Bảng tổng hợp cơ chế bảo vệ vị thế

Cơ chế thoát lệnhĐiều kiện kích hoạtHành động thực thiGhi chú trong Code
Cắt lỗ (Stop Loss)Giá chạm entryPrice ∓ 5.0 điểmĐóng lệnh qua strategy.exitcomment_loss="SL Long" / "SL Short"
Chốt lời (Take Profit)Giá chạm entryPrice ± 15.0 điểmĐóng lệnh qua strategy.exitcomment_profit="TP Long" / "TP Short"
Đóng hết phiên (Session End)Nến vượt mốc 14:45 (Asia/Ho_Chi_Minh)strategy.close_all(immediately=true)comment="Session End"
Hủy Setup PullbackGãy trend, lệch > 1 ATR hoặc quá 5 nếnReset pendingBull / pendingBearNgăn vào lệnh muộn khi cấu trúc hỏng

6. Hướng dẫn cài đặt và đọc bảng Diagnostics trên TradingView

Các bước cài đặt

  1. Mở biểu đồ hợp đồng tương lai VN30F1M trên TradingView (khuyến nghị khung thời gian giao dịch trong ngày như M5 hoặc M15).
  2. Nhấn vào tab Pine Editor ở thanh công cụ phía dưới màn hình.
  3. Xóa toàn bộ code mẫu mặc định, sao chép nguyên văn đoạn mã nguồn Pine Script v6 ở Mục 1 và dán vào Pine Editor.
  4. Nhấn Save để lưu script, sau đó nhấn Add to chart để đưa chiến lược lên biểu đồ.
  5. Vào biểu tượng bánh răng (Settings) của chiến lược để bật/tắt các bộ lọc tùy chọn hoặc bật Show Diagnostics? nếu muốn theo dõi bảng thống kê trực quan.

Cách đọc bảng chẩn đoán (Diagnostics Table)

Khi bật tùy chọn showDiagnostics = true, bot sẽ vẽ một bảng gồm 2 cột, 19 dòng ở góc trên bên phải biểu đồ (position.top_right) tại nến cuối cùng (barstate.islast):

Dòng hiển thịÝ nghĩa thực tế trong Code
CNPS72Tên bot và khung thời gian biểu đồ đang chạy (timeframe.period)
RegressionGiá trị hiện tại của đường hồi quy tuyến tính regressionLine
SlopeĐộ dốc trung bình averageRegressionSlope (làm tròn 4 chữ số thập phân)
Slope / ATRĐộ dốc đã chuẩn hóa theo ATR (normalizedSlope), dùng đối chiếu với ngưỡng 0.05
TrendTrạng thái xu hướng hiện tại: UP, DOWN hoặc NEUTRAL
ATRGiá trị ATR(14) hiện tại
Bull Pullbacks / Bear PullbacksTổng số lần ghi nhận nhịp Pullback tăng / giảm từ đầu dữ liệu
Bull Confirms / Bear ConfirmsTổng số lần xuất hiện nến xác nhận longBase / shortBase
Pending Long / Pending ShortTrạng thái có đang chờ nến xác nhận sau Pullback hay không (YES / NO)
Volume OKTrạng thái bộ lọc khối lượng hiện tại (YES / NO)
Long Bias / Short BiasTrạng thái bộ lọc xu hướng khung H1 (YES / NO)
Long Entries / Short EntriesTổng số lệnh Long / Short đã vào trong toàn bộ lịch sử backtest
Trades TodaySố lệnh đã mở trong ngày trên giới hạn cho phép (ví dụ 1 / 2)
PositionTrạng thái vị thế hiện tại: LONG, SHORT hoặc FLAT

7. Cách thiết lập cảnh báo tín hiệu giao dịch (Alert)

Để nhận thông báo thời gian thực qua ứng dụng TradingView, Telegram hoặc Webhook khi bot phát sinh tín hiệu:

  1. Nhấn vào biểu tượng Alert (hình đồng hồ báo thức) trên thanh công cụ TradingView.
  2. Tại mục Condition, chọn chiến lược CNPS72 LINEAR REGRESSION SLOPE.
  3. Tại ô Message, xóa nội dung mặc định và nhập chính xác biến sau: {{strategy.order.alert_message}}
  4. Đặt tên Alert và nhấn Create để kích hoạt.

(Lưu ý: Nếu chỉ muốn nhận thông báo vào lệnh và đóng phiên, bạn có thể tick chọn Disable SL / TP Alerts? trong phần cài đặt của bot).

Bảng thông điệp Alert của CNPS72

Sự kiện kích hoạtNội dung thông điệp (alert_message / alert_profit / alert_loss)
Vào lệnh Long🟢 VÀO VỊ THẾ LONG (CNPS72 Linear Regression)\n🎯 Giá vào: <giá>\n🛑 Cắt lỗ (SL): <giá SL>\n💰 Chốt lời (TP): <giá TP>
Vào lệnh Short🔴 VÀO VỊ THẾ SHORT (CNPS72 Linear Regression)\n🎯 Giá vào: <giá>\n🛑 Cắt lỗ (SL): <giá SL>\n💰 Chốt lời (TP): <giá TP>
Chốt lời Long (TP)💰 CHỐT LỜI LONG (TP HIT)\n🎯 Giá chốt: <giá TP>
Cắt lỗ Long (SL)🛑 CẮT LỖ LONG (SL HIT)\n🎯 Giá cắt: <giá SL>
Chốt lời Short (TP)💰 CHỐT LỜI SHORT (TP HIT)\n🎯 Giá chốt: <giá TP>
Cắt lỗ Short (SL)🛑 CẮT LỖ SHORT (SL HIT)\n🎯 Giá cắt: <giá SL>
Đóng vị thế cuối phiên⏰ ĐÓNG VỊ THẾ HẾT PHIÊN (Session End)\n🎯 Giá đóng: <giá đóng>

Kết luận

Bot CNPS72 Linear Regression Slope là một hệ thống giao dịch có cấu trúc logic rõ ràng, kết hợp giữa toán học hồi quy tuyến tính và hành động giá Pullback. Nhờ cơ chế chuẩn hóa độ dốc theo ATR, bộ đếm cửa sổ xác nhận 1–5 nến cùng tỷ lệ R:R cố định 1:3 (5 điểm SL / 15 điểm TP), chiến lược phát huy hiệu quả tốt nhất trong những phiên VN30F1M có xu hướng rõ ràng và có các nhịp điều chỉnh kỹ thuật lành mạnh về vùng cân bằng.

Bạn có thể tham khảo thêm các hệ thống giao dịch tự động khác trên VN30F1M như Bot CNPS50 - Trend Analysis V2 và Bot CNPS49 - Daily Open để đa dạng hóa danh mục chiến lược.

Thông tin chỉ mang tính tham khảo, không phải khuyến nghị đầu tư. Kết quả kiểm thử quá khứ không đảm bảo lợi nhuận trong tương lai.

Thông tin trong bài chỉ mang tính tham khảo, không phải khuyến nghị mua bán. Giao dịch phái sinh có rủi ro cao do sử dụng đòn bẩy; nhà đầu tư tự chịu trách nhiệm với quyết định của mình.

Đinh Mạnh Đạt

Nhà nghiên cứu định lượng, chuyên sâu về dữ liệu Open Interest và quản trị vị thế.

Bản tin phái sinh mỗi phiên
Nhận bản tin mỗi phiên + Dự báo Nhịp đập phái sinh

Giao dịch & cuộc sống

Xem tất cả →
Cộng đồng