커뮤니티

문의 드립니다

프로필 이미지
만강
2024-10-29 13:17:30
571
글번호 184706
답변완료
안녕하세요 1. 다음 트랜드지표을 다음변수로 3개을 만들고자 합니다 1.라인1;10,1 2.라인1:11,2 3.라인3:12,3의 변수로 만들고 각 라인의 변수는 변경 가능 하게해주세요. input : Periods(10); input : Multiplier(3.0); input : changeATR(1);#1:SMA 0:RMA var : src(0),alpha(0),source(0),ATR1(0),ATR2(0),ATRV(0); var : up(0),up1(0),dn(0),dn1(0),trend(0),tx(0); src = (H+L)/2; alpha = 1 / Periods; atr1 = IFf(IsNan(atr1[1]) == true , ma(TrueRange, Periods) , alpha * TrueRange + (1 - alpha) * atr1[1]); atr2 = ATR(Periods); atrv = IFf(changeATR == 1 , atr1 , atr2); up=src-(Multiplier*atrv); up1 = IFf(IsNan(up[1]) == False,up[1],up); up = iff(close[1] > up1 , max(up,up1) , up); dn=src+(Multiplier*atrv); dn1 = IFf(IsNan(dn[1]) == False,dn[1], dn); dn = iff(close[1] < dn1 , min(dn, dn1) , dn); trend = 1; trend = IFf(IsNan(trend[1]) == False,trend[1], trend); trend = IFf(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend)); if trend == 1 Then plot1(up,"UpTrend",White); Else NoPlot(1); if trend == -1 then Plot2(dn,"Down Trend",Black); Else NoPlot(2); if trend == 1 and trend[1] == -1 Then { tx =Text_New(sDate,sTime,up,"●"); Text_SetStyle(tx,1,1); Text_SetColor(tx,Red); } if trend == -1 and trend[1] == 1 Then { tx =Text_New(sDate,sTime,dn,"●"); Text_SetStyle(tx,1,1); Text_SetColor(tx,Blue); } 2 10ema선을 고가,저가,종가을 기준으로 3개의 ema선을 만들고 싶습니다. 감사합니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-10-30 11:00:43

