이 전략은 이동 평균을 기반으로 거래 채널을 형성하고, 가격이 채널을 뚫고 오르락 내리락 할 때 거래 신호를 발생시킨다. 전형적인 트렌드 추적 전략으로, 매개 변수를 최적화하여 간단한 효과적인 장기 지위 운영을 가능하게 한다.
이동 평균을 계산할 때 SMA/EMA/WMA/RMA와 같은 다양한 유형을 선택할 수 있다.
통로 상 궤도 이동 평균의 일정한 비율의 증가. 아래 궤도 일정한 비율의 감소.
가격 돌파 위 궤도를 할 때 더; 돌파 하향 궤도를 할 때 공백. 그냥 더, 그냥 공백 또는 양방향 거래를 선택할 수 있습니다.
스톱포드 스톱로스를 설정한다. 스톱포드는 입점 가격의 일정한 비율의 증가이다. 스톱포드는 일정한 비율의 감소이다.
이동 평균을 계산하는 것은 간단하고, 추세를 판단하는 것은 쉽다.
조정 가능한 매개 변수는 서로 다른 포지션 보유 시간 및 위험 선호도를 구현한다.
더 많은 공백을 선택하여 다양한 시장 상황에 적응할 수 있습니다.
제동 제동 손실 고정 비율, 제어 가능
트렌드가 바뀌면 쉽게 속일 수 있다.
잘못된 매개 변수 설정으로 인해 거래가 너무 자주 또는 지연될 수 있다.
고정 비율 스톱 스톱 손실은 충분히 유연하지 않습니다.
양방향 거래는 거래 빈도와 수수료 비용을 증가시킵니다.
이동 평균 파라미터를 최적화하여 지연과 잡음을 균형 잡는다.
채널 대역폭을 최적화하여 시장의 변동 빈도와 일치합니다.
다양한 스탠프 스탠프 손실 설정을 테스트하십시오. 동적 스탠프 손실이 더 효과적입니다.
트렌드, 진동 지표 등을 추가하여 대도시를 판단한다.
중요한 사건의 영향을 피하기 위해 필터링 시간을 추가하십시오.
이 전략은 이동 평균 채널을 통해 간단한 추세를 따라하지만, 파라미터 최적화 및 위험 통제를 강화해야합니다. 이 기초에서, 더 많은 기술 지표가 도입되어 전략 논리를 더욱 개선 할 수 있습니다.
/*backtest
start: 2023-08-17 00:00:00
end: 2023-09-16 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TaylorTneh
//@version=4
// strategy("Moving Average Band Taylor V1",shorttitle="MA Band+",overlay=true,default_qty_type=strategy.cash,default_qty_value=1000,initial_capital=1000,currency=currency.USD,commission_value=.1)
price = input(close, title="Source")
mabtype = input(title="Moving Average Type", defval="RMA", options=["SMA", "EMA", "RMA", "WMA"])
malen = input(10, "MA Period : 10")
magap = input(0.6, "Band Gap : 0.6", minval = -10, maxval = 10, step = 0.1)
mabup = if mabtype == "SMA"
sma(high, malen)
else
if mabtype == "EMA"
ema(high, malen)
else
if mabtype == "WMA"
wma(high, malen)
else
if mabtype == "RMA"
rma(high, malen)
mabdn = if mabtype == "SMA"
sma(low, malen)
else
if mabtype == "EMA"
ema(low, malen)
else
if mabtype == "WMA"
wma(low, malen)
else
if mabtype == "RMA"
rma(low, malen)
upex = mabup * (1 + magap/100)
dnex = mabdn * (1 - magap/100)
plot(upex, "Upper MA Band", color.orange)
plot(dnex, "Lower MA Band", color.orange)
//-------------------------------------------- (Strategy)
strategy.entry("Long", strategy.long, stop = upex)
strategy.entry("Short", strategy.short, stop = dnex)
//Long Only//strategy.entry("Long", strategy.long, stop = upex)
//Long Only//strategy.exit("Short", stop = dnex)
//Short Only//strategy.entry("Short", strategy.short, stop = dnex)
//Short Only//strategy.exit("Long", stop = upex)
//-------------------------------------------- (Take Profit & Stop Lose)
stopPer = input(500.0, title='# Stop Loss %', type=input.float) / 100
takePer = input(500.0, title='# Take Profit %', type=input.float) / 100
//Determine where you've entered and in what direction
longStop = strategy.position_avg_price * (1 - stopPer)
shortStop = strategy.position_avg_price * (1 + stopPer)
shortTake = strategy.position_avg_price * (1 - takePer)
longTake = strategy.position_avg_price * (1 + takePer)
if strategy.position_size > 0
strategy.exit(id="L-TP/SL", stop=longStop, limit=longTake)
if strategy.position_size < 0
strategy.exit(id="S-TP/SL", stop=shortStop, limit=shortTake)
//-------------------------------------------- (Sample Time Filter Strategy)
//fromyear = input(2018, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
//toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
//frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
//tomonth = input(10, defval = 10, minval = 01, maxval = 12, title = "To Month")
//fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
//today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
//strategy.entry("Long", strategy.long, stop = upex, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
//strategy.entry("Short", strategy.short, stop = dnex, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
//--------------------------------------------