커뮤니티
nthhighestbar수식에 대하여
2006-12-09 14:57:38
1368
글번호 11473
nthhighestbar를 수식으로 표현하면 아래가 맞는지 알려 주시기 바랍니다.
그리고 예스스탁에서 사용하는 수식이 아래와는 다르다면 nthhighestbar 를 수식으로 표현하여 주시기 바랍니다.
Input: Nth(Numeric), Price(Numeric), Length(Numeric);
Var: Value1(0),Value2(0),Value3(0);
Array: PriceArray[100](0), BarNumArray[100](0);
If Nth <= Length AND Nth <= 100 Then Begin
For value1 = 0 To Length - 1 Begin
PriceArray[value1] = Price[value1];
BarNumArray[value1] = value1;
End;
For value1 = 0 To Nth - 1 Begin
For value2 = value1 + 1 To Length - 1 Begin
If PriceArray[value2] > PriceArray[value1] Then Begin
Value3 = PriceArray[value1];
PriceArray[value1] = PriceArray[value2];
PriceArray[value2] = Value3;
Value3 = BarNumArray[value1];
BarNumArray[value1] = BarNumArray[value2];
BarNumArray[value2] = Value3;
End;
End;
End;
NthHighestBar = BarNumArray[Nth - 1];
End
Else
NthHighestBar = -1;
답변 1
예스스탁 예스스탁 답변
2006-12-11 10:37:56
안녕하세요
예스스탁입니다.
올리신 식과 같은 내용입니다.
즐거운 하루되세요
> 이지화 님이 쓴 글입니다.
> 제목 : nthhighestbar수식에 대하여
> nthhighestbar를 수식으로 표현하면 아래가 맞는지 알려 주시기 바랍니다.
그리고 예스스탁에서 사용하는 수식이 아래와는 다르다면 nthhighestbar 를 수식으로 표현하여 주시기 바랍니다.
Input: Nth(Numeric), Price(Numeric), Length(Numeric);
Var: Value1(0),Value2(0),Value3(0);
Array: PriceArray[100](0), BarNumArray[100](0);
If Nth <= Length AND Nth <= 100 Then Begin
For value1 = 0 To Length - 1 Begin
PriceArray[value1] = Price[value1];
BarNumArray[value1] = value1;
End;
For value1 = 0 To Nth - 1 Begin
For value2 = value1 + 1 To Length - 1 Begin
If PriceArray[value2] > PriceArray[value1] Then Begin
Value3 = PriceArray[value1];
PriceArray[value1] = PriceArray[value2];
PriceArray[value2] = Value3;
Value3 = BarNumArray[value1];
BarNumArray[value1] = BarNumArray[value2];
BarNumArray[value2] = Value3;
End;
End;
End;
NthHighestBar = BarNumArray[Nth - 1];
End
Else
NthHighestBar = -1;