함수설명
가중이동평균(Weighted Moving Average) 지표함수
작성방법
Wma(기준값, 기간)
C
복사
매개변수 설명
•
"기준값": Numeric, 데이터, 함수, 변수, 계산식 등
•
"기간": Numeric, 최근 N개봉 기간값을 입력
계산
(Price× N + Price[1]×(N-1)+....Price[N]×1)/(N+(N-1)+(N-2)......+1)
활용예시
//인라인함수(수식안에서 만들어 사용하는 함수)
Function infx_WMA Numeric
{
Input : Price(NumericSeries), Length(NumericSimple);
Var : Sum(0), Counter(0), CSum(0);
Sum = 0;
CSum = 0;
For counter = 0 To Length - 1 Begin
Sum = Sum + Price[counter] * (Length - counter);
CSum = CSum + Length - counter;
End;
If CSum > 0 Then
infx_WMA = Sum / CSum;
Else
infx_WMA = 0;
}
EndFunction
input : Period(14);
var : wmav(0);
wmav = infx_WMA(C,Period);
Plot1(wmav);
C
복사
뒤로가기는 좌측상단의 목차 버튼을 눌러주세요.