예스스탁
예스스탁 답변
2021-01-05 14:57:27
안녕하세요
예스스탁입니다.
문의하신 내용만으로는 식을 작성해 드리기 어렵습니다.
어떤조건의 hi나 lo가 원하시는 내용인지 알수 없습니다.
수식에서 발생하는 고점과 저점에는 번호를 부여해 드릴수는 있습니다.
1번은 전체 발생번호이고 2번은 당일기준 발생 횟수입니다.
번호 부여된 내용 확인하시고 수정보완해 사용하시기 바랍니다.
1
Input:chngRate(0.1);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0),tx(0);
Array:valArr[10](0),barArr[10](0),turnPntArr[10]("");
For j = 0 To 9
{
barArr[j] = barArr[j] + 1;
}
Condition1 = Min(valArr[1],valArr[2]) * (1 + (chngRate/100)) < H and lastHiVal < H;
Condition2 = Max(valArr[1],valArr[2]) * (1 - (chngRate/100)) > L and (lastLoVal > L || lastLoVal == 0);
If Condition1 Then { lastHiVal = H; lastLoVal = 0; }
If Condition2 Then { lastLoVal = L; lastHiVal = 0; }
turnPntBit = "";
If Condition1 and Condition2 Then
{
If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then
turnPntBit = "HiLo";
Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi";
Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit <> "" Then
{
If turnPntBit == "HiLo" Then
{
valArr[1] = IFF(turnPntArr[1] == "Hi",H,L);
barArr[1] = 0;
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
If turnPntArr[1] == "Hi" Then
turnPntBit = "Lo";
Else
turnPntBit = "Hi";
}
If turnPntBit <> turnPntArr[1] Then
{
for j = 8 downto 1
{
valArr[j+1] = valArr[j];
barArr[j+1] = barArr[j];
turnPntArr[j+1] = turnPntArr[j];
}
}
If turnPntBit <> turnPntArr[1] or
(turnPntBit == turnPntArr[1] and
((turnPntBit == "Hi" and valArr[1] < H) or
(turnPntBit == "Lo" and valArr[1] > L))) Then
{
valArr[1] = IFF(turnPntBit == "Hi",H,L);
barArr[1] = 0;
turnPntArr[1] = turnPntBit;
If turnPntArr[1][1] <> turnPntArr[1][0] Then
{
TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
if turnPntArr[1][0]=="Hi" Then
{
var1 = var1+1;
tx = Text_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],"Lo:"+NumToStr(var1,0));
Text_SetStyle(tx,2,0);
buy();
}
if turnPntArr[1][0] =="Lo" Then
{
Var2 = Var2+1;
tx = Text_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],"Hi:"+NumToStr(var2,0));
tx = Text_SetStyle(tx,2,1);
sell();
}
}
Else
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
}
}
TL_SetSize(TL1,1);
if turnPntArr[1][0] == "Hi" Then
TL_SetColor(TL1,RED);
Else
TL_SetColor(TL1,BLUE);
2
Input:chngRate(0.1);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0),tx(0);
Array:valArr[10](0),barArr[10](0),turnPntArr[10]("");
if Bdate != Bdate[1] Then
{
vaR1 = 0;
Var2 = 0;
}
For j = 0 To 9
{
barArr[j] = barArr[j] + 1;
}
Condition1 = Min(valArr[1],valArr[2]) * (1 + (chngRate/100)) < H and lastHiVal < H;
Condition2 = Max(valArr[1],valArr[2]) * (1 - (chngRate/100)) > L and (lastLoVal > L || lastLoVal == 0);
If Condition1 Then { lastHiVal = H; lastLoVal = 0; }
If Condition2 Then { lastLoVal = L; lastHiVal = 0; }
turnPntBit = "";
If Condition1 and Condition2 Then
{
If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then
turnPntBit = "HiLo";
Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi";
Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit <> "" Then
{
If turnPntBit == "HiLo" Then
{
valArr[1] = IFF(turnPntArr[1] == "Hi",H,L);
barArr[1] = 0;
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
If turnPntArr[1] == "Hi" Then
turnPntBit = "Lo";
Else
turnPntBit = "Hi";
}
If turnPntBit <> turnPntArr[1] Then
{
for j = 8 downto 1
{
valArr[j+1] = valArr[j];
barArr[j+1] = barArr[j];
turnPntArr[j+1] = turnPntArr[j];
}
}
If turnPntBit <> turnPntArr[1] or
(turnPntBit == turnPntArr[1] and
((turnPntBit == "Hi" and valArr[1] < H) or
(turnPntBit == "Lo" and valArr[1] > L))) Then
{
valArr[1] = IFF(turnPntBit == "Hi",H,L);
barArr[1] = 0;
turnPntArr[1] = turnPntBit;
If turnPntArr[1][1] <> turnPntArr[1][0] Then
{
TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
if turnPntArr[1][0]=="Hi" Then
{
var1 = var1+1;
tx = Text_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],"Lo:"+NumToStr(var1,0));
Text_SetStyle(tx,2,0);
buy();
}
if turnPntArr[1][0] =="Lo" Then
{
Var2 = Var2+1;
tx = Text_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],"Hi:"+NumToStr(var2,0));
tx = Text_SetStyle(tx,2,1);
sell();
}
}
Else
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
}
}
TL_SetSize(TL1,1);
if turnPntArr[1][0] == "Hi" Then
TL_SetColor(TL1,RED);
Else
TL_SetColor(TL1,BLUE);
즐거운 하루되세요
> blueo 님이 쓴 글입니다.
> 제목 : 지그재그 번호설정
> 안녕하세요 관리자님 우선 감사의 말씀 드립니다.
아래 지그재그 식에
제가 원하는 지그재그 hi나 lo를 1번으로 지정해서 표시 되면서
시스템에서도 몇번에서는 매수 몇번에서는 매도 주문이 들어 가게 만들고 싶은데요
가능 한지 가능하면 어떻게 해야 되는지 부탁 드립니다.
감사 합니다.
Input:chngRate(0.1);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0);
Array:valArr[10](0),barArr[10](0),turnPntArr[10]("");
For j = 0 To 9
{
barArr[j] = barArr[j] + 1;
}
Condition1 = Min(valArr[1],valArr[2]) * (1 + (chngRate/100)) < H and lastHiVal < H;
Condition2 = Max(valArr[1],valArr[2]) * (1 - (chngRate/100)) > L and (lastLoVal > L || lastLoVal == 0);
If Condition1 Then { lastHiVal = H; lastLoVal = 0; }
If Condition2 Then { lastLoVal = L; lastHiVal = 0; }
turnPntBit = "";
If Condition1 and Condition2 Then
{
If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then
turnPntBit = "HiLo";
Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi";
Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit <> "" Then
{
If turnPntBit == "HiLo" Then
{
valArr[1] = IFF(turnPntArr[1] == "Hi",H,L);
barArr[1] = 0;
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
If turnPntArr[1] == "Hi" Then
turnPntBit = "Lo";
Else
turnPntBit = "Hi";
}
If turnPntBit <> turnPntArr[1] Then
{
for j = 8 downto 1
{
valArr[j+1] = valArr[j];
barArr[j+1] = barArr[j];
turnPntArr[j+1] = turnPntArr[j];
}
}
If turnPntBit <> turnPntArr[1] or
(turnPntBit == turnPntArr[1] and
((turnPntBit == "Hi" and valArr[1] < H) or
(turnPntBit == "Lo" and valArr[1] > L))) Then
{
valArr[1] = IFF(turnPntBit == "Hi",H,L);
barArr[1] = 0;
turnPntArr[1] = turnPntBit;
If turnPntArr[1][1] <> turnPntArr[1][0] Then
{
TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
if turnPntArr[1][0]=="Hi" Then{
buy();
}
if turnPntArr[1][0] =="Lo" Then{
sell();
}
}
Else
TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]);
}
}
TL_SetSize(TL1,1);
if turnPntArr[1][0] == "Hi" Then
TL_SetColor(TL1,RED);
Else
TL_SetColor(TL1,BLUE);