안녕하세요 예스스탁입니다. 1 input : Periods1(10),Multiplier1(1.0),changeATR1(1);#1:SMA 0:RMA input : Periods2(11),Multiplier2(2.0),changeATR2(1);#1:SMA 0:RMA input : Periods3(12),Multiplier3(3.0),changeATR3(1);#1:SMA 0:RMA var : src(0); var : xalpha(0),xsource(0),xATR1(0),xATR2(0),xATRV(0),xup(0),xup1(0),xdn(0),xdn1(0),xtrend(0),xtx(0); var : yalpha(0),ysource(0),yATR1(0),yATR2(0),yATRV(0),yup(0),yup1(0),ydn(0),ydn1(0),ytrend(0),ytx(0); var : zalpha(0),zsource(0),zATR1(0),zATR2(0),zATRV(0),zup(0),zup1(0),zdn(0),zdn1(0),ztrend(0),ztx(0); src = (H+L)/2; xalpha = 1 / Periods1; xatr1 = IFf(IsNan(xatr1[1]) == true , ma(TrueRange, Periods1) , xalpha * TrueRange + (1 - xalpha) * xatr1[1]); xatr2 = ATR(Periods1); xatrv = IFf(changeATR1 == 1 , xatr1 , xatr2); xup = src-(Multiplier1*xatrv); xup1 = IFf(IsNan(xup[1]) == False,xup[1],xup); xup = iff(close[1] > xup1 , max(xup,xup1) , xup); xdn = src+(Multiplier1*xatrv); xdn1 = IFf(IsNan(xdn[1]) == False,xdn[1], xdn); xdn = iff(close[1] < xdn1 , min(xdn, xdn1) , xdn); xtrend = 1; xtrend = IFf(IsNan(xtrend[1]) == False,xtrend[1], xtrend); xtrend = IFf(xtrend == -1 and close > xdn1 , 1 , iff(xtrend == 1 and close < xup1 , -1 , xtrend)); if xtrend == 1 Then plot1(xup,"UpTrend1",White); Else NoPlot(1); if xtrend == -1 then Plot2(xdn,"DownTrend1",Black); Else NoPlot(2); if xtrend == 1 and xtrend[1] == -1 Then { xtx =Text_New(sDate,sTime,xup,"●"); Text_SetStyle(xtx,1,1); Text_SetColor(xtx,Red); } if xtrend == -1 and xtrend[1] == 1 Then { xtx =Text_New(sDate,sTime,xdn,"●"); Text_SetStyle(xtx,1,1); Text_SetColor(xtx,Blue); } yalpha = 1 / Periods2; yatr1 = IFf(IsNan(yatr1[1]) == true , ma(TrueRange, Periods2) , yalpha * TrueRange + (1 - yalpha) * yatr1[1]); yatr2 = ATR(Periods2); yatrv = IFf(changeATR2 == 1 , yatr1 , yatr2); yup = src-(Multiplier2*yatrv); yup1 = IFf(IsNan(yup[1]) == False,yup[1],yup); yup = iff(close[1] > yup1 , max(yup,yup1) , yup); ydn = src+(Multiplier2*yatrv); ydn1 = IFf(IsNan(ydn[1]) == False,ydn[1], ydn); ydn = iff(close[1] < ydn1 , min(ydn, ydn1) , ydn); ytrend = 1; ytrend = IFf(IsNan(ytrend[1]) == False,ytrend[1], ytrend); ytrend = IFf(ytrend == -1 and close > ydn1 , 1 , iff(ytrend == 1 and close < yup1 , -1 , ytrend)); if ytrend == 1 Then plot3(yup,"UpTrend1",White); Else NoPlot(3); if ytrend == -1 then Plot4(ydn,"DownTrend1",Black); Else NoPlot(4); if ytrend == 1 and ytrend[1] == -1 Then { ytx =Text_New(sDate,sTime,yup,"●"); Text_SetStyle(ytx,1,1); Text_SetColor(ytx,Red); } if ytrend == -1 and ytrend[1] == 1 Then { ytx =Text_New(sDate,sTime,ydn,"●"); Text_SetStyle(ytx,1,1); Text_SetColor(ytx,Blue); } zalpha = 1 / Periods3; zatr1 = IFf(IsNan(zatr1[1]) == true , ma(TrueRange, Periods3) , zalpha * TrueRange + (1 - zalpha) * zatr1[1]); zatr2 = ATR(Periods3); zatrv = IFf(changeATR3 == 1 , zatr1 , zatr2); zup = src-(Multiplier3*zatrv); zup1 = IFf(IsNan(zup[1]) == False,zup[1],zup); zup = iff(close[1] > zup1 , max(zup,zup1) , zup); zdn = src+(Multiplier3*zatrv); zdn1 = IFf(IsNan(zdn[1]) == False,zdn[1], zdn); zdn = iff(close[1] < zdn1 , min(zdn, zdn1) , zdn); ztrend = 1; ztrend = IFf(IsNan(ztrend[1]) == False,ztrend[1], ztrend); ztrend = IFf(ztrend == -1 and close > zdn1 , 1 , iff(ztrend == 1 and close < zup1 , -1 , ztrend)); if ztrend == 1 Then plot5(zup,"UpTrend1",White); Else NoPlot(5); if ztrend == -1 then Plot6(zdn,"DownTrend1",Black); Else NoPlot(6); if ztrend == 1 and ztrend[1] == -1 Then { ztx =Text_New(sDate,sTime,zup,"●"); Text_SetStyle(ztx,1,1); Text_SetColor(ztx,Red); } if ztrend == -1 and ztrend[1] == 1 Then { ztx =Text_New(sDate,sTime,zdn,"●"); Text_SetStyle(ztx,1,1); Text_SetColor(ztx,Blue); } 2 var1 = Ema(h,10); var2 = Ema(l,10); var3 = Ema(c,10); Plot1(var1); Plot2(var2); Plot3(var3); 즐거운 하루되세요 > 만강 님이 쓴 글입니다. > 제목 : 문의 드립니다 > 안녕하세요 1. 다음 트랜드지표을 다음변수로 3개을 만들고자 합니다 1.라인1;10,1 2.라인1:11,2 3.라인3:12,3의 변수로 만들고 각 라인의 변수는 변경 가능 하게해주세요. input : Periods(10); input : Multiplier(3.0); input : changeATR(1);#1:SMA 0:RMA var : src(0),alpha(0),source(0),ATR1(0),ATR2(0),ATRV(0); var : up(0),up1(0),dn(0),dn1(0),trend(0),tx(0); src = (H+L)/2; alpha = 1 / Periods; atr1 = IFf(IsNan(atr1[1]) == true , ma(TrueRange, Periods) , alpha * TrueRange + (1 - alpha) * atr1[1]); atr2 = ATR(Periods); atrv = IFf(changeATR == 1 , atr1 , atr2); up=src-(Multiplier*atrv); up1 = IFf(IsNan(up[1]) == False,up[1],up); up = iff(close[1] > up1 , max(up,up1) , up); dn=src+(Multiplier*atrv); dn1 = IFf(IsNan(dn[1]) == False,dn[1], dn); dn = iff(close[1] < dn1 , min(dn, dn1) , dn); trend = 1; trend = IFf(IsNan(trend[1]) == False,trend[1], trend); trend = IFf(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend)); if trend == 1 Then plot1(up,"UpTrend",White); Else NoPlot(1); if trend == -1 then Plot2(dn,"Down Trend",Black); Else NoPlot(2); if trend == 1 and trend[1] == -1 Then { tx =Text_New(sDate,sTime,up,"●"); Text_SetStyle(tx,1,1); Text_SetColor(tx,Red); } if trend == -1 and trend[1] == 1 Then { tx =Text_New(sDate,sTime,dn,"●"); Text_SetStyle(tx,1,1); Text_SetColor(tx,Blue); } 2 10ema선을 고가,저가,종가을 기준으로 3개의 ema선을 만들고 싶습니다. 감사합니다