커뮤니티
부탁드립니다.
2015-07-22 15:58:46
114
글번호 88776
파란점에서 매수진입 빨간점에서 매수청산 & 매도진입 다시 파란점에서 매도청산 & 매수진입하도록 부탁드립니다.
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);
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;
//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];
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];
}
}
}
//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];
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];
}
}
}
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
예스스탁 예스스탁 답변
2015-07-22 17:38:14
안녕하세요
예스스탁입니다.
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);
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;
//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];
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];
}
}
}
//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];
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];
}
}
}
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 sell();
if 저점표시 == L[n] then buy();
즐거운 하루되세요
> 매일상승 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 파란점에서 매수진입 빨간점에서 매수청산 & 매도진입 다시 파란점에서 매도청산 & 매수진입하도록 부탁드립니다.
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);
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;
//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];
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];
}
}
}
//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];
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];
}
}
}
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); //점그래프
}