커뮤니티

수식 부탁드립니다.

프로필 이미지
목포댁
2022-06-02 20:54:56
1128
글번호 159555
답변완료
안녕하십니까!! 헤이킨아시(HeikinAshi Candle) 시고저종 값으로 적용한 두 가지 헤이킨아시용 파라볼릭 Sar , 파라볼릭(종가) CSar 사용자 함수를 부탁드립니다. 수고하십시요!!! 아래는 파라볼릭(종가) CSar 사용자 함수 수정해 본 것인데, 지표값이 틀리게 나타나네요 #======================================================# # Heikin Ashi Candle 계산식 Vars: ha_C(0), ha_O(0), ha_H(0), ha_L(0) ; #------------------------------------------------------# ha_O = (ha_O[1] + ha_C[1]) / 2 ; # 시가 = (이전 막대의 시가+이전막대의 종가)/2, 직전HA의 몸통 중간값(절반) If Index == 0 then ha_O = O ; ha_C = (O+H+L+C)/4 ; # 종가 = 캔들의 4median ha_H = MaxList(H, ha_O, ha_C) ; ha_L = MinList(L, ha_O, ha_C) ; #======================================================# Input : AF(NumericSimple), AFMAX(NumericSimple); #Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0); Var : Direction(0), SAR_Value(ha_C), AF_Value(.02), HighValue(ha_H), LowValue(ha_L), EP(0); SAR_Value = ha_C ; HighValue = ha_H ; LowValue = ha_L ; if EP != 0 Then { if Direction == 1 then { EP = HighValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if ha_H > HighValue then { HighValue = ha_H; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ha_C < SAR_Value then { Direction = -1; SAR_Value = EP; AF_Value = 0; EP = 0; LowValue = ha_L; } } else { EP = LowValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if ha_L < LowValue then { LowValue = ha_L; AF_Value = AF_Value + Af; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ha_C > SAR_Value then { Direction = 1; SAR_Value = EP; AF_Value = 0; EP = 0; HighValue = ha_H; } } ha_CSar = 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 ha_H > HighValue then { HighValue = ha_H; 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 ha_L < LowValue then { LowValue = ha_L; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } ha_CSar = SAR_Value; } else { if Direction == 0 then { if ha_C > ha_C[1] then Direction = 1; else if ha_C < ha_C[1] then Direction = -1; } else { if Direction == 1 then { if ha_C < ha_C[1] then { Direction = -1; SAR_Value = HighValue; ha_CSar = SAR_Value; } } if Direction == -1 then { if ha_C > ha_C[1] then { Direction = 1; SAR_Value = LowValue; ha_CSar = SAR_Value; } } } LowValue = min(ha_L, LowValue); HighValue = max(ha_H, HighValue); } }
사용자 함수
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-06-03 13:33:35

