답변완료
수식 수정 부탁드립니다.
안녕하세요?
늘 고맙습니다.
아래 지표수식에 추가 부탁드립니다.
매도 : 바로전 고점1과 저점1이 확정된 후 다시 고점2가 확정됨, 이후 가격이 하락해서 고점1를 하향 돌파시 매도 진입
청산 : 저점1 하향 돌파시 매도 청산
청산2 : 고점2 상향 돌파시 매도 청산
매수 : 바로전 고점1과 저점1이 확정된 후 다시 저점2가 확정됨, 이후 가격이 상승해서 저점1을 상향 돌파시 매수 진입
청산 : 고점1 상향 돌파시 매수 청산
청산2 : 저점2 하향 돌파시 매도 청산
Input:length(3);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),
TL1(0),처리구분(""),T(0),TL2(0),TL3(0);
var : hh(0),ll(0),ii(0),diff(0),TL41(0),TL42(0),TL43(0),TL44(0),TL45(0),TL46(0);
Array:고점[10,5](0),저점[10,5](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);
TL_Delete(TL2);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetExtRight(TL2,False);
TL2 = TL_New(sDate[1],sTime[1],고점[1,1],sdate,sTime,고점[1,1]);
TL_SetColor(TL2,BLUE);
TL_SetSize(TL2,2);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
}
}
}
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);
TL_Delete(TL3);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetExtRight(TL3,False);
TL3 = TL_New(sDate[1],sTime[1],저점[1,1],sdate,sTime,저점[1,1]);
TL_SetColor(TL3,RED);
TL_SetSize(TL3,2);
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_SetSize(TL1,0);
TL_SetColor(TL1,YELLOW);
TL_SetEnd(TL2,sdate,stime,고점[1,1]);
TL_SetEnd(TL3,sdate,stime,저점[1,1]);
TL_SetExtRight(TL2,true);
TL_SetExtRight(TL3,true);
if T != T[1] then
{
if T == 1 Then
{
HH = 고점[2,1];
LL = 저점[1,1];
ii = index-고점[2,2];
diff = abs(HH-LL);
}
Else
{
HH = 고점[1,1];
LL = 저점[2,1];
ii = index-저점[2,2];
diff = abs(HH-LL);
}
TL_Delete(TL41);
TL_Delete(TL42);
TL_Delete(TL43);
TL_Delete(TL44);
TL_Delete(TL45);
TL_Delete(TL46);
TL41 = TL_New(sdate[ii],stime[ii],LL+diff*2.00,sdate,stime,LL+diff*2.00);
TL42 = TL_New(sdate[ii],stime[ii],LL+diff*2.618,sdate,stime,LL+diff*2.618);
TL43 = TL_New(sdate[ii],stime[ii],LL+diff*3.618,sdate,stime,LL+diff*3.618);
TL44 = TL_New(sdate[ii],stime[ii],HH-diff*2.00,sdate,stime,HH-diff*2.00);
TL45 = TL_New(sdate[ii],stime[ii],HH-diff*2.618,sdate,stime,HH-diff*2.618);
TL46 = TL_New(sdate[ii],stime[ii],HH-diff*3.618,sdate,stime,HH-diff*3.618);
TL_SetExtRight(TL41,true);
TL_SetExtRight(TL42,true);
TL_SetExtRight(TL43,true);
TL_SetExtRight(TL44,true);
TL_SetExtRight(TL45,true);
TL_SetExtRight(TL46,true);
TL_SetSize(TL41,2);
TL_SetSize(TL42,2);
TL_SetSize(TL43,2);
TL_SetSize(TL44,2);
TL_SetSize(TL45,2);
TL_SetSize(TL46,2);
}
2020-11-09
520
글번호 143706
시스템
답변완료
부탁 드립니다.
도움에 감사 드립니다.
질문 수식을 타주기(분봉용)식으로 어슬픈 지식으로 작성 해본것입니다.
1)타주기(분봉용)식을 정상적인지 검토와
2)타주기(틱봉용)과
3)타주기(분봉에서 일봉지표)식 부탁 드립니다.
미리 경배로 감사 인사 올립니다.
질문수식)
var : src(0),a(0),b(0),size(0);
if a[1] > a[2] Then
{
Condition1 = true;
var1 = 0;
}
Else
{
if Condition1 == true Then
var1 = var1+1;
}
if b[1] < b[2] Then
{
Condition2 = true;
var2 = 0;
}
Else
{
if Condition2 == true Then
var2 = var2+1;
}
size = iff((a[1]-a[2]) > 0 or (b[1]-b[2]) < 0 , atr(length) ,TrueRange);
a = max(c,a[1]) - size/pow(length,2)*(var1*mult);
b = min(c,b[1]) + size/pow(length,2)*(Var2*mult);
var11=(a+b)/2;
var3=c-var11;;
var33=ma(var3,sig);
*타주기(분봉)식
input : 타주기분(30),length(60),mult(1),sig(5);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),idx(0);
//타주기식_TrueRange
var : HH(0),LL(0),C1(0);
Array : cc10[101](0),TH[101](0),TL[101](0),TR[101](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
HH = H;
LL = L;
C1 = CC10[1];
for cnt = 1 to 100
{
TH[cnt] = TH[cnt-1][1];
TL[cnt] = TL[cnt-1][1];
TR[cnt] = TR[cnt-1][1];
}
}
if H > HH Then
HH = H;
if L < LL Then
LL = L;
CC10[0] = c;
TH[0] = max(C1,HH);
TL[0] = Min(C1,LL);
TR[0] = TH[0]-TL[0];
}
//타주기식_ATR
var : hht2(0),LL3(0),C13(0),CC3(0);
var : sumTR(0),ATRV(0);
Array : TH3[101](0),TL3[101](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
HH = H;
LL = L;
c13 = cc3[1];
for cnt = 1 to 100
{
TH[cnt] = TH[cnt-1][1];
TL[cnt] = TL[cnt-1][1];
}
}
if H > HH Then
HH = H;
if L < LL Then
LL = L;
cc3 = c;
TH[0] = max(c13,HH);
TL[0] = Min(c13,LL);
if TH[length-1] > 0 and TL[length-1] > 0 then
{
sumTR = 0;
for cnt = 0 to length-1
{
sumTR = sumTR + (TH[cnt]-TL[cnt]);
}
ATRV = sumTR/length;
}
}
var:size(0),sum(0);
Array : CC[101](0),a[101](0),b[101](0);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
idx = idx+1;
for cnt = 1 to 100
{
CC[cnt] = CC[cnt-1][1];
a[cnt] = a[cnt-1][1];
b[cnt] = b[cnt-1][1];
}
if a[1] > a[2] and a[2] > 0 Then
{
Condition1 = true;
value1 = idx[1];
}
if b[1] < b[2] and b[2] > 0 Then
{
Condition2 = true;
Value2 = idx[1];
}
}
CC[0] = C;
if Condition1 == true Then
var1 = idx-value1;
if Condition2 == true Then
var2 = idx-Value2;
if a[2] > 0 and b[2] > 0 then
size = iff((a[1]-a[2]) > 0 or (b[1]-b[2]) < 0 ,atrv , tr[0]);
Else
size = 0;
if a[1] == 0 Then
{
a[0] = CC[0] - size/pow(length,2)*(var1*mult);
}
Else if idx > 3 Then
{
a[0] = max(CC[0],a[1]) - size/pow(length,2)*(var1*mult);
}
if b[1] == 0 Then
{
b[0] = CC[0] + size/pow(length,2)*(Var2*mult);
}
Else if idx > 3 Then
{
b[0] = min(CC[0],b[1]) + size/pow(length,2)*(Var2*mult);
}
var11 = (a[0]+b[0])/2;
Var3 = CC[0]-var11;
if a[sig-1] > 0 and b[sig-1] > 0 Then
{
sum = 0;
For cnt = 0 to sig-1
{
sum = sum + (CC[cnt] - (a[cnt]+b[cnt])/2);
}
Var33 = sum/sig;
}
}
2020-11-08
586
글번호 143699
지표