답변완료
수식부탁합니다
input:length(6);
Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""),
TL1(0),Text1(0),TL2(0),TL3(0),TL4(0),TL5(0),TL12(0),TL13(0),TL14(0),TL15(0),T(0),고점변곡(""),저점변곡("");
var : clr1(0),clr2(0),BE(0),SE(0),cnt(0),upcond(False),dncond(False),text2(0);
Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime
#==========================================#
HH = IFF(0==1,C,H);
LL = IFF(0==1,C,L);
If Index == 0 Then
{
고[1,1] = HH;
저[1,1] = LL;
}
Condition1 = Highest(HH,length) == HH and 최종고가 <> HH;
Condition2 = Lowest (LL,length) == LL and 최종저가 <> LL;
처리구분 = "";
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
{
T = 1;
최종고가 = HH; // 신규고점을 체크하기 위해 저장
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH;
고[1,2] = Index;
고[1,3] = sDate;
고[1,4] = sTime;
TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
If 1 == 1 Then
{
Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2));
Text_SetStyle(Text1, 0, 1);
Text_SetColor(Text1,Red);
}
TL_SetSize(TL1,1);
TL_SetColor(TL1,Gray);
}
Else If 고[1,1] < HH Then // 1번 고점보다 높은 고가 출현
{
고[1,1] = HH;
고[1,2] = Index;
고[1,3] = sDate;
고[1,4] = sTime;
TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]);
// 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임
If 1 == 1 Then
{
Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text1,NumToStr(고[1,1],2));
}
}
최종꼭지점 = "고점";
}
#==========================================#
If 처리구분 == "저점처리" Then
{
T = -1;
최종저가 = LL;
If 최종꼭지점 == "고점" then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL;
저[1,2] = Index;
저[1,3] = sDate;
저[1,4] = sTime;
TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
If 1 == 1 Then
{
Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2));
Text_SetStyle(Text1, 0, -1);
Text_SetColor(Text1,Blue);
}
TL_SetSize(TL1,1);
TL_SetColor(TL1,Gray);
}
Else If 저[1,1] > LL then
{
저[1,1] = LL;
저[1,2] = Index;
저[1,3] = sDate;
저[1,4] = sTime;
TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]);
If 1 == 1 Then
{
Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text1,NumToStr(저[1,1],2));
}
}
최종꼭지점 = "저점";
}
if T == -1 and T[1] != -1 Then
{
TL12 = TL_New(고[2,3],고[2,4],고[2,1],sdate,stime,고[2,1]);
TL_Delete(TL13);
TL13 = TL_New(고[1,3],고[1,4],고[1,1],Sdate,Stime,고[1,1]);
TL_SetExtRight(TL13,true);
TL_SetSize(TL13,2);
TL_SetColor(TL12,clr1);
TL_SetSize(TL12,2);
clr1 = Pink;
TL_SetColor(TL13,clr1);
upcond = False;
}
if T == 1 and T[1] != 1 Then
{
TL14= TL_New(저[2,3],저[2,4],저[2,1],sdate,stime,저[2,1]);
TL_Delete(TL15);
TL15= TL_New(저[1,3],저[1,4],저[1,1],sdate,stime,저[1,1]);
TL_SetExtRight(TL15,true);
TL_SetColor(TL14,clr2);
TL_SetSize(TL14,2);
clr2 = LightBlue;
TL_SetColor(TL15,clr2);
TL_SetSize(TL15,2);
dncond = False;
}
#===================================================#
VAR:mav5(0),mav10(0),mav20(0),mav40(0),mav60(0),mav120(0),mav30(0);
mav5=ma(c,5);
mav10=ma(c,10);
mav20=ma(c,20);
mav30=ma(c,30);
mav40=ma(c,40);
mav60=ma(c,60);
mav120=ma(c,120);
#============#
if (min(C,ma(c,5)) > TL_GetValue(TL13,sDate,sTime)) Then
{
clr1 = Red;
TL_SetColor(TL13,clr1);
}
if max(C,ma(c,5)) < TL_GetValue(TL15,sDate,sTime) Then
{
clr2 = Blue;
TL_SetColor(TL15,clr2);
}
#=========================================================================#
array:Redline[4](0),Blueline[4](0),Pinkline[4](0),liblueline[4](0),libluex[4](0),Pinkx[4](0);
#==============레드==========================#
if upcond == False and min(c,mav5)>TL_GetValue(TL13,sDate,sTime) Then
{
upcond = true;
Redline[0]=TL_GetValue(TL13,sDate,sTime);
For cnt=1 to 4
{
Redline[cnt]=Redline[cnt-1][1];
}
}
1.조건만족 시점만 누적시켜 주세요
(지금은 봉개수가 누적됩니다)
var:x(0);
condition1=mav20<Redline[0]and max(c,mav5)<Redline[0]and mav5<mav10);
if (min(C,ma(c,5)) > TL_GetValue(TL13,sDate,sTime)) Then x=0;
if condition1 Then
{
x=x+1;
}
2.condition2 가 아니면 condition1 을 유지한다
condition2=mav20>Redline[0]and min(c,mav5)>Redline[0]and mav5>mav10);
3.condition1 and condition3 이면 condition1 을 유지한다
condition3= min(c,mav5)>mav20 and mav10>=mav20;
항상 감사드립니다....
2023-02-06
553
글번호 166010
지표
답변완료
추세선 쓰리바닥 박스
input : Period(35),pt(0.25);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Array:r[7](0),fr[7](0),TL2[7](0),TL3[7](0),TX2[7](0),TX3[7](0);
var : txx(0),txxx(0);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
for j = 0 to 6
{
fr[j] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[j]);
}
Condition1 = False;
if max(LoVal[1],LoVal[2]) <= min(LoVal[1],LoVal[2])+pt Then
{
txx = Text_New(sdate[HiBar[0]],sTime[HiBar[0]],Hival[0]+PriceScale*0,"●");
Text_SetColor(txx,Green);
Text_SetSize(txx,20);
Text_SetStyle(txx,2,2);
Condition1 = true;
}
Condition2 = true;
txxx = Text_New(sdate[HiBar[0]],sTime[HiBar[0]],Hival[0]+PriceScale*0,"●"+NewLine);
Text_SetColor(txxx,Cyan);
Text_SetSize(txxx,30);
Text_SetStyle(txxx,2,2);
if Condition2 == true and L <= LoVal[1]-PriceScale*1 Then
{
Condition2 = False;
Text_Delete(txxx);
}
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date22 = date[0];
time22 = stime[0];
}
if Condition1 == true and LoVal[0] < max(LoVal[1],LoVal[2])-pt Then
{
Condition1 = False;
Text_Delete(txx);
PlaySound("C:₩예스트레이더₩data₩Sound₩alert.wav");
}
if Condition2 == true and LoVal[0] <= LoVal[1]-PriceScale*1 Then
{
Condition2 = False;
Text_Delete(txxx);
PlaySound("C:₩예스트레이더₩data₩Sound₩alert.wav");
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
text_Delete(txx);
text_Delete(txxx);
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
for j = 0 to 5
{
fr[j] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[j]);
}
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
}
}
현 수식은 0.25p 내에서 쓰리바닥 가능성을 실시간으로 보기위해, 0.25p 내에서 쌍바닥 후에 쓰리바닥으로 가는 하락 중일 때 동그라미를 표시했다가 양전환되거나 0.25p를 벗어나서 더 하락하면 동그라미를 삭제하는 수식인데,
표현 방식을 현재 방식과 병행해서, 동그라미 생성될 때 그 부분을 추가로 박스로도 표현.
동그라미 삭제될 때 박스도 같이 삭제. 박스는 삭제될 때까지 연장.
오류 수정:직전 저점과 전전 저점의 차이가 0.25p 이내일 때만 하락 전환시 동그라미가 생성되어야 하는데 하락전환시 무조건 생성되는 듯 합니다. 동그라미가 두개 생성됩니다. 하나를 제거해도 되나요? 감사합니다.
2023-02-06
1022
글번호 166004
지표