커뮤니티

행복; 수식 작성 바랍니다

프로필 이미지
행복한가방
2012-08-16 01:22:35
360
글번호 53791
답변완료
한국의 금융산업 발전을 위해 불철주야 애쓰시는 귀하의 노고를 높이 평가합니다 < 아래 1 >은 시스템식 입니다 ========================< 아래 1 >======================================= < 시스템식 내용 > // MarketPosition == 0 인 상태에서 첫번째 주가 데드크로스(1x300)가 발생 후 // 즉, 종가가 300일 이평선을 하향돌파한 후 두번째 발생하는 거래량 골든크로스 // (5x20)가 생기면 다음날 AtMarket으로 천만원어치씩 10회 나누어서 분할매수하고 // 손익한도청산에 의해 5회에 나누어 매도하는 시스템식 입니다 < 시스템식 > input : 투입금액(10000000); var : entry(0),exit1(0),exit2(0),exit3(0); var : AE1(0),AE2(0),X1(0),X2(0),X3(0),Xi1(0),Xi2(0),Xi3(0); if CodeCategory == 1 Then #코스피 { if BasePrice < 50000 Then entry = int(int(투입금액/C)/10)*10; Else entry = int(투입금액/C); } if CodeCategory == 2 or CodeCategory == 8 Then #코스닥,etf entry = int(투입금액/C); var1 = ma(c,300); var2 = ma(V,5); var3 = ma(V,20); if MarketPosition == 1 Then { condition3 = false; value1 =0; } if MarketPosition == 0 Then { value2 = 0; value3 = 0; condition1 = false; condition2 = false; if CrossDown(c,var1) Then { condition3 = true; If condition3 == True and condition3[1] == False Then value1 = 0 ; } if condition3 == true and crossup(var2,var3) Then { value1 = value1+1; if value1 == 2 Then buy("b1",AtMarket,def,entry); } } if MarketPosition == 1 Then { if CurrentEntries < 10 and BarsSinceEntry < 10 and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then buy("b11",AtMarket,def,entry); } if MarketPosition == 0 Then { X1 = 0; X2 = 0; X3 = 0; } if MarketPosition == 1 Then { if CurrentContracts == MaxContracts then { if CodeCategory == 1 Then #코스피 { if BasePrice < 50000 Then { exit1 = int(int(CurrentContracts*(1/5))/10)*10; exit2 = int(int(CurrentContracts*(1/7))/10)*10; exit3 = int(int(CurrentContracts*(1/9))/10)*10; } Else { exit1 = int(CurrentContracts*(1/5)); exit2 = int(CurrentContracts*(1/7)); exit3 = int(CurrentContracts*(1/9)); } } if CodeCategory == 2 or CodeCategory == 8 Then #코스닥,etf { exit1 = int(CurrentContracts*(1/5)); exit2 = int(CurrentContracts*(1/7)); exit3 = int(CurrentContracts*(1/9)); } } if MaxEntries == 10 and MaxEntries > MaxEntries[1] Then Xi1 = index; if MaxEntries == 10 and index > Xi1 and condition1 == False Then { if C <= AvgEntryPrice*0.76 Then X1 = 1; if C >= AvgEntryPrice*2.0 Then X1 = 2; if highest(C,index-Xi1) >= AvgEntryPrice*1.12 and C < AvgEntryPrice*1.05 Then X1 = 3; if highest(C,index-Xi1) >= AvgEntryPrice*1.23 and C < AvgEntryPrice*1.14 Then X1 = 4; if BarsSinceEntry > 10 and highest(C,index-Xi1) > AvgEntryPrice*1.34 and C <= highest(C,index -Xi1)*0.87 Then X1 = 5; if BarsSinceEntry > 10 and highest(C,index-Xi1) > AvgEntryPrice*1.45 and C <= highest(C,index-Xi1)-ATR(14)*5 Then X1 = 6; //=================================================================== If CurrentEntries == 10 and condition1 == False and X1 > 0 Then { condition1 == True ; } //=================================================================== if X1 > 0 and X1[1] == 0 Then ExitLong("bx1",AtMarket,def,"",exit1,1); if X1[1] > 0 and X1[2] == 0 Then ExitLong("bx2",AtMarket,def,"",exit1,1); if X1[2] > 0 and X1[3] == 0Then ExitLong("bx3",AtMarket,def,"",exit1,1); if X1[3] > 0 and X1[4] == 0 Then ExitLong("bx4",AtMarket,def,"",exit1,1); if X1[4] > 0 and X1[5] == 0 Then ExitLong("bx5",AtMarket); } } ====================================================================== < 아래 2 >는 상기의 시스템식에 맞추어 손익한도청산의 지표식을 작성한 것입니다 ========================< 아래 2 >======================================= < 지표식 내용 > // 이 지표식은 시스템식에 맞추어 작성한 것입니다. 지표가 그려지는 구간은 // 분할매수가 완료되는 날부터 분할매도가 시작되는 날의 20일 후까지 입니다 // 지표식이 작성해 보았는데 잘못되었습니다. 잘못된 곳을 바로잡아 주시기 바랍니다 // 일봉으로 삼성물산에 적용한 결과 여러 곳에서 에러가 나옵니다 // // 에러1) 그려져야 하는데 안그려진 구간 // 1994.09.16~1994.11.19 // 1996.06.22~1996.09.11 // // 에러2) 구간이 변경되어 그려져야 하는 에러 // 2002.09.02~2002.11.01 이 2002.08.26~2002.10.08 에 그려져야 함 // 2010.09.06~2011.03.03 이 2010.06.14~2011.03.03 에 그려져야 함 // 2011.10.19~2011.12.07 이 2011.10.10~2011.12.07 에 그려져야 함 // 2012.05.18~2012.08.14 이 2012.05.10~2012.08.14 에 그려져야 함 // // 에러3) 안그려져야 하는데 그려진 구간 // 1995.12.19~1996.07.15 // 2001.10.30~2002.01.16 // < 지표식 > input : 투자금액(10000000) ; var : entry(0), AA(0), HH(0) ; if CodeCategory == 1 Then #코스피 { if BasePrice < 50000 Then entry = int(int(투자금액/C[1])/10)*10; Else entry = int(투자금액/C[1]); } if CodeCategory == 2 or CodeCategory == 8 Then #코스닥, etf entry = int(투자금액/C[1]); var1 = ma(c,1); var2 = ma(c,300); var3 = ma(v,5); var4 = ma(v,20); if /*condition19 == False and*/ CrossDown(var1,var2) Then { value1 = 0; } if crossup(var3,var4) Then { value1 = value1+1; } if condition19 == False and value1[10] == 2 and value1[10+1] == 1 Then { Condition19 = true; Condition18 = false; Condition11 = false; Condition12 = false; Condition13 = false; Condition14 = false; AA = accumn( O * entry, 10 ) / accumn( entry, 10 ); HH = C; } if C > HH Then HH = C; if condition11 == false and C > AA*(1+12/100) Then condition11 = true; if condition12 == false and C > AA*(1+23/100) Then condition12 = true; if condition13 == false and C > AA*(1+34/100) Then condition13 = true; if condition14 == false and C > AA*(1+45/100) Then condition14 = true; if condition19 == true and condition18 == false then { if CrossDown(c,AA*(1-24/100)) or Crossup(c,AA*(1+100/100)) or (Condition11 == true and CrossDown(C,AA*(1+5/100))) or (Condition12 == true and CrossDown(C,AA*(1+14/100))) or (Condition13 == true and CrossDown(C,HH*(1-13/100))) or (Condition14 == true and CrossDown(C,HH-ATR(14)*5)) Then { value18 = index; condition18 = true; } } if condition19 == true and condition18 == true and index == value18+20 Then condition19 = false; if condition19 == true Then { plot1(AA,"AA", BLUE); plot2(AA*(1-24/100),"BB", BLACK); plot3(AA*(1+100/100),"CC", RGB(255,0,128)); if condition11 == true Then plot4(AA*(1+5/100),"DD", RED ); if condition12 == true Then plot5(AA*(1+14/100),"EE", GREEN ); if condition13 == true Then plot6(HH*(1-13/100),"FF", RED); if condition14 == true Then plot7(HH-ATR(14)*5,"GG", BLUE ); plot8(HH,"HH", MAGENTA); } ========================================================================== 상기의 에러가 나오지 않도록 바로잡아 주시기 바랍니다 항상 수고 많으십니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2012-08-16 11:44:18

