커뮤니티

수식변환 부탁드립니다.

프로필 이미지
이글루
2025-05-02 14:16:02
320
글번호 190547
답변완료
안녕하세요 수식변환 부탁드립니다. .// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // author &#169; KivancOzbilgic // developer &#169; KivancOzbilgic //@version=5 indicator('AlphaTrend', shorttitle='AT', overlay=true, format=format.price, precision=2, timeframe='') coeff = input.float(1, 'Multiplier', step=0.1) AP = input(14, 'Common Period') ATR = ta.sma(ta.tr, AP) src = input(close) showsignalsk = input(title='Show Signals?', defval=true) novolumedata = input(title='Change calculation (no volume data)?', defval=false) upT = low - ATR * coeff downT = high + ATR * coeff AlphaTrend = 0.0 AlphaTrend := (novolumedata ? ta.rsi(src, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT color1 = AlphaTrend > AlphaTrend[2] ? #00E60F : AlphaTrend < AlphaTrend[2] ? #80000B : AlphaTrend[1] > AlphaTrend[3] ? #00E60F : #80000B k1 = plot(AlphaTrend, color=color.new(#0022FC, 0), linewidth=3) k2 = plot(AlphaTrend[2], color=color.new(#FC0400, 0), linewidth=3) fill(k1, k2, color=color1) buySignalk = ta.crossover(AlphaTrend, AlphaTrend[2]) sellSignalk = ta.crossunder(AlphaTrend, AlphaTrend[2]) K1 = ta.barssince(buySignalk) K2 = ta.barssince(sellSignalk) O1 = ta.barssince(buySignalk[1]) O2 = ta.barssince(sellSignalk[1]) plotshape(buySignalk and showsignalsk and O1 > K2 ? AlphaTrend[2] * 0.9999 : na, title='BUY', text='BUY', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(#0022FC, 0), textcolor=color.new(color.white, 0)) plotshape(sellSignalk and showsignalsk and O2 > K1 ? AlphaTrend[2] * 1.0001 : na, title='SELL', text='SELL', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.maroon, 0), textcolor=color.new(color.white, 0)) alertcondition(buySignalk and O1 > K2, title='Potential BUY Alarm', message='BUY SIGNAL!') alertcondition(sellSignalk and O2 > K1, title='Potential SELL Alarm', message='SELL SIGNAL!') alertcondition(buySignalk[1] and O1[1] > K2, title='Confirmed BUY Alarm', message='BUY SIGNAL APPROVED!') alertcondition(sellSignalk[1] and O2[1] > K1, title='Confirmed SELL Alarm', message='SELL SIGNAL APPROVED!') alertcondition(ta.cross(close, AlphaTrend), title='Price Cross Alert', message='Price - AlphaTrend Crossing!') alertcondition(ta.crossover(low, AlphaTrend), title='Candle CrossOver Alarm', message='LAST BAR is ABOVE ALPHATREND') alertcondition(ta.crossunder(high, AlphaTrend), title='Candle CrossUnder Alarm', message='LAST BAR is BELOW ALPHATREND!') alertcondition(ta.cross(close[1], AlphaTrend[1]), title='Price Cross Alert After Bar Close', message='Price - AlphaTrend Crossing!') alertcondition(ta.crossover(low[1], AlphaTrend[1]), title='Candle CrossOver Alarm After Bar Close', message='LAST BAR is ABOVE ALPHATREND!') alertcondition(ta.crossunder(high[1], AlphaTrend[1]), title='Candle CrossUnder Alarm After Bar Close', message='LAST BAR is BELOW ALPHATREND!')
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-05-02 17:01:36

