커뮤니티

수식변환

프로필 이미지
부호장자
2024-06-23 11:07:31
989
글번호 180888
답변완료
수고하십니다. 아래 수식을 예스로 변환부탁드립니다. study("Waddah Attar Explosion V2 [SHK]", shorttitle="WAE [SHK]") sensitivity = input(150, title="Sensitivity") fastLength=input(20, title="FastEMA Length") slowLength=input(40, title="SlowEMA Length") channelLength=input(20, title="BB Channel Length") mult=input(2.0, title="BB Stdev Multiplier") DEAD_ZONE = nz(rma(tr(true),100)) * 3.7 calc_macd(source, fastLength, slowLength) => fastMA = ema(source, fastLength) slowMA = ema(source, slowLength) fastMA - slowMA calc_BBUpper(source, length, mult) => basis = sma(source, length) dev = mult * stdev(source, length) basis + dev calc_BBLower(source, length, mult) => basis = sma(source, length) dev = mult * stdev(source, length) basis - dev t1 = (calc_macd(close, fastLength, slowLength) - calc_macd(close[1], fastLength, slowLength))*sensitivity e1 = (calc_BBUpper(close, channelLength, mult) - calc_BBLower(close, channelLength, mult)) trendUp = (t1 >= 0) ? t1 : 0 trendDown = (t1 < 0) ? (-1*t1) : 0 plot(trendUp, style=columns, linewidth=1, color=(trendUp<trendUp[1])?lime:green, transp=45, title="UpTrend") plot(trendDown, style=columns, linewidth=1, color=(trendDown<trendDown[1])?orange:red, transp=45, title="DownTrend") plot(e1, style=line, linewidth=2, color=#A0522D, title="ExplosionLine") plot(DEAD_ZONE, color=blue, linewidth=1, style=cross, title="DeadZoneLine")
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-06-24 17:16:46

안녕하세요 예스스탁입니다. input : sensitivity(150); input : fastLength(20); input : slowLength(40); input : channelLength(20); input : mult(2.0); var : alpha(0),Rma(0),DEAD_ZONE(0),calc_macd(0),calc_BBUpper(0),calc_BBLower(0); var : t1(0),e1(0),trendUp(0),trendDown(0); alpha = 1/100; RMA = iff(IsNan(RMA[1]) == true , ma(TrueRange, 100) , alpha * TrueRange + (1 - alpha) * RMA[1]); DEAD_ZONE = IFf(IsNaN(RMA) == true, 0, RMA) * 3.7; calc_macd = macd(fastLength,slowLength); calc_BBUpper = BollBandUp(channelLength,mult); calc_BBLower = BollBandDown(channelLength,mult); t1 = (calc_macd - calc_macd[1])*sensitivity; e1 = (calc_BBUpper - calc_BBLower); trendUp = IFf(t1 >= 0 , t1 , 0); trendDown = IFf(t1 < 0 , (-1*t1) , 0); plot1(trendUp,"UpTrend",IFf(trendUp<trendUp[1],lime,green)); plot2(trendDown,"DownTrend",IFf(trendDown<trendDown[1],orange,red)); plot3(e1,"ExplosionLine"); plot4(DEAD_ZONE,"DeadZoneLine",blue); 즐거운 하루되세요 > 부호장자 님이 쓴 글입니다. > 제목 : 수식변환 > 수고하십니다. 아래 수식을 예스로 변환부탁드립니다. study("Waddah Attar Explosion V2 [SHK]", shorttitle="WAE [SHK]") sensitivity = input(150, title="Sensitivity") fastLength=input(20, title="FastEMA Length") slowLength=input(40, title="SlowEMA Length") channelLength=input(20, title="BB Channel Length") mult=input(2.0, title="BB Stdev Multiplier") DEAD_ZONE = nz(rma(tr(true),100)) * 3.7 calc_macd(source, fastLength, slowLength) => fastMA = ema(source, fastLength) slowMA = ema(source, slowLength) fastMA - slowMA calc_BBUpper(source, length, mult) => basis = sma(source, length) dev = mult * stdev(source, length) basis + dev calc_BBLower(source, length, mult) => basis = sma(source, length) dev = mult * stdev(source, length) basis - dev t1 = (calc_macd(close, fastLength, slowLength) - calc_macd(close[1], fastLength, slowLength))*sensitivity e1 = (calc_BBUpper(close, channelLength, mult) - calc_BBLower(close, channelLength, mult)) trendUp = (t1 >= 0) ? t1 : 0 trendDown = (t1 < 0) ? (-1*t1) : 0 plot(trendUp, style=columns, linewidth=1, color=(trendUp<trendUp[1])?lime:green, transp=45, title="UpTrend") plot(trendDown, style=columns, linewidth=1, color=(trendDown<trendDown[1])?orange:red, transp=45, title="DownTrend") plot(e1, style=line, linewidth=2, color=#A0522D, title="ExplosionLine") plot(DEAD_ZONE, color=blue, linewidth=1, style=cross, title="DeadZoneLine")