답변완료
시간박스
안녕하세요?
시장시간별고가와 저가의 박스를그리는지표입니다,
그런데 애러가 발생합니다,,,, 수정부탁드립니다,,
var : T(0),idx(0),HH(0),LL(0),SD(0),ST(0);
var : TL1(0),TL2(0),TL3(0),TL4(0),color(0);
if (bdate != bdate[1] and stime >= 070000) or
(bdate == bdate[1] and stime >= 070000 and stime[1] < 070000) Then
{
T = 1;
}
if (bdate != bdate[1] and stime >= 170000) or
(bdate == bdate[1] and stime >= 170000 and stime[1] < 170000) Then
{
T = 2;
}
if (bdate != bdate[1] and stime >= 230000) or
(bdate == bdate[1] and stime >= 230000 and stime[1] < 230000) Then
{
T = 3;
}
if T != T[1] Then
{
HH = H;
LL = L;
SD = sdate;
ST = stime;
idx = 0;
}
if T == T[1] and T >= 1 then
{
idx = idx+1;
if H > HH Then
HH = H;
if L < LL Then
LL = L;
if idx == 1 then
{
TL1 = TL_New(SD,ST,HH,sdate,stime,HH);
TL2 = TL_New(SD,ST,LL,sdate,stime,LL);
TL3 = TL_New(SD,ST,HH,SD,ST,LL);
TL4 = TL_New(sDate,sTime,HH,sdate,stime,HH);
if T == 1 Then
color = red;
if T == 2 Then
color = blue;
if T == 3 Then
color = GREEN;
TL_SetColor(TL1,color);
TL_SetColor(TL2,color);
TL_SetColor(TL3,color);
TL_SetColor(TL4,color);
}
Else
{
TL_SetBegin(TL1,SD,ST,HH);
TL_SetEnd(TL1,sdate,stime,HH);
TL_SetBegin(TL2,SD,ST,LL);
TL_SetEnd(TL2,sdate,stime,LL);
TL_SetBegin(TL3,SD,ST,HH);
TL_SetEnd(TL3,SD,ST,LL);
TL_SetBegin(TL4,sDate,sTime,HH);
TL_SetEnd(TL4,sDate,sTime,LL);
}
}
2024-03-06
747
글번호 177214
지표
답변완료
피보나치 중간선 박스
Input : 전환(0.7);
Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분("");
Array:고[10,4](0),저[10,4](0);
var : box(0),TX(0),TL(0),T(0),TL1(0),TL2(0),TL3(0);
HH = H;
LL = L;
If Index == 0 Then
{
고[1,1] = HH;
고[1,2] = 0;
고[1,3] = sDate;
고[1,4] = sTime;
저[1,1] = LL;
저[1,2] = 0;
저[1,3] = sDate;
저[1,4] = sTime;
}
If Index > 0 Then
{
hiBar = hiBar + 1;
loBar = loBar + 1;
}
If HH[hiBar] < HH Then hiBar = 0;
If LL[loBar] > LL Then loBar = 0;
Condition1 = 저[1,1]+전환 <= HH and hiBar == 0;
Condition2 = 고[1,1]-전환 >= LL and loBar == 0;
처리구분 = "";
If Condition1 and Condition2 Then
{
If 최종꼭지점 == "저점" Then
{
If 저[1,1] > LL Then 처리구분 = "저점처리";
Else 처리구분 = "고점처리";
}
Else If 최종꼭지점 == "고점" Then
{
If 고[1,1] < HH Then 처리구분 = "고점처리";
Else 처리구분 = "저점처리";
}
}
Else If Condition1 Then 처리구분 = "고점처리";
Else If Condition2 Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL = TL_New_Self(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetSize(TL,1);
TL_SetColor(TL,Red);
TX = Text_New_Self(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)+" ");
Text_SetSize(tx,25);
Text_SetColor(tx,Red);
Text_SetStyle(tx,1,1);
Text_SetBold(tx,1);
Condition4 = false;
}
If 고[1,1] < HH[hiBar] Then
{
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]);
Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" ");
Text_SetLocation(TX,고[1,3],고[1,4],고[1,1]);
}
if Condition4 == False and abs(저[1,1]-고[1,1]) >= 0.9 Then
{
Condition4 = true;
TL1 = TL_New_Self(고[1,3],고[1,4],(고[1,1]+저[1,1])/2,저[1,3],저[1,4],(고[1,1]+저[1,1])/2);
TL_SetColor(TL1,Magenta);
TL_SetSize(TL1,0.5);
TL2 = TL_New_Self(고[1,3],고[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.618,저[1,3],저[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.618);
TL_SetColor(TL2,Orange);
TL_SetSize(TL2,0.5);
TL3 = TL_New_Self(고[1,3],고[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.382,저[1,3],저[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.382);
TL_SetColor(TL3,Orange);
TL_SetSize(TL3,0.5);
}
if Condition4 == true Then
{
TL_SetBegin(TL1,고[1,3],고[1,4],(고[1,1]+저[1,1])/2);
TL_SetEnd(TL1,저[1,3],저[1,4],(고[1,1]+저[1,1])/2);
TL_SetBegin(TL2,고[1,3],고[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.618);
TL_SetEnd(TL2,저[1,3],저[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.618);
TL_SetBegin(TL3,고[1,3],고[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.382);
TL_SetEnd(TL3,저[1,3],저[1,4],저[1,1] + abs(고[1,1]-저[1,1])*0.382);
}
최종꼭지점 = "고점";
Plot1(고[1,1]);
NoPlot(2);
}
If 처리구분 == "저점처리" Then
{
If 최종꼭지점 == "고점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL = TL_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetSize(TL,1);
TL_SetColor(TL,Blue);
TX = Text_New_Self(저[1,3],저[1,4],저[1,1],NumToStr(고[1,1]-저[1,1],2)+" ");
Text_SetSize(tx,25);
Text_SetColor(tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetBold(tx,1);
Condition3 = False;
}
If 저[1,1] > LL[loBar] Then
{
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,저[1,3],저[1,4],저[1,1]);
Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" ");
Text_SetLocation(TX,저[1,3],저[1,4],저[1,1]);
}
if Condition3 == False and abs(고[1,1]-저[1,1]) >= 0.9 Then
{
Condition3 = true;
TL1 = TL_New_Self(고[1,3],고[1,4],(고[1,1]+저[1,1])/2,저[1,3],저[1,4],(고[1,1]+저[1,1])/2);
TL_SetColor(TL1,Magenta);
TL_SetSize(TL1,0.5);
TL2 = TL_New_Self(고[1,3],고[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.618,저[1,3],저[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.618);
TL_SetColor(TL2,Orange);
TL_SetSize(TL2,0.5);
TL3 = TL_New_Self(고[1,3],고[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.382,저[1,3],저[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.382);
TL_SetColor(TL3,Orange);
TL_SetSize(TL3,0.5);
}
if Condition3 == true Then
{
TL_SetBegin(TL1,고[1,3],고[1,4],(고[1,1]+저[1,1])/2);
TL_SetEnd(TL1,저[1,3],저[1,4],(고[1,1]+저[1,1])/2);
TL_SetBegin(TL2,고[1,3],고[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.618);
TL_SetEnd(TL2,저[1,3],저[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.618);
TL_SetBegin(TL3,고[1,3],고[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.382);
TL_SetEnd(TL3,저[1,3],저[1,4],고[1,1] - abs(고[1,1]-저[1,1])*0.382);
}
최종꼭지점 = "저점";
Plot2(저[1,1]);
NoPlot(1);
}
피보나치 38.2부터 50까지, 50부터 61.8까지 박스.
현재 수식과 같이, 설정한 크기에 도달할 때부터 박스. 감사합니다.
2024-03-06
653
글번호 177205
지표