커뮤니티

시스템 질문드립니다.

프로필 이미지
비엔에프
2013-04-24 13:39:53
255
글번호 62434
답변완료

첨부 이미지

현재 우리투자증권의 우리트레이더에 계좌 하나 하이투자증권의 예스트레이더에 계좌 두개를 각각 운영하구 있습니다. 하이투자증권의 예스트레이더만 버전이 4.0인지 몰랐습니다. >> 질문드리구 싶은것은 밑에 자동추세선(이건 우리트레이더와 예스트레이더에서 다 작동) 지표식의 옵션체크란의 '단기상단채널'을 돌파하면 매수하는 시스템을 작성해보고 싶습니다만.. 자동추세선이 3.0버전에서두 다 그어지는데 3.0버전에서 추세돌파시스템두 만들수 있을거 같습니다만.. 위사진은 자동추세선지표를 우리트레이더 3.0버전에서 링네트 15분봉 2013년 4월19일 '단기상단채널'만 체크하고 지표표시한 화면입니다. 3.0버전에서 저런 추세선이 자동 작성되면 저 동그라미표시된 부분의 돌파가 나오면 매수하는 시스템을 만들어보고 싶습니다. 밑에는 전에 쓸수 있게 수정해주신 추세선 지표식입니다. ======= Input:n(5),단기(True),중기(True),장기(False),미완성사용(True); Var:j(0),q(0),k(0),상단(200),하단(100),고점표시(0),저점표시(0),Exit(100), 고점갱신(False),저점갱신(False),중기고점갱신(False),중기저점갱신(False), 중기추세갱신(0),장기추세갱신(0), 단기상단기울기(0),단기상단Bar(0),단기상단절편(0),단기하단기울기(0), 단기하단Bar(0),단기하단절편(0), 중기상단기울기(0),중기상단Bar(0),중기상단절편(0),중기하단기울기(0), 중기하단Bar(0),중기하단절편(0), 장기상단기울기(0),장기상단Bar(0),장기상단절편(0),장기하단기울기(0), 장기하단Bar(0),장기하단절편(0), 단기상단채널(0),단기하단채널(0),중기상단채널(0),중기하단채널(0), 장기상단채널(0),장기하단채널(0); Array:고[50](0),저[50](0),고Bar[50](0),저Bar[50](0), 중기고[20](0),중기저[20](0),중기고Bar[20](0),중기저Bar[20](0), 장기고[20](0),장기저[20](0),장기고Bar[20](0),장기저Bar[20](0); #==========================================# # 초기처리 (Initialize Routine) #==========================================# for j = 1 to 19 { 고Bar[j] = 고Bar[j] + 1; 저Bar[j] = 저Bar[j] + 1; 중기고Bar[j] = 중기고Bar[j] + 1; 중기저Bar[j] = 중기저Bar[j] + 1; 장기고Bar[j] = 장기고Bar[j] + 1; 장기저Bar[j] = 장기저Bar[j] + 1; } for j = 20 to 49 { 고Bar[j] = 고Bar[j] + 1; 저Bar[j] = 저Bar[j] + 1; } 단기상단Bar = 단기상단Bar + 1; 단기하단Bar = 단기하단Bar + 1; 중기상단Bar = 중기상단Bar + 1; 중기하단Bar = 중기하단Bar + 1; 장기상단Bar = 장기상단Bar + 1; 장기하단Bar = 장기하단Bar + 1; 고점표시=(O[n]+C[n])/2; 저점표시=(O[n]+C[n])/2; #==========================================# # 단기 파동선 계산 #==========================================# # 전고점(Peak) 계산 #------------------------------------------# //Highest(H,2)[3] <= H[2] and H[2] > Highest(H,2) if Highest(H,n)[n+1] <= H[n] and H[n] > Highest(H,n) then { if 미완성사용 == True then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } 고[1] = H[n]; 고Bar[1] = n; 고점갱신 = True; 고점표시 = 고[1]*1.005; if 저Bar[1] > 고Bar[2] then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } k = n + 1; for j = n + 2 to 고Bar[2]-1 { if L[k] > L[j] then k = j; } 저[1] = L[k]; 저Bar[1] = k; } } if 미완성사용 == False then { if 고Bar[1] > 저Bar[1] then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } } if 고Bar[1] > 저Bar[1] or 고[1] <= H[n] then { 고[1] = H[n]; 고Bar[1] = n; 고점갱신 = True; 고점표시 = 고[1]*1.005; } } } #------------------------------------------# # 전저점(Trough) 계산 #------------------------------------------# //Lowest(L,2)[3] >= L[2] and L[2] < Lowest(L,2) if Lowest(L,n)[n+1] >= L[n] and L[n] < Lowest(L,n) then { if 미완성사용 == True then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } 저[1] = L[n]; 저Bar[1] = n; 저점갱신 = True; 저점표시 = 저[1]*0.995; if 고Bar[1] > 저Bar[2] then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } k = n + 1; for j = n + 2 to 저Bar[2]-1 { if H[k] < H[j] then k = j; } 고[1] = H[k]; 고Bar[1] = k; } } if 미완성사용 == False then { if 저Bar[1] > 고Bar[1] then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } } if 저Bar[1] > 고Bar[1] or 저[1] >= L[n] then { 저[1] = L[n]; 저Bar[1] = n; 저점갱신 = True; 저점표시 = 저[1]*0.995; } } } #==========================================# # 중기 파동선 계산 #==========================================# # 중기고점 계산 #------------------------------------------# //단기 고점이 발생한 다음 꼭지점을 찾아 중기고점으로 설정 if 고점갱신 == True and 고[3] < 고[2] and 고[2] > 고[1] then { //↗↘ if 미완성사용 == True then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } 중기고[1] = 고[2]; 중기고Bar[1] = 고Bar[2]; 중기고점갱신 = True; if 중기저Bar[1] > 중기고Bar[2] then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } k = 2; for j = 3 to 19 { if 중기고Bar[2] > 저Bar[j] and 저[k] > 저[j] then { k = j; } } 중기저[1] = 저[k]; 중기저Bar[1] = 저Bar[k]; } } if 미완성사용 == False then { if 중기고Bar[1] > 중기저Bar[1] then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } } if 중기고Bar[1] > 중기저Bar[1] or 중기고[1] <= 고[2] then { 중기고[1] = 고[2]; 중기고Bar[1] = 고Bar[2]; 중기고점갱신 = True; } } 고점갱신 = False; 중기추세갱신 = 상단; } #------------------------------------------# # 중기저점 계산 #------------------------------------------# //단기 저점이 발생한 다음 꼭지점을 찾아 중기저점으로 설정 if 저점갱신 == True and 저[3] > 저[2] and 저[2] < 저[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } 중기저[1] = 저[2]; 중기저Bar[1] = 저Bar[2]; 중기저점갱신 = True; if 중기고Bar[1] > 중기저Bar[2] then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } k = 2; for j = 3 to 19 { if 중기저Bar[2] > 고Bar[j] and 고[k] < 고[j] then { k = j; } } 중기고[1] = 고[k]; 중기고Bar[1] = 고Bar[k]; } } if 미완성사용 == False then { if 중기저Bar[1] > 중기고Bar[1] then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } } if 중기저Bar[1] > 중기고Bar[1] or 중기저[1] >= 저[2] then { 중기저[1] = 저[2]; 중기저Bar[1] = 저Bar[2]; 중기저점갱신 = True; } } 저점갱신 = False; 중기추세갱신 = 하단; } #==========================================# # 장기 파동선 계산 #==========================================# # 장기고점 계산 #------------------------------------------# //중기 고점이 발생한 다음 꼭지점을 찾아 장기고점으로 설정 if 중기고점갱신 == True and 중기고[3] < 중기고[2] and 중기고[2] > 중기고[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } 장기고[1] = 중기고[2]; 장기고Bar[1] = 중기고Bar[2]; if 장기저Bar[1] > 장기고Bar[2] then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } k = 2; for j = 3 to 19 { if 장기고Bar[2] > 중기저Bar[j] and 중기저[k] > 중기저[j] then { k = j; } } 장기저[1] = 중기저[k]; 장기저Bar[1] = 중기저Bar[k]; } } if 미완성사용 == False then { if 장기고Bar[1] > 장기저Bar[1] then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } } if 장기고Bar[1] > 장기저Bar[1] or 장기고[1] <= 중기고[2] then { 장기고[1] = 중기고[2]; 장기고Bar[1] = 중기고Bar[2]; } } 중기고점갱신 = False; 장기추세갱신 = 상단; } #------------------------------------------# # 장기저점 계산 #------------------------------------------# //중기 저점이 발생한 다음 꼭지점을 찾아 장기저점으로 설정 if 중기저점갱신 == True and 중기저[3] > 중기저[2] and 중기저[2] < 중기저[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } 장기저[1] = 중기저[2]; 장기저Bar[1] = 중기저Bar[2]; if 장기고Bar[1] > 장기저Bar[2] then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } k = 2; for j = 3 to 19 { if 장기저Bar[2] > 중기고Bar[j] and 중기고[k] < 중기고[j] then { k = j; } } 장기고[1] = 중기고[k]; 장기고Bar[1] = 중기고Bar[k]; } } if 미완성사용 == False then { if 장기저Bar[1] > 장기고Bar[1] then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } } if 장기저Bar[1] > 장기고Bar[1] or 장기저[1] >= 중기저[2] then { 장기저[1] = 중기저[2]; 장기저Bar[1] = 중기저Bar[2]; } } 중기저점갱신 = False; 장기추세갱신 = 하단; } #==========================================# # 자동추세선 계산 #==========================================# if 고Bar[1] == n then { 단기상단채널 = 0; 단기상단기울기 = 0; for j = 2 to 49 { if 고[1] < 고[j] and 단기상단기울기 == 0 then { 단기상단기울기 =((고[1]-고[j])/(고Bar[j]-고Bar[1])); 단기상단Bar = 고Bar[j]; 단기상단절편 = 고[j]; j = Exit; } else if 고[j] <= 0 then j = Exit; } } if 저Bar[1] == n then { 단기하단채널 = 0; 단기하단기울기 = 0; for j = 2 to 49 { if 저[1] > 저[j] and 단기하단기울기 == 0 then { 단기하단기울기 = ((저[1]-저[j])/(저Bar[j]-저Bar[1])); 단기하단Bar = 저Bar[j]; 단기하단절편 = 저[j]; j = Exit; } else if 저[j] <= 0 then j = Exit; } } if 중기추세갱신 == 상단 then { 중기상단채널 = 0; 중기상단기울기 = 0; for j = 2 to 19 { if 중기고[1] < 중기고[j] and 중기상단기울기 == 0 then { 중기상단기울기 = ((중기고[1]-중기고[j])/(중기고Bar[j]-중기고Bar[1])); 중기상단Bar = 중기고Bar[j]; 중기상단절편 = 중기고[j]; j = Exit; } else if 중기고[j] <= 0 then j = Exit; } 중기추세갱신 = 0; } if 중기추세갱신 == 하단 then { 중기하단채널 = 0; 중기하단기울기 = 0; for j = 2 to 19 { if 중기저[1] > 중기저[j] and 중기하단기울기 == 0 then { 중기하단기울기 = ((중기저[1]-중기저[j])/(중기저Bar[j]-중기저Bar[1])); 중기하단Bar = 중기저Bar[j]; 중기하단절편 = 중기저[j]; j = Exit; } else if 중기저[j] <= 0 then j = Exit; } 중기추세갱신 = 0; } if 장기추세갱신 == 상단 then { 장기상단채널 = 0; 장기상단기울기 = 0; for j = 2 to 19 { if 장기고[1] < 장기고[j] and 장기상단기울기 == 0 then { 장기상단기울기 = ((장기고[1]-장기고[j])/(장기고Bar[j]-장기고Bar[1])); 장기상단Bar = 장기고Bar[j]; 장기상단절편 = 장기고[j]; j = Exit; } else if 장기고[j] <= 0 then j = Exit; } 장기추세갱신 = 0; } if 장기추세갱신 == 하단 then { 장기하단채널 = 0; 장기하단기울기 = 0; for j = 2 to 19 { if 장기저[1] > 장기저[j] and 장기하단기울기 == 0 then { 장기하단기울기 = ((장기저[1]-장기저[j])/(장기저Bar[j]-장기저Bar[1])); 장기하단Bar = 장기저Bar[j]; 장기하단절편 = 장기저[j]; j = Exit; } else if 장기저[j] <= 0 then j = Exit; } 장기추세갱신 = 0; } if 단기상단기울기 < 0 then 단기상단채널 = 단기상단기울기 * 단기상단Bar + 단기상단절편; if 단기하단기울기 > 0 then 단기하단채널 = 단기하단기울기 * 단기하단Bar + 단기하단절편; if 중기상단기울기 < 0 then 중기상단채널 = 중기상단기울기 * 중기상단Bar + 중기상단절편; if 중기하단기울기 > 0 then 중기하단채널 = 중기하단기울기 * 중기하단Bar + 중기하단절편; if 장기상단기울기 < 0 then 장기상단채널 = 장기상단기울기 * 장기상단Bar + 장기상단절편; if 장기하단기울기 > 0 then 장기하단채널 = 장기하단기울기 * 장기하단Bar + 장기하단절편; #=================================# # 지표식 #=================================# if 고점표시 > H[n] then Plot1(고점표시,"전고점",RED); //점그래프,수평이동 if 저점표시 < L[n] then Plot2(저점표시,"전저점",BLUE); //점그래프,수평이동 #------------------------------------------# # 채널 표시 #------------------------------------------# if 단기 == True then { if 단기상단채널 > 0 then Plot3(단기상단채널,"단기상단채널",RED); //점그래프 if 단기하단채널 > 0 then Plot4(단기하단채널,"단기하단채널",BLUE); //점그래프 } if 중기 == True then { if 중기상단채널 > 0 then Plot5(중기상단채널,"중기상단채널",RED); //점그래프 if 중기하단채널 > 0 then Plot6(중기하단채널,"중기하단채널",BLUE); //점그래프 } if 장기 == True then { if 장기상단채널 > 0 then Plot7(장기상단채널,"장기상단채널",RED); //점그래프 if 장기하단채널 > 0 then Plot8(장기하단채널,"장기하단채널",BLUE); //점그래프 }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-04-24 16:46:10

