예스스탁
예스스탁 답변
2024-09-06 11:04:54
안녕하세요
예스스탁입니다.
1-1 주봉 %K
사용자함수명 : WeekStoK
반환값형 : 숫자형
input : wSto1(Numeric),wSto2(Numeric);
var : wEp1(0),cnt(0);
var : wHV(0), wLV(0), wfastK(0),wStoK(0);
var : wIDX(0), PrewStoK(0);
Array : WH[100](0),WL[100](0);
wEp1 = 2/(wSto2+1);
if DayOfWeek(bdate) < DayOfWeek(bdate[1]) Then
{
for cnt = 99 DownTo 1
{
WH[cnt] = WH[cnt-1];
WL[cnt] = WL[cnt-1];
}
widx = widx + 1;
PrewStoK = wStoK[1];
WH[0] = H;
WL[0] = L;
}
if WH[0] > 0 and H > WH[0] Then
WH[0] = H;
if WL[0] > 0 and L < WL[0] Then
WL[0] = L;
if WH[wSto1-1] > 0 and WL[wSto1-1] > 0 Then
{
wHV = WH[0];
wLV = WL[0];
for cnt = 0 to wSto1-1
{
if WH[cnt] > wHV then
wHV = WH[cnt];
if WL[cnt] < wLV then
wLV = WL[cnt];
}
wFastK = (C-wLV)/(wHV-wLV)*100;
}
if wIDX <= 1 then
{
wStoK = wFastK ;
}
else
{
wStoK = wFastK * wEP1 + PrewStoK * (1-wEP1);
}
WeekStoK = wStoK;
1-2 주봉 %D
사용자함수명 : WeekStoD
반환값형 : 숫자형
input : wSto1(Numeric),wSto2(Numeric), wSto3(Numeric);
var : wEp1(0),wEP2(0),cnt(0);
var : wHV(0), wLV(0), wfastK(0),wStoK(0),wStoD(0);
var : wIDX(0), PrewStoK(0), PrewStoD(0);
Array : WH[100](0),WL[100](0);
wEp1 = 2/(wSto2+1);
wEp2 = 2/(wSto3+1);
if DayOfWeek(bdate) < DayOfWeek(bdate[1]) Then
{
for cnt = 99 DownTo 1
{
WH[cnt] = WH[cnt-1];
WL[cnt] = WL[cnt-1];
}
widx = widx + 1;
PrewStoK = wStoK[1];
PrewStoD = wStoD[1];
WH[0] = H;
WL[0] = L;
}
if WH[0] > 0 and H > WH[0] Then
WH[0] = H;
if WL[0] > 0 and L < WL[0] Then
WL[0] = L;
if WH[wSto1-1] > 0 and WL[wSto1-1] > 0 Then
{
wHV = WH[0];
wLV = WL[0];
for cnt = 0 to wSto1-1
{
if WH[cnt] > wHV then
wHV = WH[cnt];
if WL[cnt] < wLV then
wLV = WL[cnt];
}
wFastK = (C-wLV)/(wHV-wLV)*100;
}
if wIDX <= 1 then
{
wStoK = wFastK ;
wStoD = wStoK ;
}
else
{
wStoK = wFastK * wEP1 + PrewStoK * (1-wEP1);
wStoD = wStoK * wEP2 + PrewStoD * (1-wEP2);
}
WeekStoD = wStoD;
2. 주봉 RSI
사용자함수명 : WeekRSI
반환값형 : 숫자형
Input : Length(Numeric);
var : cnt(0),S1(0),D1(0),TM(0),TF1(0);
var : SigSum(0),count2(0),RSIsig(0);
Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0);
var : idx(0), PreUpAvg(0), preDownAvg(0),RSIV(0);
Array : C1[100](0);
if DayOfWeek(Bdate) < DayOfWeek(Bdate[1]) Then
{
for cnt = 99 downto 1
{
C1[cnt] = C1[cnt-1];
}
PreUpAvg = UpAvg[1];
preDownAvg = DownAvg[1];
idx = idx + 1;
}
C1[0] = C;
If idx == Length+2 Then
{
UpSum = 0;
DownSum = 0;
For Counter = 0 To Length - 1
{
UpAmt = C1[Counter] - C1[Counter+1];
If UpAmt >= 0 Then
DownAmt = 0;
Else
{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpSum = UpSum + UpAmt;
DownSum = DownSum + DownAmt;
}
UpAvg = UpSum / Length;
DownAvg = DownSum / Length;
}
If idx > Length+2 Then
{
UpAmt = C1[0] - C1[1];
If UpAmt >= 0 Then
DownAmt = 0;
Else
{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpAvg = (PreUpAvg * (Length - 1) + UpAmt) / Length;
DownAvg = (preDownAvg * (Length - 1) + DownAmt) / Length;
}
If UpAvg + DownAvg <> 0 Then
RSIv = 100 * UpAvg / (UpAvg + DownAvg);
Else
RSIv = 0;
WeekRSI = RSIv;
3-1
사용자함수명 : DayStok
반환값형 : 숫자형
input : Period(Numeric), Period1(Numeric);
var : cnt(0), highVal(0), lowVal(0), FK(0), SK(0);
var : Ep1(0), PreSK(0);
highVal = dayhigh(0);
lowVal = daylow(0);
for cnt = 0 to Period-1 {
if dayHigh(cnt) > highVal then
highVal = dayhigh(cnt);
if dayLow(cnt) < lowVal then
lowVal = dayLow(cnt);
}
fK = (C-lowVal)/(highVal-lowVal)*100;
Ep1 = 2/(Period1+1);
if bdate != bdate[1] then
{
PreSK = SK[1];
}
SK = FK * EP1 + PreSK * (1-EP1);
DayStoK = SK;
3-2
사용자함수명 : DayStoD
반환값형 : 숫자형
input : Period(Numeric), Period1(Numeric), Period2(Numeric);
var : cnt(0), highVal(0), lowVal(0), FK(0), SK(0), SD(0);
var : Ep1(0), Ep2(0), PreSK(0), PreSD(0);
highVal = dayhigh(0);
lowVal = daylow(0);
for cnt = 0 to Period-1 {
if dayHigh(cnt) > highVal then
highVal = dayhigh(cnt);
if dayLow(cnt) < lowVal then
lowVal = dayLow(cnt);
}
fK = (C-lowVal)/(highVal-lowVal)*100;
Ep1 = 2/(Period1+1);
Ep2 = 2/(Period2+1);
if bdate != bdate[1] then {
PreSK = SK[1];
PreSD = SD[1];
}
SK = FK * EP1 + PreSK * (1-EP1);
SD = SK * EP2 + PreSD * (1-EP2);
DayStoD = SD;
4
사용자함수명 : DayRSI
반환값형 : 숫자형
Input : Length(Numeric);
var : cnt(0),SigSum(0),count2(0);
Var : Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0), DownAvg(0);
var : idx(0), PreUpAvg(0), preDownAvg(0),RSIV(0);
Array : C1[100](0);
if Bdate != Bdate[1] Then
{
for cnt = 99 DownTo 1
{
C1[cnt] = C1[cnt-1];
}
PreUpAvg = UpAvg[1];
preDownAvg = DownAvg[1];
idx = idx + 1;
}
C1[0] = C;
If idx == Length+2 Then
{
UpSum = 0;
DownSum = 0;
For Counter = 0 To Length - 1
{
UpAmt = C1[Counter] - C1[Counter+1];
If UpAmt >= 0 Then
DownAmt = 0;
Else
{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpSum = UpSum + UpAmt;
DownSum = DownSum + DownAmt;
}
UpAvg = UpSum / Length;
DownAvg = DownSum / Length;
}
If idx > Length+2 Then
{
UpAmt = C1[0] - C1[1];
If UpAmt >= 0 Then
DownAmt = 0;
Else
{
DownAmt = -UpAmt;
UpAmt = 0;
}
UpAvg = (PreUpAvg * (Length - 1) + UpAmt) / Length;
DownAvg = (preDownAvg * (Length - 1) + DownAmt) / Length;
}
If UpAvg + DownAvg <> 0 Then
RSIv = 100 * UpAvg / (UpAvg + DownAvg);
Else
RSIv = 0;
DayRSI = RSIv;
즐거운 하루되세요
> gunman 님이 쓴 글입니다.
> 제목 : 문의
> 사용자함수를 부탁드립니다.
아래와 같은 조건의 사용자함수를 등록하여 사용하고자 합니다.
1. 분봉에서 주봉의 스토캐스틱 수치를 출력하는 함수
2. 분봉에서 주봉의 RSI수치를 출력하는 함수
3. 분봉에서 일봉의 스토캐스틱 수치를 출력하는 함수
4. 분봉에서 일봉의 RSI수치를 출력하는 함수