이 전략은 99주기 간단한 이동 평균 ((MA99) 을 기반으로 거래 신호를 판단한다. 가격이 MA99을 만질 때 포지션을 열 수 있으며, 두 개의 K 라인 확인이 필요하지 않다. 그리고 상쇄는 다이내믹 스톱을 사용한다. 즉, 가격이 MA99을 뚫고 다음 K 라인에서 확인되면 평정 포지션 중지이다. 이 전략은 MA99 근처의 가격을 포착하는 것을 목표로 하고, 동시에 다이내믹 스톱을 통해 위험을 제어한다.
MA99 접촉과 동적 손실 전략은 가격과 MA99의 관계를 판단하여 포지션을 열고 동적 손실을 사용하여 위험을 제어한다. 이 전략은 간단하고 사용하기 쉽고 중·장기 추세를 따라갈 수 있지만, 불안정한 시장에서 자주 거래하는 문제가 발생할 수 있다. 다른 지표 필터링, 최적화 매개 변수, 포지션 관리 및 비용을 고려하는 등의 조치를 도입함으로써 이 전략의 성과와 안정성을 더욱 향상시킬 수 있다.
/*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