윌리엄스의 악어 스칼핑 전략

저자:차오장, 날짜: 2023-09-25 17:42:27
태그:

전반적인 설명

이 전략은 빌 윌리엄스 알리거터 지표에 기반하지만 가격 입력으로 하이켄 아시 촛불을 사용합니다. 1분에서 5분 시간 프레임에 적합한 단기 스칼핑 전략입니다.

전략 논리

전략의 주요 거래 원칙은 다음과 같습니다.

  1. 가격 액션을 위해 일반 촛불 대신 하이켄 아시 촛불을 사용한다. 하이켄 아시는 잡음을 필터링하고 트렌드를 식별한다.

  2. 빌 윌리엄스 알리거터의 3개의 이동평균선을 적용합니다. 턱, 이빨, 입술입니다. 그들은 트렌드 방향을 결정하기 위해 이동평균처럼 작용합니다.

  3. 이 선들이 턱 (최하), 이빨 (중), 입술 (최고) 로 쌓이면 상승 추세를 나타냅니다. 턱 (최고), 이빨 (중), 입술 (최하) 로 역전되면 하락 추세를 나타냅니다.

  4. 엔트리는 하이켄 아시 촛불 방향 + 알리거터 라인 정렬에 기초합니다. 상승 촛불과 황소 설정에 대한 긴 엔트리; 하락 촛불과 곰 설정에 대한 짧은 엔트리.

  5. 알리거터 선이 넘어가면 빠져나갑니다. 트렌드 전환을 신호합니다.

  6. 고정 취득, 위험 관리에 사용되는 손실 중지 포인트. 목표 포인트, 손실 중지 포인트, 후속 중지 등을 구성 할 수 있습니다.

하이켄 아시와 알리거터의 이중 필터를 결합하면 높은 확률의 단기 거래 전략을 만듭니다.

장점

이 전략의 주요 장점은 다음과 같습니다.

  1. 이중 표시기 필터링은 잘못된 신호를 최소화합니다. 하이켄 아시 + 알리거터는 신호 품질을 향상시킵니다.

  2. 명확하고 직관적인 트렌드 식별 알리거터 라인은 불투명한 황소 / 곰 신호를 가지고 있습니다.

  3. 단기 스칼핑에 효율적입니다. 1분에서 5분 차트에서 가격 변동을 포착합니다.

  4. 간단한 매개 변수, 복잡한 최적화가 필요하지 않습니다.

  5. 수익을 취하고 손실을 멈추는 지점을 통해 엄격한 위험 관리

  6. 알리거터 라인 크로스 (Alligator line crossing) 에 기초한 입국/출국 규칙이 정의됩니다.

  7. 구현하고 복제하기 쉬우며 초보자 편리합니다.

위험성

고려해야 할 주요 위험은 다음과 같습니다.

  1. 휘프사브로 인한 마감 위험. 자주 알리거터 신호가 거래와 비용을 증가시킬 수 있습니다.

  2. 시장의 위험은 범위를 제한합니다.

  3. 과도한 최적화 위험, 잘못된 매개 변수 조정으로 인해 곡선 부착

  4. 지표 고장 위험 극한 조건에서 악어가 작동을 중단 할 수 있습니다.

  5. 스톱 로스 미끄러짐 위험. 격차는 불합리한 손실을 유발하는 스톱을 유발할 수 있습니다.

  6. 거래 빈도가 높습니다. 더 많은 거래는 거래 비용을 증가시킵니다.

예상 분석, 최적화된 정차, 제어 된 주파수 등이 이러한 위험의 많은 부분을 해결할 수 있습니다.

더 나은 기회

전략을 개선 할 수있는 몇 가지 방법은 다음과 같습니다.

  1. 더 높은 승률을 위해 RSI와 같은 추가 필터를 포함합니다.

  2. 트레이드당 손실을 제어하기 위해 동적 ATR 정지를 사용합니다.

  3. 베팅 크기를 최적화하기 위해 포지션 사이즈 규칙을 추가합니다. 트렌드 강도에 따라 증가합니다.

  4. 차트 패턴이나 다른 기술적 분석을 결합하여 입력 시기를 결정합니다.

  5. 기기 유형 (주식, 외환 등) 에 따라 매개 변수를 최적화합니다.

  6. 적응적 매개 변수 최적화를 위한 기계 학습을 도입합니다.

  7. 예상 분석을 수행하여 수익 대 손실 비율을 조정합니다.

지속적인 개선을 통해 전략은 강력한 단기 거래 시스템이 될 수 있습니다.

결론

이 전략은 하이켄 아시와 윌리엄스 알리거터를 결합하여 높은 확률의 단기 거래 전략을 만듭니다. 이중 지표 필터링, 간단한 매개 변수 및 잘 정의된 엔트리 / 엑시트 메커니즘을 활용하여 효과적으로 스칼프 트렌드 및 역전을 수행합니다. 그러나 시장의 범위 및 스톱 로스 리스크의 위프사우는 적극적인 관리가 필요합니다. 지속적인 정제로 인해 비교적 안정적인 단기 거래 시스템으로 발전 할 수 있습니다.


