BV의 이치모쿠 클라우드

저자:차오장, 날짜: 2023-09-08 16:18:04
태그:

이 스크립트는 이치모쿠 클라우드 거래 시스템의 전략입니다.

  1. 이 스크립트는 이치모쿠 클라우드 시스템에서 제공하는 다양한 거래 신호를 테스트 할 수 있습니다.

  2. 일본엔 (JPY) 을 포함 한 통화 쌍을 테스트하는 경우 JPYPAIR 체크 박스를 체크하십시오. 이것은 스크립트가 스톱 로스 및 테이크 노프트를 계산하는 방법을 조정합니다.

  3. 당신은 스크립트의 매개 변수에서 이익 (TP) 및 스톱 손실 (SL) 값의 비율을 변경할 수 있습니다. 좋은 결과는 1.5:1 비율로 발견됩니다.

  4. 이 스크립트는 이치모쿠 클라우드 계산을 사용하여 다른 사람들 중 텐칸 / 키준, 가격 / 키준, 가격 / 텐칸과 같은 신호 입력을 제공합니다. 귀하의 선택에 따라 스크립트는 해당 거래 신호를 제공합니다.

  5. 이치모쿠 클라우드는 돈치안 함수를 사용하여 그래프화되며, 입력 메뉴에서 선택한 값에 따라 가격이 변환선, 기본선, 큐모 하이 또는 큐모 로우를 넘거나 밑을 넘을 때 신호가 생성됩니다.

  6. 이 스크립트는 또한 긴 거래와 짧은 거래에 대한 조건을 포함합니다.

  7. 그것은 돈을 관리하기 위해 평균 진정한 범위 (ATR) 를 사용하며, 정지 손실과 수익을 취하기 위해 곱셈을 사용하여 조정 할 수 있습니다.

  8. 또한, 테스트 시간을 위한 필터가 있습니다. 얼마나 많은 세월이 지난지 지정할 수 있습니다.

  9. 마지막으로, 전략은 계속 신호와 ATR 수익 및 손실 값에 따라 거래를 입력하거나 종료하도록 설정됩니다.

이 스크립트는 이치모쿠 클라우드 거래 전략을 백테스트하는 데 유용한 도구가 될 수 있지만, 항상 그렇듯이 논리를 이해하고 지식과 편안한 수준에 따라 매개 변수를 조정하는 데 시간을 투자해야합니다. 또한 백테스트 결과는 단지 지표적이며 미래의 성능은 다를 수 있습니다.


/*backtest
start: 2023-01-01 00:00:00
end: 2023-03-21 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/
// © vuagnouxb

//@version=4
strategy("BV's ICHIMOKU CLOUD SIGNAL TESTER", overlay=true)


// Signal imputs 
signalChoice = input(title = "SIGNAL - Choose your signal", defval = "Tenkan/Kijun", options = ["Tenkan/Kijun", "Tenkan/Kijun+Kumo", "Price/Tenkan", "Price/Tenkan+Kumo", "Price/Kijun", "Price/Kijun+Kumo", "Price/Kumo", "Kumo Color"])
JPYPair = input(type = input.bool, title = "ATR - Check if JPY Pair ", defval = false)


//------------------------------------------------------------------------
//----------               ICHIMOKU CLOUD Calculation          ----------- INPUT
//------------------------------------------------------------------------

conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),
basePeriods = input(26, minval=1, title="Base Line Periods")
laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods"),
displacement = input(26, minval=1, title="Displacement")

donchian(len) => avg(lowest(len), highest(len))

conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)

plot(conversionLine, color=#0496ff, title="Conversion Line")
plot(baseLine, color=#991515, title="Base Line")
plot(close, offset = -displacement + 1, color=#459915, title="Lagging Span")

p1 = plot(leadLine1, offset = displacement - 1, color=color.green,
 title="Lead 1")
p2 = plot(leadLine2, offset = displacement - 1, color=color.red,
 title="Lead 2")
fill(p1, p2, color = leadLine1 > leadLine2 ? color.green : color.red)

kumoHigh = max(leadLine1[displacement-1], leadLine2[displacement-1])
kumoLow = min(leadLine1[displacement-1], leadLine2[displacement-1])

// -- Trade entry signals

continuationSignalLong = signalChoice == "Tenkan/Kijun" ? crossover(conversionLine, baseLine) :
   signalChoice == "Tenkan/Kijun+Kumo" ? crossover(conversionLine, baseLine) and close > kumoHigh : 
   signalChoice == "Price/Tenkan" ? crossover(close, conversionLine) : 
   signalChoice == "Price/Tenkan+Kumo" ? crossover(close, conversionLine) and close > kumoHigh :
   signalChoice == "Price/Kijun" ? crossover(close, baseLine) :
   signalChoice == "Price/Kijun+Kumo" ? crossover(close, baseLine) and close > kumoHigh : 
   signalChoice == "Price/Kumo" ? crossover(close, kumoHigh) :
   signalChoice == "Kumo Color" ? crossover(leadLine1, leadLine2) :
   false
   
continuationSignalShort = signalChoice == "Tenkan/Kijun" ? crossunder(conversionLine, baseLine) :
   signalChoice == "Tenkan/Kijun+Kumo" ? crossunder(conversionLine, baseLine) and close < kumoLow : 
   signalChoice == "Price/Tenkan" ? crossunder(close, conversionLine) : 
   signalChoice == "Price/Tenkan+Kumo" ? crossunder(close, conversionLine) and close < kumoLow :
   signalChoice == "Price/Kijun" ? crossunder(close, baseLine) :
   signalChoice == "Price/Kijun+Kumo" ? crossunder(close, baseLine) and close < kumoLow : 
   signalChoice == "Price/Kumo" ? crossunder(close, kumoLow) :
   signalChoice == "Kumo Color" ? crossunder(leadLine1, leadLine2) :
   false

longCondition = continuationSignalLong

shortCondition = continuationSignalShort

//------------------------------------------------------------------------
//----------             ATR MONEY MANAGEMENT                 ------------
//------------------------------------------------------------------------

SLmultiplier = input(title = "ATR - Stop Loss Multiplier", type = input.float, defval = 1.5, step = 0.1)
TPmultiplier = input(title = "ATR - Take Profit Multiplier", type = input.float, defval = 1.0, step = 0.1)

pipAdjuster = JPYPair ? 1000 : 100000

ATR = atr(14) * pipAdjuster // 1000 for jpy pairs : 100000
SL = ATR * SLmultiplier
TP = ATR * TPmultiplier

//------------------------------------------------------------------------
//----------                  TIME FILTER                     ------------
//------------------------------------------------------------------------

YearOfTesting = input(title = "Time - How many years of testing ?" , type = input.integer, defval = 3)

_time = 2020 - YearOfTesting

timeFilter = (year > _time) 

//------------------------------------------------------------------------
//---------                 ENTRY FUNCTIONS                    ----------- INPUT
//------------------------------------------------------------------------

if (longCondition and timeFilter)  
    strategy.entry("Long", strategy.long)

if (shortCondition and timeFilter) 
    strategy.entry("Short", strategy.short)
    
//------------------------------------------------------------------------
//---------                 EXIT  FUNCTIONS                    -----------
//------------------------------------------------------------------------


strategy.exit("ATR", from_entry = "Long", profit = TP, loss = SL)  

strategy.exit("ATR", from_entry = "Short", profit = TP, loss = SL)  

더 많은