커뮤니티

자동시스템 타주기 조건추가

프로필 이미지
조민철
2021-06-10 14:46:25
1466
글번호 149846
답변완료
항상 감사드립니다 아래 자동추세선 시스템을 아래조건으로 수정하고 싶습니다 1.본챠트 (10틱) 신호가 매수이면 t2= 1 본챠트 (10틱) 신호가 매도이면 t2= -1 2.타주기챠트 (1분) 신호가 매수이면t3= 1 타주기챠트 (1분) 신호가 매도이면t3= -1 3.본챠트 1발생시점과 타주기챠트 2발생시점의 가격차이가 10틱이내이면 t4= 1 본챠트 1발생시점과 타주기챠트 2발생시점의 가격차이가 10틱이상이면 t4= -1 4.본챠트 1발생시점과 타주기챠트 2발생시점의 시간차이가 10분이내이면 t5= 1 본챠트 1발생시점과 타주기챠트 2발생시점의 가격차이가 10분이상이면 t5= -1 5.본챠트가 t2=1 and t3= 1 and t4=1 and t5=1 이면 매수신호(b_1) 발생 본챠트가 t2= -1 and t3= -1 and t4= 1 and t5= 1 이면 매도신호(s_1) 발생 ********************************************************************************** ***가중이평 스토케스틱*** Input : Period(100), Period1(28), Period2(13); var : fk(0),StoK(0),StoD(0); var : t1(0); fk = (c-lowest(L,Period))/(highest(H,Period)-lowest(L,period))*100; StoK = wma(fk,Period1); StoD = wma(stok,Period2); if crossup(stok,stod) Then t1 = 1 ; if crossdown(stok ,stod) Then t1 = -1; *** 자동추세선 시스템 *** input : 비교고저점기준(10); var : cnt(0),BTL(0),STL(0); Array : HH[20](0),HD[20](0),HT[20](0); Array : LL[20](0),LD[20](0),LT[20](0); if SwingHigh(1,H,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1 Then{ HH[0] = H[비교고저점기준]; HD[0] = sdate[비교고저점기준]; HT[0] = sTime[비교고저점기준]; Condition1 = false; for cnt = 1 to 19{ HH[cnt] = HH[cnt-1][1]; HD[cnt] = HD[cnt-1][1]; HT[cnt] = HT[cnt-1][1]; if Condition1 == false and HH[cnt] > HH[0] and HH[cnt] > 0 Then{ Condition1 = true; TL_Delete(BTL); BTL = TL_New(HD[cnt],HT[cnt],HH[cnt],HD[0],HT[0],HH[0]); TL_SetExtRight(BTL,true); TL_SetColor(BTL,RED); } } } if SwingLow(1,L,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1 Then{ LL[0] = L[비교고저점기준]; LD[0] = sdate[비교고저점기준]; LT[0] = sTime[비교고저점기준]; Condition2 = false; for cnt = 1 to 19{ LL[cnt] = LL[cnt-1][1]; LD[cnt] = LD[cnt-1][1]; LT[cnt] = LT[cnt-1][1]; if Condition2 == false and LL[cnt] < LL[0] and LL[cnt] > 0 Then{ Condition2 = true; TL_Delete(STL); STL = TL_New(LD[cnt],LT[cnt],LL[cnt],LD[0],LT[0],LL[0]); TL_SetExtRight(STL,true); TL_SetColor(STL,blue); } } } if TL_GetValue(BTL,sdate,stime) > TL_GetValue(STL,sdate,stime) Then { if C > TL_GetValue(BTL,sdate,stime) and C[1] < TL_GetValue(BTL,sdate[1],stime[1]) and t1==1 Then{ buy("b_1"); } if C < TL_GetValue(STL,sdate,stime) and C[1] > TL_GetValue(STL,sdate[1],stime[1]) and t1==-1 Then{ sell("s_1"); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-06-10 17:35:13

안녕하세요 예스스탁입니다. 아래 수식 내용을 참고하시기 바랍니다. 다만 해당 수식이 기본차트만 이용하는 수식에서는 가장 최근 추세선만 남길수 있는데 data2의 참조데이타를 이용하는 내용을 작성하면 이전 출력된 추세선을 지우기 어렵습니다. Input : Period(100), Period1(28), Period2(13); var : xfk(0,Data1),xStoK(0,Data1),xStoD(0,Data1),S1(0,Data1),P1(0,Data1),m1(0,data1),d1(0,data1),xt1(0,Data1); var : yfk(0,Data2),yStoK(0,Data2),yStoD(0,Data2),S2(0,Data1),P2(0,Data1),m2(0,data1),d2(0,data1),yt1(0,Data1); xfk = Data1((c-lowest(L,Period))/(highest(H,Period)-lowest(L,period))*100); xStoK = data1(wma(xfk,Period1)); xStoD = data1(wma(xstok,Period2)); if xt1 <= 0 and data1(crossup(xstok,xstod)) Then xt1 = 1 ; if xt1 >= 0 and data1(crossdown(xstok ,xstod)) Then xt1 = -1; yfk = Data2((c-lowest(L,Period))/(highest(H,Period)-lowest(L,period))*100); yStoK = data2(wma(yfk,Period1)); yStoD = data2(wma(ystok,Period2)); if data2(crossup(ystok,ystod)) Then yt1 = 1 ; if data2(crossdown(ystok,ystod)) Then yt1 = -1; input : 비교고저점기준(10); var : cnt(0); var : xBTL(0,Data1),xSTL(0,Data1); var : xcond1(False,Data1),xcond2(False,data1); Array : xHH[20](0,Data1),xHD[20](0,Data1),xHT[20](0,Data1); Array : xLL[20](0,Data1),xLD[20](0,Data1),xLT[20](0,Data1); var : yBTL(0,Data1),ySTL(0,Data1); var : ycond1(False,Data2),ycond2(False,data2); Array : yHH[20](0,Data2),yHD[20](0,Data2),yHT[20](0,Data2); Array : yLL[20](0,Data2),yLD[20](0,Data2),yLT[20](0,Data2); if data1(SwingHigh(1,H,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1) Then { xHH[0] = data1(H[비교고저점기준]); xHD[0] = data1(sdate[비교고저점기준]); xHT[0] = data1(sTime[비교고저점기준]); xcond1 = false; for cnt = 1 to 19 { xHH[cnt] = xHH[cnt-1][1]; xHD[cnt] = xHD[cnt-1][1]; xHT[cnt] = xHT[cnt-1][1]; if xcond1 == false and xHH[cnt] > xHH[0] and xHH[cnt] > 0 Then { xcond1 = true; TL_Delete(xBTL); xBTL = TL_New(xHD[cnt],xHT[cnt],xHH[cnt],xHD[0],xHT[0],xHH[0]); TL_SetExtRight(xBTL,true); TL_SetColor(xBTL,RED); } } } if data1(SwingLow(1,L,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1) Then { xLL[0] = data1(L[비교고저점기준]); xLD[0] = data1(sdate[비교고저점기준]); xLT[0] = data1(sTime[비교고저점기준]); xcond2 = false; for cnt = 1 to 19{ xLL[cnt] = xLL[cnt-1][1]; xLD[cnt] = xLD[cnt-1][1]; xLT[cnt] = xLT[cnt-1][1]; if xcond2 == false and xLL[cnt] < xLL[0] and xLL[cnt] > 0 Then { xcond2 = true; TL_Delete(xSTL); xSTL = TL_New(xLD[cnt],xLT[cnt],xLL[cnt],xLD[0],xLT[0],xLL[0]); TL_SetExtRight(xSTL,true); TL_SetColor(xSTL,blue); } } } if TL_GetValue(xBTL,data1(sdate),data1(stime)) > TL_GetValue(xSTL,data1(sdate),data1(stime)) Then { if S1 <= 0 and data1(C) > TL_GetValue(xBTL,data1(sdate),data1(stime)) and data1(C[1]) < TL_GetValue(xBTL,data1(sdate[1]),data1(stime[1])) and xt1==1 Then { S1 = 1; P1 = Data1(c); m1 = Data1(TimeToMinutes(Time)); d1 = Data1(sDate); } if S1 >= 0 and data1(C) < TL_GetValue(xSTL,data1(sdate),data1(stime)) and data1(C[1]) > TL_GetValue(xSTL,data1(sdate[1]),data1(stime[1])) and xt1==-1 Then { S1 = -1; P1 = Data1(c); m1 = Data1(TimeToMinutes(Time)); d1 = Data1(sDate); } } if data2(SwingHigh(1,H,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1) Then { yHH[0] = data2(H[비교고저점기준]); yHD[0] = data2(sdate[비교고저점기준]); yHT[0] = data2(sTime[비교고저점기준]); ycond1 = false; for cnt = 1 to 19 { yHH[cnt] = yHH[cnt-1][1]; yHD[cnt] = yHD[cnt-1][1]; yHT[cnt] = yHT[cnt-1][1]; if ycond1 == false and yHH[cnt] > yHH[0] and yHH[cnt] > 0 Then { ycond1 = true; TL_Delete(yBTL); yBTL = TL_New(yHD[cnt],yHT[cnt],yHH[cnt],yHD[0],yHT[0],yHH[0]); TL_SetExtRight(yBTL,true); TL_SetColor(yBTL,RED); } } } if data2(SwingLow(1,L,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1) Then { yLL[0] = data2(L[비교고저점기준]); yLD[0] = data2(sdate[비교고저점기준]); yLT[0] = data2(sTime[비교고저점기준]); ycond2 = false; for cnt = 1 to 19 { yLL[cnt] = yLL[cnt-1][1]; yLD[cnt] = yLD[cnt-1][1]; yLT[cnt] = yLT[cnt-1][1]; if ycond2 == false and yLL[cnt] < yLL[0] and yLL[cnt] > 0 Then { ycond2 = true; TL_Delete(ySTL); ySTL = TL_New(yLD[cnt],yLT[cnt],yLL[cnt],yLD[0],yLT[0],yLL[0]); TL_SetExtRight(ySTL,true); TL_SetColor(ySTL,blue); } } } if TL_GetValue(yBTL,data2(sdate),data2(stime)) > TL_GetValue(ySTL,data2(sdate),data2(stime)) Then { if S2 <= 0 and data2(C) > TL_GetValue(yBTL,data2(sdate),data2(stime)) and data2(C[1]) < TL_GetValue(yBTL,data2(sdate[1]),data2(stime[1])) and yt1==1 Then { S2 = 1; P2 = Data2(c); m2 = Data2(TimeToMinutes(Time)); d2 = Data2(bDate); } if S2 >= 0 and data2(C) < TL_GetValue(ySTL,data2(sdate),data2(stime)) and data2(C[1]) > TL_GetValue(ySTL,data2(sdate[1]),data2(stime[1])) and yt1==-1 Then { S2 = -1; P2 = Data2(c); m2 = Data2(TimeToMinutes(Time)); d2 = Data2(bDate); } } var : t2(0),t3(0),t4(0),t5(0); if S1 == 1 Then T2 = 1; if S1 == -1 Then T2 = -1; if S2 == 1 Then T3 = 1; if S2 == -1 Then T3 = -1; if P1 > 0 and P2 > 0 and abs(P1-P2) < PriceScale*10 Then T4 = 1; if P1 > 0 and P2 > 0 and abs(P1-P2) >= PriceScale*10 Then T4 = -1; if m1 > 0 and m2 > 0 and d1 == d2 and abs(m1-m2) < 10 Then T5 = 1; if m1 > 0 and m2 > 0 and (d1 != d2 or (d1 == d2 and abs(m1-m2) >= 10)) Then T5 = -1; if t2 == 1 and t3 == 1 and t4 == 1 and t5 == 1 Then Buy("b_1"); if t2 == -1 and t3 == -1 and t4 == 1 and t5 == 1 Then Sell("s_1"); 즐거운 하루되세요 > 조민철 님이 쓴 글입니다. > 제목 : 자동시스템 타주기 조건추가 > 항상 감사드립니다 아래 자동추세선 시스템을 아래조건으로 수정하고 싶습니다 1.본챠트 (10틱) 신호가 매수이면 t2= 1 본챠트 (10틱) 신호가 매도이면 t2= -1 2.타주기챠트 (1분) 신호가 매수이면t3= 1 타주기챠트 (1분) 신호가 매도이면t3= -1 3.본챠트 1발생시점과 타주기챠트 2발생시점의 가격차이가 10틱이내이면 t4= 1 본챠트 1발생시점과 타주기챠트 2발생시점의 가격차이가 10틱이상이면 t4= -1 4.본챠트 1발생시점과 타주기챠트 2발생시점의 시간차이가 10분이내이면 t5= 1 본챠트 1발생시점과 타주기챠트 2발생시점의 가격차이가 10분이상이면 t5= -1 5.본챠트가 t2=1 and t3= 1 and t4=1 and t5=1 이면 매수신호(b_1) 발생 본챠트가 t2= -1 and t3= -1 and t4= 1 and t5= 1 이면 매도신호(s_1) 발생 ********************************************************************************** ***가중이평 스토케스틱*** Input : Period(100), Period1(28), Period2(13); var : fk(0),StoK(0),StoD(0); var : t1(0); fk = (c-lowest(L,Period))/(highest(H,Period)-lowest(L,period))*100; StoK = wma(fk,Period1); StoD = wma(stok,Period2); if crossup(stok,stod) Then t1 = 1 ; if crossdown(stok ,stod) Then t1 = -1; *** 자동추세선 시스템 *** input : 비교고저점기준(10); var : cnt(0),BTL(0),STL(0); Array : HH[20](0),HD[20](0),HT[20](0); Array : LL[20](0),LD[20](0),LT[20](0); if SwingHigh(1,H,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1 Then{ HH[0] = H[비교고저점기준]; HD[0] = sdate[비교고저점기준]; HT[0] = sTime[비교고저점기준]; Condition1 = false; for cnt = 1 to 19{ HH[cnt] = HH[cnt-1][1]; HD[cnt] = HD[cnt-1][1]; HT[cnt] = HT[cnt-1][1]; if Condition1 == false and HH[cnt] > HH[0] and HH[cnt] > 0 Then{ Condition1 = true; TL_Delete(BTL); BTL = TL_New(HD[cnt],HT[cnt],HH[cnt],HD[0],HT[0],HH[0]); TL_SetExtRight(BTL,true); TL_SetColor(BTL,RED); } } } if SwingLow(1,L,비교고저점기준,비교고저점기준,비교고저점기준*2+1) != -1 Then{ LL[0] = L[비교고저점기준]; LD[0] = sdate[비교고저점기준]; LT[0] = sTime[비교고저점기준]; Condition2 = false; for cnt = 1 to 19{ LL[cnt] = LL[cnt-1][1]; LD[cnt] = LD[cnt-1][1]; LT[cnt] = LT[cnt-1][1]; if Condition2 == false and LL[cnt] < LL[0] and LL[cnt] > 0 Then{ Condition2 = true; TL_Delete(STL); STL = TL_New(LD[cnt],LT[cnt],LL[cnt],LD[0],LT[0],LL[0]); TL_SetExtRight(STL,true); TL_SetColor(STL,blue); } } } if TL_GetValue(BTL,sdate,stime) > TL_GetValue(STL,sdate,stime) Then { if C > TL_GetValue(BTL,sdate,stime) and C[1] < TL_GetValue(BTL,sdate[1],stime[1]) and t1==1 Then{ buy("b_1"); } if C < TL_GetValue(STL,sdate,stime) and C[1] > TL_GetValue(STL,sdate[1],stime[1]) and t1==-1 Then{ sell("s_1"); } }