
이 전략은 간단한 이동 평균에 기반한 트렌드 추적 및 역전 거래 전략이다. 1일선과 4일선의 평행선 교차를 사용하여 트렌드 방향을 판단하고, 구매 및 판매 신호를 생성한다.
1일선이 위쪽에서 아래쪽으로 4일선을 가로지르면 판매 신호가 발생하고, 1일선이 아래쪽에서 4일선을 가로지르면 구매 신호가 발생한다. 이렇게 빠른 이동 평균과 느린 이동 평균의 교차로 시장 추세의 전환점을 판단하여 수익을 얻는다.
상장 후 스톱 로즈와 스톱 을 설정한다. 스톱 로즈는 상장 가격 아래 10점으로 설정하고, 스톱 은 상장 가격 위 100점으로 설정한다. 이로 인해 손실을 제한하고 이익을 잠금할 수 있다.
평균선 파라미터를 조정하거나, 동적 스톱 스톱 메커니즘을 설정하거나, 다른 지표 판단을 추가하여 이러한 위험을 줄일 수 있다.
이 전략은 전체적으로 전형적인 쌍평평선 거래 전략이다. 이 전략은 빠른 느린 평평선 교차 판단 트렌드 전환점을 사용하고, 스톱 스톱 제어 위험을 설정하고, 간단하고 실용적이며, 이해하기 쉽으며, 초보자에게 적합하다. 매개 변수를 조정하고 최적화하여, 다른 시장 환경에 적응할 수 있으며, 다른 지표 필터링을 추가하여 효과를 높일 수 있다.
/*backtest
start: 2023-11-19 00:00:00
end: 2023-12-19 00:00:00
period: 1h
basePeriod: 15m
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/
// © cesarpieres72
//@version=5
strategy("300% STRATEGY", overlay=true, margin_long=10, margin_short=10)
var float lastLongOrderPrice = na
var float lastShortOrderPrice = na
longCondition = ta.crossover(ta.sma(close, 1), ta.sma(close, 4))
if (longCondition)
strategy.entry("Long Entry", strategy.long) // Enter long
shortCondition = ta.crossunder(ta.sma(close, 1), ta.sma(close, 4))
if (shortCondition)
strategy.entry("Short Entry", strategy.short) // Enter short
if (longCondition)
lastLongOrderPrice := close
if (shortCondition)
lastShortOrderPrice := close
// Calculate stop loss and take profit based on the last executed order's price
stopLossLong = lastLongOrderPrice - 170 // 10 USDT lower than the last long order price
takeProfitLong = lastLongOrderPrice + 150 // 100 USDT higher than the last long order price
stopLossShort = lastShortOrderPrice + 170 // 10 USDT higher than the last short order price
takeProfitShort = lastShortOrderPrice - 150 // 100 USDT lower than the last short order price
// Apply stop loss and take profit to long positions
strategy.exit("Long Exit", from_entry="Long Entry", stop=stopLossLong, limit=takeProfitLong)
// Apply stop loss and take profit to short positions
strategy.exit("Short Exit", from_entry="Short Entry", stop=stopLossShort, limit=takeProfitShort)