커뮤니티

수식부탁드립니다.

프로필 이미지
라떼처럼
2017-11-25 10:47:33
162
글번호 114494
답변완료
아래의 거래시간 내 매수한번 매도한번 진입 하는식을 첫번째 청산에서 수익이면 개래 종료, 손실이면 두번째 진입 하는식으로 수정 부탁드립니다 감사합니다 input : short(12),long(26),sig(9),P1(3),P2(30),P3(100); input : af(0.02),maxaf(0.2); input : 최고익절1(70), 최고대비하락1(40), 최고익절2(80),최고익절3(180),최고대비퍼센트(0.20), 손절(50); input : 시작시간(105500), 종료시간(142000); input : 진입회수(1); var : mav1(0),mav2(0),mav3(0); var : Tcond(False),Bcount(0),Scount(0); var : MACDO2(0), MACDO1(0); var : BH(0), SL(0); var : para(0); mav1 = ma(c,P1); mav2 = ma(c,P2); mav3 = ma(c,P3); para = sar(af,maxaf); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; Bcount = 0; Scount = 0; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } //진입회수 if MarketPosition != MarketPosition[1] and MarketPosition == 1 Then Bcount = Bcount+1; if MarketPosition != MarketPosition[1] and MarketPosition == -1 Then Scount = Scount+1; //진입 if Tcond == true Then{ if Bcount < 진입회수 and crossup(mav2,mav3) Then buy("Buy"); if Scount < 진입회수 and CrossDown(mav2,mav3) Then sell("Sell"); } //청산2 if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if BH >= EntryPrice+PriceScale*최고익절1 and BH < EntryPrice+PriceScale*최고익절2 Then{ ExitLong("B익절1",AtStop,BH-PriceScale*최고대비하락1); } if BH >= EntryPrice+PriceScale*최고익절2 and CrossDown(C,para) Then{ ExitLong("B익절Pa"); } if BH >= EntryPrice+PriceScale*최고익절3 then{ ExitLong("B익절%",AtStop,BH-(BH-EntryPrice)*최고대비퍼센트); } ExitLong("B손절",AtStop,EntryPrice-PriceScale*손절); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if SL <= EntryPrice-PriceScale*최고익절1 and SL > EntryPrice-PriceScale*최고익절2 Then{ ExitShort("S익절1",AtStop,SL+PriceScale*최고대비하락1); } if SL <= EntryPrice-PriceScale*최고익절2 and CrossUp(C,para) Then{ ExitShort("S익절Pa"); } if SL <= EntryPrice-PriceScale*최고익절3 then{ ExitShort("S익절%",AtStop,SL+(EntryPrice-SL)*최고대비퍼센트); } ExitShort("S손절",AtStop,EntryPrice+PriceScale*손절); } if 종료시간 <= sTime or sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-11-28 14:43:40