안녕하세요 예스스탁입니다. 해당 시스템안에 값의 초기화 등이 포지션관련된 함수와 결부가 되어 있어 지표식을 더이상 수정해 드리기 어렵습니다. 도움을 드리지 못해 죄송합니다. 즐거운 하루되세요 > 행복한가방 님이 쓴 글입니다. > 제목 : 행복; 수식 작성 바랍니다 > 한국의 금융산업 발전을 위해 불철주야 애쓰시는 귀하의 노고를 높이 평가합니다 < 아래 1 >은 시스템식 입니다 ========================< 아래 1 >======================================= < 시스템식 내용 > // MarketPosition == 0 인 상태에서 첫번째 주가 데드크로스(1x300)가 발생 후 // 즉, 종가가 300일 이평선을 하향돌파한 후 두번째 발생하는 거래량 골든크로스 // (5x20)가 생기면 다음날 AtMarket으로 천만원어치씩 10회 나누어서 분할매수하고 // 손익한도청산에 의해 5회에 나누어 매도하는 시스템식 입니다 < 시스템식 > input : 투입금액(10000000); var : entry(0),exit1(0),exit2(0),exit3(0); var : AE1(0),AE2(0),X1(0),X2(0),X3(0),Xi1(0),Xi2(0),Xi3(0); if CodeCategory == 1 Then #코스피 { if BasePrice < 50000 Then entry = int(int(투입금액/C)/10)*10; Else entry = int(투입금액/C); } if CodeCategory == 2 or CodeCategory == 8 Then #코스닥,etf entry = int(투입금액/C); var1 = ma(c,300); var2 = ma(V,5); var3 = ma(V,20); if MarketPosition == 1 Then { condition3 = false; value1 =0; } if MarketPosition == 0 Then { value2 = 0; value3 = 0; condition1 = false; condition2 = false; if CrossDown(c,var1) Then { condition3 = true; If condition3 == True and condition3[1] == False Then value1 = 0 ; } if condition3 == true and crossup(var2,var3) Then { value1 = value1+1; if value1 == 2 Then buy("b1",AtMarket,def,entry); } } if MarketPosition == 1 Then { if CurrentEntries < 10 and BarsSinceEntry < 10 and countif(CurrentContracts < CurrentContracts[1],BarsSinceEntry) < 1 Then buy("b11",AtMarket,def,entry); } if MarketPosition == 0 Then { X1 = 0; X2 = 0; X3 = 0; } if MarketPosition == 1 Then { if CurrentContracts == MaxContracts then { if CodeCategory == 1 Then #코스피 { if BasePrice < 50000 Then { exit1 = int(int(CurrentContracts*(1/5))/10)*10; exit2 = int(int(CurrentContracts*(1/7))/10)*10; exit3 = int(int(CurrentContracts*(1/9))/10)*10; } Else { exit1 = int(CurrentContracts*(1/5)); exit2 = int(CurrentContracts*(1/7)); exit3 = int(CurrentContracts*(1/9)); } } if CodeCategory == 2 or CodeCategory == 8 Then #코스닥,etf { exit1 = int(CurrentContracts*(1/5)); exit2 = int(CurrentContracts*(1/7)); exit3 = int(CurrentContracts*(1/9)); } } if MaxEntries == 10 and MaxEntries > MaxEntries[1] Then Xi1 = index; if MaxEntries == 10 and index > Xi1 and condition1 == False Then { if C <= AvgEntryPrice*0.76 Then X1 = 1; if C >= AvgEntryPrice*2.0 Then X1 = 2; if highest(C,index-Xi1) >= AvgEntryPrice*1.12 and C < AvgEntryPrice*1.05 Then X1 = 3; if highest(C,index-Xi1) >= AvgEntryPrice*1.23 and C < AvgEntryPrice*1.14 Then X1 = 4; if BarsSinceEntry > 10 and highest(C,index-Xi1) > AvgEntryPrice*1.34 and C <= highest(C,index -Xi1)*0.87 Then X1 = 5; if BarsSinceEntry > 10 and highest(C,index-Xi1) > AvgEntryPrice*1.45 and C <= highest(C,index-Xi1)-ATR(14)*5 Then X1 = 6; //=================================================================== If CurrentEntries == 10 and condition1 == False and X1 > 0 Then { condition1 == True ; } //=================================================================== if X1 > 0 and X1[1] == 0 Then ExitLong("bx1",AtMarket,def,"",exit1,1); if X1[1] > 0 and X1[2] == 0 Then ExitLong("bx2",AtMarket,def,"",exit1,1); if X1[2] > 0 and X1[3] == 0Then ExitLong("bx3",AtMarket,def,"",exit1,1); if X1[3] > 0 and X1[4] == 0 Then ExitLong("bx4",AtMarket,def,"",exit1,1); if X1[4] > 0 and X1[5] == 0 Then ExitLong("bx5",AtMarket); } } ====================================================================== < 아래 2 >는 상기의 시스템식에 맞추어 손익한도청산의 지표식을 작성한 것입니다 ========================< 아래 2 >======================================= < 지표식 내용 > // 이 지표식은 시스템식에 맞추어 작성한 것입니다. 지표가 그려지는 구간은 // 분할매수가 완료되는 날부터 분할매도가 시작되는 날의 20일 후까지 입니다 // 지표식이 작성해 보았는데 잘못되었습니다. 잘못된 곳을 바로잡아 주시기 바랍니다 // 일봉으로 삼성물산에 적용한 결과 여러 곳에서 에러가 나옵니다 // // 에러1) 그려져야 하는데 안그려진 구간 // 1994.09.16~1994.11.19 // 1996.06.22~1996.09.11 // // 에러2) 구간이 변경되어 그려져야 하는 에러 // 2002.09.02~2002.11.01 이 2002.08.26~2002.10.08 에 그려져야 함 // 2010.09.06~2011.03.03 이 2010.06.14~2011.03.03 에 그려져야 함 // 2011.10.19~2011.12.07 이 2011.10.10~2011.12.07 에 그려져야 함 // 2012.05.18~2012.08.14 이 2012.05.10~2012.08.14 에 그려져야 함 // // 에러3) 안그려져야 하는데 그려진 구간 // 1995.12.19~1996.07.15 // 2001.10.30~2002.01.16 // < 지표식 > input : 투자금액(10000000) ; var : entry(0), AA(0), HH(0) ; if CodeCategory == 1 Then #코스피 { if BasePrice < 50000 Then entry = int(int(투자금액/C[1])/10)*10; Else entry = int(투자금액/C[1]); } if CodeCategory == 2 or CodeCategory == 8 Then #코스닥, etf entry = int(투자금액/C[1]); var1 = ma(c,1); var2 = ma(c,300); var3 = ma(v,5); var4 = ma(v,20); if /*condition19 == False and*/ CrossDown(var1,var2) Then { value1 = 0; } if crossup(var3,var4) Then { value1 = value1+1; } if condition19 == False and value1[10] == 2 and value1[10+1] == 1 Then { Condition19 = true; Condition18 = false; Condition11 = false; Condition12 = false; Condition13 = false; Condition14 = false; AA = accumn( O * entry, 10 ) / accumn( entry, 10 ); HH = C; } if C > HH Then HH = C; if condition11 == false and C > AA*(1+12/100) Then condition11 = true; if condition12 == false and C > AA*(1+23/100) Then condition12 = true; if condition13 == false and C > AA*(1+34/100) Then condition13 = true; if condition14 == false and C > AA*(1+45/100) Then condition14 = true; if condition19 == true and condition18 == false then { if CrossDown(c,AA*(1-24/100)) or Crossup(c,AA*(1+100/100)) or (Condition11 == true and CrossDown(C,AA*(1+5/100))) or (Condition12 == true and CrossDown(C,AA*(1+14/100))) or (Condition13 == true and CrossDown(C,HH*(1-13/100))) or (Condition14 == true and CrossDown(C,HH-ATR(14)*5)) Then { value18 = index; condition18 = true; } } if condition19 == true and condition18 == true and index == value18+20 Then condition19 = false; if condition19 == true Then { plot1(AA,"AA", BLUE); plot2(AA*(1-24/100),"BB", BLACK); plot3(AA*(1+100/100),"CC", RGB(255,0,128)); if condition11 == true Then plot4(AA*(1+5/100),"DD", RED ); if condition12 == true Then plot5(AA*(1+14/100),"EE", GREEN ); if condition13 == true Then plot6(HH*(1-13/100),"FF", RED); if condition14 == true Then plot7(HH-ATR(14)*5,"GG", BLUE ); plot8(HH,"HH", MAGENTA); } ========================================================================== 상기의 에러가 나오지 않도록 바로잡아 주시기 바랍니다 항상 수고 많으십니다