예스스탁
예스스탁 답변
2025-03-06 08:56:39
안녕하세요
예스스탁입니다.
1번식은 기존식에 윗꼬리/아랫꼬리 추가한선입니다.
2번식은 기존몸통을 추세선으로 그리셨는데 박스함수로 대체한 식입니다
1
input : ntime1(30);
var : SS1(0),DD1(0),TTM(0),TTF(0);
var : SM1(0),m3var(0), m3L(0), cnt(0);
Array : Mb30[100](0);
var : TL11(0),TL12(0),TL13(0),TL14(0),idx2(-1);
var : M3date(0),M3time(0), StrtV(0), m3UD(0), mrCl(0);
var : HH(0),LL(0),HTL(0),LTL(0),bb(0);
if Bdate != Bdate[1] Then
{
SS1 = TimeToMinutes(0);
DD1 = sdate;
}
if DD1 > 0 then
{
if sdate == DD1 Then
TTM = TimeToMinutes(stime)-SS1;
Else
TTM = TimeToMinutes(stime)+1440-SS1;
TTF = TTM%ntime1;
if Bdate != Bdate[1] or sTime == 90000 or // 90000
(Bdate == Bdate[1] && ntime1 > 1 && TTF < TTF[1]) or
(Bdate == Bdate[1] && ntime1 > 1 && TTM >= TTM[1]+ntime1) or
(Bdate == Bdate[1] && ntime1 == 1 && TTM > TTM[1]) Then
{
m3L = 1;
}
else
m3L = 0;
if m3L == 1 Then
{
idx2 = 0;
StrtV = O;
M3date = sdate;
M3time = stime;
HH = H;
LL = L;
HTL = TL_New(sDate,sTime,max(C,StrtV),sDate,sTime,HH);
LTL = TL_New(sDate,sTime,min(C,StrtV),sDate,sTime,LL);
}
else
{
idx2 = idx2+1;
if H > HH Then
HH = H;
if L < LL Then
LL = L;
bb = Floor(idx2/2);
TL_SetBegin(HTL,sDate[bb],sTime[bb],max(C,StrtV));
TL_SetEnd(HTL,sDate[bb],sTime[bb],HH);
TL_SetBegin(LTL,sDate[bb],sTime[bb],min(C,StrtV));
TL_SetEnd(LTL,sDate[bb],sTime[bb],LL);
if idx2 > 0 then
{
if idx2 == 1 then
{
TL11 = TL_New(sdate[1],stime[1],StrtV, sdate, stime, StrtV);
TL12 = TL_New(M3date, M3time, O, sdate, stime, C);
TL13 = TL_New(M3date, M3time, StrtV, M3date,M3time,C);
TL14 = TL_New(sdate, stime, StrtV, sdate, stime, C);
}
else
{
TL_SetEnd(TL11,sdate,stime,StrtV);
TL_SetBegin(TL12,M3date, M3time,C);
TL_SetEnd( TL12,sdate,stime,C);
TL_SetBegin(TL13,M3date,M3time,StrtV);
TL_SetEnd( TL13,M3date,M3time,C);
TL_SetBegin(TL14,sdate,stime,StrtV);
TL_SetEnd( TL14,sdate,stime,C);
}
if C > StrtV Then
{
TL_SetColor(TL11,RGB(235,000,000));
TL_SetColor(TL12,RGB(235,000,000));
TL_SetColor(TL13,RGB(235,000,000));
TL_SetColor(TL14,RGB(235,000,000));
TL_SetSize(TL11,0); TL_SetSize(TL12,0); TL_SetSize(TL13,0); TL_SetSize(TL14,0);
}
else
{
TL_SetColor(TL11,RGB(000,000,235));
TL_SetColor(TL12,RGB(000,000,235));
TL_SetColor(TL13,RGB(000,000,235));
TL_SetColor(TL14,RGB(000,000,235));
TL_SetSize(TL11,0); TL_SetSize(TL12,0); TL_SetSize(TL13,0); TL_SetSize(TL14,0);
}
}
}
}
2
input : ntime1(30);
var : SS1(0),DD1(0),TTM(0),TTF(0);
var : SM1(0),m3var(0), m3L(0), cnt(0);
Array : Mb30[100](0);
var : M3date(0),M3time(0), StrtV(0), m3UD(0), mrCl(0);
var : idx2(0), HH(0),LL(0),HTL(0),LTL(0),bb(0),box(0);
if Bdate != Bdate[1] Then
{
SS1 = TimeToMinutes(0);
DD1 = sdate;
}
if DD1 > 0 then
{
if sdate == DD1 Then
TTM = TimeToMinutes(stime)-SS1;
Else
TTM = TimeToMinutes(stime)+1440-SS1;
TTF = TTM%ntime1;
if Bdate != Bdate[1] or sTime == 90000 or // 90000
(Bdate == Bdate[1] && ntime1 > 1 && TTF < TTF[1]) or
(Bdate == Bdate[1] && ntime1 > 1 && TTM >= TTM[1]+ntime1) or
(Bdate == Bdate[1] && ntime1 == 1 && TTM > TTM[1]) Then
{
m3L = 1;
}
else
m3L = 0;
if m3L == 1 Then
{
idx2 = 0;
StrtV = O;
M3date = sdate;
M3time = stime;
HH = H;
LL = L;
HTL = TL_New(sDate,sTime,max(C,StrtV),sDate,sTime,HH);
LTL = TL_New(sDate,sTime,min(C,StrtV),sDate,sTime,LL);
box = Box_New(sDate,sTime,StrtV,NextBarSdate,NextBarStime,C);
Box_SetFill(box,true);
}
else
{
idx2 = idx2+1;
if H > HH Then
HH = H;
if L < LL Then
LL = L;
bb = Floor(idx2/2);
TL_SetBegin(HTL,sDate[bb],sTime[bb],max(C,StrtV));
TL_SetEnd(HTL,sDate[bb],sTime[bb],HH);
TL_SetBegin(LTL,sDate[bb],sTime[bb],min(C,StrtV));
TL_SetEnd(LTL,sDate[bb],sTime[bb],LL);
Box_SetEnd(Box,sDate,sTime,C);
}
if C > StrtV Then
{
box_SetColor(box,RGB(235,000,000));
TL_SetColor(HTL,RGB(235,000,000));
TL_SetColor(LTL,RGB(235,000,000));
}
Else
{
box_SetColor(box,RGB(000,000,235));
TL_SetColor(HTL,RGB(000,000,235));
TL_SetColor(LTL,RGB(000,000,235));
}
}
즐거운 하루되세요
> 짱짱해야지 님이 쓴 글입니다.
> 제목 : 30분봉에서 최고 최저점 그리기
> 아래 코딩에서 30분의 사각선에서 30분의 최고점과 최저점을 30분 사각의 중앙(위쪽의 그림과 같이 30분 사각형 중앙)에 나타낼 수 있을 까요?
그림에서 수기로 그린 부분과 같습니다
항상 감사드립니다.
input : ntime1(30);
var : SS1(0),DD1(0),TTM(0),TTF(0);
var : SM1(0),m3var(0), m3L(0), cnt(0);
Array : Mb30[100](0);
if Bdate != Bdate[1] Then{
SS1 = TimeToMinutes(0);
DD1 = sdate;
}
if DD1 > 0 then{
if sdate == DD1 Then
TTM = TimeToMinutes(stime)-SS1;
Else
TTM = TimeToMinutes(stime)+1440-SS1;
TTF = TTM%ntime1;
if Bdate != Bdate[1] or sTime == 90000 or // 90000
(Bdate == Bdate[1] && ntime1 > 1 && TTF < TTF[1]) or
(Bdate == Bdate[1] && ntime1 > 1 && TTM >= TTM[1]+ntime1) or
(Bdate == Bdate[1] && ntime1 == 1 && TTM > TTM[1]) Then
{
m3L = 1;
}
else m3L = 0;
// 30봉 선 그리기
var : TL11(0),TL12(0),TL13(0),TL14(0),idx2(-1);
var : M3date(0), M3time(0), StrtV(0), m3UD(0), mrCl(0);
if m3L == 1 Then{
idx2 = 0;
StrtV = O;
M3date = sdate;
M3time = stime;
}
else{
idx2 = idx2+1;
if idx2 > 0 then{
if idx2 == 1 then{
TL11 = TL_New(sdate[1],stime[1],StrtV, sdate, stime, StrtV);
TL12 = TL_New(M3date, M3time, O, sdate, stime, C);
TL13 = TL_New(M3date, M3time, StrtV, M3date,M3time,C);
TL14 = TL_New(sdate, stime, StrtV, sdate, stime, C);
}
else {
TL_SetEnd(TL11,sdate,stime,StrtV);
TL_SetBegin(TL12,M3date, M3time,C);
TL_SetEnd( TL12,sdate,stime,C);
TL_SetBegin(TL13,M3date,M3time,StrtV);
TL_SetEnd( TL13,M3date,M3time,C);
TL_SetBegin(TL14,sdate,stime,StrtV);
TL_SetEnd( TL14,sdate,stime,C);
}
if C > StrtV Then{
TL_SetColor(TL11,RGB(235,000,000));
TL_SetColor(TL12,RGB(235,000,000));
TL_SetColor(TL13,RGB(235,000,000));
TL_SetColor(TL14,RGB(235,000,000));
TL_SetSize(TL11,0); TL_SetSize(TL12,0); TL_SetSize(TL13,0); TL_SetSize(TL14,0);
}
else {
TL_SetColor(TL11,RGB(000,000,235));
TL_SetColor(TL12,RGB(000,000,235));
TL_SetColor(TL13,RGB(000,000,235));
TL_SetColor(TL14,RGB(000,000,235));
TL_SetSize(TL11,0); TL_SetSize(TL12,0); TL_SetSize(TL13,0); TL_SetSize(TL14,0);
}
}
}