커뮤니티

수식 부탁드립니다

프로필 이미지
이큐
2023-05-19 22:18:49
700
글번호 169140
답변완료
아래와 같은 수식을 예스랭귀지로 전환 부탁드립니다. //PRC_BBands Stop | indicator //30.03.2017 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //translated from MT4 code // --- settings //Length=20 // Bollinger Bands Period //Deviation=2 // Deviation //MoneyRisk=1.00 // Offset Factor // --- end of settings avg=average[Length] dev=std[Length]*Deviation smax = avg+dev smin = avg-dev if close>smax[1] then trend=1 endif if close<smin[1] then trend=-1 endif if trend>0 and smin<smin[1] then smin=smin[1] endif if trend<0 and smax>smax[1] then smax=smax[1] endif bsmax=smax+0.5*(MoneyRisk-1)*(smax-smin) bsmin=smin-0.5*(MoneyRisk-1)*(smax-smin) if(trend>0 and bsmin<bsmin[1]) then bsmin=bsmin[1] endif if(trend<0 and bsmax>bsmax[1]) then bsmax=bsmax[1] endif if trend>0 then TrendLine=bsmin r=127 g=255 drawtext("&#8226;",barindex,bsmin,Dialog,Standard,10) coloured(r,g,0) if trend[1]<0 then drawtext("&#8226;",barindex,bsmin,Dialog,Standard,22) coloured(r,g,0) endif endif if trend<0 then TrendLine=bsmax r=255 g=165 drawtext("&#8226;",barindex,bsmax,Dialog,Standard,10) coloured(r,g,0) if trend[1]>0 then drawtext("&#8226;",barindex,bsmax,Dialog,Standard,22) coloured(r,g,0) endif endif RETURN TrendLine coloured(r,g,0) style(line,2) as "BBands stop Trend"
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-05-22 09:23:37

안녕하세요 예스스탁입니다. //PRC_BBands Stop | indicator //30.03.2017 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //translated from MT4 code // --- settings //Length=20 // Bollinger Bands Period //Deviation=2 // Deviation //MoneyRisk=1.00 // Offset Factor // --- end of settings input : Length(20),Deviation(2),MoneyRisk(1); var : avgv(0),dev(0),smax(0),smin(0),trend(0),r(0),g(0); var : bsmax(0),bsmin(0),TrendLine(0),tx(0); avgv = ma(c,Length); dev = std(C,Length)*Deviation; smax = avgv+dev; smin = avgv-dev; if close>smax[1] then trend = 1; if close<smin[1] then trend = -1; if trend>0 and smin<smin[1] then smin = smin[1]; if trend<0 and smax>smax[1] then smax = smax[1]; bsmax=smax+0.5*(MoneyRisk-1)*(smax-smin); bsmin=smin-0.5*(MoneyRisk-1)*(smax-smin); if(trend>0 and bsmin<bsmin[1]) then bsmin=bsmin[1]; if(trend<0 and bsmax>bsmax[1]) then bsmax=bsmax[1]; if trend>0 then { TrendLine=bsmin; r=127; g=255; tx = text_new(sDate,sTime,bsmin,"●"); Text_SetStyle(tx,2,2); Text_SetColor(tx,RGB(r,g,0)); Text_SetSize(tx,10); if trend[1]<0 then { Text_SetSize(tx,22); } } if trend<0 then { TrendLine=bsmax; r=255; g=165; tx = text_new(sDate,sTime,bsmax,"●"); Text_SetStyle(tx,2,2); Text_SetColor(tx,RGB(r,g,0)); Text_SetSize(tx,10); if trend[1]>0 then { Text_SetSize(tx,22); } } Plot1(TrendLine, "BBands stop Trend",Rgb(r,g,0)); 즐거운 하루되세요 > 이큐 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다 > 아래와 같은 수식을 예스랭귀지로 전환 부탁드립니다. //PRC_BBands Stop | indicator //30.03.2017 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //translated from MT4 code // --- settings //Length=20 // Bollinger Bands Period //Deviation=2 // Deviation //MoneyRisk=1.00 // Offset Factor // --- end of settings avg=average[Length] dev=std[Length]*Deviation smax = avg+dev smin = avg-dev if close>smax[1] then trend=1 endif if close<smin[1] then trend=-1 endif if trend>0 and smin<smin[1] then smin=smin[1] endif if trend<0 and smax>smax[1] then smax=smax[1] endif bsmax=smax+0.5*(MoneyRisk-1)*(smax-smin) bsmin=smin-0.5*(MoneyRisk-1)*(smax-smin) if(trend>0 and bsmin<bsmin[1]) then bsmin=bsmin[1] endif if(trend<0 and bsmax>bsmax[1]) then bsmax=bsmax[1] endif if trend>0 then TrendLine=bsmin r=127 g=255 drawtext("&#8226;",barindex,bsmin,Dialog,Standard,10) coloured(r,g,0) if trend[1]<0 then drawtext("&#8226;",barindex,bsmin,Dialog,Standard,22) coloured(r,g,0) endif endif if trend<0 then TrendLine=bsmax r=255 g=165 drawtext("&#8226;",barindex,bsmax,Dialog,Standard,10) coloured(r,g,0) if trend[1]>0 then drawtext("&#8226;",barindex,bsmax,Dialog,Standard,22) coloured(r,g,0) endif endif RETURN TrendLine coloured(r,g,0) style(line,2) as "BBands stop Trend"