듀얼 인디케이터 콤보 미친 내일 스칼핑 전략

저자:차오장, 날짜: 2023-12-01 14:47:57
태그:

img

전반적인 설명

이 전략은 LuxAlgo의 TMO 및 AMA 지표의 구매 및 판매 신호를 결합하여 범위 연대화 과정에서 트렌드의 시작을 파악합니다. TMO 신호, AMA 끝자락 및 촛불 몸집 크기의 증가 조건이 충족되면 길거나 짧습니다. 스톱 로스는 최근 바를 기반으로 최신 스윙 하위 / 하위로 설정됩니다.

전략 논리

TMO 지표는 가격 모멘텀을 반영한다. 오시레이터 지표 유형에 속하며 오차가 발생하면 거래 신호를 생성할 수 있다. AMA 지표는 평형 이동 평균이다. 가격 변동의 범위를 보여주며, 가격이 상위/하위 대역에 접근할 때 과잉 구매/ 과잉 판매 조건을 나타낸다.

이 전략의 주된 논리는: TMO는 트렌드 분리를 감지하여 거래 신호를 생성 할 수 있습니다. AMA는 가격 반전 구역을 식별 할 수 있습니다. 촛불 몸 크기를 증가시키는 확인과 함께 트렌드 시작을 캡처하는 정확도를 향상시킬 수 있습니다. 따라서 전략은:

  1. TMO는 구매 신호를 주고, 즉, 상승성 오차를 주고 AMA는 최대 절경을 보여줍니다.
  2. TMO는 판매 신호를 주고, 즉 하향적 분리를 주고, AMA는 최저점을 보여준다.
  3. 또한 가장 최근 3 촛불의 몸의 크기를 확장해야합니다

이것은 단일 지표의 잘못된 신호 문제를 해결합니다. 최근 바 최고 최고/최저 최저에 기반한 스톱 손실은 위험을 효과적으로 제어 할 수 있습니다.

장점

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

  1. 지표 조합은 신호 정확성을 향상시킵니다. TMO와 AMA는 서로 검증하여 잘못된 신호를 줄이고 정확성을 향상시킵니다.

  2. 여러 조건이 트렌드 시작을 포착합니다. TMO 신호, AMA 끝자락 및 촛불 크기를 증가시키는 조합은 스칼핑 전략이 추구하는 트렌드 시작을 효과적으로 식별 할 수 있습니다.

  3. 촛불 기반의 스톱 로스는 위험을 관리합니다. 최근 바 최고/최저 가격을 스톱 로스로 사용하여 지표 재 계산으로 인한 지연 위험을 피하면서 각 거래의 위험을 제어합니다.

  4. 간결하고 효과적인 논리. 단지 두 가지 지표로 전략은 명확하고 간단한 논리로 완전한 스칼핑 시스템을 구현했습니다. 백테스트 결과는 또한 수익성이 보입니다.

위험성

전략의 주요 위험은:

  1. 빈번한 출입 거래 위험. 짧은 보유 기간을 목표로 하는 스칼핑 전략으로서, 높은 거래 비용은 수익성에 영향을 줄 수 있습니다.

  2. 공격적인 스톱 로스 위험. 최근 극단적인 스톱 로스 가격을 이용함으로써 시장 소음에 취약할 수 있으며 스톱 로스 발생 가능성을 높일 수 있습니다.

  3. 어려운 매개 변수 최적화 위험. 전략은 여러 매개 변수를 포함합니다. 최적의 매개 변수 조합을 찾는 것은 어려울 수 있습니다.

최적화

이 전략은 다음 영역에서 더 이상 최적화 될 수 있습니다.

  1. 부피와 같은 더 많은 필터 지표를 추가하여 잘못된 신호를 제거하고 신호 품질을 더욱 향상시킵니다.

  2. 스톱 로스 규칙에 대한 테스트 수정, 예를 들어 스톱 로스를 실행하기 전에 확인 바를 추가하여 덜 공격적이도록 합니다.

  3. 지표에 대한 최고의 매개 변수 조합을 찾기 위해 매개 변수 최적화를 수행하여 더 많은 소음을 필터링하고 승률을 높이는 데 도움이 될 수 있습니다. 주로 TMO 길이, AMA 길이 및 멀티플라이어를 최적화합니다.

  4. 이 전략 논리에 가장 적합한 시장 조건을 알아내기 위해 다양한 제품과 시간 프레임에 따라 라이브로 테스트하고 거래하십시오.

