예스스탁
예스스탁 답변
2022-03-10 13:50:15
안녕하세요
예스스탁입니다.
지표속성에서 막대그래프로 지정해 보시면 됩니다.
빨간이나 파란색 막대가 그려지는 봉이 상승/하락 추세변경봉이고
나머지는 초록색으로 표시됩니다.
Input:length(12);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),
TL_Val1(0),TL_Val2(0),T(0);
Array:고점[10,2](0),저점[10,2](0);
처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
T = 1;
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then
TL_Delete(TL2);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,WHITe);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 1, 1);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
TL_SetExtLeft(TL2,false);
TL_SetExtRight(TL2,false);
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL2,BLUE);
TL_SetExtLeft(TL2,true);
TL_SetExtRight(TL2,true);
}
}
}
If 처리구분 == "저점처리" Then
{
T = -1;
lastLoVal = L;
If 저점[1,2] < 고점[1,2] Then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then
TL_Delete(TL3);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,blue);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 1, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
TL_SetExtLeft(TL3,false);
TL_SetExtRight(TL3,false);
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL3,GREEn);
TL_SetExtLeft(TL3,true);
TL_SetExtRight(TL3,true);
}
}
}
TL_SetSize(TL1,0.5);
TL_SetSize(TL2,0.5);
TL_SetSize(TL3,0.5);
TL_Val1 = 0; TL_Val2 = 0;
If 고점[2,1] > 고점[1,1] and 고점[2,1] > 고점[3,1] Then
{
If 고점[1,2] < 저점[1,2] and 저점[3,1] < 저점[2,1] Then
TL_Val1 = (저점[2,1]-저점[3,1])/(저점[2,2]-저점[3,2]) * (Index-저점[3,2])+저점[3,1];
If 저점[1,2] < 고점[1,2] and 저점[2,1] < 저점[1,1] Then
TL_Val1 = (저점[1,1]-저점[2,1])/(저점[1,2]-저점[2,2]) * (Index-저점[2,2])+저점[2,1];
}
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] Then
{
If 저점[1,2] < 고점[1,2] and 고점[3,1] > 고점[2,1] Then
TL_Val2 = (고점[2,1]-고점[3,1])/(고점[2,2]-고점[3,2]) * (Index-고점[3,2])+고점[3,1];
If 고점[1,2] < 저점[1,2] and 고점[2,1] > 고점[1,1] Then
TL_Val2 = (고점[1,1]-고점[2,1])/(고점[1,2]-고점[2,2]) * (Index-고점[2,2])+고점[2,1];
}
if T != T[1] Then
{
if T == 1 Then
Plot1(1,"trd",RED);
if T == -1 Then
Plot1(1,"trd",BLUE);
}
Else
Plot1(1,"trd",GREEN);
즐거운 하루되세요
> 라몬 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다
> 안녕하세요
아래의 수식을 수정 부탁드립니다.
수정사항은 파동선이 바뀔때 즉 파동선이 위로향하면 주황, 아래로 향하면 파랑
그리고 표현이 될지 모르나 아래에서 위로 , 위에서 아래로 바뀌기전의 중간상황은
녹색으로 표시를 하는데 챠트 하단에 막대 그래프로 표시하고 싶습니다.
글로 표현하자니 제대로 전달될는지 모르겠습니다
Input:length(12);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),
TL_Val1(0),TL_Val2(0);
Array:고점[10,2](0),저점[10,2](0);
처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then
TL_Delete(TL2);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,WHITe);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 1, 1);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
TL_SetExtLeft(TL2,false);
TL_SetExtRight(TL2,false);
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL2,BLUE);
TL_SetExtLeft(TL2,true);
TL_SetExtRight(TL2,true);
}
}
}
If 처리구분 == "저점처리" Then
{
lastLoVal = L;
If 저점[1,2] < 고점[1,2] Then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then
TL_Delete(TL3);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,blue);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 1, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
TL_SetExtLeft(TL3,false);
TL_SetExtRight(TL3,false);
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL3,GREEn);
TL_SetExtLeft(TL3,true);
TL_SetExtRight(TL3,true);
}
}
}
TL_SetSize(TL1,0.5);
TL_SetSize(TL2,0.5);
TL_SetSize(TL3,0.5);
TL_Val1 = 0; TL_Val2 = 0;
If 고점[2,1] > 고점[1,1] and 고점[2,1] > 고점[3,1] Then
{
If 고점[1,2] < 저점[1,2] and 저점[3,1] < 저점[2,1] Then
TL_Val1 = (저점[2,1]-저점[3,1])/(저점[2,2]-저점[3,2]) * (Index-저점[3,2])+저점[3,1];
If 저점[1,2] < 고점[1,2] and 저점[2,1] < 저점[1,1] Then
TL_Val1 = (저점[1,1]-저점[2,1])/(저점[1,2]-저점[2,2]) * (Index-저점[2,2])+저점[2,1];
}
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] Then
{
If 저점[1,2] < 고점[1,2] and 고점[3,1] > 고점[2,1] Then
TL_Val2 = (고점[2,1]-고점[3,1])/(고점[2,2]-고점[3,2]) * (Index-고점[3,2])+고점[3,1];
If 고점[1,2] < 저점[1,2] and 고점[2,1] > 고점[1,1] Then
TL_Val2 = (고점[1,1]-고점[2,1])/(고점[1,2]-고점[2,2]) * (Index-고점[2,2])+고점[2,1];
}