안녕하세요 예스스탁입니다. input : short(12),long(26),sig(9),P1(3),P2(30),P3(100); input : af(0.02),maxaf(0.2); input : 최고익절1(70), 최고대비하락1(40), 최고익절2(80),최고익절3(180),최고대비퍼센트(0.20), 손절(50); input : 시작시간(105500), 종료시간(142000); input : 진입회수(1); var : mav1(0),mav2(0),mav3(0); var : Tcond(False),Bcount(0),Scount(0),count(0); var : MACDO2(0), MACDO1(0); var : BH(0), SL(0); var : para(0); mav1 = ma(c,P1); mav2 = ma(c,P2); mav3 = ma(c,P3); para = sar(af,maxaf); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; Bcount = 0; Scount = 0; count = 0; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } //진입회수 if MarketPosition != MarketPosition[1] and MarketPosition == 1 Then Bcount = Bcount+1; if MarketPosition != MarketPosition[1] and MarketPosition == -1 Then Scount = Scount+1; count = Bcount+Scount; //진입 if Tcond == true Then{ if ((count == 0) or (count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0) or (count >= 1 and MarketPosition == -1 and PositionProfit(0) >= 0)) and Bcount < 진입회수 and crossup(mav2,mav3) Then buy("Buy"); if ((count == 0) or (count >= 1 and MarketPosition == 0 and PositionProfit(1) >= 0) or (count >= 1 and MarketPosition == 1 and PositionProfit(0) >= 0)) and Scount < 진입회수 and CrossDown(mav2,mav3) Then sell("Sell"); } //청산2 if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if BH >= EntryPrice+PriceScale*최고익절1 and BH < EntryPrice+PriceScale*최고익절2 Then{ ExitLong("B익절1",AtStop,BH-PriceScale*최고대비하락1); } if BH >= EntryPrice+PriceScale*최고익절2 and CrossDown(C,para) Then{ ExitLong("B익절Pa"); } if BH >= EntryPrice+PriceScale*최고익절3 then{ ExitLong("B익절%",AtStop,BH-(BH-EntryPrice)*최고대비퍼센트); } ExitLong("B손절",AtStop,EntryPrice-PriceScale*손절); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if SL <= EntryPrice-PriceScale*최고익절1 and SL > EntryPrice-PriceScale*최고익절2 Then{ ExitShort("S익절1",AtStop,SL+PriceScale*최고대비하락1); } if SL <= EntryPrice-PriceScale*최고익절2 and CrossUp(C,para) Then{ ExitShort("S익절Pa"); } if SL <= EntryPrice-PriceScale*최고익절3 then{ ExitShort("S익절%",AtStop,SL+(EntryPrice-SL)*최고대비퍼센트); } ExitShort("S손절",AtStop,EntryPrice+PriceScale*손절); } if 종료시간 <= sTime or sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } } 즐거운 하루되세요 > 라떼처럼 님이 쓴 글입니다. > 제목 : 수식부탁드립니다. > 아래의 거래시간 내 매수한번 매도한번 진입 하는식을 첫번째 청산에서 수익이면 개래 종료, 손실이면 두번째 진입 하는식으로 수정 부탁드립니다 감사합니다 input : short(12),long(26),sig(9),P1(3),P2(30),P3(100); input : af(0.02),maxaf(0.2); input : 최고익절1(70), 최고대비하락1(40), 최고익절2(80),최고익절3(180),최고대비퍼센트(0.20), 손절(50); input : 시작시간(105500), 종료시간(142000); input : 진입회수(1); var : mav1(0),mav2(0),mav3(0); var : Tcond(False),Bcount(0),Scount(0); var : MACDO2(0), MACDO1(0); var : BH(0), SL(0); var : para(0); mav1 = ma(c,P1); mav2 = ma(c,P2); mav3 = ma(c,P3); para = sar(af,maxaf); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; Bcount = 0; Scount = 0; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } //진입회수 if MarketPosition != MarketPosition[1] and MarketPosition == 1 Then Bcount = Bcount+1; if MarketPosition != MarketPosition[1] and MarketPosition == -1 Then Scount = Scount+1; //진입 if Tcond == true Then{ if Bcount < 진입회수 and crossup(mav2,mav3) Then buy("Buy"); if Scount < 진입회수 and CrossDown(mav2,mav3) Then sell("Sell"); } //청산2 if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if BH >= EntryPrice+PriceScale*최고익절1 and BH < EntryPrice+PriceScale*최고익절2 Then{ ExitLong("B익절1",AtStop,BH-PriceScale*최고대비하락1); } if BH >= EntryPrice+PriceScale*최고익절2 and CrossDown(C,para) Then{ ExitLong("B익절Pa"); } if BH >= EntryPrice+PriceScale*최고익절3 then{ ExitLong("B익절%",AtStop,BH-(BH-EntryPrice)*최고대비퍼센트); } ExitLong("B손절",AtStop,EntryPrice-PriceScale*손절); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if SL <= EntryPrice-PriceScale*최고익절1 and SL > EntryPrice-PriceScale*최고익절2 Then{ ExitShort("S익절1",AtStop,SL+PriceScale*최고대비하락1); } if SL <= EntryPrice-PriceScale*최고익절2 and CrossUp(C,para) Then{ ExitShort("S익절Pa"); } if SL <= EntryPrice-PriceScale*최고익절3 then{ ExitShort("S익절%",AtStop,SL+(EntryPrice-SL)*최고대비퍼센트); } ExitShort("S손절",AtStop,EntryPrice+PriceScale*손절); } if 종료시간 <= sTime or sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } }