EMA 클라우드 내일 전략

저자:차오장, 날짜: 2022-05-17 16:30:12
태그:EMA

이 전략은 이치모쿠 클라우드에서 보이는 것과 유사한 9 및 20 기간 기하급수적 이동 평균을 활용하여 색상의 구름을 만듭니다. 전략은 거래 날의 끝까지 모든 거래를 닫습니다. 진입은 가격이 녹색 (9 EMA above 20 EMA) 클라우드 이상 또는 빨간색 (9 EMA below 20 EMA) 클라우드 아래에 닫을 때입니다. 출입은 가격이 9 EMA 또는 거래 날의 끝에서 닫을 때입니다. 다른 내일 시간 프레임에서 전략 테스터를 실행하면 주어진 기호에 대한 최고의 시간 프레임을 보여줄 것입니다. 예를 들어, 나는 이 전략이 30 분 시간 프레임에서 SPY에 대한 최고의 결과를 반환한다는 것을 발견했습니다.

백테스트

img


/*backtest
start: 2022-04-16 00:00:00
end: 2022-05-15 23:59:00
period: 1d
basePeriod: 1h
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/
// © rwestbrookjr

//@version=5
strategy("EMA Cloud Intraday Strategy", overlay=true, margin_long=100, margin_short=100, process_orders_on_close=true)

i_trdQty = input.int(10, "Trade Quantity", minval = 1)




fastLen = input(title = "Fast EMA Length", defval = 7)
slowLen = input(title = "Slow EMA Length", defval = 20)

fastEMA = ta.ema(close, fastLen)
slowEMA = ta.ema(close, slowLen)

fema = plot(fastEMA, title = "FastEMA", color = color.green, linewidth = 1, style = plot.style_line)
sema = plot(slowEMA, title = "SlowEMA", color = color.red, linewidth = 1, style = plot.style_line)

fill(fema, sema, color = fastEMA > slowEMA ? color.new(#417505, 50) : color.new(#890101, 50), title = "Cloud")

longCondition = (close > fastEMA and fastEMA > slowEMA)

if (longCondition)
    strategy.entry("Long_Entry", strategy.long)
longExit = close[1] < fastEMA
if (longExit)
    strategy.close("Long_Entry",when=longExit)
    //strategy.exit("exit", "My Long Entry Id", trail_points=1.5, trail_offset=0)

shortCondition = (close < fastEMA and fastEMA < slowEMA)
if (shortCondition)
    strategy.entry("Short_Entry", strategy.short)
shortExit = close[1] > fastEMA
if (shortExit)
    strategy.close("Short_Entry",when=shortExit)
    //strategy.exit("exit", "My Short Entry Id", trail_points=1.5, trail_offset=0)



관련

더 많은