예스스탁
예스스탁 답변
2023-09-18 15:47:49
안녕하세요
예스스탁입니다.
1.1 일봉
input : Period(10);
var : cnt(0),sum1(0),sum2(0),MFIv(0);
sum1 = 0;
sum2 = 0;
for cnt = 0 to Period-1{
if (dayhigh(cnt)+daylow(cnt)+DayClose(cnt)) > (dayhigh(cnt+1)+daylow(cnt+1)+DayClose(cnt+1)) Then
sum1 = sum1 + DayVolume(cnt)*(dayhigh(cnt)+daylow(cnt)+DayClose(cnt))/3;
Else
sum1 = sum1+0;
if (dayhigh(cnt)+daylow(cnt)+DayClose(cnt)) < (dayhigh(cnt+1)+daylow(cnt+1)+DayClose(cnt+1)) Then
sum2 = sum2 + DayVolume(cnt)*(dayhigh(cnt)+daylow(cnt)+DayClose(cnt))/3;
Else
sum2 = sum2+0;
}
MFIv = 100 - 100 / (1 + (sum1 / sum2));
Plot1(MFIv, "돈흐름");
Plot2(20, "하단기준선");
Plot3(80, "상단기준선");
Plot4(50,"중심선");
plot7(MFIv,"볼밴",iff(MFIv>MFIv[1],red,BLACK));
input : P20(20),D(2);
var : sum(0),mav(0),SumSqrt(0),Stdv(0);
var : BBup(0),BBdn(0),BandB(0),Counter(0);
If DayClose(Period) > 0 Then
{
#일봉 이동평균 계산
sum = 0;
for cnt = 0 to P20-1{
sum = sum + DayClose(cnt);
}
mav = sum/P20;
#표준편차 계산
SumSqrt = 0;
For Counter = 0 To P20 - 1 {
SumSqrt = SumSqrt + (DayClose(Counter) - mav)^2;
}
Stdv = SquareRoot(SumSqrt / P20);
# 일봉 볼린져밴드 계산
BBup = mav + (D * Stdv);
BBdn = mav - (D * Stdv);
BandB = ((c-BBdn)/(BBup-BBdn))*100;
If BandB<=10 Then Plot5(50,"침체");
If BandB>=90 Then Plot6(50,"과열");
}
1-2 분봉
input : 타주기분(30),Period(10),P20(20),D(2);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),SumSqrt(0),Stdv(0);
var : sum(0),BBmd(0),Bbup(0),BBdn(0),BandB(0);
var : MFIv(0),sum1(0),sum2(0);
Array : HH[100](0),LL[100](0),CC[100](0),Vv[100](0);
Array : val1[100](0),val2[100](0),val3[100](0),val4[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
HH[0] = H;
LL[0] = L;
VV[0] = 0;
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
CC[cnt] = CC[cnt-1][1];
val1[cnt] = val1[cnt-1][1];
val2[cnt] = val2[cnt-1][1];
val3[cnt] = val3[cnt-1][1];
val4[cnt] = val4[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
CC[0] = C;
VV[0] = VV[0]+V;
val1[0] = HH[0] + LL[0] + CC[0];
val4[0] = VV[0] * Val1[0]/ 3;
if val1[0] > val1[1] then
val2[0] = val4[0];
else
val2[0] = 0;
if val1[0] < val1[1] then
val3[0] = val4[0];
else
val3[0] = 0;
if CC[Period-1] > 0 Then
{
sum1 = 0;
sum2 = 0;
for cnt = 0 to Period-1{
sum1 = sum1+val2[cnt];
sum2 = sum2+val3[cnt];
}
MFIv = 100 - 100 / (1 + (sum1/sum2));
Plot1(MFIv, "돈흐름");
Plot2(20, "하단기준선");
Plot3(80, "상단기준선");
Plot4(50,"중심선");
plot7(MFIv,"볼밴",iff(MFIv>MFIv[1],red,BLACK));
}
if CC[P20-1] > 0 then{
sum = 0;
for cnt = 0 to P20-1
{
sum = sum + CC[cnt];
}
BBmd = sum/P20;
SumSqrt = 0;
For cnt = 0 To P20 - 1
{
SumSqrt = SumSqrt + (CC[cnt] - BBmd)^2;
}
Stdv = SquareRoot(SumSqrt / P20);
BBup = BBmd + (D * Stdv);
BBdn = BBmd - (D * Stdv);
BandB = ((c-BBdn)/(BBUp-BBdn))*100;
If BandB<=10 Then Plot5(50,"침체");
If BandB>=90 Then Plot6(50,"과열");
}
}
2-1 일봉
Input : Period(20), Dv(2),상단기준(90),하단기준(10);
var : sum(0),cnt(0),mav(0),SumSqrt(0),Stdv(0);
var : BBup(0),BBdn(0),BandB(0);
If DayClose(Period) > 0 Then
{
#일봉 이동평균 계산
sum = 0;
for cnt = 0 to Period-1{
sum = sum + DayClose(cnt);
}
mav = sum/Period;
#표준편차 계산
SumSqrt = 0;
For cnt = 0 To Period - 1 {
SumSqrt = SumSqrt + (DayClose(cnt) - mav)^2;
}
Stdv = SquareRoot(SumSqrt / Period);
# 일봉 볼린져밴드 계산
BBup = mav + (Dv * Stdv);
BBdn = mav - (Dv * Stdv);
BandB = ((C-BBdn)/(BBUp-BBdn))*100;
Plot1(BandB);
Plot2(상단기준,"90");
Plot3(하단기준,"10");
}
2-2 분봉
input : 타주기분(30),Period(20), Dv(2),상단기준(90),하단기준(10);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),SumSqrt(0),Stdv(0);
var : sum(0),BBmd(0),Bbup(0),BBdn(0),BandB(0);
Array : CC[100](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
}
}
CC[0] = C;
if CC[Period-1] > 0 then
{
sum = 0;
for cnt = 0 to Period-1{
sum = sum + CC[cnt];
}
BBmd = sum/Period;
SumSqrt = 0;
For cnt = 0 To Period - 1 {
SumSqrt = SumSqrt + (CC[cnt] - BBmd)^2;
}
Stdv = SquareRoot(SumSqrt / Period);
BBup = BBmd + (Dv * Stdv);
BBdn = BBmd - (Dv * Stdv);
BandB = ((c-BBdn)/(BBUp-BBdn))*100;
Plot1(BandB);
Plot2(90,"90");
Plot3(10,"10");
}
}
즐거운 하루되세요
> 레전드 님이 쓴 글입니다.
> 제목 : 문의
> 2개의 지표를 외부 변수로 하여 타주기로 부탁드립니다
1)
Input: Period(10);
Var :MONEYFLOW(0);
MoneyFlow = MFI(Period);
Plot1(MoneyFlow, "돈흐름");
Plot2(20, "하단기준선");
Plot3(80, "상단기준선");
Plot4(50,"중심선");
plot7(MoneyFlow,"볼밴",iff(MoneyFlow>MoneyFlow[1],red,BLACK));
Input :P20(20), D(2);
var :BBdown(0), BBup(0),BandB(0);
BBdown = BollBandDown(P20,D);
BBUp =BollBandUp(P20,D);
BandB = ((c-BBDOWN)/(BBUp-BBDown))*100;
If BandB<=10 Then Plot5(50,"침체");
If BandB>=90 Then Plot6(50,"과열");
2)
Input : Period(20), Dv(2),상단기준(90),하단기준(10);
var : BBdown(0),BBUp(0),BandB(0);
BBDown = BollBandDown(Period,Dv);
BBUp = BollBandUp(Period,Dv);
BandB = ((C-BBDown)/(BBUp-BBDown))*100;
Plot1(BandB);
Plot2(90,"90");
Plot3(10,"10");