
Chiến lược này dựa trên các tín hiệu giao dịch dựa trên đường trung bình di chuyển đơn giản (MA99) 99 chu kỳ. Bạn có thể mở vị trí khi giá chạm MA99 mà không cần hai đường K xác nhận. Trong khi đó, dừng lỗ là dừng động, tức là khi giá vượt qua MA99 và được xác nhận trong đường K tiếp theo. Chiến lược này nhằm mục đích nắm bắt sự biến động của giá gần MA99 và đồng thời kiểm soát rủi ro bằng cách dừng động.
MA99 tiếp xúc với chiến lược dừng động để mở vị trí bằng cách đánh giá mối quan hệ giữa giá và MA99 và sử dụng dừng động để kiểm soát rủi ro. Chiến lược này đơn giản và dễ sử dụng, có thể theo dõi xu hướng trung và dài hạn, nhưng có thể gặp vấn đề giao dịch thường xuyên trong thị trường bất ổn. Các biện pháp có thể được nâng cao hơn nữa về hiệu suất và sự ổn định của chiến lược bằng cách giới thiệu các bộ lọc chỉ số khác, tham số tối ưu hóa, quản lý vị trí và xem xét chi phí.
/*backtest
start: 2023-04-23 00:00:00
end: 2024-04-28 00:00:00
period: 1d
basePeriod: 1h
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/
//@version=5
strategy("MA99 Temas ve Dinamik Stop-Loss Stratejisi", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// MA99 hesaplayalım
ma99 = ta.sma(close, 99)
plot(ma99, color=color.blue, title="MA99")
// Fiyatın MA99'a temas edip etmediğini kontrol edelim
priceTouchedMA99 = (low <= ma99 and high >= ma99)
// Long ve short koşullarını tanımlayalım
longCondition = priceTouchedMA99 and close > ma99
shortCondition = priceTouchedMA99 and close < ma99
var float longStopLoss = na
var float shortStopLoss = na
var int longStopTriggered = 0
var int shortStopTriggered = 0
// Alım veya satım sinyallerine göre işlemleri başlatalım ve stop-loss ayarlayalım
if (longCondition)
strategy.entry("Long Entry", strategy.long)
longStopLoss := ma99
longStopTriggered := 0
if (shortCondition)
strategy.entry("Short Entry", strategy.short)
shortStopLoss := ma99
shortStopTriggered := 0
// Stop-loss koşullarını ve iki mum kuralını kontrol edelim
if (not na(longStopLoss))
if (close < longStopLoss)
longStopTriggered := 1
else
longStopTriggered := 0
if (longStopTriggered[1] == 1 and close < longStopLoss) // Bir önceki mumda tetiklendi ve hala altında
strategy.close("Long Entry", comment="Stop Loss Long")
longStopLoss := na
longStopTriggered := 0
if (not na(shortStopLoss))
if (close > shortStopLoss)
shortStopTriggered := 1
else
shortStopTriggered := 0
if (shortStopTriggered[1] == 1 and close > shortStopLoss) // Bir önceki mumda tetiklendi ve hala üstünde
strategy.close("Short Entry", comment="Stop Loss Short")
shortStopLoss := na
shortStopTriggered := 0