
Bạn có biết không? Chiến lược này giống như cây kim cương của thần biển Hy Lạp cổ đại, Poseidon, xây dựng một vũ khí giao dịch mạnh mẽ với ba điểm chính!
Hãy tưởng tượng bạn dựng một cái lều đơn giản trên bờ biển bằng ba cây gỗ ️ - cái đầu tiên là cột trụ, hai cái còn lại tạo thành ranh giới của lều. Khi gió (cái giá) phá vỡ ranh giới của lều, đó là tín hiệu cho hành động của chúng tôi!
Hãy tập trung!Ý nghĩa của chiến lược này là:
Giống như ở một trạm xe điện ngầm đông đúc, bạn nhìn vào ba điểm chính của dòng người và đoán trước rằng đám đông sẽ đổ về hướng nào!
Hướng dẫn tránh hốKhông phải tất cả những đột phá đều đáng để theo đuổi!
Làm nhiều điều kiện:
Điều kiện làm trống:
Và điều tốt nhất trong chiến lược này là nó có một quản lý tài trợ cho khoa học được xây dựng sẵn!
Giống như khi bạn đi chơi xe đạp leo núi ở công viên giải trí, dây an toàn phải được thắt chặt, nhưng bạn cũng phải để cho mình một chút không gian kích thích!
Hãy nhớ rằng, giao dịch giống như học đi xe đạp ♀️, bạn có thể sẽ phải vật lộn lúc đầu, nhưng khi bạn nắm được sự cân bằng, bạn sẽ được tự do! Chiến lược ba bánh là “bánh xe phụ trợ” của bạn, giúp bạn giữ thăng bằng trong thị trường.
/*backtest
start: 2024-10-29 00:00:00
end: 2025-10-27 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("Pitchfork Trading Friends",
overlay=true,
default_qty_type=strategy.percent_of_equity,
default_qty_value=100) // We will calculate size manually
// === 1. INPUTS ===
leftBars = input.int(10, "Pivot Left Bars", minval=1)
rightBars = input.int(10, "Pivot Right Bars", minval=1)
riskPercent = input.float(1.0, "Risk Per Trade %", minval=0.1, step=0.1)
// === 2. PIVOT DETECTION & STORAGE ===
// Find pivot points
float ph = ta.pivothigh(high, leftBars, rightBars)
float pl = ta.pivotlow(low, leftBars, rightBars)
// Store the last 3 pivots (P1, P2, P3)
var float p1_price = na
var int p1_bar = na
var float p2_price = na
var int p2_bar = na
var float p3_price = na
var int p3_bar = na
var int lastPivotType = 0 // 0=none, 1=high, -1=low
// Update pivots when a new one is found, ensuring they alternate
if not na(ph) and lastPivotType != 1
p1_price := p2_price
p1_bar := p2_bar
p2_price := p3_price
p2_bar := p3_bar
p3_price := ph
p3_bar := bar_index[rightBars]
lastPivotType := 1
if not na(pl) and lastPivotType != -1
p1_price := p2_price
p1_bar := p2_bar
p2_price := p3_price
p2_bar := p3_bar
p3_price := pl
p3_bar := bar_index[rightBars]
lastPivotType := -1
// === 3. PITCHFORK CALCULATION & DRAWING ===
// We need 3 valid points to draw
bool has3Pivots = not na(p1_bar) and not na(p2_bar) and not na(p3_bar)
// Declare lines
var line medianLine = na
var line upperLine = na
var line lowerLine = na
// Declare line prices for strategy logic
var float ml_price = na
var float ul_price = na
var float ll_price = na
if (has3Pivots)
// P1, P2, P3 coordinates
p1_y = p1_price
p1_x = p1_bar
p2_y = p2_price
p2_x = p2_bar
p3_y = p3_price
p3_x = p3_bar
// Calculate midpoint of P2-P3
mid_y = (p2_y + p3_y) / 2.0
mid_x = (p2_x + p3_x) / 2.0
// Calculate Median Line (ML) slope
float ml_slope = (mid_y - p1_y) / (mid_x - p1_x)
// Calculate price on current bar for each line
// y = m*(x - x_n) + y_n
ml_price := ml_slope * (bar_index - p1_x) + p1_y
// Identify which pivot is high (P2 or P3)
float highPivot_y = p2_y > p3_y ? p2_y : p3_y
int highPivot_x = p2_y > p3_y ? p2_x : p3_x
float lowPivot_y = p2_y < p3_y ? p2_y : p3_y
int lowPivot_x = p2_y < p3_y ? p2_x : p3_x
// Upper/Lower line prices
ul_price := ml_slope * (bar_index - highPivot_x) + highPivot_y
ll_price := ml_slope * (bar_index - lowPivot_x) + lowPivot_y
// === 4. STRATEGY LOGIC ===
// Define trend by pitchfork slope
bool trendUp = ml_slope > 0
bool trendDown = ml_slope < 0
// Entry Conditions
bool longEntry = ta.crossover(close, ul_price) // Breakout
bool shortEntry = ta.crossunder(close, ll_price) // Breakdown
// Risk Calculation
float capital = strategy.equity
float riskAmount = (capital * riskPercent) / 100
// --- LONG TRADE ---
if (longEntry and trendUp)
float sl_price = ml_price // SL at median line
float stop_loss_pips = close - sl_price
float tp_price = close + stop_loss_pips // 1:1 TP
// Calculate position size
float positionSize = riskAmount / (stop_loss_pips * syminfo.pointvalue)
if (positionSize > 0)
strategy.entry("Long", strategy.long, qty=positionSize)
strategy.exit("SL/TP Long", from_entry="Long", stop=sl_price, limit=tp_price)
// --- SHORT TRADE ---
if (shortEntry and trendDown)
float sl_price = ml_price // SL at median line
float stop_loss_pips = sl_price - close
float tp_price = close - stop_loss_pips // 1:1 TP
// Calculate position size
float positionSize = riskAmount / (stop_loss_pips * syminfo.pointvalue)
if (positionSize > 0)
strategy.entry("Short", strategy.short, qty=positionSize)
strategy.exit("SL/TP Short", from_entry="Short", stop=sl_price, limit=tp_price)