커뮤니티
타주기 시스템식 검증
2016-05-19 11:43:02
100
글번호 98235
항상 감사드립니다
타주기 시스템식에서 아래조건을 가동할때 식을 검토해주시기 바랍니다..
1_ 동일방향 재진입금지/전일 마지막신호와 무관하게 진입
2_ 2회연속손실시 시스템 신호발생 금지
3_시초가 갭발생시(20틱이상) 첫번재신호 발생금지
이조건에서
1_ 매수매도 ==> 시스템에 따름
2_ 타주기 청산식추가
3_ 최대익절 청산식 추가
요청1) 청산식이 추가되니 시스템 신호가 발생하지 않습니다. 수정부탁드립니다
요청2)_ 2회연속손실시 시스템 신호발생 금지부분의 해설부탁드립니다
3회연속손실시 시스템 신호발생금지로 변경 가능하게....
감사합니다
#########################
##### 당일익절 설정 #####
#########################
input : 당일수익틱수(100),당일손실틱수(45);
var : NP(0),PreNP(0),dayPL(0),DollerToTick(0),당일수익(0),당일손실(0);
NP = NetProfit;
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if stime == 170000 or (stime > 170000 and stime[1] < 170000) then
PreNP = NP[1];
##################################################
##### 당일 17:00 장시작 / 익일 14:30 장종료 #####
##################################################
### 동일방향 재진입금지/전일 마지막신호와 무관하게 진입 ###
### 2회연속손실시 시스템 신호발생 금지 ###
### 시초가 갭발생시(20틱이상) 첫번재신호 발생금지 ###
var : entrycnt(0),cond(false),T(0),count(0),gap(false),Xcond(false);
#장시작
if stime == 170000 or (stime > 170000 and stime[1] < 170000) Then{ # 현지시간_뉴욕 17:00 장시작 #
Entrycnt = 0;
cond = false;
Xcond = false;
#매수매도 방향을 알기위한 변수 초기값은 0
T = 0;
#조건만족횟수 카운트 초기화 0
count = 0;
#시가가 전봉종가(전일종가)보다 20틱이상 크거나 20틱이상 낮으면
#gap은 true 아니면 false
if O >= C[1]+PriceScale*20 or O <= C[1]-PriceScale*20 Then
gap = true;
Else
gap = false;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
Entrycnt = Entrycnt+1;
if TotalTrades > TotalTrades[1] and (IsExitName("BP",1) or IsExitName("BL",1) or IsExitName("SP",1) or IsExitName("SL",1)) Then
Xcond = true;
cond = false;
if entrycnt >= 2 Then{
if MarketPosition == 0 and PositionProfit(1) < 0 and PositionProfit(2) < 0 Then
cond = true;
if MarketPosition != 0 and PositionProfit(0) < 0 and PositionProfit(1) < 0 Then
cond = true;
}
if (stime > 170000 or stime < 143000) and (DayPL < 당일수익틱수*PriceScale and dayPL > -당일손실틱수*PriceScale and Xcond == false ) Then{
# 현지시간_뉴욕 17:00 장시작~익일 14:30 장종료 #
##############################
##### 1_ 매매식 #####
##############################
if T <= 0 and #T가 0이고 매수조건이 만족하면
((entrycnt == 0) or
(entrycnt >= 1 and ((MarketPosition == 0 and MarketPosition(1) != 1) or (MarketPosition == -1)))) and #동일방향 재진입금지#
V10 == 1 and data1(c)>선행1 and var12==1 and var13==1 and upAroon1 > DnAroon1 and upAroon1>70 and
V70 == 1 and vv12==1 and upAroon2 > DnAroon2 and dnAroon2<50 Then {
T = 1; #T는 1(매수조건만족했음을 나타냄)
count = count+1; #count는 1증가, 장시작이후 조건만족 횟수를 카운트
#gap이 false이거나 gap이 true이면 count가 2이상일때 진입
if gap == false or (gap == true and count >= 2) Then
{
if cond == false then
buy("B_200_20");
Else
ExitShort();
}
}
if T >= 0 and
((entrycnt == 0) or
(entrycnt >= 1 and ((MarketPosition == 0 and MarketPosition(1) != -1) or (MarketPosition == 1)))) and #동일방향 재진입금지#
V10 == -1 and data1(c)<선행1 and var12==-1 and var13==-1 and upAroon1 < DnAroon1 and dnAroon1>70 and
V70 == -1 and vv12==-1 and upAroon2 < DnAroon2 and upAroon2<50 Then {
T = -1;
count = count+1;
#gap이 false이거나 gap이 true이면 count가 2이상일때 진입
if gap == false or (gap == true and count >= 2) Then
{
if cond == false Then
sell("S_200_20");
Else
ExitLong();
}
}
}
###############################
##### 청산 시스템_1 #####
###############################
if MarketPosition == 1 and V70 == -1 and vv12==-1 and upAroon2 < DnAroon2 and upAroon2<50 then
exitlong("eB_타주기");
if MarketPosition == -1 and V70 == 1 and vv12==1 and upAroon2 > DnAroon2 and dnAroon2<50 Then
ExitShort("eS_타주기");
##########################################
##### 당일수익,당일손실 조건청산 #####
##########################################
if MarketPosition == 1 Then{
ExitLong("BP",atlimit,EntryPrice+당일수익-dayPL);
ExitLong("BL",AtStop,EntryPrice-당일손실-dayPL);
}
if MarketPosition == -1 Then{
ExitShort("SP",atlimit,EntryPrice-당일수익+dayPL);
ExitShort("SL",AtStop,EntryPrice+당일손실+dayPL);
}
##########################################
##### 최대이익도달후 조건청산 #####
##########################################
if MarketPosition == 1 Then{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*30 Then
exitlong("bx30",AtStop,EntryPrice+PriceScale*27);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then
exitlong("bx50",AtStop,EntryPrice+PriceScale*47);
}
답변 1
예스스탁 예스스탁 답변
2016-05-20 12:52:36
안녕하세요
예스스탁입니다.
1
청산식이 추가 됐는데 신호가 발생하지 않는것은
올려주신 내용만으로는 판단이 되지 않습니다.
수식에서 참조데이터를 사용할때는
수식에서 사용하는 모든 변수에 해당 변수가 어떤 데이터주기로 값을 저장할지
선언문에서 아래와 같이 주기를 지정해 주셔야 하고
var : AA(0,data1),BB(0,data2);
수식에 있는 계산을 모두 데이터 함수로 쒸워주셔야 합니다.
수식에서 사용하는 값과 기간등이 어떤 데이터주기로 값을 가져오고 봉수를 카운트 하는지
지정해야 합니다.
AA = data1(ma(C,5));
BB = data2(ma(c,5));
예스랭귀지 도움말에소 예스랭귀지 활용 --> 타종목/타주기 참조의 도움말 내용 확인하시기 바랍니다.
2
아래내용이 2회연속손실을 체크하는 내용입니다.
2회연속이면 cond가 true값을 리턴합니다.
cond = false;
#당일 진입이 2회이상이고
if entrycnt >= 2 Then{
#현재 무포지션이면 전거래, 전전거래의 손익이 모두 0이하이면 true
if MarketPosition == 0 and PositionProfit(1) < 0 and PositionProfit(2) < 0 Then
cond = true;
#현재 포지션 진행중이면 현재거래, 전전거래의 손익이 모두 0이하이면 true
if MarketPosition != 0 and PositionProfit(0) < 0 and PositionProfit(1) < 0 Then
cond = true;
}
회수를 3회로 늘린다면
아래와 같이 수정하시면 됩니다.
#당일 진입이 3회이상이고
if entrycnt >= 3 Then{
#현재 무포지션이면 전거래, 전전거래의 손익이 모두 0이하이면 true
if MarketPosition == 0 and PositionProfit(1) < 0 and PositionProfit(2) < 0 and PositionProfit(3) < 0 Then
cond = true;
#현재 포지션 진행중이면 현재거래, 전전거래의 손익이 모두 0이하이면 true
if MarketPosition != 0 and PositionProfit(0) < 0 and PositionProfit(1) < 0 PositionProfit(2) < 0 Then
cond = true;
}
즐거운 하루되세요
> 조민철 님이 쓴 글입니다.
> 제목 : 타주기 시스템식 검증
> 항상 감사드립니다
타주기 시스템식에서 아래조건을 가동할때 식을 검토해주시기 바랍니다..
1_ 동일방향 재진입금지/전일 마지막신호와 무관하게 진입
2_ 2회연속손실시 시스템 신호발생 금지
3_시초가 갭발생시(20틱이상) 첫번재신호 발생금지
이조건에서
1_ 매수매도 ==> 시스템에 따름
2_ 타주기 청산식추가
3_ 최대익절 청산식 추가
요청1) 청산식이 추가되니 시스템 신호가 발생하지 않습니다. 수정부탁드립니다
요청2)_ 2회연속손실시 시스템 신호발생 금지부분의 해설부탁드립니다
3회연속손실시 시스템 신호발생금지로 변경 가능하게....
감사합니다
#########################
##### 당일익절 설정 #####
#########################
input : 당일수익틱수(100),당일손실틱수(45);
var : NP(0),PreNP(0),dayPL(0),DollerToTick(0),당일수익(0),당일손실(0);
NP = NetProfit;
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if stime == 170000 or (stime > 170000 and stime[1] < 170000) then
PreNP = NP[1];
##################################################
##### 당일 17:00 장시작 / 익일 14:30 장종료 #####
##################################################
### 동일방향 재진입금지/전일 마지막신호와 무관하게 진입 ###
### 2회연속손실시 시스템 신호발생 금지 ###
### 시초가 갭발생시(20틱이상) 첫번재신호 발생금지 ###
var : entrycnt(0),cond(false),T(0),count(0),gap(false),Xcond(false);
#장시작
if stime == 170000 or (stime > 170000 and stime[1] < 170000) Then{ # 현지시간_뉴욕 17:00 장시작 #
Entrycnt = 0;
cond = false;
Xcond = false;
#매수매도 방향을 알기위한 변수 초기값은 0
T = 0;
#조건만족횟수 카운트 초기화 0
count = 0;
#시가가 전봉종가(전일종가)보다 20틱이상 크거나 20틱이상 낮으면
#gap은 true 아니면 false
if O >= C[1]+PriceScale*20 or O <= C[1]-PriceScale*20 Then
gap = true;
Else
gap = false;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
Entrycnt = Entrycnt+1;
if TotalTrades > TotalTrades[1] and (IsExitName("BP",1) or IsExitName("BL",1) or IsExitName("SP",1) or IsExitName("SL",1)) Then
Xcond = true;
cond = false;
if entrycnt >= 2 Then{
if MarketPosition == 0 and PositionProfit(1) < 0 and PositionProfit(2) < 0 Then
cond = true;
if MarketPosition != 0 and PositionProfit(0) < 0 and PositionProfit(1) < 0 Then
cond = true;
}
if (stime > 170000 or stime < 143000) and (DayPL < 당일수익틱수*PriceScale and dayPL > -당일손실틱수*PriceScale and Xcond == false ) Then{
# 현지시간_뉴욕 17:00 장시작~익일 14:30 장종료 #
##############################
##### 1_ 매매식 #####
##############################
if T <= 0 and #T가 0이고 매수조건이 만족하면
((entrycnt == 0) or
(entrycnt >= 1 and ((MarketPosition == 0 and MarketPosition(1) != 1) or (MarketPosition == -1)))) and #동일방향 재진입금지#
V10 == 1 and data1(c)>선행1 and var12==1 and var13==1 and upAroon1 > DnAroon1 and upAroon1>70 and
V70 == 1 and vv12==1 and upAroon2 > DnAroon2 and dnAroon2<50 Then {
T = 1; #T는 1(매수조건만족했음을 나타냄)
count = count+1; #count는 1증가, 장시작이후 조건만족 횟수를 카운트
#gap이 false이거나 gap이 true이면 count가 2이상일때 진입
if gap == false or (gap == true and count >= 2) Then
{
if cond == false then
buy("B_200_20");
Else
ExitShort();
}
}
if T >= 0 and
((entrycnt == 0) or
(entrycnt >= 1 and ((MarketPosition == 0 and MarketPosition(1) != -1) or (MarketPosition == 1)))) and #동일방향 재진입금지#
V10 == -1 and data1(c)<선행1 and var12==-1 and var13==-1 and upAroon1 < DnAroon1 and dnAroon1>70 and
V70 == -1 and vv12==-1 and upAroon2 < DnAroon2 and upAroon2<50 Then {
T = -1;
count = count+1;
#gap이 false이거나 gap이 true이면 count가 2이상일때 진입
if gap == false or (gap == true and count >= 2) Then
{
if cond == false Then
sell("S_200_20");
Else
ExitLong();
}
}
}
###############################
##### 청산 시스템_1 #####
###############################
if MarketPosition == 1 and V70 == -1 and vv12==-1 and upAroon2 < DnAroon2 and upAroon2<50 then
exitlong("eB_타주기");
if MarketPosition == -1 and V70 == 1 and vv12==1 and upAroon2 > DnAroon2 and dnAroon2<50 Then
ExitShort("eS_타주기");
##########################################
##### 당일수익,당일손실 조건청산 #####
##########################################
if MarketPosition == 1 Then{
ExitLong("BP",atlimit,EntryPrice+당일수익-dayPL);
ExitLong("BL",AtStop,EntryPrice-당일손실-dayPL);
}
if MarketPosition == -1 Then{
ExitShort("SP",atlimit,EntryPrice-당일수익+dayPL);
ExitShort("SL",AtStop,EntryPrice+당일손실+dayPL);
}
##########################################
##### 최대이익도달후 조건청산 #####
##########################################
if MarketPosition == 1 Then{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*30 Then
exitlong("bx30",AtStop,EntryPrice+PriceScale*27);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then
exitlong("bx50",AtStop,EntryPrice+PriceScale*47);
}