커뮤니티

문의드립니다.

프로필 이미지
해암
2025-04-23 21:14:22
182
글번호 190371
답변완료
지난번 수식에서 아래부분이 빠져있었네요 다시한번 부탁드립니다. =============== // === COLOR DEFINITIONS === // bullColor = color.rgb(92, 240, 215) // #5CF0D7 bearColor = color.rgb(179, 42, 195) // #B32AC3 flatColor = color.rgb(136, 136, 136) // gray bullShadow = color.rgb(92, 240, 215, 14) // 20% opacity bearShadow = color.rgb(179, 42, 195, 14) flatShadow = color.new(flatColor, 80) // === SLOPE-BASED COLORING === // slopeColor = basis > basis[slopeIndex] ? bullColor : basis < basis[slopeIndex] ? bearColor : flatColor shadowColor = basis > basis[slopeIndex] ? bullShadow : basis < basis[slopeIndex] ? bearShadow : flatShadow // === PLOT Z-SCORE MEAN LINE + SHADOW === // plot(showMeanLine ? basis : na, "Z-Mean Shadow", color=shadowColor, linewidth=10) plot(showMeanLine ? basis : na, "Z-Mean", color=slopeColor, linewidth=2) ============== 매번 감사드립니다. 수고하세요!!!
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-04-24 13:32:48

안녕하세요 예스스탁입니다. input : zLen(100);#"Z-Score Period" input : emaTrendLen(50); #"EMA Trend Filter" input : rsiLen(14); #"RSI Length" input : rsiEmaLen(8); #"EMA of RSI Period" input : zBuyLevel(-2.0); #"Z-Score Buy Threshold" input : zSellLevel(2.0); #"Z-Score Sell Threshold" input : cooldownBars(10); #"Cooldown (Bars)" input : slopeIndex(30); #"Slope Sensitivity (Bars)", minval=1) input : showMeanLine(true);#"Show Z-Score Mean Line") var : basis(0),stdev(0),zscore(0),EmaTrend(0),R(0),rsiEma(0),rsiEmaSlope(0); var : isUptrend(False),isDowntrend(False); var : canBuy(true), canSell(true), rsiBuyConfirm(False),rsiSellConfirm(False); var : rawBuy(False),rawSell(False); var : lastBuyBar(nan),lastSellBar(nan); var : buySignal(False),SellSignal(False); basis = ma(close, zLen); stdev = std(close, zLen); zscore = (close - basis) / stdev; emaTrend = ema(close, emaTrendLen); r = rsi( rsiLen); rsiEma = ema(R, rsiEmaLen); rsiEmaSlope = rsiEma - rsiEma[1]; isUptrend = close > emaTrend; isDowntrend = close < emaTrend; if rsiEma > 30 Then canBuy = true; if rsiEma < 70 Then canSell = true; rsiBuyConfirm = rsiEma < 30 and rsiEmaSlope > 0 and canBuy; rsiSellConfirm = rsiEma > 70 and rsiEmaSlope < 0 and canSell; rawBuy = zscore < zBuyLevel and isDowntrend and rsiBuyConfirm; rawSell = zscore > zSellLevel and isUptrend and rsiSellConfirm; if rawBuy Then canBuy = false; if rawSell Then canSell = false; buySignal = rawBuy and (IsNan(lastSellBar) == true or index - lastSellBar > cooldownBars); sellSignal = rawSell and (IsNan(lastBuyBar) == true or index - lastBuyBar > cooldownBars); if buySignal then lastBuyBar = index; if sellSignal Then lastSellBar = index; var : bullColor(0),bearColor(0),flatColor(0); var : bullShadow(0),bearShadow(0),flatShadow(0); var : slopeColor(0),shadowColor(0); // === COLOR DEFINITIONS === // bullColor = rgb(92, 240, 215); // #5CF0D7 bearColor = rgb(179, 42, 195); // #B32AC3 flatColor = rgb(136, 136, 136); // gray bullShadow = rgb(92, 240, 215); // 20% opacity bearShadow = rgb(179, 42, 195); flatShadow = flatColor; // === SLOPE-BASED COLORING === // slopeColor = iff(basis > basis[slopeIndex] , bullColor , iff(basis < basis[slopeIndex] , bearColor , flatColor)); shadowColor = iff(basis > basis[slopeIndex] , bullShadow ,iff( basis < basis[slopeIndex] , bearShadow , flatShadow)); // === PLOT Z-SCORE MEAN LINE + SHADOW === // if showMeanLine == true then { plot1(basis, "Z-Mean Shadow",shadowColor,Def,5); plot2(basis, "Z-Mean",slopeColor,Def,2); } Else { NoPlot(1); NoPlot(2); } 즐거운 하루되세요 > 해암 님이 쓴 글입니다. > 제목 : 문의드립니다. > 지난번 수식에서 아래부분이 빠져있었네요 다시한번 부탁드립니다. =============== // === COLOR DEFINITIONS === // bullColor = color.rgb(92, 240, 215) // #5CF0D7 bearColor = color.rgb(179, 42, 195) // #B32AC3 flatColor = color.rgb(136, 136, 136) // gray bullShadow = color.rgb(92, 240, 215, 14) // 20% opacity bearShadow = color.rgb(179, 42, 195, 14) flatShadow = color.new(flatColor, 80) // === SLOPE-BASED COLORING === // slopeColor = basis > basis[slopeIndex] ? bullColor : basis < basis[slopeIndex] ? bearColor : flatColor shadowColor = basis > basis[slopeIndex] ? bullShadow : basis < basis[slopeIndex] ? bearShadow : flatShadow // === PLOT Z-SCORE MEAN LINE + SHADOW === // plot(showMeanLine ? basis : na, "Z-Mean Shadow", color=shadowColor, linewidth=10) plot(showMeanLine ? basis : na, "Z-Mean", color=slopeColor, linewidth=2) ============== 매번 감사드립니다. 수고하세요!!!