Search

CSAR_TA

함수설명

종가 파라볼릭(Parablic Stop And Reverse) 지표함수
※기존 CSar함수는 가속도와 최고가속도값 지정이 가능하고 계산의 기준값들은 지정할 수 없었지만 CSar_TA함수는 기준값을 다른 값으로 지정해 계산할 수 있습니다.

작성방법

CSar_TA(HPrice, LPrice, CPrice, AF, AFMAX)
C
복사

매개변수 설명

"Hprice": Numeric, 데이터, 함수, 변수, 계산식 등, 계산식에서 고가로 사용할 값
"LPrice": Numeric, 데이터, 함수, 변수, 계산식 등, 계산식에서 저가로 사용할 값
"CPrice": Numeric, 데이터, 함수, 변수, 계산식 등, 계산식에서 종가로 사용할 값
"AF": Numeric, 가속도
"AFMAX": Numeric, 가속도 최대치
계산 익일Sar = 당일Sar + (극단값-당일CSar)X가속도 일반 파라볼릭은 극단값으로 고가와 저가를 사용하고 파라볼릭 종가는 극단값으로 종가를 사용합니다.

활용예시

1. value1 = ma(C,5); var1 = CSar_TA(value1,value1,value1, 0.02, 0.2); --> 5기간 단순이동평균으로 종가 파라볼릭값을 계산하고 var1에 저장 2. //인라인함수(수식안에서 만들어 사용하는 함수) Function infx_CSAR_TA Numeric { Input : highPrice(NumericSeries),LowPrice(NumericSeries),ClosePrice(NumericSeries); input : AF(NumericSimple), AFMAX(NumericSimple); Var : Direction(0), SAR_Value(ClosePrice), AF_Value(.02); var : HighValue(highPrice), LowValue(LowPrice), EP(0); if EP != 0 Then { if Direction == 1 then { EP = HighValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if highPrice > HighValue then { HighValue = highPrice; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ClosePrice < SAR_Value then { Direction = -1; SAR_Value = EP; AF_Value = 0; EP = 0; LowValue = LowPrice; } } else { EP = LowValue; SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value); if LowPrice < LowValue then { LowValue = LowPrice; AF_Value = AF_Value + Af; if AF_Value >= AFMAX then AF_Value = AFMAX; } if ClosePrice > SAR_Value then { Direction = 1; SAR_Value = EP; AF_Value = 0; EP = 0; HighValue = highPrice; } } infx_CSAR_TA = 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 highPrice > HighValue then { HighValue = highPrice; 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 LowPrice < LowValue then { LowValue = LowPrice; AF_Value = AF_Value + AF; if AF_Value >= AFMAX then AF_Value = AFMAX; } } infx_CSAR_TA = SAR_Value; } else { if Direction == 0 then { if ClosePrice > ClosePrice[1] then Direction = 1; else if ClosePrice < ClosePrice[1] then Direction = -1; } else { if Direction == 1 then { if ClosePrice < ClosePrice[1] then { Direction = -1; SAR_Value = HighValue; infx_CSAR_TA = SAR_Value; } } if Direction == -1 then { if ClosePrice > ClosePrice[1] then { Direction = 1; SAR_Value = LowValue; infx_CSAR_TA = SAR_Value; } } } LowValue = min(LowPrice, LowValue); HighValue = max(HighPrice, HighValue); } } } EndFunction Input : af(0.02), maxAF(0.2); value1 = ma(C,5); var1 = infx_CSAR_TA(value1,value1,value1,af,maxAF); if value1 > var1 Then Plot1(var1, "SAR",Red); Else Plot1(var1, "SAR",Blue); plot2(value1,"이동평균");
C
복사
뒤로가기는 좌측상단의 목차 버튼을 눌러주세요.