안녕하세요 예스스탁입니다. 1 Input : AF(Numeric), AFMAX(Numeric); Var : Direction(0), SAR_Value(0), AF_Value(.02), HighValue(0), LowValue(0), EP(0); Vars: ha_C(0), ha_O(0), ha_H(0), ha_L(0) ; ha_O = (ha_O[1] + ha_C[1]) / 2 ; # 시가 = (이전 막대의 시가+이전막대의 종가)/2, 직전HA의 몸통 중간값(절반) If Index == 0 then ha_O = O ; ha_C = (O+H+L+C)/4 ; # 종가 = 캔들의 4median ha_H = MaxList(H, ha_O, ha_C) ; ha_L = MinList(L, ha_O, ha_C) ; if Index == 0 Then { SAR_Value= ha_C; HighValue = ha_H; LowValue = ha_L; } if EP != 0 Then { if Direction == 1 then { EP = HighValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if Ha_H > HighValue then { HighValue = Ha_H; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } if Ha_L < SAR_Value then { Direction = -1; SAR_Value = EP; AF_Value = 0; EP = 0; LowValue = Ha_L; } } else { EP = LowValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if Ha_L < LowValue then { LowValue = Ha_L; AF_Value = AF_Value + Af; if AF_Value >= AFMAX then AF_Value = AFMAX; } if Ha_H > SAR_Value then { Direction = 1; SAR_Value = EP; AF_Value = 0; EP = 0; HighValue = Ha_H; } } ha_Sar = 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 Ha_H > HighValue then { HighValue = Ha_H; 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 Ha_L < LowValue then { LowValue = Ha_L; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } ha_Sar = SAR_Value; } else { if Direction == 0 then { if Ha_C > Ha_C[1] then Direction = 1; else if Ha_C < Ha_C[1] then Direction = -1; } else { if Direction == 1 then { if Ha_C < Ha_C[1] then { Direction = -1; SAR_Value = HighValue; ha_Sar = SAR_Value; } } if Direction == -1 then { if Ha_C > Ha_C[1] then { Direction = 1; SAR_Value = LowValue; ha_Sar = SAR_Value; } } } LowValue = min(Ha_L, LowValue); HighValue = max(Ha_H, HighValue); } } 2 Input : AF(Numeric), AFMAX(Numeric); Var : Direction(0), SAR_Value(0), AF_Value(.02), HighValue(0), LowValue(0), EP(0); #======================================================# # Heikin Ashi Candle 계산식 Vars: ha_C(0), ha_O(0), ha_H(0), ha_L(0) ; #------------------------------------------------------# ha_O = (ha_O[1] + ha_C[1]) / 2 ; # 시가 = (이전 막대의 시가+이전막대의 종가)/2, 직전HA의 몸통 중간값(절반) If Index == 0 then ha_O = O ; ha_C = (O+H+L+C)/4 ; # 종가 = 캔들의 4median ha_H = MaxList(H, ha_O, ha_C) ; ha_L = MinList(L, ha_O, ha_C) ; #======================================================# if Index == 0 Then { SAR_Value= ha_C; HighValue = ha_H; LowValue = ha_L; } if EP != 0 Then { if Direction == 1 then { EP = HighValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if ha_H > HighValue then { HighValue = ha_H; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ha_C < SAR_Value then { Direction = -1; SAR_Value = EP; AF_Value = 0; EP = 0; LowValue = ha_L; } } else { EP = LowValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if ha_L < LowValue then { LowValue = ha_L; AF_Value = AF_Value + Af; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ha_C > SAR_Value then { Direction = 1; SAR_Value = EP; AF_Value = 0; EP = 0; HighValue = ha_H; } } ha_CSar = 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 ha_H > HighValue then { HighValue = ha_H; 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 ha_L < LowValue then { LowValue = ha_L; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } ha_CSar = SAR_Value; } else { if Direction == 0 then { if ha_C > ha_C[1] then Direction = 1; else if ha_C < ha_C[1] then Direction = -1; } else { if Direction == 1 then { if ha_C < ha_C[1] then { Direction = -1; SAR_Value = HighValue; ha_CSar = SAR_Value; } } if Direction == -1 then { if ha_C > ha_C[1] then { Direction = 1; SAR_Value = LowValue; ha_CSar = SAR_Value; } } } LowValue = min(Low, LowValue); HighValue = max(High, HighValue); } } 즐거운 하루되세요 > 목포댁 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다. > 안녕하십니까!! 헤이킨아시(HeikinAshi Candle) 시고저종 값으로 적용한 두 가지 헤이킨아시용 파라볼릭 Sar , 파라볼릭(종가) CSar 사용자 함수를 부탁드립니다. 수고하십시요!!! 아래는 파라볼릭(종가) CSar 사용자 함수 수정해 본 것인데, 지표값이 틀리게 나타나네요 #======================================================# # Heikin Ashi Candle 계산식 Vars: ha_C(0), ha_O(0), ha_H(0), ha_L(0) ; #------------------------------------------------------# ha_O = (ha_O[1] + ha_C[1]) / 2 ; # 시가 = (이전 막대의 시가+이전막대의 종가)/2, 직전HA의 몸통 중간값(절반) If Index == 0 then ha_O = O ; ha_C = (O+H+L+C)/4 ; # 종가 = 캔들의 4median ha_H = MaxList(H, ha_O, ha_C) ; ha_L = MinList(L, ha_O, ha_C) ; #======================================================# Input : AF(NumericSimple), AFMAX(NumericSimple); #Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0); Var : Direction(0), SAR_Value(ha_C), AF_Value(.02), HighValue(ha_H), LowValue(ha_L), EP(0); SAR_Value = ha_C ; HighValue = ha_H ; LowValue = ha_L ; if EP != 0 Then { if Direction == 1 then { EP = HighValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if ha_H > HighValue then { HighValue = ha_H; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ha_C < SAR_Value then { Direction = -1; SAR_Value = EP; AF_Value = 0; EP = 0; LowValue = ha_L; } } else { EP = LowValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if ha_L < LowValue then { LowValue = ha_L; AF_Value = AF_Value + Af; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ha_C > SAR_Value then { Direction = 1; SAR_Value = EP; AF_Value = 0; EP = 0; HighValue = ha_H; } } ha_CSar = 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 ha_H > HighValue then { HighValue = ha_H; 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 ha_L < LowValue then { LowValue = ha_L; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } ha_CSar = SAR_Value; } else { if Direction == 0 then { if ha_C > ha_C[1] then Direction = 1; else if ha_C < ha_C[1] then Direction = -1; } else { if Direction == 1 then { if ha_C < ha_C[1] then { Direction = -1; SAR_Value = HighValue; ha_CSar = SAR_Value; } } if Direction == -1 then { if ha_C > ha_C[1] then { Direction = 1; SAR_Value = LowValue; ha_CSar = SAR_Value; } } } LowValue = min(ha_L, LowValue); HighValue = max(ha_H, HighValue); } }