커뮤니티
부탁드립니다
2018-05-09 12:42:00
253
글번호 118770
아래 수식을 data2에 적용될수있도록 변경 부탁드립니다
_아래-
Input:length(20),X(1),Q(1),파동선두께(3),추세선두께1(1),추세선두께2(1),소수점아래자리수(2),z1(2),z2(1),p1(2),p2(0),숫자색(black),파동선색1(cyan),파동선색2(magenta),추세선색1(blue),추세선색2(red);
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);
}
if X == 1 Then
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
if H < 고점[2,1] Then
TL_SetColor(TL1,파동선색1);
Else
TL_SetColor(TL1,파동선색2);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],소수점아래자리수));
Text_SetStyle(Text1, z1, z2);
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);
if Q == 1 Then
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL2,추세선색1);
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);
}
if X == 1 Then
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,추세선색2);
if L > 저점[2,1] Then
TL_SetColor(TL1,파동선색2);
Else
TL_SetColor(TL1,파동선색1);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],소수점아래자리수));
Text_SetStyle(Text1, p1, p2);
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);
if Q == 1 Then
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL3,blue);
TL_SetExtLeft(TL3,true);
TL_SetExtRight(TL3,true);
}
}
}
TL_SetSize(TL1,파동선두께);
TL_SetSize(TL2,추세선두께1);
TL_SetSize(TL3,추세선두께2);
#텍스트색상
Text_SetColor(text1,숫자색);#숫자 text색
답변 1
예스스탁 예스스탁 답변
2018-05-10 14:39:56
안녕하세요
예스스탁입니다.
수식은 참조데이터에 바로 적용하게 할수가 없습니다.
지표속성에서 Y축표시를 화면으로 지정하시고
아래식 차트에 적용하시면 별도의 여백에 data2의 이평이 그려집니다.
해당 이평을 마우스로 집어 data2 위로 올리시면 추세선이 나타납니다.
20이평은 수식을 data2위로 드래그앤드롭하기 위한 용도입니다.
Input : length(20),X(1),Q(1),파동선두께(3),추세선두께1(1),추세선두께2(1),소수점아래자리수(2);
input : z1(2),z2(1),p1(2),p2(0),숫자색(black),파동선색1(cyan),파동선색2(magenta),추세선색1(blue),추세선색2(red);
Var : j(0,data2),lastHiVal(0,data2),lastLoVal(0,data2),sBar(0,data2),eBar(0,data2);
var : TL1(0,data2),TL2(0,data2),TL3(0,data2),Text1(0,data2),처리구분("",data2),TL_Val1(0,data2),TL_Val2(0,data2);
Array:고점[10,2](0,data2),저점[10,2](0,data2);
처리구분 = "";
If data2(Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L) Then
{
If 저점[1,1] > data2(L) Then 처리구분 = "저점처리";
If 고점[1,1] < data2(H) Then 처리구분 = "고점처리";
}
Else If data2(Highest(H,length) == H and lastHiVal <> H) Then 처리구분 = "고점처리";
Else If data2(Lowest(L,length) == L and lastLoVal <> L) Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
lastHiVal = data2(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] < data2(H) Then
{
고점[1,1] = data2(H);
고점[1,2] = data2(Index);
sBar = data2(Index - 저점[1,2]);
eBar = 0;
If TL_GetBeginDate(TL1) == data2(sDate[sBar]) and TL_GetBeginTime(TL1) == data2(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);
}
if X == 1 Then
TL1 = TL_New_Self(data2(sDate[sBar]),data2(sTime[sBar]),저점[1,1],data2(sDate[eBar]),data2(sTime[eBar]),고점[1,1]);
if data2(H) < 고점[2,1] Then
TL_SetColor(TL1,파동선색1);
Else
TL_SetColor(TL1,파동선색2);
Text1 = Text_New_Self(data2(sDate[eBar]),data2(sTime[eBar]),고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/data2(PriceScale),0)+NewLine+NumToStr(고점[1,1],소수점아래자리수));
Text_SetStyle(Text1, z1, z2);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = data2(Index - 저점[2,2]);
eBar = data2(Index - 저점[1,2]);
TL_SetExtLeft(TL2,false);
TL_SetExtRight(TL2,false);
if Q == 1 Then
TL2 = TL_New(data2(sDate[sBar]),data2(sTime[sBar]),저점[2,1],data2(sDate[eBar]),data2(sTime[eBar]),저점[1,1]);
TL_SetColor(TL2,추세선색1);
TL_SetExtLeft(TL2,true);
TL_SetExtRight(TL2,true);
}
}
}
If 처리구분 == "저점처리" Then
{
lastLoVal = data2(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] > data2(L) Then
{
저점[1,1] = data2(L);
저점[1,2] = data2(Index);
sBar = data2(Index - 고점[1,2]);
eBar = 0;
If TL_GetBeginDate(TL1) == data2(sDate[sBar]) and TL_GetBeginTime(TL1) == data2(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);
}
if X == 1 Then
TL1 = TL_New_Self(data2(sDate[sBar]),data2(sTime[sBar]),고점[1,1],data2(sDate[eBar]),data2(sTime[eBar]),저점[1,1]);
TL_SetColor(TL1,추세선색2);
if L > 저점[2,1] Then
TL_SetColor(TL1,파동선색2);
Else
TL_SetColor(TL1,파동선색1);
Text1 = Text_New_Self(data2(sDate[eBar]),data2(sTime[eBar]),저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/data2(PriceScale),0)+NewLine+NumToStr(저점[1,1],소수점아래자리수));
Text_SetStyle(Text1, p1, p2);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = data2(Index - 고점[2,2]);
eBar = data2(Index - 고점[1,2]);
TL_SetExtLeft(TL3,false);
TL_SetExtRight(TL3,false);
if Q == 1 Then
TL3 = TL_New_Self(data2(sDate[sBar]),data2(sTime[sBar]),고점[2,1],data2(sDate[eBar]),data2(sTime[eBar]),고점[1,1]);
TL_SetColor(TL3,blue);
TL_SetExtLeft(TL3,true);
TL_SetExtRight(TL3,true);
}
}
}
TL_SetSize(TL1,파동선두께);
TL_SetSize(TL2,추세선두께1);
TL_SetSize(TL3,추세선두께2);
#텍스트색상
Text_SetColor(text1,숫자색);#숫자 text색
plot1(data2(ma(C,20)));
즐거운 하루되세요
> 마르뚝 님이 쓴 글입니다.
> 제목 : 부탁드립니다
> 아래 수식을 data2에 적용될수있도록 변경 부탁드립니다
_아래-
Input:length(20),X(1),Q(1),파동선두께(3),추세선두께1(1),추세선두께2(1),소수점아래자리수(2),z1(2),z2(1),p1(2),p2(0),숫자색(black),파동선색1(cyan),파동선색2(magenta),추세선색1(blue),추세선색2(red);
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);
}
if X == 1 Then
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
if H < 고점[2,1] Then
TL_SetColor(TL1,파동선색1);
Else
TL_SetColor(TL1,파동선색2);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],소수점아래자리수));
Text_SetStyle(Text1, z1, z2);
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);
if Q == 1 Then
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL2,추세선색1);
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);
}
if X == 1 Then
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,추세선색2);
if L > 저점[2,1] Then
TL_SetColor(TL1,파동선색2);
Else
TL_SetColor(TL1,파동선색1);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],소수점아래자리수));
Text_SetStyle(Text1, p1, p2);
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);
if Q == 1 Then
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL3,blue);
TL_SetExtLeft(TL3,true);
TL_SetExtRight(TL3,true);
}
}
}
TL_SetSize(TL1,파동선두께);
TL_SetSize(TL2,추세선두께1);
TL_SetSize(TL3,추세선두께2);
#텍스트색상
Text_SetColor(text1,숫자색);#숫자 text색
다음글
이전글