커뮤니티

수식 부탁합니다.

프로필 이미지
newstory
2026-02-02 22:35:56
32
글번호 230272
답변완료

안녕하세요.


수식 변환 작업 부탁합니다.



//Parameters required

fastEmaPeriod = input(5, minval=1, title="Fast TEMA")

slowEmaPeriod = input(20, minval=1, title="Slow TEMA")


triple_ema(src, time_period) =>

ema1 = rsi(src, time_period)

ema2 = rsi(ema1, time_period)

ema3 = rsi(ema2, time_period)

TEMA_cal = 0.0

TEMA_cal := 3 * (ema1 - ema2) + ema3

TEMA_cal

//

fastTEMA = triple_ema(high,fastEmaPeriod)

slowTEMA = triple_ema(low,slowEmaPeriod)


plot(fastTEMA, title = 'fast TEMA',color=color.blue, linewidth=2)

plot(slowTEMA, title = 'slow TEMA',color=color.red, linewidth=2)

//

showZones = input(true, title="Show Bullish/Bearish Zones")


// bullish signal rule:

bullishRule = fastTEMA >= slowTEMA

// bearish signal rule:

bearishRule = fastTEMA <= slowTEMA

// current trading State

ruleState = 0

ruleState := bullishRule ? 1 : bearishRule ? -1 : nz(ruleState[1])

bgcolor(showZones ? ruleState == 1 ? color.lime : ruleState == -1 ? color.red : color.yellow : na, title=" Bullish/Bearish Zones", transp=90)

//

지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-02-03 10:25:38

안녕하세요 예스스탁입니다. input: fastEmaPeriod(5); input: slowEmaPeriod(20); Function _RSI { Input : Price(Numeric),Length(NumericSimple); var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0); var : DownSum(0), UpAvg(0), DownAvg(0); If CurrentBar == 1 AND Length > 0 Then Begin UpSum = 0; DownSum = 0; For Counter = 0 To Length - 1 Begin UpAmt = Price[Counter] - Price[Counter+1]; If UpAmt >= 0 Then DownAmt = 0; Else Begin DownAmt = -UpAmt; UpAmt = 0; End; UpSum = UpSum + UpAmt; DownSum = DownSum + DownAmt; End; UpAvg = UpSum / Length; DownAvg = DownSum / Length; End Else If CurrentBar > 1 AND Length > 0 Then Begin UpAmt = Price[0] - Price[1]; If UpAmt >= 0 Then DownAmt = 0; Else Begin DownAmt = -UpAmt; UpAmt = 0; End; UpAvg = (UpAvg[1] * (Length - 1) + UpAmt) / Length; DownAvg = (DownAvg[1] * (Length - 1) + DownAmt) / Length; End; If UpAvg + DownAvg <> 0 Then _RSI = 100 * UpAvg / (UpAvg + DownAvg); Else _RSI = 0; } EndFunction Function triple_ema { input : src(Numeric),time_period(Numeric); var : Ema1(0),Ema2(0),Ema3(0); ema1 = _rsi(src, time_period); ema2 = _rsi(ema1, time_period); ema3 = _rsi(ema2, time_period); triple_ema = 0.0; triple_ema = 3 * (ema1 - ema2) + ema3; } EndFunction var : fastTEMA(0),slowTEMA(0); fastTEMA = triple_ema(high,fastEmaPeriod); slowTEMA = triple_ema(low,slowEmaPeriod); plot1(fastTEMA, "fast TEMA",blue); plot2(slowTEMA, "slow TEMA",red); 즐거운 하루되세요