예스스탁
예스스탁 답변
2022-09-29 15:27:00
안녕하세요
예스스탁입니다.
아래 내용 참고하시기 바랍니다
n주전,n월전,n년전 시고저종가를 계산하는 식입니다.
1
요일함수가 기본으로 제공되고 있습니다.
dayofweek
2
input : n(1);
var : cnt(0);
Array : WeekO[50](0),WeekH[50](0),WeekL[50](0),WeekC[50](0);
if DayOfWeek(Bdate) < DayOfWeek(Bdate[1]) Then
{
For cnt = 49 to 1
{
WeekO[cnt] = WeekC[cnt-1];
WeekH[cnt] = WeekH[cnt-1];
WeekL[cnt] = WeekL[cnt-1];
WeekC[cnt] = WeekC[cnt-1];
}
WeekO[0] = O;
}
if WeekH[0] > 0 and H > WeekH[0] Then
WeekH[0] = H;
if WeekL[0] > 0 and L < WeekL[0] Then
WeekL[0] = L;
WeekC[0] = c;
if WeekO[n] > 0 Then
{
Plot1(WeekO[n],"n주전 시가");
Plot2(WeekH[n],"n주전 고가");
Plot3(WeekL[n],"n주전 저가");
Plot4(WeekC[n],"n주전 종가");
}
3
input : n(1);
var : cnt(0);
Array : MonthO[50](0),MonthH[50](0),MonthL[50](0),MonthC[50](0);
if bdate > bdate[1]+30 Then
{
For cnt = 49 to 1
{
MonthO[cnt] = MonthC[cnt-1];
MonthH[cnt] = MonthH[cnt-1];
MonthL[cnt] = MonthL[cnt-1];
MonthC[cnt] = MonthC[cnt-1];
}
MonthO[0] = O;
}
if MonthH[0] > 0 and H > MonthH[0] Then
MonthH[0] = H;
if MonthL[0] > 0 and L < MonthL[0] Then
MonthL[0] = L;
MonthC[0] = c;
if MonthO[n] > 0 Then
{
Plot1(MonthO[n],"n월전 시가");
Plot2(MonthH[n],"n월전 고가");
Plot3(MonthL[n],"n월전 저가");
Plot4(MonthC[n],"n월전 종가");
}
4
input : n(1);
var : cnt(0);
Array : YearO[50](0),YearH[50](0),YearL[50](0),YearC[50](0);
if bdate > bdate[1]+30 Then
{
For cnt = 49 to 1
{
YearO[cnt] = YearC[cnt-1];
YearH[cnt] = YearH[cnt-1];
YearL[cnt] = YearL[cnt-1];
YearC[cnt] = YearC[cnt-1];
}
YearO[0] = O;
}
if YearH[0] > 0 and H > YearH[0] Then
YearH[0] = H;
if YearL[0] > 0 and L < YearL[0] Then
YearL[0] = L;
YearC[0] = c;
if YearO[n] > 0 Then
{
Plot1(YearO[n],"n년전 시가");
Plot2(YearH[n],"n년전 고가");
Plot3(YearL[n],"n년전 저가");
Plot4(YearC[n],"n년전 종가");
}
즐거운 하루되세요
> 심기일전 님이 쓴 글입니다.
> 제목 : 수식부탁드립니다
> 안녕하세요. 유튜브에서, 주봉이평, 월봉이평, 연봉이평을 일봉차트에
나타나게하는 수식을 보고 카움수식으로 따라만들어보았읍니다.
이수식을 예스수식으로 부탁드립니다. 늘 감사드립니다.
(1)요일(함수)
M=floor(D/100)%100;
YY=if((M+1-1)==1 or (M+1-1)==2, floor(D/10000)-1, floor(D/10000));
MM=if((M+1-1)==1, 13, if((M+1-1)==2, 14, M));
DD=D%100;
A=(DD+ floor((13*MM+8)/5) + floor(YY/400) + floor(YY/100)+ YY)%7+2;
if(A>7, A-7, A)
(2)주봉의 값을 일봉값으로 나타내기(n주)
A=요일(date);
Valuewhen(n, A(1)>A, C(1))
(3)월봉의값을 일봉값으로 나타내기 (n개월)
M=floor(date/100);
Valuewhen(n, M1=M(1), C(1));
(4)년봉의값을 일봉값으로 나타내기 (n년)
Y=floor(date/10000);
Valuewhen(n, Y1=Y(1), C(1));