커뮤니티

문의드립니다.

프로필 이미지
thegin
2020-04-07 16:29:41
579
글번호 137665
답변완료
inputs: ATRLength(100), ATRMult(5), Strength(100); vars: strend(0),st(0); st = SuperTrend(ATRLength, ATRMult, Strength, strend); Plot1(st+atr(ATRLength)*ATRMult,"Up",iff(strend == 1,red,blue)); Plot2(st-atr(ATRLength)*ATRMult,"Down",iff(strend == 1,red,blue)); Plot3(st,"SuperTrend",iff(strend == 1,red,blue)); 안녕하세요 상기 지표를 컴파일하려고 하는데 4번째 줄, 6열에서 선언되지 않은 이름 'SuperTrend'이(가) 사용되었습니다 라는 문구가 뜨고 있습니다. 어떻게 수정해야 검증할 수 있을지 문의드립니다. 감사합니다.
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-04-08 08:48:24

안녕하세요 예스스탁입니다. 아래내용을 사용자함수로 만드시면 됩니다. 사용자함수명 : SuperTrend 반환값형 : 숫자형 inputs: ATRLength(NumericSimple), ATRMult(NumericSimple), Strength(NumericSimple), STrend(NumericRef); vars: ATR(0), avg(0), dn(0), up(0), trend(1), flag(0), flagh(0), ST(0),hl(0); hl = Highest(High, ATRLength) - Lowest(Low, ATRLength); ATR = ema(hl, ATRLength); avg = (ema(high, Strength) + ema(low, Strength))/2; up = avg + ATR; dn = avg - ATR; if c > up[1] and c > Highest(High, Strength)[1] then trend = 1; else if c < dn[1] and c < Lowest(Low, Strength)[1] then trend = -1; if trend < 0 and trend[1] > 0 then flag=1; else flag=0; if trend > 0 and trend[1] < 0 then flagh = 1; else flagh = 0; if trend > 0 and dn < dn[1] then dn=dn[1]; if trend < 0 and up > up[1] then up=up[1]; if flag == 1 then up = avg + ATR; if flagh == 1 then dn = avg - ATR; if trend == 1 then ST = dn; else ST = up; SuperTrend = ST; STrend = trend; 즐거운 하루되세요 > thegin 님이 쓴 글입니다. > 제목 : 문의드립니다. > inputs: ATRLength(100), ATRMult(5), Strength(100); vars: strend(0),st(0); st = SuperTrend(ATRLength, ATRMult, Strength, strend); Plot1(st+atr(ATRLength)*ATRMult,"Up",iff(strend == 1,red,blue)); Plot2(st-atr(ATRLength)*ATRMult,"Down",iff(strend == 1,red,blue)); Plot3(st,"SuperTrend",iff(strend == 1,red,blue)); 안녕하세요 상기 지표를 컴파일하려고 하는데 4번째 줄, 6열에서 선언되지 않은 이름 'SuperTrend'이(가) 사용되었습니다 라는 문구가 뜨고 있습니다. 어떻게 수정해야 검증할 수 있을지 문의드립니다. 감사합니다.