안녕하세요 예스스탁입니다. Input:n(5),단기(True),중기(True),장기(False),미완성사용(True); Var:j(0),q(0),k(0),상단(200),하단(100),고점표시(0),저점표시(0),Exit(100), 고점갱신(False),저점갱신(False),중기고점갱신(False),중기저점갱신(False), 중기추세갱신(0),장기추세갱신(0), 단기상단기울기(0),단기상단Bar(0),단기상단절편(0),단기하단기울기(0), 단기하단Bar(0),단기하단절편(0), 중기상단기울기(0),중기상단Bar(0),중기상단절편(0),중기하단기울기(0), 중기하단Bar(0),중기하단절편(0), 장기상단기울기(0),장기상단Bar(0),장기상단절편(0),장기하단기울기(0), 장기하단Bar(0),장기하단절편(0), 단기상단채널(0),단기하단채널(0),중기상단채널(0),중기하단채널(0), 장기상단채널(0),장기하단채널(0); Array:고[50](0),저[50](0),고Bar[50](0),저Bar[50](0), 중기고[20](0),중기저[20](0),중기고Bar[20](0),중기저Bar[20](0), 장기고[20](0),장기저[20](0),장기고Bar[20](0),장기저Bar[20](0); #==========================================# # 초기처리 (Initialize Routine) #==========================================# for j = 1 to 19 { 고Bar[j] = 고Bar[j] + 1; 저Bar[j] = 저Bar[j] + 1; 중기고Bar[j] = 중기고Bar[j] + 1; 중기저Bar[j] = 중기저Bar[j] + 1; 장기고Bar[j] = 장기고Bar[j] + 1; 장기저Bar[j] = 장기저Bar[j] + 1; } for j = 20 to 49 { 고Bar[j] = 고Bar[j] + 1; 저Bar[j] = 저Bar[j] + 1; } 단기상단Bar = 단기상단Bar + 1; 단기하단Bar = 단기하단Bar + 1; 중기상단Bar = 중기상단Bar + 1; 중기하단Bar = 중기하단Bar + 1; 장기상단Bar = 장기상단Bar + 1; 장기하단Bar = 장기하단Bar + 1; 고점표시=(O[n]+C[n])/2; 저점표시=(O[n]+C[n])/2; #==========================================# # 단기 파동선 계산 #==========================================# # 전고점(Peak) 계산 #------------------------------------------# //Highest(H,2)[3] <= H[2] and H[2] > Highest(H,2) if Highest(H,n)[n+1] <= H[n] and H[n] > Highest(H,n) then { if 미완성사용 == True then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } 고[1] = H[n]; 고Bar[1] = n; 고점갱신 = True; 고점표시 = 고[1]*1.005; if 저Bar[1] > 고Bar[2] then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } k = n + 1; for j = n + 2 to 고Bar[2]-1 { if L[k] > L[j] then k = j; } 저[1] = L[k]; 저Bar[1] = k; } } if 미완성사용 == False then { if 고Bar[1] > 저Bar[1] then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } } if 고Bar[1] > 저Bar[1] or 고[1] <= H[n] then { 고[1] = H[n]; 고Bar[1] = n; 고점갱신 = True; 고점표시 = 고[1]*1.005; } } } #------------------------------------------# # 전저점(Trough) 계산 #------------------------------------------# //Lowest(L,2)[3] >= L[2] and L[2] < Lowest(L,2) if Lowest(L,n)[n+1] >= L[n] and L[n] < Lowest(L,n) then { if 미완성사용 == True then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } 저[1] = L[n]; 저Bar[1] = n; 저점갱신 = True; 저점표시 = 저[1]*0.995; if 고Bar[1] > 저Bar[2] then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } k = n + 1; for j = n + 2 to 저Bar[2]-1 { if H[k] < H[j] then k = j; } 고[1] = H[k]; 고Bar[1] = k; } } if 미완성사용 == False then { if 저Bar[1] > 고Bar[1] then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } } if 저Bar[1] > 고Bar[1] or 저[1] >= L[n] then { 저[1] = L[n]; 저Bar[1] = n; 저점갱신 = True; 저점표시 = 저[1]*0.995; } } } #==========================================# # 중기 파동선 계산 #==========================================# # 중기고점 계산 #------------------------------------------# //단기 고점이 발생한 다음 꼭지점을 찾아 중기고점으로 설정 if 고점갱신 == True and 고[3] < 고[2] and 고[2] > 고[1] then { //↗↘ if 미완성사용 == True then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } 중기고[1] = 고[2]; 중기고Bar[1] = 고Bar[2]; 중기고점갱신 = True; if 중기저Bar[1] > 중기고Bar[2] then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } k = 2; for j = 3 to 19 { if 중기고Bar[2] > 저Bar[j] and 저[k] > 저[j] then { k = j; } } 중기저[1] = 저[k]; 중기저Bar[1] = 저Bar[k]; } } if 미완성사용 == False then { if 중기고Bar[1] > 중기저Bar[1] then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } } if 중기고Bar[1] > 중기저Bar[1] or 중기고[1] <= 고[2] then { 중기고[1] = 고[2]; 중기고Bar[1] = 고Bar[2]; 중기고점갱신 = True; } } 고점갱신 = False; 중기추세갱신 = 상단; } #------------------------------------------# # 중기저점 계산 #------------------------------------------# //단기 저점이 발생한 다음 꼭지점을 찾아 중기저점으로 설정 if 저점갱신 == True and 저[3] > 저[2] and 저[2] < 저[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } 중기저[1] = 저[2]; 중기저Bar[1] = 저Bar[2]; 중기저점갱신 = True; if 중기고Bar[1] > 중기저Bar[2] then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } k = 2; for j = 3 to 19 { if 중기저Bar[2] > 고Bar[j] and 고[k] < 고[j] then { k = j; } } 중기고[1] = 고[k]; 중기고Bar[1] = 고Bar[k]; } } if 미완성사용 == False then { if 중기저Bar[1] > 중기고Bar[1] then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } } if 중기저Bar[1] > 중기고Bar[1] or 중기저[1] >= 저[2] then { 중기저[1] = 저[2]; 중기저Bar[1] = 저Bar[2]; 중기저점갱신 = True; } } 저점갱신 = False; 중기추세갱신 = 하단; } #==========================================# # 장기 파동선 계산 #==========================================# # 장기고점 계산 #------------------------------------------# //중기 고점이 발생한 다음 꼭지점을 찾아 장기고점으로 설정 if 중기고점갱신 == True and 중기고[3] < 중기고[2] and 중기고[2] > 중기고[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } 장기고[1] = 중기고[2]; 장기고Bar[1] = 중기고Bar[2]; if 장기저Bar[1] > 장기고Bar[2] then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } k = 2; for j = 3 to 19 { if 장기고Bar[2] > 중기저Bar[j] and 중기저[k] > 중기저[j] then { k = j; } } 장기저[1] = 중기저[k]; 장기저Bar[1] = 중기저Bar[k]; } } if 미완성사용 == False then { if 장기고Bar[1] > 장기저Bar[1] then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } } if 장기고Bar[1] > 장기저Bar[1] or 장기고[1] <= 중기고[2] then { 장기고[1] = 중기고[2]; 장기고Bar[1] = 중기고Bar[2]; } } 중기고점갱신 = False; 장기추세갱신 = 상단; } #------------------------------------------# # 장기저점 계산 #------------------------------------------# //중기 저점이 발생한 다음 꼭지점을 찾아 장기저점으로 설정 if 중기저점갱신 == True and 중기저[3] > 중기저[2] and 중기저[2] < 중기저[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } 장기저[1] = 중기저[2]; 장기저Bar[1] = 중기저Bar[2]; if 장기고Bar[1] > 장기저Bar[2] then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } k = 2; for j = 3 to 19 { if 장기저Bar[2] > 중기고Bar[j] and 중기고[k] < 중기고[j] then { k = j; } } 장기고[1] = 중기고[k]; 장기고Bar[1] = 중기고Bar[k]; } } if 미완성사용 == False then { if 장기저Bar[1] > 장기고Bar[1] then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } } if 장기저Bar[1] > 장기고Bar[1] or 장기저[1] >= 중기저[2] then { 장기저[1] = 중기저[2]; 장기저Bar[1] = 중기저Bar[2]; } } 중기저점갱신 = False; 장기추세갱신 = 하단; } #==========================================# # 자동추세선 계산 #==========================================# if 고Bar[1] == n then { 단기상단채널 = 0; 단기상단기울기 = 0; for j = 2 to 49 { if 고[1] < 고[j] and 단기상단기울기 == 0 then { 단기상단기울기 =((고[1]-고[j])/(고Bar[j]-고Bar[1])); 단기상단Bar = 고Bar[j]; 단기상단절편 = 고[j]; j = Exit; } else if 고[j] <= 0 then j = Exit; } } if 저Bar[1] == n then { 단기하단채널 = 0; 단기하단기울기 = 0; for j = 2 to 49 { if 저[1] > 저[j] and 단기하단기울기 == 0 then { 단기하단기울기 = ((저[1]-저[j])/(저Bar[j]-저Bar[1])); 단기하단Bar = 저Bar[j]; 단기하단절편 = 저[j]; j = Exit; } else if 저[j] <= 0 then j = Exit; } } if 중기추세갱신 == 상단 then { 중기상단채널 = 0; 중기상단기울기 = 0; for j = 2 to 19 { if 중기고[1] < 중기고[j] and 중기상단기울기 == 0 then { 중기상단기울기 = ((중기고[1]-중기고[j])/(중기고Bar[j]-중기고Bar[1])); 중기상단Bar = 중기고Bar[j]; 중기상단절편 = 중기고[j]; j = Exit; } else if 중기고[j] <= 0 then j = Exit; } 중기추세갱신 = 0; } if 중기추세갱신 == 하단 then { 중기하단채널 = 0; 중기하단기울기 = 0; for j = 2 to 19 { if 중기저[1] > 중기저[j] and 중기하단기울기 == 0 then { 중기하단기울기 = ((중기저[1]-중기저[j])/(중기저Bar[j]-중기저Bar[1])); 중기하단Bar = 중기저Bar[j]; 중기하단절편 = 중기저[j]; j = Exit; } else if 중기저[j] <= 0 then j = Exit; } 중기추세갱신 = 0; } if 장기추세갱신 == 상단 then { 장기상단채널 = 0; 장기상단기울기 = 0; for j = 2 to 19 { if 장기고[1] < 장기고[j] and 장기상단기울기 == 0 then { 장기상단기울기 = ((장기고[1]-장기고[j])/(장기고Bar[j]-장기고Bar[1])); 장기상단Bar = 장기고Bar[j]; 장기상단절편 = 장기고[j]; j = Exit; } else if 장기고[j] <= 0 then j = Exit; } 장기추세갱신 = 0; } if 장기추세갱신 == 하단 then { 장기하단채널 = 0; 장기하단기울기 = 0; for j = 2 to 19 { if 장기저[1] > 장기저[j] and 장기하단기울기 == 0 then { 장기하단기울기 = ((장기저[1]-장기저[j])/(장기저Bar[j]-장기저Bar[1])); 장기하단Bar = 장기저Bar[j]; 장기하단절편 = 장기저[j]; j = Exit; } else if 장기저[j] <= 0 then j = Exit; } 장기추세갱신 = 0; } if 단기상단기울기 < 0 then 단기상단채널 = 단기상단기울기 * 단기상단Bar + 단기상단절편; if 단기하단기울기 > 0 then 단기하단채널 = 단기하단기울기 * 단기하단Bar + 단기하단절편; if 중기상단기울기 < 0 then 중기상단채널 = 중기상단기울기 * 중기상단Bar + 중기상단절편; if 중기하단기울기 > 0 then 중기하단채널 = 중기하단기울기 * 중기하단Bar + 중기하단절편; if 장기상단기울기 < 0 then 장기상단채널 = 장기상단기울기 * 장기상단Bar + 장기상단절편; if 장기하단기울기 > 0 then 장기하단채널 = 장기하단기울기 * 장기하단Bar + 장기하단절편; if crossup(c,단기상단채널) Then buy(); if CrossDown(c,단기하단채널) Then exitlong(); 청산이 없으면 차트상 처음만족한 봉에 매수신호만 발생하고 이후에 신호가 발생하지 않으므로 단기하단체널값을 하향하면 청산되는 식을 임의로 추가했습니다. 즐거운 하루되세요 > 비엔에프 님이 쓴 글입니다. > 제목 : 시스템 질문드립니다. > 현재 우리투자증권의 우리트레이더에 계좌 하나 하이투자증권의 예스트레이더에 계좌 두개를 각각 운영하구 있습니다. 하이투자증권의 예스트레이더만 버전이 4.0인지 몰랐습니다. >> 질문드리구 싶은것은 밑에 자동추세선(이건 우리트레이더와 예스트레이더에서 다 작동) 지표식의 옵션체크란의 '단기상단채널'을 돌파하면 매수하는 시스템을 작성해보고 싶습니다만.. 자동추세선이 3.0버전에서두 다 그어지는데 3.0버전에서 추세돌파시스템두 만들수 있을거 같습니다만.. 위사진은 자동추세선지표를 우리트레이더 3.0버전에서 링네트 15분봉 2013년 4월19일 '단기상단채널'만 체크하고 지표표시한 화면입니다. 3.0버전에서 저런 추세선이 자동 작성되면 저 동그라미표시된 부분의 돌파가 나오면 매수하는 시스템을 만들어보고 싶습니다. 밑에는 전에 쓸수 있게 수정해주신 추세선 지표식입니다. ======= Input:n(5),단기(True),중기(True),장기(False),미완성사용(True); Var:j(0),q(0),k(0),상단(200),하단(100),고점표시(0),저점표시(0),Exit(100), 고점갱신(False),저점갱신(False),중기고점갱신(False),중기저점갱신(False), 중기추세갱신(0),장기추세갱신(0), 단기상단기울기(0),단기상단Bar(0),단기상단절편(0),단기하단기울기(0), 단기하단Bar(0),단기하단절편(0), 중기상단기울기(0),중기상단Bar(0),중기상단절편(0),중기하단기울기(0), 중기하단Bar(0),중기하단절편(0), 장기상단기울기(0),장기상단Bar(0),장기상단절편(0),장기하단기울기(0), 장기하단Bar(0),장기하단절편(0), 단기상단채널(0),단기하단채널(0),중기상단채널(0),중기하단채널(0), 장기상단채널(0),장기하단채널(0); Array:고[50](0),저[50](0),고Bar[50](0),저Bar[50](0), 중기고[20](0),중기저[20](0),중기고Bar[20](0),중기저Bar[20](0), 장기고[20](0),장기저[20](0),장기고Bar[20](0),장기저Bar[20](0); #==========================================# # 초기처리 (Initialize Routine) #==========================================# for j = 1 to 19 { 고Bar[j] = 고Bar[j] + 1; 저Bar[j] = 저Bar[j] + 1; 중기고Bar[j] = 중기고Bar[j] + 1; 중기저Bar[j] = 중기저Bar[j] + 1; 장기고Bar[j] = 장기고Bar[j] + 1; 장기저Bar[j] = 장기저Bar[j] + 1; } for j = 20 to 49 { 고Bar[j] = 고Bar[j] + 1; 저Bar[j] = 저Bar[j] + 1; } 단기상단Bar = 단기상단Bar + 1; 단기하단Bar = 단기하단Bar + 1; 중기상단Bar = 중기상단Bar + 1; 중기하단Bar = 중기하단Bar + 1; 장기상단Bar = 장기상단Bar + 1; 장기하단Bar = 장기하단Bar + 1; 고점표시=(O[n]+C[n])/2; 저점표시=(O[n]+C[n])/2; #==========================================# # 단기 파동선 계산 #==========================================# # 전고점(Peak) 계산 #------------------------------------------# //Highest(H,2)[3] <= H[2] and H[2] > Highest(H,2) if Highest(H,n)[n+1] <= H[n] and H[n] > Highest(H,n) then { if 미완성사용 == True then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } 고[1] = H[n]; 고Bar[1] = n; 고점갱신 = True; 고점표시 = 고[1]*1.005; if 저Bar[1] > 고Bar[2] then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } k = n + 1; for j = n + 2 to 고Bar[2]-1 { if L[k] > L[j] then k = j; } 저[1] = L[k]; 저Bar[1] = k; } } if 미완성사용 == False then { if 고Bar[1] > 저Bar[1] then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } } if 고Bar[1] > 저Bar[1] or 고[1] <= H[n] then { 고[1] = H[n]; 고Bar[1] = n; 고점갱신 = True; 고점표시 = 고[1]*1.005; } } } #------------------------------------------# # 전저점(Trough) 계산 #------------------------------------------# //Lowest(L,2)[3] >= L[2] and L[2] < Lowest(L,2) if Lowest(L,n)[n+1] >= L[n] and L[n] < Lowest(L,n) then { if 미완성사용 == True then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } 저[1] = L[n]; 저Bar[1] = n; 저점갱신 = True; 저점표시 = 저[1]*0.995; if 고Bar[1] > 저Bar[2] then { for j = 48 downto 1 { 고[j+1] = 고[j]; 고Bar[j+1] = 고Bar[j]; } k = n + 1; for j = n + 2 to 저Bar[2]-1 { if H[k] < H[j] then k = j; } 고[1] = H[k]; 고Bar[1] = k; } } if 미완성사용 == False then { if 저Bar[1] > 고Bar[1] then { for j = 48 downto 1 { 저[j+1] = 저[j]; 저Bar[j+1] = 저Bar[j]; } } if 저Bar[1] > 고Bar[1] or 저[1] >= L[n] then { 저[1] = L[n]; 저Bar[1] = n; 저점갱신 = True; 저점표시 = 저[1]*0.995; } } } #==========================================# # 중기 파동선 계산 #==========================================# # 중기고점 계산 #------------------------------------------# //단기 고점이 발생한 다음 꼭지점을 찾아 중기고점으로 설정 if 고점갱신 == True and 고[3] < 고[2] and 고[2] > 고[1] then { //↗↘ if 미완성사용 == True then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } 중기고[1] = 고[2]; 중기고Bar[1] = 고Bar[2]; 중기고점갱신 = True; if 중기저Bar[1] > 중기고Bar[2] then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } k = 2; for j = 3 to 19 { if 중기고Bar[2] > 저Bar[j] and 저[k] > 저[j] then { k = j; } } 중기저[1] = 저[k]; 중기저Bar[1] = 저Bar[k]; } } if 미완성사용 == False then { if 중기고Bar[1] > 중기저Bar[1] then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } } if 중기고Bar[1] > 중기저Bar[1] or 중기고[1] <= 고[2] then { 중기고[1] = 고[2]; 중기고Bar[1] = 고Bar[2]; 중기고점갱신 = True; } } 고점갱신 = False; 중기추세갱신 = 상단; } #------------------------------------------# # 중기저점 계산 #------------------------------------------# //단기 저점이 발생한 다음 꼭지점을 찾아 중기저점으로 설정 if 저점갱신 == True and 저[3] > 저[2] and 저[2] < 저[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } 중기저[1] = 저[2]; 중기저Bar[1] = 저Bar[2]; 중기저점갱신 = True; if 중기고Bar[1] > 중기저Bar[2] then { for j = 18 downto 1 { 중기고[j+1] = 중기고[j]; 중기고Bar[j+1] = 중기고Bar[j]; } k = 2; for j = 3 to 19 { if 중기저Bar[2] > 고Bar[j] and 고[k] < 고[j] then { k = j; } } 중기고[1] = 고[k]; 중기고Bar[1] = 고Bar[k]; } } if 미완성사용 == False then { if 중기저Bar[1] > 중기고Bar[1] then { for j = 18 downto 1 { 중기저[j+1] = 중기저[j]; 중기저Bar[j+1] = 중기저Bar[j]; } } if 중기저Bar[1] > 중기고Bar[1] or 중기저[1] >= 저[2] then { 중기저[1] = 저[2]; 중기저Bar[1] = 저Bar[2]; 중기저점갱신 = True; } } 저점갱신 = False; 중기추세갱신 = 하단; } #==========================================# # 장기 파동선 계산 #==========================================# # 장기고점 계산 #------------------------------------------# //중기 고점이 발생한 다음 꼭지점을 찾아 장기고점으로 설정 if 중기고점갱신 == True and 중기고[3] < 중기고[2] and 중기고[2] > 중기고[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } 장기고[1] = 중기고[2]; 장기고Bar[1] = 중기고Bar[2]; if 장기저Bar[1] > 장기고Bar[2] then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } k = 2; for j = 3 to 19 { if 장기고Bar[2] > 중기저Bar[j] and 중기저[k] > 중기저[j] then { k = j; } } 장기저[1] = 중기저[k]; 장기저Bar[1] = 중기저Bar[k]; } } if 미완성사용 == False then { if 장기고Bar[1] > 장기저Bar[1] then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } } if 장기고Bar[1] > 장기저Bar[1] or 장기고[1] <= 중기고[2] then { 장기고[1] = 중기고[2]; 장기고Bar[1] = 중기고Bar[2]; } } 중기고점갱신 = False; 장기추세갱신 = 상단; } #------------------------------------------# # 장기저점 계산 #------------------------------------------# //중기 저점이 발생한 다음 꼭지점을 찾아 장기저점으로 설정 if 중기저점갱신 == True and 중기저[3] > 중기저[2] and 중기저[2] < 중기저[1] then { if 미완성사용 == True then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } 장기저[1] = 중기저[2]; 장기저Bar[1] = 중기저Bar[2]; if 장기고Bar[1] > 장기저Bar[2] then { for j = 18 downto 1 { 장기고[j+1] = 장기고[j]; 장기고Bar[j+1] = 장기고Bar[j]; } k = 2; for j = 3 to 19 { if 장기저Bar[2] > 중기고Bar[j] and 중기고[k] < 중기고[j] then { k = j; } } 장기고[1] = 중기고[k]; 장기고Bar[1] = 중기고Bar[k]; } } if 미완성사용 == False then { if 장기저Bar[1] > 장기고Bar[1] then { for j = 18 downto 1 { 장기저[j+1] = 장기저[j]; 장기저Bar[j+1] = 장기저Bar[j]; } } if 장기저Bar[1] > 장기고Bar[1] or 장기저[1] >= 중기저[2] then { 장기저[1] = 중기저[2]; 장기저Bar[1] = 중기저Bar[2]; } } 중기저점갱신 = False; 장기추세갱신 = 하단; } #==========================================# # 자동추세선 계산 #==========================================# if 고Bar[1] == n then { 단기상단채널 = 0; 단기상단기울기 = 0; for j = 2 to 49 { if 고[1] < 고[j] and 단기상단기울기 == 0 then { 단기상단기울기 =((고[1]-고[j])/(고Bar[j]-고Bar[1])); 단기상단Bar = 고Bar[j]; 단기상단절편 = 고[j]; j = Exit; } else if 고[j] <= 0 then j = Exit; } } if 저Bar[1] == n then { 단기하단채널 = 0; 단기하단기울기 = 0; for j = 2 to 49 { if 저[1] > 저[j] and 단기하단기울기 == 0 then { 단기하단기울기 = ((저[1]-저[j])/(저Bar[j]-저Bar[1])); 단기하단Bar = 저Bar[j]; 단기하단절편 = 저[j]; j = Exit; } else if 저[j] <= 0 then j = Exit; } } if 중기추세갱신 == 상단 then { 중기상단채널 = 0; 중기상단기울기 = 0; for j = 2 to 19 { if 중기고[1] < 중기고[j] and 중기상단기울기 == 0 then { 중기상단기울기 = ((중기고[1]-중기고[j])/(중기고Bar[j]-중기고Bar[1])); 중기상단Bar = 중기고Bar[j]; 중기상단절편 = 중기고[j]; j = Exit; } else if 중기고[j] <= 0 then j = Exit; } 중기추세갱신 = 0; } if 중기추세갱신 == 하단 then { 중기하단채널 = 0; 중기하단기울기 = 0; for j = 2 to 19 { if 중기저[1] > 중기저[j] and 중기하단기울기 == 0 then { 중기하단기울기 = ((중기저[1]-중기저[j])/(중기저Bar[j]-중기저Bar[1])); 중기하단Bar = 중기저Bar[j]; 중기하단절편 = 중기저[j]; j = Exit; } else if 중기저[j] <= 0 then j = Exit; } 중기추세갱신 = 0; } if 장기추세갱신 == 상단 then { 장기상단채널 = 0; 장기상단기울기 = 0; for j = 2 to 19 { if 장기고[1] < 장기고[j] and 장기상단기울기 == 0 then { 장기상단기울기 = ((장기고[1]-장기고[j])/(장기고Bar[j]-장기고Bar[1])); 장기상단Bar = 장기고Bar[j]; 장기상단절편 = 장기고[j]; j = Exit; } else if 장기고[j] <= 0 then j = Exit; } 장기추세갱신 = 0; } if 장기추세갱신 == 하단 then { 장기하단채널 = 0; 장기하단기울기 = 0; for j = 2 to 19 { if 장기저[1] > 장기저[j] and 장기하단기울기 == 0 then { 장기하단기울기 = ((장기저[1]-장기저[j])/(장기저Bar[j]-장기저Bar[1])); 장기하단Bar = 장기저Bar[j]; 장기하단절편 = 장기저[j]; j = Exit; } else if 장기저[j] <= 0 then j = Exit; } 장기추세갱신 = 0; } if 단기상단기울기 < 0 then 단기상단채널 = 단기상단기울기 * 단기상단Bar + 단기상단절편; if 단기하단기울기 > 0 then 단기하단채널 = 단기하단기울기 * 단기하단Bar + 단기하단절편; if 중기상단기울기 < 0 then 중기상단채널 = 중기상단기울기 * 중기상단Bar + 중기상단절편; if 중기하단기울기 > 0 then 중기하단채널 = 중기하단기울기 * 중기하단Bar + 중기하단절편; if 장기상단기울기 < 0 then 장기상단채널 = 장기상단기울기 * 장기상단Bar + 장기상단절편; if 장기하단기울기 > 0 then 장기하단채널 = 장기하단기울기 * 장기하단Bar + 장기하단절편; #=================================# # 지표식 #=================================# if 고점표시 > H[n] then Plot1(고점표시,"전고점",RED); //점그래프,수평이동 if 저점표시 < L[n] then Plot2(저점표시,"전저점",BLUE); //점그래프,수평이동 #------------------------------------------# # 채널 표시 #------------------------------------------# if 단기 == True then { if 단기상단채널 > 0 then Plot3(단기상단채널,"단기상단채널",RED); //점그래프 if 단기하단채널 > 0 then Plot4(단기하단채널,"단기하단채널",BLUE); //점그래프 } if 중기 == True then { if 중기상단채널 > 0 then Plot5(중기상단채널,"중기상단채널",RED); //점그래프 if 중기하단채널 > 0 then Plot6(중기하단채널,"중기하단채널",BLUE); //점그래프 } if 장기 == True then { if 장기상단채널 > 0 then Plot7(장기상단채널,"장기상단채널",RED); //점그래프 if 장기하단채널 > 0 then Plot8(장기하단채널,"장기하단채널",BLUE); //점그래프 }