결론

이 전략은 초기 트렌드 움직임을 포착함으로써 TMO와 AMA의 거래 신호를 범위 제한 시장에서 스칼프로 결합합니다. 높은 신호 정확성, 초기 트렌드 포착 및 효과적인 위험 통제의 장점이 있습니다. 매개 변수 및 전략 규칙에 대한 추가 최적화는 매우 실용적인 내일 스칼핑 전략으로 만들 수 있습니다.


/*backtest
start: 2023-11-23 00:00:00
end: 2023-11-30 00:00:00
period: 10m
basePeriod: 1m
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/
// © Kaspricci

//@version=5
strategy("TradeIQ - Crazy Scalping Trading Strategy [Kaspricci]", overlay=true, initial_capital = 1000, currency = currency.USD)

headlineTMO = "TMO Settings"

tmoLength   = input.int(7, "TMO Length", minval = 1, group = headlineTMO)
tmoSource   = input.source(close, "TMO Source", group = headlineTMO)

// calculate values
osc         = ta.mom(ta.sma(ta.sma(tmoSource, tmoLength), tmoLength), tmoLength)

// determine color of historgram
oscColor    = osc > osc[1] and osc > 0 ? #00c42b : osc < osc[1] and osc > 0 ? #4ee567 : osc < osc[1] and osc < 0 ? #ff441f : osc > osc[1] and osc < 0 ? #c03920 : na

// plot histogram
//plot(osc, "OSC", oscColor, linewidth = 3, style = plot.style_histogram)

// conditon to find highs and lows
up          = ta.highest(tmoSource, tmoLength)
dn          = ta.lowest(tmoSource, tmoLength)

// define conditions to be used for finding divergence
phosc = ta.crossunder(ta.change(osc), 0)
plosc = ta.crossover (ta.change(osc), 0)

// test for divergence
bear = osc > 0 and phosc and ta.valuewhen(phosc,osc,0) < ta.valuewhen(phosc,osc,1) and ta.valuewhen(phosc,up,0) > ta.valuewhen(phosc,up,1) ? 1 : 0
bull = osc < 0 and plosc and ta.valuewhen(plosc,osc,0) > ta.valuewhen(plosc,osc,1) and ta.valuewhen(plosc,dn,0) < ta.valuewhen(plosc,dn,1) ? 1 : 0

// -------------------------------------------------------------------------------------------------------------

headlineAMA = "AMA Settings"

amaSource   = input.source(defval = close, title = "AMA Source", group = headlineAMA)
amaLength   = input.int(defval = 50, title = "AMA Length", minval = 2, group = headlineAMA)


amaMulti    = input.float(defval = 2.0, title = "Factor", minval = 1)

amaShowCd   = input(defval = true , title = "As Smoothed Candles")
amaShowEx   = input(defval = true,   title = "Show Alternating Extremities")

amaAlpha    = input.float(1.0, "Lag",       minval=0, step=.1, tooltip='Control the lag of the moving average (higher = more lag)', group= 'AMA Kernel Parameters')
amaBeta     = input.float(0.5, "Overshoot", minval=0, step=.1, tooltip='Control the overshoot amplitude of the moving average (higher = overshoots with an higher amplitude)', group='AMA Kernel Parameters')

// -------------------------------------------------------------------------------------------------------------

headlineSL = "Stop Loss Settings"

slLength    = input.int(defval = 10, title = "SL Period", minval = 1, group = headlineSL, tooltip = "Number of bars for swing high / low")

// -------------------------------------------------------------------------------------------------------------

var b       = array.new_float(0)
var float x = na

if barstate.isfirst
    for i = 0 to amaLength - 1
        x := i / (amaLength - 1)
        w = math.sin(2 * 3.14159 * math.pow(x, amaAlpha)) * (1 - math.pow(x, amaBeta))
        array.push(b, w)

// local function to filter the source
filter(series float x) =>
    sum = 0.

    for i = 0 to amaLength - 1
        sum := sum + x[i] * array.get(b,i)
    
    sum / array.sum(b)

// apply filter function on source series

srcFiltered = filter(amaSource)

deviation   = ta.sma(math.abs(amaSource - srcFiltered), amaLength) * amaMulti

upper       = srcFiltered + deviation
lower       = srcFiltered - deviation

//----
crossHigh   = ta.cross(high, upper)
crossLow    = ta.cross(low, lower)

var os      = 0
os          := crossHigh ? 1 : crossLow ? 0 : os[1]

ext         = os * upper + (1 - os) * lower

//----
os_css = ta.rsi(srcFiltered, amaLength) / 100

extColor    = os == 1 ? #30FF85 : #ff1100

plot(srcFiltered, "MA", amaShowCd ? na : color.black, 2, editable = false)
plot(amaShowEx ? ext : na, "Extremities", ta.change(os) ? na : extColor, 2, editable=false)

// handle smoothed candles
var float h = na
var float l = na
var float c = na
var float body = na

if amaShowCd
    h := filter(high)
    l := filter(low)
    c := filter(amaSource)
    body := math.abs(math.avg(c[1], c[2]) - c)

ohlc_os = ta.rsi(c, amaLength) / 100

plotcandle(math.avg(c[1], c[2]), h, l, c, "Smooth Candles", #434651, bordercolor = na, editable = false, display = amaShowCd ? display.all : display.none)

// -------------------------------------------------------------------------------------------------------------

plotshape(bull ? ext : na, "Bullish Circle", shape.circle,    location.absolute, color = #00c42b, size=size.tiny)
plotshape(bear ? ext : na, "Bearish Circle", shape.circle,    location.absolute, color = #ff441f, size=size.tiny)
plotshape(bull ? ext : na, "Bullish Label",  shape.labeldown, location.absolute, color = #00c42b, text="Buy", textcolor=color.white, size=size.tiny)
plotshape(bear ? ext : na, "Bearish Label",  shape.labelup,   location.absolute, color = #ff441f, text="Sell", textcolor=color.white, size=size.tiny)

// -------------------------------------------------------------------------------------------------------------

candleSizeIncreasing = body[2] < body[1] and body[1] < body[0]

longEntryCond   = os == 1 and bull
shortEntryCond  = os == 0 and bear

longEntry       = strategy.opentrades == 0 and candleSizeIncreasing and not candleSizeIncreasing[1] and ta.barssince(longEntryCond)  < ta.barssince(os == 0) and ta.barssince(longEntryCond) < ta.barssince(bear)
shortEntry      = strategy.opentrades == 0 and candleSizeIncreasing and not candleSizeIncreasing[1] and ta.barssince(shortEntryCond) < ta.barssince(os == 1) and ta.barssince(shortEntryCond) < ta.barssince(bull)

longExit        = strategy.opentrades > 0 and strategy.position_size > 0 and (bear or os == 0)
shortExit       = strategy.opentrades > 0 and strategy.position_size < 0 and (bull or os == 1)

recentSwingHigh = ta.highest(high, slLength) // highest high of last candles
recentSwingLow  = ta.lowest(low,   slLength) // lowest low of recent candles

bgcolor(longEntry  ? color.rgb(76, 175, 79, 90) : na)
bgcolor(shortEntry ? color.rgb(255, 82, 82, 90) : na)

slLong          = (close - recentSwingLow) / syminfo.mintick  // stop loss in ticks
slShort         = (recentSwingHigh - close) / syminfo.mintick // stop loss in ticks

newOrderID         = str.tostring(strategy.closedtrades + strategy.opentrades + 1)
curOrderID         = str.tostring(strategy.closedtrades + strategy.opentrades)

alertMessageForEntry = "Trade {0} - New {1} Entry at price: {2} with stop loss at: {3}"

if (longEntry)
    alertMessage = str.format(alertMessageForEntry, newOrderID, "Long", close, recentSwingLow)
    
    strategy.entry(newOrderID, strategy.long, alert_message = alertMessage)
    strategy.exit("Stop Loss Long", newOrderID, loss = slLong, alert_message = "Stop Loss for Trade " + newOrderID)

if(longExit)
    strategy.close(curOrderID, alert_message = "Close Trade " + curOrderID)

if (shortEntry)
    alertMessage = str.format(alertMessageForEntry, newOrderID, "Short", close, recentSwingLow)

    strategy.entry(newOrderID, strategy.short, alert_message = alertMessage)
    strategy.exit("Stop Loss Short", newOrderID, loss = slShort, alert_message = "Stop Loss for Trade " + newOrderID)

if(shortExit)
    strategy.close(curOrderID, alert_message = "Close Trade " + curOrderID)

더 많은