본문 바로가기
∎ 매매의 기술 [ K ]/지표편집

어느 지표식의 주석

by 케이님[K] 2015. 1. 14.

 

 

1.
var : ii(0,data1);

#TimeToMinutes은 시간을 0시이후에 경과된 분수로 리턴해 주는 함수입니다.
#차트의 시간을 15분 단위로 구별(15분보다 아래 주기에서 15분봉의 주기를 구할때 사용됩니다)
#ii는 1분봉 차트이면 해당값이 0,1,2,3,4,5,~~13,14,0,1,2,3,4,~~,13,14,0,1,2와 같이 변화됨
ii = TimeToMinutes(stime)%15;

#첫봉이후이고 14시30분 이전에 ii가 14분이면
if data1(dayindex > 0 and ii == 14 and stime <= 143000) Then{
      # data2가 양봉이면 매수
    if data2(C > O) Then
          buy("b");
    # data2가 음봉이면 매도
    if data2(C < O) Then
            sell("s");
}

#매수후 주종목이 음봉이면 매수포지션 청산
if MarketPosition == 1 and C < O Then
      ExitLong("bx");

#매도후 주종목이 양봉이면 매도포지션 청산
if MarketPosition == -1 and C > O Then
      ExitShort("sx");

#진입 후 13분이 지나면 포지션 청산
if MarketPosition != 0 and ii == 13 then{#13분봉 완성시 청산 
    ExitLong("bx1");
    ExitShort("sx1");
}

2.
var : ii(0,data1);

ii = TimeToMinutes(stime)%15;

if data1(dayindex > 0 and ii == 14 and stime <= 143000) Then{
      if data2(C > O) Then
            buy("b");
      if data2(C < O) Then
            sell("s");
}
#진입은 1번과 같은

#진입 후 2개봉 경과하면 청산
if MarketPosition != 0 and BarsSinceEntry == 2 then{
    ExitLong("bx2");
    ExitShort("sx2");
}
#진입 후 13분이 지나면 포지션 청산
if MarketPosition != 0 and ii == 13 then{#13분봉 완성시 청산 
    ExitLong("bx1");
    ExitShort("sx1");
}

3.
input : N(1);
var : ii(0,data1),AA(0,data1),BB(0,data1);

ii = TimeToMinutes(stime)%15;

#첫봉이후이고 14시30분 이전에 ii가 14분이면
if data1(dayindex > 0 and ii == 14 and stime <= 143000) Then{
    #data2가 양봉이면 Condition1은 true 아니면 false
      if data2(C > O) Then
            Condition1 = True;
      Else
            Condition1 = false;
      #data2가 d음봉이면 Condition1은 true 아니면 false
      if data2(C < O) Then
            Condition2 = true;
      Else
            Condition2 = false;            
}

#날짜가 변경되면 AA는0 ,BB는 0
if date != date[1] Then{
      AA = 0;
      BB = 0;
}

#AA와 BB는 당일 조건만족 횟수를 카운트하는 식입니다.
#Condition1 == true이고 주종목에서 양봉이 N개봉 연속 나오고  ii가 N-1과 같으면 AA는 1씩증가
if Condition1 == true and countif(C > O,N) == N and ii == N-1 Then
      AA = AA+1;
      
#Condition2 == true이고 주종목에서 음봉이 N개봉 연속 나오고  ii가 N-1과 같으면 BB는 1씩증가
if Condition2 == true and countif(C < O,N) == N and ii == N-1 Then
      BB = BB+1;



plot1(AA);
plot2(BB);

4.
input : N(1);
var : ii(0,data1),AA(0,data1),BB(0,data1);

ii = TimeToMinutes(stime)%15;

if data1(dayindex > 0 and ii == 14 and stime <= 143000) Then{
      if data2(C > O) Then
            Condition1 = True;
      Else
            Condition1 = false;
      if data2(C < O) Then
            Condition2 = true;
      Else
            Condition2 = false;            
}
#위 내용은 3번과 같은

#날짜가 변경되면 AA는0 ,BB는 0
if date != date[1] Then{
      AA = 0;
      BB = 0;
}
#AA와 BB는 당일 조건만족 횟수를 카운트하는 식입니다.
#Condition1 == true이고 주종목의 고가가 참조데이터의 종가보다 0.2이상 크고 ii가 N-1과 같으면 AA는 1씩증가
if Condition1 == true and H-data2(c) > 0.2 and ii == N-1 Then
      AA = AA+1;

#Condition2 == true이고 주종목의 w저가가 참조데이터의 종가보다 0.2이상 작고 크고 ii가 N-1과 같으면 BB는 1씩증가
if Condition2 == true and L-data2(c) < -0.2 and ii == N-1 Then
      BB = BB+1;

plot1(AA);
plot2(BB);


5.
var : va1(0),va2(0),va3(0); 

#날짜에서 월을 추출 --> 20141221 --> 12
va1 = int(date/100)-int(date/10000)*100;
#날짜에서 일을 추출 --> 20141221 --> 21
va2 = date - int(date/100)*100;
#날짜를 요일값으로 리턴해주는 함수 
#일요일0,월요일1,화요일2,수요일3,목요일4,금요일5,토요일6
va3 = DayOfWeek(date);

#va1%3 == 3 월을 3으로 나누어 나머지가 0인 월을 찾은 즉 3,6,9,12월 찾는식
#va2 >= 8 and va2 <= 14 일수는 8일~14일 사이 
#va3 == 4 목요일
#즉 아래식은 선물 만기일을 계산하는 식입니다.
#선물만기일이면  true 아니면 false
if va1%3 == 0 and va2 >= 8 and va2 <= 14 and va3 == 4 Then
      Condition1 = true;
Else
      Condition1 = false;

#날짜가 변경이되고 오늘은 Condition1이 true인데 전봉(전일)은 true일때
#즉 전일이 만기일이라는 표현식입니다.
#전일이 만기일이면 0 아니면 1
if date != date[1] Then{
      if Condition1 == false and Condition1[1] == true Then
            var1 = 0;
      Else
            var1 = 1;
}

#전일이 만기일이 아니면 조건1만족하면 매수
if var1==1 and 조건1 then Buy();

http://www.yesstock.com/

 

 

댓글