안녕하세요 예스스탁입니다. input : coeff(1); input : AP(14); input : src(close); input : showsignalsk(true); input : novolumedata(false); var : ATRV(0),upT(0),downT(0),AlphaTrend(0); var : color1(0),buySignalk(False),SellSignalk(False); var : K1(0),K2(0),O1(0),O2(0),TX(0); ATRV = ma(TrueRange, AP); upT = low - ATRV * coeff; downT = high + ATRV * coeff; AlphaTrend = IFF(IFF(novolumedata , rsi(AP) >= 50 ,mfi(AP) >= 50), IFF(upT < IFF(IsNaN(AlphaTrend) == true,0,AlphaTrend[1]) ,IFF(IsNaN(AlphaTrend) == true,0,AlphaTrend[1]) , upT) , IFF(downT > IFF(IsNaN(AlphaTrend) == true,0,AlphaTrend[1]) , IFF(IsNaN(AlphaTrend) == true,0,AlphaTrend[1]) , downT)); color1 = IFF(AlphaTrend > AlphaTrend[2] , Lime , IFF( AlphaTrend < AlphaTrend[2] , Brown ,IFF( AlphaTrend[1] > AlphaTrend[3] , Lime,Brown))); plot1(AlphaTrend,"k1", Blue); plot2(AlphaTrend[2],"k2",Red); buySignalk = crossup(AlphaTrend, AlphaTrend[2]); sellSignalk = CrossDown(AlphaTrend, AlphaTrend[2]); if buySignalk == true Then K1 = 0; Else K1 = K1+1; if sellSignalk == true Then K2 = 0; Else K2 = K2+1; O1 = K1[1]; O2 = K2[1]; if buySignalk and showsignalsk and O1 > K2 Then { tx = text_new(sDate,sTime,AlphaTrend[2] * 0.9999,"▲"); Text_SetStyle(tx,2,0); Text_SetColor(tx,Blue); Text_SetSize(tx,20); } if sellSignalk and showsignalsk and O2 > K1 Then { tx = text_new(sDate,sTime, AlphaTrend[2] * 1.0001,"▼"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Brown); Text_SetSize(tx,20); } 즐거운 하루되세요 > 이글루 님이 쓴 글입니다. > 제목 : 수식변환 부탁드립니다. > 안녕하세요 수식변환 부탁드립니다. .// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // author &#169; KivancOzbilgic // developer &#169; KivancOzbilgic //@version=5 indicator('AlphaTrend', shorttitle='AT', overlay=true, format=format.price, precision=2, timeframe='') coeff = input.float(1, 'Multiplier', step=0.1) AP = input(14, 'Common Period') ATR = ta.sma(ta.tr, AP) src = input(close) showsignalsk = input(title='Show Signals?', defval=true) novolumedata = input(title='Change calculation (no volume data)?', defval=false) upT = low - ATR * coeff downT = high + ATR * coeff AlphaTrend = 0.0 AlphaTrend := (novolumedata ? ta.rsi(src, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT color1 = AlphaTrend > AlphaTrend[2] ? #00E60F : AlphaTrend < AlphaTrend[2] ? #80000B : AlphaTrend[1] > AlphaTrend[3] ? #00E60F : #80000B k1 = plot(AlphaTrend, color=color.new(#0022FC, 0), linewidth=3) k2 = plot(AlphaTrend[2], color=color.new(#FC0400, 0), linewidth=3) fill(k1, k2, color=color1) buySignalk = ta.crossover(AlphaTrend, AlphaTrend[2]) sellSignalk = ta.crossunder(AlphaTrend, AlphaTrend[2]) K1 = ta.barssince(buySignalk) K2 = ta.barssince(sellSignalk) O1 = ta.barssince(buySignalk[1]) O2 = ta.barssince(sellSignalk[1]) plotshape(buySignalk and showsignalsk and O1 > K2 ? AlphaTrend[2] * 0.9999 : na, title='BUY', text='BUY', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(#0022FC, 0), textcolor=color.new(color.white, 0)) plotshape(sellSignalk and showsignalsk and O2 > K1 ? AlphaTrend[2] * 1.0001 : na, title='SELL', text='SELL', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.maroon, 0), textcolor=color.new(color.white, 0)) alertcondition(buySignalk and O1 > K2, title='Potential BUY Alarm', message='BUY SIGNAL!') alertcondition(sellSignalk and O2 > K1, title='Potential SELL Alarm', message='SELL SIGNAL!') alertcondition(buySignalk[1] and O1[1] > K2, title='Confirmed BUY Alarm', message='BUY SIGNAL APPROVED!') alertcondition(sellSignalk[1] and O2[1] > K1, title='Confirmed SELL Alarm', message='SELL SIGNAL APPROVED!') alertcondition(ta.cross(close, AlphaTrend), title='Price Cross Alert', message='Price - AlphaTrend Crossing!') alertcondition(ta.crossover(low, AlphaTrend), title='Candle CrossOver Alarm', message='LAST BAR is ABOVE ALPHATREND') alertcondition(ta.crossunder(high, AlphaTrend), title='Candle CrossUnder Alarm', message='LAST BAR is BELOW ALPHATREND!') alertcondition(ta.cross(close[1], AlphaTrend[1]), title='Price Cross Alert After Bar Close', message='Price - AlphaTrend Crossing!') alertcondition(ta.crossover(low[1], AlphaTrend[1]), title='Candle CrossOver Alarm After Bar Close', message='LAST BAR is ABOVE ALPHATREND!') alertcondition(ta.crossunder(high[1], AlphaTrend[1]), title='Candle CrossUnder Alarm After Bar Close', message='LAST BAR is BELOW ALPHATREND!')