
Chiến lược này là một hệ thống giao dịch ngắn hạn kết hợp các chỉ số Squeeze Momentum Indicator (SMI) và Ultimate Buy/Sell (UBS). Chiến lược này chủ yếu để nắm bắt cơ hội tháo lỗ của thị trường bằng cách theo dõi xu hướng thay đổi động lực giá và tín hiệu chéo của đường trung bình di chuyển. Hệ thống được thiết kế dựa trên cơ chế kiểm soát lỗ hổng dựa trên tỷ lệ phần trăm, theo đuổi lợi nhuận ổn định trong khi bảo vệ an toàn vốn.
Lý luận cốt lõi của chiến lược này dựa trên sự kết hợp của hai chỉ số chính:
Chiến lược này được xây dựng bằng cách kết hợp hai chỉ số kỹ thuật của động lực bóp méo và mua bán cuối cùng, tạo ra một hệ thống giao dịch ngoại hối tương đối hoàn chỉnh. Ưu điểm của chiến lược là tín hiệu đáng tin cậy cao, kiểm soát rủi ro rõ ràng, nhưng đồng thời có tính chất phụ thuộc mạnh vào môi trường thị trường.
/*backtest
start: 2024-10-28 00:00:00
end: 2024-11-27 00:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © algostudio
// Code Generated using PineGPT - www.marketcalls.in
//@version=5
strategy("Squeeze Momentum and Ultimate Buy/Sell with Stop Loss", overlay=true, process_orders_on_close = false)
// Input settings
smiLength = input.int(20, title="SMI Length")
smiSmoothing = input.int(5, title="SMI Smoothing")
ultBuyLength = input.int(14, title="Ultimate Buy/Sell Length")
stopLossPerc = input.float(2.5, title="Stop Loss Percentage", step=0.1) / 100
// Define Squeeze Momentum logic
smi = ta.sma(close - ta.lowest(low, smiLength), smiSmoothing) - ta.sma(ta.highest(high, smiLength) - close, smiSmoothing)
squeezeMomentum = ta.sma(smi, smiSmoothing)
smiUp = squeezeMomentum > squeezeMomentum[1]
smiDown = squeezeMomentum < squeezeMomentum[1]
// Define Ultimate Buy/Sell Indicator logic (you can customize the conditions)
ultimateBuy = ta.crossover(close, ta.sma(close, ultBuyLength))
ultimateSell = ta.crossunder(close, ta.sma(close, ultBuyLength))
// Trading logic: Short entry (Squeeze Momentum from green to red and Ultimate Sell signal)
shortCondition = smiDown and ultimateSell
if (shortCondition)
strategy.entry("Short", strategy.short)
//Set short target (exit when price decreases by 0.2%)
shortTarget = strategy.position_avg_price * 0.996
// Set stop loss for short (5% above the entry price)
shortStop = strategy.position_avg_price * (1 + stopLossPerc)
// Exit logic for short
if (strategy.position_size < 0)
strategy.exit("Exit Short", "Short", limit=shortTarget, stop=shortStop)
// Plot the Squeeze Momentum for reference
plot(squeezeMomentum, color=color.blue, linewidth=2, title="Squeeze Momentum")
// Optional: Plot signals on the chart
plotshape(series=ultimateBuy, location=location.belowbar, color=color.green, style=shape.labelup, title="Ultimate Buy Signal")
plotshape(series=ultimateSell, location=location.abovebar, color=color.red, style=shape.labeldown, title="Ultimate Sell Signal")
// For more tutorials on Tradingview Pinescript visit https://www.marketcalls.in/category/tradingview