커뮤니티
시스템식수정부탁드림니다.
2011-08-07 12:38:33
844
글번호 41699
안녕하세요
현재의수식이 진입후 분명희 손실인데 이익으로 표시 되는 부분이 있어서 수정부탁드림니다.
선물3분봉 갯수 5000개 년 500p이익으로나오는데 상세하게보면 손실부분도 이익으로 표시가 되는군요 찾을방법이없네요 또한 SetStopEndofday 선정후 다시진입이되는데 이부분도 부탁드림니다.
Input : af(0.02), maxAF(0.2);
Var : value(0);
value = sar(af,maxAF);
Variables:Body(0),Highbody(0),Lowbody(0);
Body = Abs(C-L);
Highbody = Max(H,C);
Lowbody = Min(O,C);
if BarsSinceExit(0) > 1 then ##청산신호 후에 1봉이 경과 할때까지 재진입을 금지하라
//-----------------------------------------------------------------------------------------------------------------
If ((dayindex == 0 and C >= dayopen+0.4) or (dayindex > 0 and CrossUp(c,dayopen+0.4))) and marketposition==0 Then
{
Buy("b",AtLimit,C);
}
If ((dayindex == 0 and C <= dayopen-0.4) or (dayindex > 0 and CrossDown(c,dayopen+0.4))) and marketposition==0 Then
{
sell("s");
}
//-------------------------------------------------------------------------------
Input : Period(10),DNSim(30),UPSim(70),A(0),A1(0),A2(0);
var77 = Simrido(Period);
if ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and var77 <= DNSim and C > O Then
buy("b1");
if ((MarketPosition == 0) or (MarketPosition == -1 and C > 0)) and var77 >= UPSim and C < O Then
sell("s1");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[1] and Body[1] > Ma(Body,10)[1]*2 then
buy("b2",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[2] and Body[2] > Ma(Body,10)[2]*2 then
buy("b3",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[3] and Body[3] > Ma(Body,10)[3]*2 then
buy("b4",AtStop,O);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[7] and Body[7] > Ma(Body,10)[7]*2 then
buy("b6",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[9] and Body[9] > Ma(Body,10)[9]*2 then
buy("b7",AtStop,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C< value[7] and Body[7] > Ma(Body,10)[9]*2 then
buy("b9",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C< value[8] and Body[8] > Ma(Body,10)[10]*2 then
buy("b10",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C[5] < value[5] and Body[5] > Ma(Body,10)[10]*2 then
buy("b11",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C[7] < value[7] and Body[7] > Ma(Body,10)[10]*2 then
buy("b12",AtLimit,C);
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[1] > Ma(C,10)[2] and Body[1] < Ma(Body,10)[1]*2 Then
sell("s3");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C < value[8] and Body[8] > Ma(Body,10)[8]*2 then
Sell("s4");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C < value[4] and Body[4] > Ma(Body,10)[4]*2 then
Sell("s5",AtStop,H);
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[6] > Ma(C,10)[5] and Body[5] < Ma(Body,10)[5]*2 Then
sell("s6");
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[6] > Ma(C,10)[6] and Body[6] < Ma(body,10)[6]*2 Then
sell("s7");
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[7] > Ma(C,10)[7] and Body[7] > Ma(body,10)[7]*2 Then
sell("s8");
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[10] > Ma(C,10)[10] and Body[10] < Ma(Body,10)[10]*2 Then
sell("s9");
//------------------------------------------------------------------------------------------------------------------------------
Input : maPeriod(20), ROCPeriod(12), stoPeriod1(5), stoPeriod2(3), sPeriod(12), IPeriod(26),sigPeriod(9);
var78 = BW(maPeriod,ROCPeriod,stoPeriod1,stoPeriod2);
var79 = ema(var78,sPeriod)-ema(var78,IPeriod); ##MACD_Sig값을 하향돌파하면 매도식
var80 = ema(Var79,sigPeriod);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and CrossDown(C,var80) Then
Sell("s10");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and CrossDown(C,var79) Then
Sell("s12");
//--------------------------------------------------------------------------------------------------------------------
var81 = max(dayhigh(1),dayhigh(2));
var82 = min(DayLow(1),daylow(2));
var83 = (var81+var82)/2;
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and crossup(c,var83) Then
buy("bf1",AtLimit,L);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and CrossUp(var81,var82) Then
buy("b13",AtLimit,L);
if stime == 151500 Then{
if NextBarOpen > (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 And
C < (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 Then
buy("b14",AtLimit,L);
if NextBarOpen < (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 And
C > (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 Then
sell("s11");
}
//----------------------------------------------------------------------------------------------------------------------
If (stime > 120000 and stime < 140000) THEN {
input : P(10),Left(3),Right(3);
var41 = ma(C,P);
if SwingLow(1,var41,Left,Right,Left+Right+1) != -1 Then{
value43 = var41;
value44 = value41[1];
if value43 > value44 and value44 > 0 Then
buy("b15",AtLimit,L);
}
if SwingHigh(1,var41,Left,Right,Left+Right+1) != -1 Then{
value41 = var41;
value42 = value41[1];
if value41 < value42 and value42 > 0 Then
Buy("b19",AtLimit,L);
}
if SwingLow(1,var41,Left,Right,Left+Right+1) != -1 Then{
value43 = var41;
value44 = value41[1];
if value43[1] < value44[1] and value44[1] > 0 Then
buy("bd15",AtLimit,L);
}
if SwingHigh(1,var41,Left,Right,Left+Right+1) != -1 Then{
value41 = var41;
value42 = value41[1];
if value41 > value42[2] and value42[1] > 0 Then
Buy("bd19",AtLimit,L);
}
}
//---------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------
Input : Period30(12), Period31(5), Period32(5);
value91 = StochasticsK(Period30,Period31);
value92 = StochasticsD(Period30,Period31,Period32);
If CrossDown(value91, value92) Then {
var91 = C;#데드크로스시 발생시 초기값
var92 = var91[1]; # 직전 데드크로스 구간의 종가 중 최저가
}
#가장 최근 데드크로스 구간의 종가중 최저가 계산
if value91 < value92 Then{
if C < var91 Then
var91 = C;
}
if CrossUp(value91,value92) Then{
var93 = value91; #골든크로스시 value1값
var94 = var93[1];#직전골든크로스시 value1값
if var93 > var94 and var91 < var92 and C > entryPrice Then
buy("다이",AtLimit,C);
}
if IsEntryName("다이") Then{
if BarsSinceEntry == 10 and C < EntryPrice Then
Sell("상승형다",AtLimit,H);
}
If (stime > 90000 and stime < 150000) THEN {
if MarketPosition == 1 Then{
if Highest(C,BarsSinceEntry) >= EntryPrice+1 Then
buy("ssgg1",AtStop,Highest(C,BarsSinceEntry)-0.05);
}
if MarketPosition == -1 Then{
if Lowest(L[1],BarsSinceEntry) <= entryPrice-1 Then
Sell("bbgg1",AtStop,Lowest(L[1],BarsSinceEntry)+0.05);
}
}
//-------------------------------------------------------------------------------------
if ExitDate(1) == sdate and
MarketPosition == 0 And #현재 무포지션
MarketPosition(1) == 1 And #직전거래 매수포지션
crossup(C,ExitPrice(1)) Then #진전거래의 청산가격을 상향돌파하면 재매수
buy("rebuy");
if ExitDate(1) == sdate and
MarketPosition == 0 And #현재 무포지션
MarketPosition(1) == -1 And #직전거래 매도포지션
CrossDown(C,ExitPrice(1)) Then #직전거래의 청산가격을 상향돌파하면 재매도
sell("resell",AtLimit,H);
if MarketPosition == -1 and IsEntryName("resell") Then{
if BarsSinceEntry == 6 and C > EntryPrice Then
ExitShort("resell stop");
}
if MarketPosition == 1 and IsEntryName("rebuy") Then{
if BarsSinceEntry == 6 and C < EntryPrice Then
ExitShort("stop");
}
//---------------------이익실현-----------------------------------
If (stime >= 90000 and stime < 95000) THEN
SetStopTrailing(0.02,1,PointStop);
else If (stime > 94500 and stime < 115000) THEN
SetStopTrailing(0.02,0.5,PointStop);
else If (stime > 114000 and stime < 135000) THEN
SetStopTrailing(0.02,0.5,PointStop);
else If (stime > 120000 and stime < 142000) THEN
SetStopTrailing(0.02,0.32,PointStop);
else If (stime > 141000 and stime < 150000) THEN
SetStopTrailing(0.02,0.5,PointStop);
Else
SetStopTrailing(0,0,0);
SetStopProfittarget(1.0,PercentStop);
SetStopLoss(1,PercentStop);
SetStopEndofday(145900);
답변 1
예스스탁 예스스탁 답변
2011-08-08 14:34:46
안녕하세요
예스스탁입니다.
손실인데 이익으로 표시된다고 하시는 부분이
어디 부분인지 찾지를 못하겠습니다.
좀더 자세한 내용 부탁드립니다.
현재 식상에 알파벳 O가 숫자 0으로 적혀져 있는 부분이 많습니다.
(MarketPosition == 1 and C < 0) --> C < O로 변경하셔야 합니다.
즐거운 하루되세요
> 외국인 님이 쓴 글입니다.
> 제목 : 시스템식수정부탁드림니다.
> 안녕하세요
현재의수식이 진입후 분명희 손실인데 이익으로 표시 되는 부분이 있어서 수정부탁드림니다.
선물3분봉 갯수 5000개 년 500p이익으로나오는데 상세하게보면 손실부분도 이익으로 표시가 되는군요 찾을방법이없네요 또한 SetStopEndofday 선정후 다시진입이되는데 이부분도 부탁드림니다.
Input : af(0.02), maxAF(0.2);
Var : value(0);
value = sar(af,maxAF);
Variables:Body(0),Highbody(0),Lowbody(0);
Body = Abs(C-L);
Highbody = Max(H,C);
Lowbody = Min(O,C);
if BarsSinceExit(0) > 1 then ##청산신호 후에 1봉이 경과 할때까지 재진입을 금지하라
//-----------------------------------------------------------------------------------------------------------------
If ((dayindex == 0 and C >= dayopen+0.4) or (dayindex > 0 and CrossUp(c,dayopen+0.4))) and marketposition==0 Then
{
Buy("b",AtLimit,C);
}
If ((dayindex == 0 and C <= dayopen-0.4) or (dayindex > 0 and CrossDown(c,dayopen+0.4))) and marketposition==0 Then
{
sell("s");
}
//-------------------------------------------------------------------------------
Input : Period(10),DNSim(30),UPSim(70),A(0),A1(0),A2(0);
var77 = Simrido(Period);
if ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and var77 <= DNSim and C > O Then
buy("b1");
if ((MarketPosition == 0) or (MarketPosition == -1 and C > 0)) and var77 >= UPSim and C < O Then
sell("s1");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[1] and Body[1] > Ma(Body,10)[1]*2 then
buy("b2",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[2] and Body[2] > Ma(Body,10)[2]*2 then
buy("b3",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[3] and Body[3] > Ma(Body,10)[3]*2 then
buy("b4",AtStop,O);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[7] and Body[7] > Ma(Body,10)[7]*2 then
buy("b6",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C < value[9] and Body[9] > Ma(Body,10)[9]*2 then
buy("b7",AtStop,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C< value[7] and Body[7] > Ma(Body,10)[9]*2 then
buy("b9",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C< value[8] and Body[8] > Ma(Body,10)[10]*2 then
buy("b10",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C[5] < value[5] and Body[5] > Ma(Body,10)[10]*2 then
buy("b11",AtLimit,C);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and C[7] < value[7] and Body[7] > Ma(Body,10)[10]*2 then
buy("b12",AtLimit,C);
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[1] > Ma(C,10)[2] and Body[1] < Ma(Body,10)[1]*2 Then
sell("s3");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C < value[8] and Body[8] > Ma(Body,10)[8]*2 then
Sell("s4");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C < value[4] and Body[4] > Ma(Body,10)[4]*2 then
Sell("s5",AtStop,H);
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[6] > Ma(C,10)[5] and Body[5] < Ma(Body,10)[5]*2 Then
sell("s6");
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[6] > Ma(C,10)[6] and Body[6] < Ma(body,10)[6]*2 Then
sell("s7");
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[7] > Ma(C,10)[7] and Body[7] > Ma(body,10)[7]*2 Then
sell("s8");
If countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and C[10] > Ma(C,10)[10] and Body[10] < Ma(Body,10)[10]*2 Then
sell("s9");
//------------------------------------------------------------------------------------------------------------------------------
Input : maPeriod(20), ROCPeriod(12), stoPeriod1(5), stoPeriod2(3), sPeriod(12), IPeriod(26),sigPeriod(9);
var78 = BW(maPeriod,ROCPeriod,stoPeriod1,stoPeriod2);
var79 = ema(var78,sPeriod)-ema(var78,IPeriod); ##MACD_Sig값을 하향돌파하면 매도식
var80 = ema(Var79,sigPeriod);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and CrossDown(C,var80) Then
Sell("s10");
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == 1 and C < 0)) and CrossDown(C,var79) Then
Sell("s12");
//--------------------------------------------------------------------------------------------------------------------
var81 = max(dayhigh(1),dayhigh(2));
var82 = min(DayLow(1),daylow(2));
var83 = (var81+var82)/2;
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and crossup(c,var83) Then
buy("bf1",AtLimit,L);
if countif(MarketPosition!=0,1) == 0 and ((MarketPosition == 0) or (MarketPosition == -1 and C < 0)) and CrossUp(var81,var82) Then
buy("b13",AtLimit,L);
if stime == 151500 Then{
if NextBarOpen > (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 And
C < (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 Then
buy("b14",AtLimit,L);
if NextBarOpen < (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 And
C > (max(dayhigh,dayhigh(1))+min(daylow,daylow(1)))/2 Then
sell("s11");
}
//----------------------------------------------------------------------------------------------------------------------
If (stime > 120000 and stime < 140000) THEN {
input : P(10),Left(3),Right(3);
var41 = ma(C,P);
if SwingLow(1,var41,Left,Right,Left+Right+1) != -1 Then{
value43 = var41;
value44 = value41[1];
if value43 > value44 and value44 > 0 Then
buy("b15",AtLimit,L);
}
if SwingHigh(1,var41,Left,Right,Left+Right+1) != -1 Then{
value41 = var41;
value42 = value41[1];
if value41 < value42 and value42 > 0 Then
Buy("b19",AtLimit,L);
}
if SwingLow(1,var41,Left,Right,Left+Right+1) != -1 Then{
value43 = var41;
value44 = value41[1];
if value43[1] < value44[1] and value44[1] > 0 Then
buy("bd15",AtLimit,L);
}
if SwingHigh(1,var41,Left,Right,Left+Right+1) != -1 Then{
value41 = var41;
value42 = value41[1];
if value41 > value42[2] and value42[1] > 0 Then
Buy("bd19",AtLimit,L);
}
}
//---------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------
Input : Period30(12), Period31(5), Period32(5);
value91 = StochasticsK(Period30,Period31);
value92 = StochasticsD(Period30,Period31,Period32);
If CrossDown(value91, value92) Then {
var91 = C;#데드크로스시 발생시 초기값
var92 = var91[1]; # 직전 데드크로스 구간의 종가 중 최저가
}
#가장 최근 데드크로스 구간의 종가중 최저가 계산
if value91 < value92 Then{
if C < var91 Then
var91 = C;
}
if CrossUp(value91,value92) Then{
var93 = value91; #골든크로스시 value1값
var94 = var93[1];#직전골든크로스시 value1값
if var93 > var94 and var91 < var92 and C > entryPrice Then
buy("다이",AtLimit,C);
}
if IsEntryName("다이") Then{
if BarsSinceEntry == 10 and C < EntryPrice Then
Sell("상승형다",AtLimit,H);
}
If (stime > 90000 and stime < 150000) THEN {
if MarketPosition == 1 Then{
if Highest(C,BarsSinceEntry) >= EntryPrice+1 Then
buy("ssgg1",AtStop,Highest(C,BarsSinceEntry)-0.05);
}
if MarketPosition == -1 Then{
if Lowest(L[1],BarsSinceEntry) <= entryPrice-1 Then
Sell("bbgg1",AtStop,Lowest(L[1],BarsSinceEntry)+0.05);
}
}
//-------------------------------------------------------------------------------------
if ExitDate(1) == sdate and
MarketPosition == 0 And #현재 무포지션
MarketPosition(1) == 1 And #직전거래 매수포지션
crossup(C,ExitPrice(1)) Then #진전거래의 청산가격을 상향돌파하면 재매수
buy("rebuy");
if ExitDate(1) == sdate and
MarketPosition == 0 And #현재 무포지션
MarketPosition(1) == -1 And #직전거래 매도포지션
CrossDown(C,ExitPrice(1)) Then #직전거래의 청산가격을 상향돌파하면 재매도
sell("resell",AtLimit,H);
if MarketPosition == -1 and IsEntryName("resell") Then{
if BarsSinceEntry == 6 and C > EntryPrice Then
ExitShort("resell stop");
}
if MarketPosition == 1 and IsEntryName("rebuy") Then{
if BarsSinceEntry == 6 and C < EntryPrice Then
ExitShort("stop");
}
//---------------------이익실현-----------------------------------
If (stime >= 90000 and stime < 95000) THEN
SetStopTrailing(0.02,1,PointStop);
else If (stime > 94500 and stime < 115000) THEN
SetStopTrailing(0.02,0.5,PointStop);
else If (stime > 114000 and stime < 135000) THEN
SetStopTrailing(0.02,0.5,PointStop);
else If (stime > 120000 and stime < 142000) THEN
SetStopTrailing(0.02,0.32,PointStop);
else If (stime > 141000 and stime < 150000) THEN
SetStopTrailing(0.02,0.5,PointStop);
Else
SetStopTrailing(0,0,0);
SetStopProfittarget(1.0,PercentStop);
SetStopLoss(1,PercentStop);
SetStopEndofday(145900);
다음글
이전글