커뮤니티

지표 문제해결 부탁합니다.

프로필 이미지
바쁜후니
2014-10-03 14:19:27
237
글번호 79062
답변완료

첨부 이미지

파라볼릭지표에 지지저항선을 표시하고자 아래와 같이 지표를 만들어 잘사용했습니다. <파라볼릭지지저항> input : af(0.02),maxaf(0.2); var1 = Sar(af,maxaf); if crossup(c,var1) Then value1 = var1; if CrossDown(c,var1) Then value1 = var1; if C > var1 Then plot1(value1,"sar",RED); if C < var1 Then plot1(value1,"sar",blue); 그런데 sar함수를 수정하여서 아래와 같이 sar1이라는 함수를 만들어서 파라볼릭지표를 작성하고 지지저항지표에서 sar함수를 sar1로 수정하여보니 지지저항선이 제대로 그려지지가 않습니다. 무엇이 문제인지를 잘 모르겠습니다. 올바르게 작동하는 지표부탁드립니다. 제대로 그려진 챠트의 모습의 파일을 첨부했습니다. 수정한 sar1 함수 내용은 아래와 같습니다.(단순히 "고가" 나 "저가" 자리를 바꾼것입니다) Input : AF(NumericSimple), AFMAX(NumericSimple); Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0); if EP != 0 Then { if Direction == 1 then { EP = HighValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if low > HighValue then { HighValue = low; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } if high < SAR_Value then { Direction = -1; SAR_Value = EP; AF_Value = 0; EP = 0; LowValue = high; } } else { EP = LowValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if high < LowValue then { LowValue = high; AF_Value = AF_Value + Af; if AF_Value >= AFMAX then AF_Value = AFMAX; } if low > SAR_Value then { Direction = 1; SAR_Value = EP; AF_Value = 0; EP = 0; HighValue = low; } } Sar1 = SAR_Value; } else { if SAR_Value != 0 && EP == 0 then { if Direction == 1 then { EP = HighValue; AF_Value = AF; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if low > HighValue then { HighValue = low; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } else { EP = LowValue; AF_Value = Af; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if high < LowValue then { LowValue = high; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } Sar1 = SAR_Value; } else { if Direction == 0 then { if Close > Close[1] then Direction = 1; else if Close < Close[1] then Direction = -1; } else { if Direction == 1 then { if Close < Close[1] then { Direction = -1; SAR_Value = HighValue; Sar1 = SAR_Value; } } if Direction == -1 then { if Close > Close[1] then { Direction = 1; SAR_Value = LowValue; Sar1 = SAR_Value; } } } LowValue = min(high, LowValue); HighValue = max(low, HighValue); } }
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-10-06 16:59:59

안녕하세요 예스스탁입니다. 지표식에서 종가 크로스를 고가와 저가 크로스로 변경하셔야 합니다. input : af(0.02),maxaf(0.2); var1 = Sar(af,maxaf); if crossup(L,var1) Then value1 = var1; if CrossDown(H,var1) Then value1 = var1; if C > var1 Then plot1(value1,"sar",RED); if C < var1 Then plot1(value1,"sar",blue); plot2(var1); 즐거운 하루되세요 > 바쁜후니 님이 쓴 글입니다. > 제목 : 지표 문제해결 부탁합니다. > 파라볼릭지표에 지지저항선을 표시하고자 아래와 같이 지표를 만들어 잘사용했습니다. <파라볼릭지지저항> input : af(0.02),maxaf(0.2); var1 = Sar(af,maxaf); if crossup(c,var1) Then value1 = var1; if CrossDown(c,var1) Then value1 = var1; if C > var1 Then plot1(value1,"sar",RED); if C < var1 Then plot1(value1,"sar",blue); 그런데 sar함수를 수정하여서 아래와 같이 sar1이라는 함수를 만들어서 파라볼릭지표를 작성하고 지지저항지표에서 sar함수를 sar1로 수정하여보니 지지저항선이 제대로 그려지지가 않습니다. 무엇이 문제인지를 잘 모르겠습니다. 올바르게 작동하는 지표부탁드립니다. 제대로 그려진 챠트의 모습의 파일을 첨부했습니다. 수정한 sar1 함수 내용은 아래와 같습니다.(단순히 "고가" 나 "저가" 자리를 바꾼것입니다) Input : AF(NumericSimple), AFMAX(NumericSimple); Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0); if EP != 0 Then { if Direction == 1 then { EP = HighValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if low > HighValue then { HighValue = low; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } if high < SAR_Value then { Direction = -1; SAR_Value = EP; AF_Value = 0; EP = 0; LowValue = high; } } else { EP = LowValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if high < LowValue then { LowValue = high; AF_Value = AF_Value + Af; if AF_Value >= AFMAX then AF_Value = AFMAX; } if low > SAR_Value then { Direction = 1; SAR_Value = EP; AF_Value = 0; EP = 0; HighValue = low; } } Sar1 = SAR_Value; } else { if SAR_Value != 0 && EP == 0 then { if Direction == 1 then { EP = HighValue; AF_Value = AF; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if low > HighValue then { HighValue = low; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } else { EP = LowValue; AF_Value = Af; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if high < LowValue then { LowValue = high; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } Sar1 = SAR_Value; } else { if Direction == 0 then { if Close > Close[1] then Direction = 1; else if Close < Close[1] then Direction = -1; } else { if Direction == 1 then { if Close < Close[1] then { Direction = -1; SAR_Value = HighValue; Sar1 = SAR_Value; } } if Direction == -1 then { if Close > Close[1] then { Direction = 1; SAR_Value = LowValue; Sar1 = SAR_Value; } } } LowValue = min(high, LowValue); HighValue = max(low, HighValue); } }