/*backtest
start: 2022-09-18 00:00:00
end: 2023-09-24 00:00:00
period: 4d
basePeriod: 1d
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/
// © 03.freeman
//Scalping strategy based on Bill Williams Alligator technique but applied to heikin ashi candles
//This strategy has to be applied to standard candles and low time frames (1min to 5min)
//@version=4
strategy("Bill Williams Alligator improved", shorttitle="Scalping alligator",overlay=true)
//source = input(close)
useHA = input (true,"Use heikin ashi candle?")

// ----------MA calculation - ChartArt-------------
smoothinput = input(1, minval=1, maxval=5, title='Moving Average Calculation: (1=SMA), (2=EMA), (3=WMA), (4=Linear), (5=VWMA)')

calc_ma(src,l) => 
    smoothinput == 1 ? sma(src, l):smoothinput == 2 ? ema(src, l):smoothinput == 3 ? wma(src, l):smoothinput == 4 ? linreg(src, l,0):smoothinput == 5 ? vwma(src,l):na
//----------------------------------------------

heikinashi_close = security(heikinashi(syminfo.tickerid), timeframe.period, close)
heikinashi_open = security(heikinashi(syminfo.tickerid), timeframe.period, open)
heikinashi_hl2 = security(heikinashi(syminfo.tickerid), timeframe.period, hl2)

direzione=heikinashi_close>heikinashi_open and heikinashi_close[1]>heikinashi_open[1]? 1 : heikinashi_close<heikinashi_open and heikinashi_close[1]<heikinashi_open[1]? -1 : 0

jawLength = input(13, minval=1, title="Jaw Length")
teethLength = input(8, minval=1, title="Teeth Length")
lipsLength = input(5, minval=1, title="Lips Length")
jawOffset = input(8, title="Jaw Offset")
teethOffset = input(5, title="Teeth Offset")
lipsOffset = input(3, title="Lips Offset")
jaw = calc_ma(heikinashi_hl2, jawLength)
teeth = calc_ma(heikinashi_hl2, teethLength)
lips = calc_ma(heikinashi_hl2, lipsLength)
plot(jaw, title="jaw",offset = jawOffset, color=#3BB3E4)
plot(teeth, title="teeth",offset = teethOffset, color=#FF006E)
plot(lips, title="lips",offset = lipsOffset, color=#36C711)

longCondition = direzione[0]==1 and jaw<teeth and jaw<lips and teeth<lips 
shortCondition = direzione[0]==-1 and jaw>teeth and jaw>lips and teeth>lips


//  Strategy: (Thanks to JayRogers)
// === STRATEGY RELATED INPUTS ===
//tradeInvert     = input(defval = false, title = "Invert Trade Direction?")
// the risk management inputs
inpTakeProfit   = input(defval = 0, title = "Take Profit Points", minval = 0)
inpStopLoss     = input(defval = 0, title = "Stop Loss Points", minval = 0)
inpTrailStop    = input(defval = 0, title = "Trailing Stop Loss Points", minval = 0)
inpTrailOffset  = input(defval = 0, title = "Trailing Stop Loss Offset Points", minval = 0)

// === RISK MANAGEMENT VALUE PREP ===
// if an input is less than 1, assuming not wanted so we assign 'na' value to disable it.
useTakeProfit   = inpTakeProfit  >= 1 ? inpTakeProfit  : na
useStopLoss     = inpStopLoss    >= 1 ? inpStopLoss    : na
useTrailStop    = inpTrailStop   >= 1 ? inpTrailStop   : na
useTrailOffset  = inpTrailOffset >= 1 ? inpTrailOffset : na

// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() => direzione[0]==1 and jaw<teeth and jaw<lips and teeth<lips // functions can be used to wrap up and work out complex conditions
exitLong() => jaw>teeth or jaw>lips or teeth>lips
strategy.entry(id = "Buy", long = true, when = enterLong() )    // use function or simple condition to decide when to get in
strategy.close(id = "Buy", when = exitLong() )                  // ...and when to get out

// === STRATEGY - SHORT POSITION EXECUTION ===
enterShort() => direzione[0]==-1 and jaw>teeth and jaw>lips and teeth>lips
exitShort() => jaw<teeth or jaw<lips or teeth<lips
strategy.entry(id = "Sell", long = false, when = enterShort())
strategy.close(id = "Sell", when = exitShort() )

// === STRATEGY RISK MANAGEMENT EXECUTION ===
// finally, make use of all the earlier values we got prepped
strategy.exit("Exit Buy", from_entry = "Buy", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
strategy.exit("Exit Sell", from_entry = "Sell", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)

// === Backtesting Dates === thanks to Trost

testPeriodSwitch = input(false, "Custom Backtesting Dates")
testStartYear = input(2020, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testStartHour = input(0, "Backtest Start Hour")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,testStartHour,0)
testStopYear = input(2020, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(31, "Backtest Stop Day")
testStopHour = input(23, "Backtest Stop Hour")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,testStopHour,0)
testPeriod() =>
    time >= testPeriodStart and time <= testPeriodStop ? true : false
isPeriod = true
// === /END

if not isPeriod
    strategy.cancel_all()
    strategy.close_all()

더 많은