커뮤니티
타주기챠트에서의 익절및 손절추가
2016-05-08 16:10:08
106
글번호 97795
항상 감사드립니다
아래시스템을 이용하여 다음조건으로 변경하고 싶습니다
1_변경조건
1)갭발생시(20틱이상) 두번째신호부터 신호발생
2)당일수익 100틱,당일손실50틱 조건만족시 시스템종료
3)연속2회손실시 신호발생금지--> 삭제
4)당일손실이 50틱이상이(신호발생시점) 될때까지 신호발생
5)청산시스템추가
#########################
##### 당일익절 설정 #####
#########################
input : 당일수익틱수(100),당일손실틱수(50);
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];
#당일 손익(포인트)
DayPL = NetProfit-PreNP ;
### 동일방향 재진입금지/전일 마지막신호와 무관하게 진입 ###
### 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 >= 5 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 장종료 #
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 macdv1>0 and var13==1 and upAroon1 > DnAroon1 and upAroon1>70 and
V70 == 1 and macdv2>0 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("B1_1분");
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 macdv1<0 and var13==-1 and upAroon1 < DnAroon1 and dnAroon1>70 and
V70 == -1 and macdv2<0 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("S1_1분");
Else
ExitLong();
}
}
}
###############################
##### 청산 시스템 #####
###############################
if MarketPosition == 1 and V70 == -1 and macdv2<0 and upAroon2 < DnAroon2 and upAroon2<50 then
exitlong("eB_타주기");
if MarketPosition == -1 and V70 == 1 and macdv2>0 and upAroon2 > DnAroon2 and dnAroon2<50 Then
ExitShort("eS_타주기");
###############################
##### 매일 14:30 강제청산 #####
###############################
if stime == 143000 or (stime > 143000 and stime[1] < 143000) Then{
exitlong("당일청산B");
ExitShort("당일청산S");
}
### 손절 ###
SetStopLoss(PriceScale*50,PointStop);
감사합니다.
답변 1
예스스탁 예스스탁 답변
2016-05-09 18:01:59
안녕하세요
예스스탁입니다.
input : 당일수익틱수(100),당일손실틱수(50);
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];
#당일 손익(포인트)
DayPL = NetProfit-PreNP ;
### 동일방향 재진입금지/전일 마지막신호와 무관하게 진입 ###
### 2회연속손실시 시스템 신호발생 금지 ###
### 시초가 갭발생시(20틱이상) 첫번재신호 발생금지 ###
var : entrycnt(0),T(0),count(0),gap(false),Xcond(false);
#장시작
if stime == 170000 or (stime > 170000 and stime[1] < 170000) Then{ # 현지시간_뉴욕 17:00 장시작 #
Entrycnt = 0;
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;
if (stime > 170000 or stime < 143000) and (DayPL < 당일수익 and dayPL > -당일손실 and Xcond == false ) Then{
# 현지시간_뉴욕 17:00 장시작~익일 14:30 장종료 #
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 macdv1>0 and var13==1 and upAroon1 > DnAroon1 and upAroon1>70 and
V70 == 1 and macdv2>0 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
{
buy("B1_1분");
}
}
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 macdv1<0 and var13==-1 and upAroon1 < DnAroon1 and dnAroon1>70 and
V70 == -1 and macdv2<0 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
{
sell("S1_1분");
}
}
}
###############################
##### 청산 시스템 #####
###############################
if MarketPosition == 1 and V70 == -1 and macdv2<0 and upAroon2 < DnAroon2 and upAroon2<50 then
exitlong("eB_타주기");
if MarketPosition == -1 and V70 == 1 and macdv2>0 and upAroon2 > DnAroon2 and dnAroon2<50 Then
ExitShort("eS_타주기");
###############################
##### 매일 14:30 강제청산 #####
###############################
if stime == 143000 or (stime > 143000 and stime[1] < 143000) Then{
exitlong("당일청산B");
ExitShort("당일청산S");
}
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);
}
### 손절 ###
SetStopLoss(PriceScale*50,PointStop);
즐거운 하루되세요
> 조민철 님이 쓴 글입니다.
> 제목 : 타주기챠트에서의 익절및 손절추가
> 항상 감사드립니다
아래시스템을 이용하여 다음조건으로 변경하고 싶습니다
1_변경조건
1)갭발생시(20틱이상) 두번째신호부터 신호발생
2)당일수익 100틱,당일손실50틱 조건만족시 시스템종료
3)연속2회손실시 신호발생금지--> 삭제
4)당일손실이 50틱이상이(신호발생시점) 될때까지 신호발생
5)청산시스템추가
#########################
##### 당일익절 설정 #####
#########################
input : 당일수익틱수(100),당일손실틱수(50);
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];
#당일 손익(포인트)
DayPL = NetProfit-PreNP ;
### 동일방향 재진입금지/전일 마지막신호와 무관하게 진입 ###
### 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 >= 5 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 장종료 #
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 macdv1>0 and var13==1 and upAroon1 > DnAroon1 and upAroon1>70 and
V70 == 1 and macdv2>0 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("B1_1분");
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 macdv1<0 and var13==-1 and upAroon1 < DnAroon1 and dnAroon1>70 and
V70 == -1 and macdv2<0 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("S1_1분");
Else
ExitLong();
}
}
}
###############################
##### 청산 시스템 #####
###############################
if MarketPosition == 1 and V70 == -1 and macdv2<0 and upAroon2 < DnAroon2 and upAroon2<50 then
exitlong("eB_타주기");
if MarketPosition == -1 and V70 == 1 and macdv2>0 and upAroon2 > DnAroon2 and dnAroon2<50 Then
ExitShort("eS_타주기");
###############################
##### 매일 14:30 강제청산 #####
###############################
if stime == 143000 or (stime > 143000 and stime[1] < 143000) Then{
exitlong("당일청산B");
ExitShort("당일청산S");
}
### 손절 ###
SetStopLoss(PriceScale*50,PointStop);
감사합니다.