커뮤니티

시스템식

프로필 이미지
외국인
2011-06-23 16:29:19
743
글번호 40070
답변완료
안녕하세요 최초진입후 다음신호시 청산만되고 진입이안되고요 이익청산후는 진입이되는데 식과식사이에 진입신호시 청산만 되고있으며 이익청산후 신호발생후 다음신호면 청산과동시에진입식부탁드립니다. 현재의방법으론 청산만됩니다. input : value1(0.5), value2(0.5); var : cnt(0), bpos(0), bval(0), spos(0), sval(0); var : bpos2(0), bval2(0), spos2(0), sval2(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; If (stime >= 90000 and stime < 91500) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) THEN { input : value1(0.5), value2(0.5); var : cnt(0), bpos(0), bval(0), spos(0), sval(0); var : bpos2(0), bval2(0), spos2(0), sval2(0); //최초 진입이 매수일 경우 if date != date[1] then { cnt = 0; bpos = 0; spos = 0; } if dayindex > 0 then{ if cnt==0 and C > H[1]+value1 then { buy("B최초진입"); bpos = 1; bVal = C; cnt = 1; } if bpos == 1 and crossdown(C,bval-value2) then { sell("B재진입1"); sVal = C; spos = 1; bpos = 0; } if spos == 1 and crossup(C, sval+value2) then { sell("B재진입2"); bval = C; spos = 0; bpos = 1; } } //최초 진입이 매도일 경우 if date != date[1] then { bpos2 = 0; spos2 = 0; } if dayindex > 0 then{ if cnt==0 and C > L[1]-value1 then { buy("S최초진입"); spos2 = 1; sVal2 = C; cnt = 1; } if spos2 == 1 and crossup(C,sval2+value2) then { buy("S재진입1"); bVal2 = C; bpos2 = 1; spos2 = 0; } if bpos2 == 1 and crossdown(C, bval2-value2) then { buy("S재진입2"); sval2 = C; bpos2= 0; spos2 = 1; } } If (stime > 91000 and stime < 113000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; if BarsSinceExit(1) > 1 then { ##청산신호 후에 1봉이 경과 할때까지 재진입을 금지하라 if stime>=090100 and Stime< 150300 and marketposition==0 then if C > H[1] and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) and MarketPosition == 0 Then buy("매수"); if MarketPosition == 1 Then sell("반대매도",AtStop,L[BarsSinceEntry]-0.5-PriceScale); ##진입봉의 고가는 H[BarsSinceEntry] if MarketPosition == -1 Then buy("SB",AtStop,H[BarsSinceEntry]+PriceScale); ##매도진입후 매도진입봉의 고가+1틱이상의 시세가 발생하면 매도로 전환 ##진입봉의 저가는 L[BarsSinceEntry] if MarketPosition == 1 Then sell("BS",AtStop,L[BarsSinceEntry]-PriceScale); ##매수진입후 매수진입봉의 저가-1틱 이하의 시세가 발생하면 매수로 전환 if C < L[1] and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then sell("매도"); if MarketPosition == -1 Then buy("반대매수",AtStop,H[BarsSinceEntry]+0.7+PriceScale); } } If (stime > 110000 and stime < 140000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Inputs: PercentRLen(10), OverSold(10), OverBought(90), Trigger(62); Variables: PcntR(0), AvgValue(0), Setup1(False), Setup2(False); PcntR = PercentR(PercentRLen); AvgValue = MA(Close, PercentRLen); If PcntR < OverSold Then Setup1 = True; If PcntR > OverBought Then Setup1 = False; If PcntR > OverBought Then Setup2 = True; If PcntR < OverSold Then Setup2 = False; If Setup1 AND AvgValue > AvgValue[1] AND Crossup(PcntR,Trigger) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then Begin{ Setup1 = False; Buy ("11시이후매수"); } End; If Setup2 AND AvgValue < AvgValue[1] AND CrossDown(PcntR, Trigger) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then Begin{ Setup2 = False; } End; If (stime >= 100000 and stime < 145000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Inputs: Length1(5),Length2(3),Length3(3),OverSold11(30),OverBought11(70); Variables: KLine(0), DLine(0); Var : value(0); KLine = StochasticsK(Length1,Length2); DLine = StochasticsD(Length1,Length2,Length3); If MarketPosition == 0 and Crossup(KLine[5], DLine[5]) AND KLine[5] < OverSold11 AND DLine[5] < OverSold11 and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then ##스토매수 신호을 3개봉뒤에 신호나옴 buy("스토매수",AtStop,value); If (stime >= 100000 and stime < 135000) THEN { If MarketPosition == 0 and CrossDown(KLine, DLine) AND KLine > OverBought11 AND DLine < OverBought11 and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then sell ("스토매도",AtStop,value); } } } If (stime >= 90000 and stime < 150000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Input : Period(12), Period1(5), Period2(5); value1 = StochasticsK(Period,Period1); value2 = StochasticsD(Period,Period1,Period2); If CrossDown(value1, value2) Then { var1 = C;#데드크로스시 발생시 초기값 var2 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value1[1] < value2[1] Then{ if C < var1 Then var1 = L; } if CrossUp(value1,value2) Then{ var3 = value1; #골든크로스시 value1값 var4 = var3[1];#직전골든크로스시 value1값 if MarketPosition == 0 and var3 > var4 and var1 < var2 and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then buy("골든크로스시",atmarket); } } If (stime >= 130000 and stime < 150000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; if MarketPosition == 0 and min(c,O) > ma(c,3) and min(C,H) > ma(c,20) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then buy("이평매수"); } If (stime >= 110000 and stime < 150000) THEN { if MarketPosition == 0 and max(c,O) < ma(c,5) and max(C,H) > ma(c,20) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then sell("이평매도"); } If (stime >= 100000 and stime < 150000) THEN { var : slowK1(0), slowD1(0), slowK2(0), slowD2(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; slowK1 = stochasticsK(12,5); slowD1 = stochasticsD(20,12,12); slowK2 = stochasticsK(12,5); slowD2 = stochasticsD(12,5,5); if BarsSinceExit(1) > 3 then { ##청산신호 후에 1봉이 경과 할때까지 재진입을 금지하라 if stime>=100000 and Stime< 150300 and marketposition==0 then if MarketPosition == 0 and slowK1 > slowD1 and crossup(slowK2,slowD2) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then buy("스토12"); //if CrossDown(slowK2,slowD2) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then //ExitLong("청산매도"); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-06-24 09:41:38

안녕하세요 예스스탁입니다. 현재 식이 문법상 오류가 너무 많습니다. 또한 하나의 식인지 여러개의 식인지도 불분명합니다. 하나의 식으로 보고 문법 수정해 드립니다. 선언문들은 if문으로 감싸시면 의도하는 부분과 다르게 동작될 수 있습니다. var : cnt(0), bpos(0), bval(0), spos(0), sval(0); var : bpos2(0), bval2(0), spos2(0), sval2(0); Input : PercentRLen(10), OverSold(10), OverBought(90), Trigger(62); Var : PcntR(0), AvgValue(0), Setup1(False), Setup2(False); Input: Length1(5),Length2(3),Length3(3),OverSold11(30),OverBought11(70); Var : KLine(0), DLine(0), value(0); KLine = StochasticsK(Length1,Length2); DLine = StochasticsD(Length1,Length2,Length3); PcntR = PercentR(PercentRLen); AvgValue = MA(Close, PercentRLen); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If (stime >= 90000 and stime < 91500) and Condition2 == true THEN { //최초 진입이 매수일 경우 if date != date[1] then { cnt = 0; bpos = 0; spos = 0; } if dayindex > 0 then{ if cnt==0 and C > H[1]+value1 then { buy("B최초진입"); bpos = 1; bVal = C; cnt = 1; } if bpos == 1 and crossdown(C,bval-value2) then { sell("B재진입1"); sVal = C; spos = 1; bpos = 0; } if spos == 1 and crossup(C, sval+value2) then { sell("B재진입2"); bval = C; spos = 0; bpos = 1; } } //최초 진입이 매도일 경우 if date != date[1] then { bpos2 = 0; spos2 = 0; } if dayindex > 0 then{ if cnt==0 and C > L[1]-value1 then { buy("S최초진입"); spos2 = 1; sVal2 = C; cnt = 1; } if spos2 == 1 and crossup(C,sval2+value2) then { buy("S재진입1"); bVal2 = C; bpos2 = 1; spos2 = 0; } if bpos2 == 1 and crossdown(C, bval2-value2) then { buy("S재진입2"); sval2 = C; bpos2= 0; spos2 = 1; } } If (stime > 91000 and stime < 113000 and Condition2 == true ) THEN { if C > H[1] Then buy("매수"); if MarketPosition == 1 Then sell("반대매도",AtStop,L[BarsSinceEntry]-0.5-PriceScale); if C < L[1] Then sell("매도"); if MarketPosition == -1 Then buy("반대매수",AtStop,H[BarsSinceEntry]+0.7+PriceScale); } If (stime > 110000 and stime < 140000) THEN { If PcntR < OverSold Then Setup1 = True; If PcntR > OverBought Then Setup1 = False; If PcntR > OverBought Then Setup2 = True; If PcntR < OverSold Then Setup2 = False; If Setup1 AND AvgValue > AvgValue[1] AND Crossup(PcntR,Trigger) and Condition2 == true Then { Setup1 = False; Buy ("11시이후매수"); } } If Setup2 AND AvgValue < AvgValue[1] AND CrossDown(PcntR, Trigger) and Condition2 == true Then { Setup2 = False; } If stime >= 100000 and stime < 145000 and Condition2 == true THEN { If Crossup(KLine[5], DLine[5]) AND KLine[5] < OverSold11 AND DLine[5] < OverSold11 Then buy("스토매수",AtStop,value); If CrossDown(KLine, DLine) AND KLine > OverBought11 AND DLine < OverBought11 Then sell ("스토매도",AtStop,value); } } Input : Period(12), Period1(5), Period2(5); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); value1 = StochasticsK(Period,Period1); value2 = StochasticsD(Period,Period1,Period2); If (stime >= 90000 and stime < 150000) THEN { If CrossDown(value1, value2) Then { var1 = C;#데드크로스시 발생시 초기값 var2 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value1[1] < value2[1] Then{ if C < var1 Then var1 = L; } if CrossUp(value1,value2) Then{ var3 = value1; #골든크로스시 value1값 var4 = var3[1];#직전골든크로스시 value1값 if var3 > var4 and var1 < var2 and Condition2 == true Then buy("골든크로스시",atmarket); } } If (stime >= 130000 and stime < 150000) and Condition2 == true THEN { if min(c,O) > ma(c,3) and min(C,H) > ma(c,20) Then buy("이평매수"); if MarketPosition == 0 and max(c,O) < ma(c,5) and max(C,H) > ma(c,20) Then sell("이평매도"); } var : slowK1(0), slowD1(0), slowK2(0), slowD2(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); slowK1 = stochasticsK(12,5); slowD1 = stochasticsD(20,12,12); slowK2 = stochasticsK(12,5); slowD2 = stochasticsD(12,5,5); If (stime >= 100000 and stime < 150000) and Condition2 == true THEN { if slowK1 > slowD1 and crossup(slowK2,slowD2) Then buy("스토12"); //if CrossDown(slowK2,slowD2) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then //ExitLong("청산매도"); } 즐거운 하루되세요 > 외국인 님이 쓴 글입니다. > 제목 : 시스템식 > 안녕하세요 최초진입후 다음신호시 청산만되고 진입이안되고요 이익청산후는 진입이되는데 식과식사이에 진입신호시 청산만 되고있으며 이익청산후 신호발생후 다음신호면 청산과동시에진입식부탁드립니다. 현재의방법으론 청산만됩니다. input : value1(0.5), value2(0.5); var : cnt(0), bpos(0), bval(0), spos(0), sval(0); var : bpos2(0), bval2(0), spos2(0), sval2(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; If (stime >= 90000 and stime < 91500) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) THEN { input : value1(0.5), value2(0.5); var : cnt(0), bpos(0), bval(0), spos(0), sval(0); var : bpos2(0), bval2(0), spos2(0), sval2(0); //최초 진입이 매수일 경우 if date != date[1] then { cnt = 0; bpos = 0; spos = 0; } if dayindex > 0 then{ if cnt==0 and C > H[1]+value1 then { buy("B최초진입"); bpos = 1; bVal = C; cnt = 1; } if bpos == 1 and crossdown(C,bval-value2) then { sell("B재진입1"); sVal = C; spos = 1; bpos = 0; } if spos == 1 and crossup(C, sval+value2) then { sell("B재진입2"); bval = C; spos = 0; bpos = 1; } } //최초 진입이 매도일 경우 if date != date[1] then { bpos2 = 0; spos2 = 0; } if dayindex > 0 then{ if cnt==0 and C > L[1]-value1 then { buy("S최초진입"); spos2 = 1; sVal2 = C; cnt = 1; } if spos2 == 1 and crossup(C,sval2+value2) then { buy("S재진입1"); bVal2 = C; bpos2 = 1; spos2 = 0; } if bpos2 == 1 and crossdown(C, bval2-value2) then { buy("S재진입2"); sval2 = C; bpos2= 0; spos2 = 1; } } If (stime > 91000 and stime < 113000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; if BarsSinceExit(1) > 1 then { ##청산신호 후에 1봉이 경과 할때까지 재진입을 금지하라 if stime>=090100 and Stime< 150300 and marketposition==0 then if C > H[1] and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) and MarketPosition == 0 Then buy("매수"); if MarketPosition == 1 Then sell("반대매도",AtStop,L[BarsSinceEntry]-0.5-PriceScale); ##진입봉의 고가는 H[BarsSinceEntry] if MarketPosition == -1 Then buy("SB",AtStop,H[BarsSinceEntry]+PriceScale); ##매도진입후 매도진입봉의 고가+1틱이상의 시세가 발생하면 매도로 전환 ##진입봉의 저가는 L[BarsSinceEntry] if MarketPosition == 1 Then sell("BS",AtStop,L[BarsSinceEntry]-PriceScale); ##매수진입후 매수진입봉의 저가-1틱 이하의 시세가 발생하면 매수로 전환 if C < L[1] and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then sell("매도"); if MarketPosition == -1 Then buy("반대매수",AtStop,H[BarsSinceEntry]+0.7+PriceScale); } } If (stime > 110000 and stime < 140000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Inputs: PercentRLen(10), OverSold(10), OverBought(90), Trigger(62); Variables: PcntR(0), AvgValue(0), Setup1(False), Setup2(False); PcntR = PercentR(PercentRLen); AvgValue = MA(Close, PercentRLen); If PcntR < OverSold Then Setup1 = True; If PcntR > OverBought Then Setup1 = False; If PcntR > OverBought Then Setup2 = True; If PcntR < OverSold Then Setup2 = False; If Setup1 AND AvgValue > AvgValue[1] AND Crossup(PcntR,Trigger) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then Begin{ Setup1 = False; Buy ("11시이후매수"); } End; If Setup2 AND AvgValue < AvgValue[1] AND CrossDown(PcntR, Trigger) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then Begin{ Setup2 = False; } End; If (stime >= 100000 and stime < 145000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Inputs: Length1(5),Length2(3),Length3(3),OverSold11(30),OverBought11(70); Variables: KLine(0), DLine(0); Var : value(0); KLine = StochasticsK(Length1,Length2); DLine = StochasticsD(Length1,Length2,Length3); If MarketPosition == 0 and Crossup(KLine[5], DLine[5]) AND KLine[5] < OverSold11 AND DLine[5] < OverSold11 and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then ##스토매수 신호을 3개봉뒤에 신호나옴 buy("스토매수",AtStop,value); If (stime >= 100000 and stime < 135000) THEN { If MarketPosition == 0 and CrossDown(KLine, DLine) AND KLine > OverBought11 AND DLine < OverBought11 and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then sell ("스토매도",AtStop,value); } } } If (stime >= 90000 and stime < 150000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Input : Period(12), Period1(5), Period2(5); value1 = StochasticsK(Period,Period1); value2 = StochasticsD(Period,Period1,Period2); If CrossDown(value1, value2) Then { var1 = C;#데드크로스시 발생시 초기값 var2 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value1[1] < value2[1] Then{ if C < var1 Then var1 = L; } if CrossUp(value1,value2) Then{ var3 = value1; #골든크로스시 value1값 var4 = var3[1];#직전골든크로스시 value1값 if MarketPosition == 0 and var3 > var4 and var1 < var2 and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then buy("골든크로스시",atmarket); } } If (stime >= 130000 and stime < 150000) THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; if MarketPosition == 0 and min(c,O) > ma(c,3) and min(C,H) > ma(c,20) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then buy("이평매수"); } If (stime >= 110000 and stime < 150000) THEN { if MarketPosition == 0 and max(c,O) < ma(c,5) and max(C,H) > ma(c,20) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then sell("이평매도"); } If (stime >= 100000 and stime < 150000) THEN { var : slowK1(0), slowD1(0), slowK2(0), slowD2(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; slowK1 = stochasticsK(12,5); slowD1 = stochasticsD(20,12,12); slowK2 = stochasticsK(12,5); slowD2 = stochasticsD(12,5,5); if BarsSinceExit(1) > 3 then { ##청산신호 후에 1봉이 경과 할때까지 재진입을 금지하라 if stime>=100000 and Stime< 150300 and marketposition==0 then if MarketPosition == 0 and slowK1 > slowD1 and crossup(slowK2,slowD2) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then buy("스토12"); //if CrossDown(slowK2,slowD2) and ((Condition1 == true and BarsSinceExit(1) >= 1) or Condition1 == false) Then //ExitLong("청산매도"); } }