커뮤니티

시스템식

프로필 이미지
외국인
2011-06-24 12:51:14
771
글번호 40109
답변완료
안녕하세요 재수정부탁드립니다. 최초진입후 다음신호시 청산만되고 진입이안되고요 이익청산후는 진입이되는데 식과식사이에 진입신호시 청산만 되고있으며 이익청산후 신호발생후 다음신호면 청산과동시에진입식부탁드립니다. 모든식을 시간대 별로 사용 하고자 합니다 현재의방법으론 청산만됩니다 input : value51(0.5), value52(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; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If (stime >= 90000 and stime < 93000) and Condition2 == true THEN { //최초 진입이 매수일 경우 if date != date[1] then { cnt = 0; bpos = 0; spos = 0; } if dayindex > 1 then{ if cnt==0 and C > H[1]+value51 then { sell("B최초진입"); bpos = 1; bVal = C; cnt = 1; } if spos == 1 and crossup(C, sval+value52) then { buy("B재진입2"); bval = C; spos = 0; bpos = 1; } } if date != date[1] then { bpos2 = 0; spos2 = 0; } if dayindex >= 1 then{ if cnt==0 and C > L[1]-value51 then { buy("S최초진입"); spos2 = 1; sVal2 = C; cnt = 1; } if bpos2 == 1 and crossdown(C, bval2-value52) then { sell("S재진입2"); sval2 = C; bpos2= 0; spos2 = 1; } } } //---------------DMI Long Entry--------------------------------------- Inputs: DMILen(3), Consec(3), MinDiff(0); Variables: DMIDiff(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); DMIDiff = DIPlus(DMILen) - DIMinus(DMILen); If DMIDiff[Consec] > 0 Then Begin If DMIDiff >= MinDiff AND CountIF(DMIDiff > DMIDiff[1], Consec) == Consec Then Buy ("DMI"); End; //-------------다이버전스------------------------ Input : Periodd(5), Periodd1(3), Periodd2(3); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); value11 = StochasticsK(Periodd,Periodd1); value12 = StochasticsD(Periodd,Periodd1,Periodd2); If CrossDown(value11, value12) Then { var11 = C;#데드크로스시 발생시 초기값 var12 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value11 < value12 Then{ if C < var11 Then var11 = C; } if CrossUp(value11,value12) Then{ var13 = value11; #골든크로스시 value1값 var14 = var13[1];#직전골든크로스시 value1값 // if var13 > var14 and var11 < var12 Then // buy("상승다이버전스",AtStop,Low); } //--------------------------------------------------------------------------- Input : Period12(12), Period121(5), Period122(5); value41 = StochasticsK(Period12,Period121); value42 = StochasticsD(Period12,Period121,Period122); If CrossDown(value41, value42) Then { var41 = C;#데드크로스시 발생시 초기값 var42 = var41[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value41[1] < value42[1] Then{ if C < var41 Then var41 = L; } if CrossUp(value1,value2) Then{ var43 = value41; #골든크로스시 value1값 var44 = var43[1];#직전골든크로스시 value1값 if var43 > var44 and var41 < var42 Then buy("골든크로스시",atmarket); } input : shortPeriod9(12), longPeriod9(26), Period9(9); var : MACDV(0),MACDS(0),Gval(0),MACDval(0); MACDV = MACD(shortPeriod9, longPeriod9);//MACD MACDS = ema(MACD(shortPeriod9, longPeriod9), Period9);//MACD signal if CrossDown(MACDV, MACDS) then { var11 = MACDV; #데드시 MACD값 var12 = var11[1]; #직전 데드시 MACD값 var13 = index; #데드시 Index var14 = var13[1]; #직전 데드시 Index if var12 > 0 and var11 < var12 and var13 <= var14+40 Then Sell("데드시"); } //-------------저점이높아지는다이버젼스--------------------------------- Input : Period(20), Period1(12), Period2(12); 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 CrossDown(value1, value2) Then { var1 = C;#데드크로스시 발생시 초기값 var2 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value1 < value2 Then{ if C < var1 Then var1 = C; } if CrossUp(value1,value2) Then{ var3 = value1; #골든크로스시 value1값 var4 = var3[1];#직전골든크로스시 value1값 // if var3 > var4 and var1 < var2 Then // buy("다이버젼스"); } //--------------------------------------------------------------------- Inputs: Length71(10), Tail(2), NBars(3); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If CountIF(HangingMan(Length71, Tail), NBars) > 0 Then Sell ("HM", AtStop, Low); //---------------------5일이동평균상승--------------------------------- If (stime > 93000 and stime < 113000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); var :O_Price(0); O_Price = (Dayopen+Dayopen(1)+Dayopen(2)+Dayopen(3)+Dayopen(4))/5; if CrossUp(C, O_Price) Then { buy("5일이동평균d"); } } //-------------------rsi------------------------------------ If (stime > 90000 and stime < 120000) and Condition2 == true THEN { Inputs: RSILength1(10), OverBought1(70); If CrossDown(RSI(RSILength1), OverBought1) Then Sell ("RSI"); } //-------------------------------------------------------------------------- If (stime > 90000 and stime < 110000) and Condition2 == true THEN { Inputs: Lengthu1(10),Lengthu2(3),Lengthu3(3),OverSoldu(30),OverBoughtu(70); Variables: KLineu(0), DLineu(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLineu = StochasticsK(Lengthu1,Lengthu2); DLineu = StochasticsD(Lengthu1,Lengthu2,Lengthu3); If CrossDown(KLineu, DLineu) AND KLineu > OverBoughtu AND DLineu > OverBoughtu Then Sell ("Stch_SE"); } //-------------------------------------------------------------- If (stime > 100000 and stime < 110000) and Condition2 == true THEN { Input : P1(3), P2(20), P3(30); var : 단기(0), 중기(0), 장기(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); 단기 = Ma(C, p1); 중기 = Ma(C, p2); 장기 = Ma(C, p3); Var1 = Highest(H, BarsSinceEntry+1); sell("추적청산", Atstop, Var1-ATR(15)*2); } //--------------------------------------------------------- //---------------------Momentum----------------------- If (stime > 130000 and stime < 150000) and Condition2 == true THEN { Inputs: Length(10), Pval(0.05); Variables: Mom(0); Mom = C- C[Length]; If Mom > 0 AND Mom >= Mom[1] AND MarketPosition() <> 1 Then Buy ("Momentum", AtStop, High + Pval); } //-------------------------cci과매도과매수--------------- If (stime > 130000 and stime < 150000) and Condition2 == true THEN { Input : Periodp(9); Var : valuep(0); valuep = CCI(Periodp); # 매수/매도청산 If CrossUp(valuep,-100) Then { Buy("cci"); } # 매도/매수청산 If CrossDown(valuep,50) Then { Sell("cci매도"); } } If (stime >= 120000 and stime < 145000) and Condition2 == true THEN { Inputs: Length1(5),Length2(3),Length3(3),OverSold11(40),OverBought11(70); Variables: KLine(0), DLine(0); Var : value(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLine = StochasticsK(Length1,Length2); DLine = StochasticsD(Length1,Length2,Length3); If Crossup(KLine[5], DLine[6]) AND KLine[5] < OverSold11 AND DLine[5] < OverSold11 Then ##스토매수 신호을 3개봉뒤에 신호나옴 buy("스토매수"); //if MarketPosition == 1 Then{ //sell("반대매도22",AtStop,L[BarsSinceEntry]-1-PriceScale); //} If (stime >= 120000 and stime < 145000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If CrossDown(KLine, DLine) AND KLine > OverBought11 AND DLine < OverBought11 Then sell ("스토매도"); } } If (stime >= 130000 and stime < 150000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); 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("이평매도"); } //-------------------------------------------------------------------------------- Input : Periodo(12), sigPeriodo(9); value15 = TRIX(Periodo); value25 = ema(value15, sigPeriodo); # 매도/매수청산 If CrossDown(value15, value25) Then { Sell("Hanging Man"); } //-------------------------------------------------------------------------------- If (stime >= 94000 and stime < 133000) and Condition2 == true THEN { Inputs: Length333(5), ATRs(1.5), APval(0.05); Variables: KLower(0), SellSetup(False), SellBase(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLower = KeltnerChannel(Close, Length333, -ATRs); Condition19 = CrossDown(Close, KLower[1]); If MarketPosition() == -1 OR Close > MA(Close, Length333) Then SellSetup = False; Else If Condition19 Then Begin SellSetup = True; SellBase = Low; End; { If SellSetup Then Sell ("Kltr", AtStop, SellBase - APval); } } //------------------------------------------------------------------------------------------- Vars : tf(5), firstBar(0), dayIdx(0); Vars : mPos(0), buyCnt(0), sellCnt(0), bseIdx(0), ehh(0), ell(0), ehc(0), elc(0); Arrays: bSetup[10](false), sSetup[10](false), cSetup[10](false); Arrays: trTime[10](false); Arrays: rangeD[10](0); Arrays: r1[2](0), r2[2](0), pp[2](0), s1[2](0), s2[2](0); Vars : stretch(0), vma(0); if CurrentBar<=0 || (CurrentBar>0 && Date>Date[1]) then { firstBar = CurrentBar; buyCnt = 0; sellCnt = 0; } dayIdx = CurrentBar - firstBar; mPos = MarketPosition(0); if mPos==1 && mPos<>mPos[1] then buyCnt = buyCnt + 1; if mPos==-1 && mPos<>mPos[1] then sellCnt = sellCnt + 1; bseIdx = BarsSinceEntry(0); ehh = Highest(h, bseIdx+1); ell = Lowest(l, bseIdx+1); ehc = Highest(c, bseIdx+1); elc = Lowest(c, bseIdx+1); for value1=1 to 10 { rangeD[value1] = DayHigh(value1)-DayLow(value1); } pp[1] = (DayHigh(1)+DayLow(1)+DayClose(1)*2)/4; r1[1] = 2*pp[1] - DayLow(1); s1[1] = 2*pp[1] - DayHigh(1); r2[1] = pp[1] + (r1[1] - s1[1]); s2[1] = pp[1] - (r1[1] - s1[1]); if DayOpen(0)>DayClose(1) then pp[2] = (DayHigh(1)+DayClose(1)+2*DayLow(1))/2; else if DayOpen(0)<DayClose(1) then pp[2] = (2*DayHigh(1)+DayClose(1)+DayLow(1))/2; else pp[2] = (DayHigh(1)+2*DayClose(1)+DayLow(1))/2; r1[2] = pp[2] - DayLow(1); s1[2] = pp[2] - DayHigh(1); vma = Ma(c,260); trTime[1] = dayIdx<=(120/tf); #당일 봉수가 24개봉 이하 trTime[2] = dayIdx<=(300/tf); #당일 봉수가 60개봉 이하 trTime[3] = dayIdx<=(180/tf); #당일 봉수가 36개봉 이하 trTime[4] = dayIdx<=(180/tf); #당일 봉수가 36개봉 이하 trTime[5] = dayIdx<=(300/tf); #당일 봉수가 60개봉 이하 trTime[6] = dayIdx==3; #당일 3번째봉 cSetup[1] = (buyCnt+sellCnt)<2 && trTime[1]==true; #매수진입횟수+매도진입횟수가 2 미만이고 당일 봉수가 24개봉 이하 cSetup[2] = (buyCnt+sellCnt)<2 && trTime[2]==true; #매수진입횟수+매도진입횟수가 2 미만이고 당일 봉수가 60개봉 이하 cSetup[3] = (buyCnt+sellCnt)<1 && trTime[3]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 36개봉 이하 cSetup[4] = (buyCnt+sellCnt)<1 && trTime[4]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 36개봉 이하 cSetup[5] = (buyCnt+sellCnt)<1 && trTime[5]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 60개봉 이하 cSetup[6] = (buyCnt+sellCnt)<1 && trTime[6]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 3번째봉 # 종가가중 피봇 : 리버스 허용 bSetup[1] = Bids>Asks*1.5 && c>r2[1]; sSetup[1] = Bids<Asks/1.5 && c<s2[1]; bSetup[2] = Bids>Asks && DayLow<s1[1] && CrossUp(c,s1[1]); sSetup[2] = Bids<Asks && DayHigh>r1[1] && CrossDown(c,r1[1]); # 디마크 : 리버스 불허 stretch = (DayHigh(1)-DayLow(1))/3; bSetup[3] = c>(DayOpen + stretch) && DayOpen>r1[2]; sSetup[3] = c<(DayOpen - stretch) && DayOpen<s1[2]; bSetup[4] = DayOpen<s1[2] && c>s1[2] && DayLow>(DayOpen - stretch) && h<DayHigh; sSetup[4] = DayOpen>r1[2] && c<r1[2] && DayHigh<(DayOpen + stretch) && l>DayLow; # 이평 돌파 bSetup[5] = (DayOpen<vma && c>vma[1]); sSetup[5] = (DayOpen>vma && c<vma[1]); # 갭필 bSetup[6] = DayOpen<DayClose(1)*0.99 && Bids>Asks*1.5 && c>DayOpen; sSetup[6] = DayOpen>DayClose(1)*1.01 && Bids<Asks/1.5 && c<DayOpen; if cSetup[1] then { if dayindex > 1 then{ if bSetup[1] then Sell("3.2.le"); if sSetup[1] then buy("3.2.se"); } } if cSetup[2] then { if dayindex > 1 then{ if bSetup[2] then Buy("4.1.le"); if sSetup[2] then Sell("4.1.se"); } } if cSetup[3] then { if dayindex > 1 then{ if bSetup[3] then Sell("3.0.le"); if sSetup[3] then buy("3.0.se"); } } if cSetup[4] then { if dayindex > 1 then{ if bSetup[4] then Buy("4.0.le"); if sSetup[4] then Sell("4.0.se"); } } if cSetup[5] then { if dayindex > 1 then{ if bSetup[5] then sell("2.0.le"); if sSetup[5] then buy("2.0.se"); } } if cSetup[6] then { if dayindex > 1 then{ if bSetup[6] then Buy("6.0.le"); if sSetup[6] then Sell("6.0.se"); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-06-24 14:49:55

안녕하세요 예스스탁입니다. 요청하신 내용이 정확히 이해되지 않습니다. 모든 식은 직전목표수익이면 1봉이후에 직전청산이 목표수익이 아니면 봉수관계없이 발생토록 하였습니다. input : value51(0.5), value52(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; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If (stime >= 90000 and stime < 93000) and Condition2 == true THEN { //최초 진입이 매수일 경우 if date != date[1] then { cnt = 0; bpos = 0; spos = 0; } if dayindex > 1 then{ if cnt==0 and C > H[1]+value51 then { sell("B최초진입"); bpos = 1; bVal = C; cnt = 1; } if spos == 1 and crossup(C, sval+value52) then { buy("B재진입2"); bval = C; spos = 0; bpos = 1; } } if date != date[1] then { bpos2 = 0; spos2 = 0; } if dayindex >= 1 then{ if cnt==0 and C > L[1]-value51 then { buy("S최초진입"); spos2 = 1; sVal2 = C; cnt = 1; } if bpos2 == 1 and crossdown(C, bval2-value52) then { sell("S재진입2"); sval2 = C; bpos2= 0; spos2 = 1; } } } //---------------DMI Long Entry--------------------------------------- Inputs: DMILen(3), Consec(3), MinDiff(0); Variables: DMIDiff(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); DMIDiff = DIPlus(DMILen) - DIMinus(DMILen); If DMIDiff[Consec] > 0 and Condition2 == true then Begin If DMIDiff >= MinDiff AND CountIF(DMIDiff > DMIDiff[1], Consec) == Consec Then Buy ("DMI"); End; //-------------다이버전스------------------------ Input : Periodd(5), Periodd1(3), Periodd2(3); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); value11 = StochasticsK(Periodd,Periodd1); value12 = StochasticsD(Periodd,Periodd1,Periodd2); If CrossDown(value11, value12) Then { var11 = C;#데드크로스시 발생시 초기값 var12 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value11 < value12 Then{ if C < var11 Then var11 = C; } if CrossUp(value11,value12) Then{ var13 = value11; #골든크로스시 value1값 var14 = var13[1];#직전골든크로스시 value1값 // if var13 > var14 and var11 < var12 Then // buy("상승다이버전스",AtStop,Low); } //--------------------------------------------------------------------------- Input : Period12(12), Period121(5), Period122(5); value41 = StochasticsK(Period12,Period121); value42 = StochasticsD(Period12,Period121,Period122); If CrossDown(value41, value42) Then { var41 = C;#데드크로스시 발생시 초기값 var42 = var41[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value41[1] < value42[1] Then{ if C < var41 Then var41 = L; } if CrossUp(value1,value2) Then{ var43 = value41; #골든크로스시 value1값 var44 = var43[1];#직전골든크로스시 value1값 if var43 > var44 and var41 < var42 and Condition2 == true Then buy("골든크로스시",atmarket); } input : shortPeriod9(12), longPeriod9(26), Period9(9); var : MACDV(0),MACDS(0),Gval(0),MACDval(0); MACDV = MACD(shortPeriod9, longPeriod9);//MACD MACDS = ema(MACD(shortPeriod9, longPeriod9), Period9);//MACD signal if CrossDown(MACDV, MACDS) then { var11 = MACDV; #데드시 MACD값 var12 = var11[1]; #직전 데드시 MACD값 var13 = index; #데드시 Index var14 = var13[1]; #직전 데드시 Index if var12 > 0 and var11 < var12 and var13 <= var14+40 and Condition2 == true Then Sell("데드시"); } //-------------저점이높아지는다이버젼스--------------------------------- Input : Period(20), Period1(12), Period2(12); 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 CrossDown(value1, value2) Then { var1 = C;#데드크로스시 발생시 초기값 var2 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value1 < value2 Then{ if C < var1 Then var1 = C; } if CrossUp(value1,value2) Then{ var3 = value1; #골든크로스시 value1값 var4 = var3[1];#직전골든크로스시 value1값 // if var3 > var4 and var1 < var2 Then // buy("다이버젼스"); } //--------------------------------------------------------------------- Inputs: Length71(10), Tail(2), NBars(3); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If CountIF(HangingMan(Length71, Tail), NBars) > 0 and Condition2 == true Then Sell ("HM", AtStop, Low); //---------------------5일이동평균상승--------------------------------- If (stime > 93000 and stime < 113000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); var :O_Price(0); O_Price = (Dayopen+Dayopen(1)+Dayopen(2)+Dayopen(3)+Dayopen(4))/5; if CrossUp(C, O_Price) and Condition2 == true Then { buy("5일이동평균d"); } } //-------------------rsi------------------------------------ If (stime > 90000 and stime < 120000) and Condition2 == true THEN { Inputs: RSILength1(10), OverBought1(70); If CrossDown(RSI(RSILength1), OverBought1) and Condition2 == true Then Sell ("RSI"); } //-------------------------------------------------------------------------- If (stime > 90000 and stime < 110000) and Condition2 == true THEN { Inputs: Lengthu1(10),Lengthu2(3),Lengthu3(3),OverSoldu(30),OverBoughtu(70); Variables: KLineu(0), DLineu(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLineu = StochasticsK(Lengthu1,Lengthu2); DLineu = StochasticsD(Lengthu1,Lengthu2,Lengthu3); If CrossDown(KLineu, DLineu) AND KLineu > OverBoughtu AND DLineu > OverBoughtu and Condition2 == true Then Sell ("Stch_SE"); } //-------------------------------------------------------------- If (stime > 100000 and stime < 110000) and Condition2 == true THEN { Input : P1(3), P2(20), P3(30); var : 단기(0), 중기(0), 장기(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); 단기 = Ma(C, p1); 중기 = Ma(C, p2); 장기 = Ma(C, p3); Var1 = Highest(H, BarsSinceEntry+1); if Condition2 == true then sell("추적청산", Atstop, Var1-ATR(15)*2); } //--------------------------------------------------------- //---------------------Momentum----------------------- If (stime > 130000 and stime < 150000) and Condition2 == true THEN { Inputs: Length(10), Pval(0.05); Variables: Mom(0); Mom = C- C[Length]; If Mom > 0 AND Mom >= Mom[1] AND MarketPosition() <> 1 and Condition2 == true Then Buy ("Momentum", AtStop, High + Pval); } //-------------------------cci과매도과매수--------------- If (stime > 130000 and stime < 150000) and Condition2 == true THEN { Input : Periodp(9); Var : valuep(0); valuep = CCI(Periodp); # 매수/매도청산 If CrossUp(valuep,-100) and Condition2 == true Then { Buy("cci"); } # 매도/매수청산 If CrossDown(valuep,50) and Condition2 == true Then { Sell("cci매도"); } } If (stime >= 120000 and stime < 145000) and Condition2 == true THEN { Inputs: Length1(5),Length2(3),Length3(3),OverSold11(40),OverBought11(70); Variables: KLine(0), DLine(0); Var : value(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLine = StochasticsK(Length1,Length2); DLine = StochasticsD(Length1,Length2,Length3); If Crossup(KLine[5], DLine[6]) AND KLine[5] < OverSold11 AND DLine[5] < OverSold11 and Condition2 == true Then ##스토매수 신호을 3개봉뒤에 신호나옴 buy("스토매수"); //if MarketPosition == 1 Then{ //sell("반대매도22",AtStop,L[BarsSinceEntry]-1-PriceScale); //} If (stime >= 120000 and stime < 145000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If CrossDown(KLine, DLine) AND KLine > OverBought11 AND DLine < OverBought11 and Condition2 == true Then sell ("스토매도"); } } If (stime >= 130000 and stime < 150000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); if min(c,O) > ma(c,3) and min(C,H) > ma(c,20) and Condition2 == true Then buy("이평매수"); if MarketPosition == 0 and max(c,O) < ma(c,5) and max(C,H) > ma(c,20) and Condition2 == true Then sell("이평매도"); } //-------------------------------------------------------------------------------- Input : Periodo(12), sigPeriodo(9); value15 = TRIX(Periodo); value25 = ema(value15, sigPeriodo); # 매도/매수청산 If CrossDown(value15, value25) and Condition2 == true Then { Sell("Hanging Man"); } //-------------------------------------------------------------------------------- If (stime >= 94000 and stime < 133000) and Condition2 == true THEN { Inputs: Length333(5), ATRs(1.5), APval(0.05); Variables: KLower(0), SellSetup(False), SellBase(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLower = KeltnerChannel(Close, Length333, -ATRs); Condition19 = CrossDown(Close, KLower[1]); If MarketPosition() == -1 OR Close > MA(Close, Length333) Then SellSetup = False; Else If Condition19 Then Begin SellSetup = True; SellBase = Low; End; { If SellSetup and Condition2 == true Then Sell ("Kltr", AtStop, SellBase - APval); } } //------------------------------------------------------------------------------------------- Vars : tf(5), firstBar(0), dayIdx(0); Vars : mPos(0), buyCnt(0), sellCnt(0), bseIdx(0), ehh(0), ell(0), ehc(0), elc(0); Arrays: bSetup[10](false), sSetup[10](false), cSetup[10](false); Arrays: trTime[10](false); Arrays: rangeD[10](0); Arrays: r1[2](0), r2[2](0), pp[2](0), s1[2](0), s2[2](0); Vars : stretch(0), vma(0); if CurrentBar<=0 || (CurrentBar>0 && Date>Date[1]) then { firstBar = CurrentBar; buyCnt = 0; sellCnt = 0; } dayIdx = CurrentBar - firstBar; mPos = MarketPosition(0); if mPos==1 && mPos<>mPos[1] then buyCnt = buyCnt + 1; if mPos==-1 && mPos<>mPos[1] then sellCnt = sellCnt + 1; bseIdx = BarsSinceEntry(0); ehh = Highest(h, bseIdx+1); ell = Lowest(l, bseIdx+1); ehc = Highest(c, bseIdx+1); elc = Lowest(c, bseIdx+1); for value1=1 to 10 { rangeD[value1] = DayHigh(value1)-DayLow(value1); } pp[1] = (DayHigh(1)+DayLow(1)+DayClose(1)*2)/4; r1[1] = 2*pp[1] - DayLow(1); s1[1] = 2*pp[1] - DayHigh(1); r2[1] = pp[1] + (r1[1] - s1[1]); s2[1] = pp[1] - (r1[1] - s1[1]); if DayOpen(0)>DayClose(1) then pp[2] = (DayHigh(1)+DayClose(1)+2*DayLow(1))/2; else if DayOpen(0)<DayClose(1) then pp[2] = (2*DayHigh(1)+DayClose(1)+DayLow(1))/2; else pp[2] = (DayHigh(1)+2*DayClose(1)+DayLow(1))/2; r1[2] = pp[2] - DayLow(1); s1[2] = pp[2] - DayHigh(1); vma = Ma(c,260); trTime[1] = dayIdx<=(120/tf); #당일 봉수가 24개봉 이하 trTime[2] = dayIdx<=(300/tf); #당일 봉수가 60개봉 이하 trTime[3] = dayIdx<=(180/tf); #당일 봉수가 36개봉 이하 trTime[4] = dayIdx<=(180/tf); #당일 봉수가 36개봉 이하 trTime[5] = dayIdx<=(300/tf); #당일 봉수가 60개봉 이하 trTime[6] = dayIdx==3; #당일 3번째봉 cSetup[1] = (buyCnt+sellCnt)<2 && trTime[1]==true; #매수진입횟수+매도진입횟수가 2 미만이고 당일 봉수가 24개봉 이하 cSetup[2] = (buyCnt+sellCnt)<2 && trTime[2]==true; #매수진입횟수+매도진입횟수가 2 미만이고 당일 봉수가 60개봉 이하 cSetup[3] = (buyCnt+sellCnt)<1 && trTime[3]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 36개봉 이하 cSetup[4] = (buyCnt+sellCnt)<1 && trTime[4]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 36개봉 이하 cSetup[5] = (buyCnt+sellCnt)<1 && trTime[5]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 60개봉 이하 cSetup[6] = (buyCnt+sellCnt)<1 && trTime[6]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 3번째봉 # 종가가중 피봇 : 리버스 허용 bSetup[1] = Bids>Asks*1.5 && c>r2[1]; sSetup[1] = Bids<Asks/1.5 && c<s2[1]; bSetup[2] = Bids>Asks && DayLow<s1[1] && CrossUp(c,s1[1]); sSetup[2] = Bids<Asks && DayHigh>r1[1] && CrossDown(c,r1[1]); # 디마크 : 리버스 불허 stretch = (DayHigh(1)-DayLow(1))/3; bSetup[3] = c>(DayOpen + stretch) && DayOpen>r1[2]; sSetup[3] = c<(DayOpen - stretch) && DayOpen<s1[2]; bSetup[4] = DayOpen<s1[2] && c>s1[2] && DayLow>(DayOpen - stretch) && h<DayHigh; sSetup[4] = DayOpen>r1[2] && c<r1[2] && DayHigh<(DayOpen + stretch) && l>DayLow; # 이평 돌파 bSetup[5] = (DayOpen<vma && c>vma[1]); sSetup[5] = (DayOpen>vma && c<vma[1]); # 갭필 bSetup[6] = DayOpen<DayClose(1)*0.99 && Bids>Asks*1.5 && c>DayOpen; sSetup[6] = DayOpen>DayClose(1)*1.01 && Bids<Asks/1.5 && c<DayOpen; if cSetup[1] and Condition2 == true then { if dayindex > 1 then{ if bSetup[1] then Sell("3.2.le"); if sSetup[1] then buy("3.2.se"); } } if cSetup[2] and Condition2 == true then { if dayindex > 1 then{ if bSetup[2] then Buy("4.1.le"); if sSetup[2] then Sell("4.1.se"); } } if cSetup[3]and Condition2 == true then { if dayindex > 1 then{ if bSetup[3] then Sell("3.0.le"); if sSetup[3] then buy("3.0.se"); } } if cSetup[4]and Condition2 == true then { if dayindex > 1 then{ if bSetup[4] then Buy("4.0.le"); if sSetup[4] then Sell("4.0.se"); } } if cSetup[5]and Condition2 == true then { if dayindex > 1 then{ if bSetup[5] then sell("2.0.le"); if sSetup[5] then buy("2.0.se"); } } if cSetup[6]and Condition2 == true then { if dayindex > 1 then{ if bSetup[6] then Buy("6.0.le"); if sSetup[6] then Sell("6.0.se"); } } 즐거운 하루되세요 > 외국인 님이 쓴 글입니다. > 제목 : 시스템식 > 안녕하세요 재수정부탁드립니다. 최초진입후 다음신호시 청산만되고 진입이안되고요 이익청산후는 진입이되는데 식과식사이에 진입신호시 청산만 되고있으며 이익청산후 신호발생후 다음신호면 청산과동시에진입식부탁드립니다. 모든식을 시간대 별로 사용 하고자 합니다 현재의방법으론 청산만됩니다 input : value51(0.5), value52(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; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If (stime >= 90000 and stime < 93000) and Condition2 == true THEN { //최초 진입이 매수일 경우 if date != date[1] then { cnt = 0; bpos = 0; spos = 0; } if dayindex > 1 then{ if cnt==0 and C > H[1]+value51 then { sell("B최초진입"); bpos = 1; bVal = C; cnt = 1; } if spos == 1 and crossup(C, sval+value52) then { buy("B재진입2"); bval = C; spos = 0; bpos = 1; } } if date != date[1] then { bpos2 = 0; spos2 = 0; } if dayindex >= 1 then{ if cnt==0 and C > L[1]-value51 then { buy("S최초진입"); spos2 = 1; sVal2 = C; cnt = 1; } if bpos2 == 1 and crossdown(C, bval2-value52) then { sell("S재진입2"); sval2 = C; bpos2= 0; spos2 = 1; } } } //---------------DMI Long Entry--------------------------------------- Inputs: DMILen(3), Consec(3), MinDiff(0); Variables: DMIDiff(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); DMIDiff = DIPlus(DMILen) - DIMinus(DMILen); If DMIDiff[Consec] > 0 Then Begin If DMIDiff >= MinDiff AND CountIF(DMIDiff > DMIDiff[1], Consec) == Consec Then Buy ("DMI"); End; //-------------다이버전스------------------------ Input : Periodd(5), Periodd1(3), Periodd2(3); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); value11 = StochasticsK(Periodd,Periodd1); value12 = StochasticsD(Periodd,Periodd1,Periodd2); If CrossDown(value11, value12) Then { var11 = C;#데드크로스시 발생시 초기값 var12 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value11 < value12 Then{ if C < var11 Then var11 = C; } if CrossUp(value11,value12) Then{ var13 = value11; #골든크로스시 value1값 var14 = var13[1];#직전골든크로스시 value1값 // if var13 > var14 and var11 < var12 Then // buy("상승다이버전스",AtStop,Low); } //--------------------------------------------------------------------------- Input : Period12(12), Period121(5), Period122(5); value41 = StochasticsK(Period12,Period121); value42 = StochasticsD(Period12,Period121,Period122); If CrossDown(value41, value42) Then { var41 = C;#데드크로스시 발생시 초기값 var42 = var41[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value41[1] < value42[1] Then{ if C < var41 Then var41 = L; } if CrossUp(value1,value2) Then{ var43 = value41; #골든크로스시 value1값 var44 = var43[1];#직전골든크로스시 value1값 if var43 > var44 and var41 < var42 Then buy("골든크로스시",atmarket); } input : shortPeriod9(12), longPeriod9(26), Period9(9); var : MACDV(0),MACDS(0),Gval(0),MACDval(0); MACDV = MACD(shortPeriod9, longPeriod9);//MACD MACDS = ema(MACD(shortPeriod9, longPeriod9), Period9);//MACD signal if CrossDown(MACDV, MACDS) then { var11 = MACDV; #데드시 MACD값 var12 = var11[1]; #직전 데드시 MACD값 var13 = index; #데드시 Index var14 = var13[1]; #직전 데드시 Index if var12 > 0 and var11 < var12 and var13 <= var14+40 Then Sell("데드시"); } //-------------저점이높아지는다이버젼스--------------------------------- Input : Period(20), Period1(12), Period2(12); 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 CrossDown(value1, value2) Then { var1 = C;#데드크로스시 발생시 초기값 var2 = var1[1]; # 직전 데드크로스 구간의 종가 중 최저가 } #가장 최근 데드크로스 구간의 종가중 최저가 계산 if value1 < value2 Then{ if C < var1 Then var1 = C; } if CrossUp(value1,value2) Then{ var3 = value1; #골든크로스시 value1값 var4 = var3[1];#직전골든크로스시 value1값 // if var3 > var4 and var1 < var2 Then // buy("다이버젼스"); } //--------------------------------------------------------------------- Inputs: Length71(10), Tail(2), NBars(3); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If CountIF(HangingMan(Length71, Tail), NBars) > 0 Then Sell ("HM", AtStop, Low); //---------------------5일이동평균상승--------------------------------- If (stime > 93000 and stime < 113000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); var :O_Price(0); O_Price = (Dayopen+Dayopen(1)+Dayopen(2)+Dayopen(3)+Dayopen(4))/5; if CrossUp(C, O_Price) Then { buy("5일이동평균d"); } } //-------------------rsi------------------------------------ If (stime > 90000 and stime < 120000) and Condition2 == true THEN { Inputs: RSILength1(10), OverBought1(70); If CrossDown(RSI(RSILength1), OverBought1) Then Sell ("RSI"); } //-------------------------------------------------------------------------- If (stime > 90000 and stime < 110000) and Condition2 == true THEN { Inputs: Lengthu1(10),Lengthu2(3),Lengthu3(3),OverSoldu(30),OverBoughtu(70); Variables: KLineu(0), DLineu(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLineu = StochasticsK(Lengthu1,Lengthu2); DLineu = StochasticsD(Lengthu1,Lengthu2,Lengthu3); If CrossDown(KLineu, DLineu) AND KLineu > OverBoughtu AND DLineu > OverBoughtu Then Sell ("Stch_SE"); } //-------------------------------------------------------------- If (stime > 100000 and stime < 110000) and Condition2 == true THEN { Input : P1(3), P2(20), P3(30); var : 단기(0), 중기(0), 장기(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); 단기 = Ma(C, p1); 중기 = Ma(C, p2); 장기 = Ma(C, p3); Var1 = Highest(H, BarsSinceEntry+1); sell("추적청산", Atstop, Var1-ATR(15)*2); } //--------------------------------------------------------- //---------------------Momentum----------------------- If (stime > 130000 and stime < 150000) and Condition2 == true THEN { Inputs: Length(10), Pval(0.05); Variables: Mom(0); Mom = C- C[Length]; If Mom > 0 AND Mom >= Mom[1] AND MarketPosition() <> 1 Then Buy ("Momentum", AtStop, High + Pval); } //-------------------------cci과매도과매수--------------- If (stime > 130000 and stime < 150000) and Condition2 == true THEN { Input : Periodp(9); Var : valuep(0); valuep = CCI(Periodp); # 매수/매도청산 If CrossUp(valuep,-100) Then { Buy("cci"); } # 매도/매수청산 If CrossDown(valuep,50) Then { Sell("cci매도"); } } If (stime >= 120000 and stime < 145000) and Condition2 == true THEN { Inputs: Length1(5),Length2(3),Length3(3),OverSold11(40),OverBought11(70); Variables: KLine(0), DLine(0); Var : value(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLine = StochasticsK(Length1,Length2); DLine = StochasticsD(Length1,Length2,Length3); If Crossup(KLine[5], DLine[6]) AND KLine[5] < OverSold11 AND DLine[5] < OverSold11 Then ##스토매수 신호을 3개봉뒤에 신호나옴 buy("스토매수"); //if MarketPosition == 1 Then{ //sell("반대매도22",AtStop,L[BarsSinceEntry]-1-PriceScale); //} If (stime >= 120000 and stime < 145000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); If CrossDown(KLine, DLine) AND KLine > OverBought11 AND DLine < OverBought11 Then sell ("스토매도"); } } If (stime >= 130000 and stime < 150000) and Condition2 == true THEN { Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); 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("이평매도"); } //-------------------------------------------------------------------------------- Input : Periodo(12), sigPeriodo(9); value15 = TRIX(Periodo); value25 = ema(value15, sigPeriodo); # 매도/매수청산 If CrossDown(value15, value25) Then { Sell("Hanging Man"); } //-------------------------------------------------------------------------------- If (stime >= 94000 and stime < 133000) and Condition2 == true THEN { Inputs: Length333(5), ATRs(1.5), APval(0.05); Variables: KLower(0), SellSetup(False), SellBase(0); Condition1 = IsExitName("StopProfittarget",1) and ExitDate(1) == sdate; Condition2 = (Condition1 == true and MarketPosition == 0 and BarsSinceExit(1) >= 1) or (Condition1 == false); KLower = KeltnerChannel(Close, Length333, -ATRs); Condition19 = CrossDown(Close, KLower[1]); If MarketPosition() == -1 OR Close > MA(Close, Length333) Then SellSetup = False; Else If Condition19 Then Begin SellSetup = True; SellBase = Low; End; { If SellSetup Then Sell ("Kltr", AtStop, SellBase - APval); } } //------------------------------------------------------------------------------------------- Vars : tf(5), firstBar(0), dayIdx(0); Vars : mPos(0), buyCnt(0), sellCnt(0), bseIdx(0), ehh(0), ell(0), ehc(0), elc(0); Arrays: bSetup[10](false), sSetup[10](false), cSetup[10](false); Arrays: trTime[10](false); Arrays: rangeD[10](0); Arrays: r1[2](0), r2[2](0), pp[2](0), s1[2](0), s2[2](0); Vars : stretch(0), vma(0); if CurrentBar<=0 || (CurrentBar>0 && Date>Date[1]) then { firstBar = CurrentBar; buyCnt = 0; sellCnt = 0; } dayIdx = CurrentBar - firstBar; mPos = MarketPosition(0); if mPos==1 && mPos<>mPos[1] then buyCnt = buyCnt + 1; if mPos==-1 && mPos<>mPos[1] then sellCnt = sellCnt + 1; bseIdx = BarsSinceEntry(0); ehh = Highest(h, bseIdx+1); ell = Lowest(l, bseIdx+1); ehc = Highest(c, bseIdx+1); elc = Lowest(c, bseIdx+1); for value1=1 to 10 { rangeD[value1] = DayHigh(value1)-DayLow(value1); } pp[1] = (DayHigh(1)+DayLow(1)+DayClose(1)*2)/4; r1[1] = 2*pp[1] - DayLow(1); s1[1] = 2*pp[1] - DayHigh(1); r2[1] = pp[1] + (r1[1] - s1[1]); s2[1] = pp[1] - (r1[1] - s1[1]); if DayOpen(0)>DayClose(1) then pp[2] = (DayHigh(1)+DayClose(1)+2*DayLow(1))/2; else if DayOpen(0)<DayClose(1) then pp[2] = (2*DayHigh(1)+DayClose(1)+DayLow(1))/2; else pp[2] = (DayHigh(1)+2*DayClose(1)+DayLow(1))/2; r1[2] = pp[2] - DayLow(1); s1[2] = pp[2] - DayHigh(1); vma = Ma(c,260); trTime[1] = dayIdx<=(120/tf); #당일 봉수가 24개봉 이하 trTime[2] = dayIdx<=(300/tf); #당일 봉수가 60개봉 이하 trTime[3] = dayIdx<=(180/tf); #당일 봉수가 36개봉 이하 trTime[4] = dayIdx<=(180/tf); #당일 봉수가 36개봉 이하 trTime[5] = dayIdx<=(300/tf); #당일 봉수가 60개봉 이하 trTime[6] = dayIdx==3; #당일 3번째봉 cSetup[1] = (buyCnt+sellCnt)<2 && trTime[1]==true; #매수진입횟수+매도진입횟수가 2 미만이고 당일 봉수가 24개봉 이하 cSetup[2] = (buyCnt+sellCnt)<2 && trTime[2]==true; #매수진입횟수+매도진입횟수가 2 미만이고 당일 봉수가 60개봉 이하 cSetup[3] = (buyCnt+sellCnt)<1 && trTime[3]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 36개봉 이하 cSetup[4] = (buyCnt+sellCnt)<1 && trTime[4]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 36개봉 이하 cSetup[5] = (buyCnt+sellCnt)<1 && trTime[5]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 봉수가 60개봉 이하 cSetup[6] = (buyCnt+sellCnt)<1 && trTime[6]==true; #매수진입횟수+매도진입횟수가 1 미만이고 당일 3번째봉 # 종가가중 피봇 : 리버스 허용 bSetup[1] = Bids>Asks*1.5 && c>r2[1]; sSetup[1] = Bids<Asks/1.5 && c<s2[1]; bSetup[2] = Bids>Asks && DayLow<s1[1] && CrossUp(c,s1[1]); sSetup[2] = Bids<Asks && DayHigh>r1[1] && CrossDown(c,r1[1]); # 디마크 : 리버스 불허 stretch = (DayHigh(1)-DayLow(1))/3; bSetup[3] = c>(DayOpen + stretch) && DayOpen>r1[2]; sSetup[3] = c<(DayOpen - stretch) && DayOpen<s1[2]; bSetup[4] = DayOpen<s1[2] && c>s1[2] && DayLow>(DayOpen - stretch) && h<DayHigh; sSetup[4] = DayOpen>r1[2] && c<r1[2] && DayHigh<(DayOpen + stretch) && l>DayLow; # 이평 돌파 bSetup[5] = (DayOpen<vma && c>vma[1]); sSetup[5] = (DayOpen>vma && c<vma[1]); # 갭필 bSetup[6] = DayOpen<DayClose(1)*0.99 && Bids>Asks*1.5 && c>DayOpen; sSetup[6] = DayOpen>DayClose(1)*1.01 && Bids<Asks/1.5 && c<DayOpen; if cSetup[1] then { if dayindex > 1 then{ if bSetup[1] then Sell("3.2.le"); if sSetup[1] then buy("3.2.se"); } } if cSetup[2] then { if dayindex > 1 then{ if bSetup[2] then Buy("4.1.le"); if sSetup[2] then Sell("4.1.se"); } } if cSetup[3] then { if dayindex > 1 then{ if bSetup[3] then Sell("3.0.le"); if sSetup[3] then buy("3.0.se"); } } if cSetup[4] then { if dayindex > 1 then{ if bSetup[4] then Buy("4.0.le"); if sSetup[4] then Sell("4.0.se"); } } if cSetup[5] then { if dayindex > 1 then{ if bSetup[5] then sell("2.0.le"); if sSetup[5] then buy("2.0.se"); } } if cSetup[6] then { if dayindex > 1 then{ if bSetup[6] then Buy("6.0.le"); if sSetup[6] then Sell("6.0.se"); } }