커뮤니티
이상합니다-------------------
2011-09-23 08:28:00
490
글번호 42922
input: 테마기간(3),채널기간(45),수평(7),이익(9),손절(7),고저차(0.75)
,전봉차(0.003),진입가(-2),Per1(0.05),X1(100),손절1(15),손절2(15);
VAR : TCHAN(0), BCHAN(0), aa(0), bb(0), highV(0), LowV(0);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
var:k(0),d(0);
k=StochasticsK(20,12);
d=StochasticsD(20,12,12);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for var1 = 1 to 10{
if sdate == EntryDate(var1) Then{
count = count+1;
PLR = PLR+PositionProfit(var1);
}
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
#당일누적손익계산 끝
TCHAN = HIGHEST(HIGH, 채널기간)[1];
BCHAN = LOWEST(LOW, 채널기간)[1];
var77 = (3 * Ema(c,테마기간)) - (3 * Ema(Ema(c,테마기간),테마기간)) + (Ema(Ema(Ema(c,테마기간),테마기간),테마기간));
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
Condition2= CountIF(Tchan==Tchan[1],7) == 7 ;
if stime >= 090100 and TCHAN - BCHAN > 고저차 * c/100 then {
#매수
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 >= var77[1]+전봉차 and Condition2==True && k<80 Then
aa = TCHAN + PriceScale*진입가;
buy("매수",atstop, aa);
}
highV = highest(H,BarsSinceEntry);
if MarketPosition == 1 Then {
ExitLong("수익", atlimit, entryPrice+PriceScale*이익);
exitlong("bxxxxx",atstop,entryPrice-PriceScale*손절);
}
if MarketPosition == 1 or var77 < var77[1] Then
aa = 999999;
#매도
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 <= var77[1]-전봉차 and CountIF(Bchan==Bchan[1],수평) == 수평 && k>22 Then
bb = BCHAN - PriceScale*진입가;
sell("매도",atstop, bb);
}
LowV = Lowest(L,BarsSinceEntry);
if MarketPosition == -1 Then {
ExitShort("도익", atlimit, entryPrice-PriceScale*이익);
exitshort("sxxxxx",atstop,entryPrice+PriceScale*손절);
}
if MarketPosition == -1 or var77 > var77[1] Then
bb = 0.000001;
}
//시간청산--------------------
var11 = int(date/100)-int(date/10000)*100; //월
var22 = date - int(date/100)*100; //일
var33 = DayOfWeek(date); //요일
if var11%3 == 0 and var22 >= 8 and var22 <= 14 and var33 == 4 then {
SetStopEndofday(144800); //만
}
else {
SetStopEndofday(150100); //평
}
If dayPL<-(PriceScale*손절2) then SetStopEndofday();//1포인트이상손실진입금지매매종료
If dayPL<-(PriceScale*손절2) Then { ExitShort();
ExitLong();}
위대로라면 진입후 손절을 7틱으로 했으므로 수수료들포함해서 손실이 0.41이어야하는데 왜 첨부처럼 9월16일에-1.11까지 손실나는지요 고저차때문인가요? 바로잡아주시면 감사하겠습니다
그리고 하루손실이 15틱이면 청산하게해주세요 ,나름대로했는데 15틱이넘어서 청산하네요
부탁드립니다............
- 1. 손익.xls (0.21 MB)
답변 2
예스스탁 예스스탁 답변
2011-09-23 11:04:10
안녕하세요
예스스탁입니다.
1.
청산발생조건에 TCHAN - BCHAN > 고저차 * c/100 라는 조건이 있어
9월16일 12시46분봉 이전에 발생하지 못하다가
9월16일 12시46분봉에 신호가 발생한 것입니다.
if stime >= 090100 and TCHAN - BCHAN > 고저차 * c/100 then
위 조건이 진입과 청산을 모두 포함하므로
청산이 위 조건과 관계가 없으시면 해당 if문 밖으로
청산식을 분리하셔야 합니다.
input: 테마기간(3),채널기간(45),수평(7),이익(9),손절(7),고저차(0.75)
,전봉차(0.003),진입가(-2),Per1(0.05),X1(100),손절1(15),손절2(15);
VAR : TCHAN(0), BCHAN(0), aa(0), bb(0), highV(0), LowV(0);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
var:k(0),d(0);
k=StochasticsK(20,12);
d=StochasticsD(20,12,12);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for var1 = 1 to 10{
if sdate == EntryDate(var1) Then{
count = count+1;
PLR = PLR+PositionProfit(var1);
}
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
#당일누적손익계산 끝
TCHAN = HIGHEST(HIGH, 채널기간)[1];
BCHAN = LOWEST(LOW, 채널기간)[1];
var77 = (3 * Ema(c,테마기간)) - (3 * Ema(Ema(c,테마기간),테마기간)) + (Ema(Ema(Ema(c,테마기간),테마기간),테마기간));
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
Condition2= CountIF(Tchan==Tchan[1],7) == 7 ;
if stime >= 090100 and TCHAN - BCHAN > 고저차 * c/100 then {
#매수
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 >= var77[1]+전봉차 and Condition2==True && k<80 Then
aa = TCHAN + PriceScale*진입가;
buy("매수",atstop, aa);
}
highV = highest(H,BarsSinceEntry);
if MarketPosition == 1 or var77 < var77[1] Then
aa = 999999;
#매도
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 <= var77[1]-전봉차 and CountIF(Bchan==Bchan[1],수평) == 수평 && k>22 Then
bb = BCHAN - PriceScale*진입가;
sell("매도",atstop, bb);
}
LowV = Lowest(L,BarsSinceEntry);
if MarketPosition == -1 or var77 > var77[1] Then
bb = 0.000001;
}
if MarketPosition == 1 Then {
ExitLong("수익", atlimit, entryPrice+PriceScale*이익);
exitlong("bxxxxx",atstop,entryPrice-PriceScale*손절);
}
if MarketPosition == -1 Then {
ExitShort("도익", atlimit, entryPrice-PriceScale*이익);
exitshort("sxxxxx",atstop,entryPrice+PriceScale*손절);
}
//시간청산--------------------
var11 = int(date/100)-int(date/10000)*100; //월
var22 = date - int(date/100)*100; //일
var33 = DayOfWeek(date); //요일
if var11%3 == 0 and var22 >= 8 and var22 <= 14 and var33 == 4 then {
SetStopEndofday(144800); //만
}
else {
SetStopEndofday(150100); //평
}
If dayPL<-(PriceScale*손절2) then SetStopEndofday();//1포인트이상손실진입금지매매종료
If dayPL<-(PriceScale*손절2) Then { ExitShort();
ExitLong();}
2.
input: 테마기간(3),채널기간(45),수평(7),이익(9),손절(7),고저차(0.75)
,전봉차(0.003),진입가(-2),Per1(0.05),X1(100),손절1(15),손절2(15);
VAR : TCHAN(0), BCHAN(0), aa(0), bb(0), highV(0), LowV(0);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
var:k(0),d(0);
k=StochasticsK(20,12);
d=StochasticsD(20,12,12);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for var1 = 1 to 10{
if sdate == EntryDate(var1) Then{
count = count+1;
PLR = PLR+PositionProfit(var1);
}
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
#당일누적손익계산 끝
TCHAN = HIGHEST(HIGH, 채널기간)[1];
BCHAN = LOWEST(LOW, 채널기간)[1];
var77 = (3 * Ema(c,테마기간)) - (3 * Ema(Ema(c,테마기간),테마기간)) + (Ema(Ema(Ema(c,테마기간),테마기간),테마기간));
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
Condition2= CountIF(Tchan==Tchan[1],7) == 7 ;
if stime >= 090100 and TCHAN - BCHAN > 고저차 * c/100 then {
#매수
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 >= var77[1]+전봉차 and Condition2==True && k<80 Then
aa = TCHAN + PriceScale*진입가;
buy("매수",atstop, aa);
}
highV = highest(H,BarsSinceEntry);
if MarketPosition == 1 or var77 < var77[1] Then
aa = 999999;
#매도
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 <= var77[1]-전봉차 and CountIF(Bchan==Bchan[1],수평) == 수평 && k>22 Then
bb = BCHAN - PriceScale*진입가;
sell("매도",atstop, bb);
}
LowV = Lowest(L,BarsSinceEntry);
if MarketPosition == -1 or var77 > var77[1] Then
bb = 0.000001;
}
if MarketPosition == 1 Then {
ExitLong("수익", atlimit, entryPrice+PriceScale*이익);
exitlong("bxxxxx",atstop,entryPrice-PriceScale*손절);
}
if MarketPosition == -1 Then {
ExitShort("도익", atlimit, entryPrice-PriceScale*이익);
exitshort("sxxxxx",atstop,entryPrice+PriceScale*손절);
}
//시간청산--------------------
var11 = int(date/100)-int(date/10000)*100; //월
var22 = date - int(date/100)*100; //일
var33 = DayOfWeek(date); //요일
if var11%3 == 0 and var22 >= 8 and var22 <= 14 and var33 == 4 then {
SetStopEndofday(144800); //만
}
else {
SetStopEndofday(150100); //평
}
if MarketPosition == 1 Then
exitlong("bx",AtStop,EntryPrice+(-PriceScale*15-(PLR)));
if MarketPosition == -1 Then
ExitShort("sx",AtStop,EntryPrice+(PriceScale*15+(PLR)));
즐거운 하루되세요
> leekss1 님이 쓴 글입니다.
> 제목 : 이상합니다-------------------
> input: 테마기간(3),채널기간(45),수평(7),이익(9),손절(7),고저차(0.75)
,전봉차(0.003),진입가(-2),Per1(0.05),X1(100),손절1(15),손절2(15);
VAR : TCHAN(0), BCHAN(0), aa(0), bb(0), highV(0), LowV(0);
var : PLR(0),XCommission(0),XSlippage(0),OpenPL(0),dayPL(0),count(0);
var:k(0),d(0);
k=StochasticsK(20,12);
d=StochasticsD(20,12,12);
#당일누적손익계산 시작
XCommission = ((C*ExitCommission)/100)*CurrentContracts; #%설정
XSlippage = (ExitSlippage)*CurrentContracts; #Pt설정
PLR = 0;
count = 0;
for var1 = 1 to 10{
if sdate == EntryDate(var1) Then{
count = count+1;
PLR = PLR+PositionProfit(var1);
}
}
if MarketPosition() == 0 Then{
OpenPL = 0;
dayPL = PLR;
}
Else{
OpenPL = (PositionProfit-(XCommission+XSlippage));
dayPL = PLR+OpenPL;
}
#당일누적손익계산 끝
TCHAN = HIGHEST(HIGH, 채널기간)[1];
BCHAN = LOWEST(LOW, 채널기간)[1];
var77 = (3 * Ema(c,테마기간)) - (3 * Ema(Ema(c,테마기간),테마기간)) + (Ema(Ema(Ema(c,테마기간),테마기간),테마기간));
Condition1 = highest(h,x1) >= lowest(L,x1)*(1+(Per1/100));
Condition2= CountIF(Tchan==Tchan[1],7) == 7 ;
if stime >= 090100 and TCHAN - BCHAN > 고저차 * c/100 then {
#매수
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 >= var77[1]+전봉차 and Condition2==True && k<80 Then
aa = TCHAN + PriceScale*진입가;
buy("매수",atstop, aa);
}
highV = highest(H,BarsSinceEntry);
if MarketPosition == 1 Then {
ExitLong("수익", atlimit, entryPrice+PriceScale*이익);
exitlong("bxxxxx",atstop,entryPrice-PriceScale*손절);
}
if MarketPosition == 1 or var77 < var77[1] Then
aa = 999999;
#매도
if DayIndex>=7 &&
MarketPosition == 0 and stime < 150000 and Condition1 and dayPL > -(PriceScale*손절1) then {
if var77 <= var77[1]-전봉차 and CountIF(Bchan==Bchan[1],수평) == 수평 && k>22 Then
bb = BCHAN - PriceScale*진입가;
sell("매도",atstop, bb);
}
LowV = Lowest(L,BarsSinceEntry);
if MarketPosition == -1 Then {
ExitShort("도익", atlimit, entryPrice-PriceScale*이익);
exitshort("sxxxxx",atstop,entryPrice+PriceScale*손절);
}
if MarketPosition == -1 or var77 > var77[1] Then
bb = 0.000001;
}
//시간청산--------------------
var11 = int(date/100)-int(date/10000)*100; //월
var22 = date - int(date/100)*100; //일
var33 = DayOfWeek(date); //요일
if var11%3 == 0 and var22 >= 8 and var22 <= 14 and var33 == 4 then {
SetStopEndofday(144800); //만
}
else {
SetStopEndofday(150100); //평
}
If dayPL<-(PriceScale*손절2) then SetStopEndofday();//1포인트이상손실진입금지매매종료
If dayPL<-(PriceScale*손절2) Then { ExitShort();
ExitLong();}
위대로라면 진입후 손절을 7틱으로 했으므로 수수료들포함해서 손실이 0.41이어야하는데 왜 첨부처럼 9월16일에-1.11까지 손실나는지요 고저차때문인가요? 바로잡아주시면 감사하겠습니다
그리고 하루손실이 15틱이면 청산하게해주세요 ,나름대로했는데 15틱이넘어서 청산하네요
부탁드립니다............
회원
2012-02-23 09:44:48
관리자님에 의해 삭제된 답변입니다.
이전글