커뮤니티

수식문의드립니다.

프로필 이미지
라떼처럼
2018-01-07 23:11:16
168
글번호 115516
답변완료
안녕하세요 시스템의 피라미딩 3번 사용시 시 손절의 경우 처음 들어간 기준으로 청산이 되는데 손절의 경우 피라미딩으로 들어간 포지션중 가장 높은 pt 를 기준으로 내려갈경우 손절 청산되는식으로 부탁드립니다 (수익 청산의 경우는 기존 시스템의 처음 들어간 기준으로 수익정산) input : short(12),long(26),sig(9),P1(3),P2(20),P3(50),P4(400); input : af(0.02),maxaf(0.1); input : 시작시간(080000), 진입종료(053000), 종료시간(060000); var : mav1(0),mav2(0),mav3(0),mav4(0); var : Tcond(False),BH(0),SL(0),para(0); mav1 = ma(c,P1); mav2 = ma(c,P2); mav3 = ma(c,P3); mav4 = ma(c,P4); para = sar(af,maxaf); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; } if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then{ Tcond = false; } //진입 if Tcond == true Then{ if mav4 > mav4[1] and crossup(mav2,mav3) Then buy("Buy"); if mav4 < mav4[1] and CrossDown(mav2,mav3) Then sell("Sell"); } //청산2 if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if BH >= EntryPrice+PriceScale*30 and BH < EntryPrice+PriceScale*30 Then{ ExitLong("B익절1",AtStop,BH-PriceScale*30); } if BH >= EntryPrice+PriceScale*40 then{ ExitLong("B익절%",AtStop,BH-(BH-EntryPrice)*0.20); } ExitLong("B손절",AtStop,EntryPrice-PriceScale*30); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if SL <= EntryPrice-PriceScale*30 and SL > EntryPrice-PriceScale*30 Then{ ExitShort("S익절1",AtStop,SL+PriceScale*30); } if SL <= EntryPrice-PriceScale*40 then{ ExitShort("S익절%",AtStop,SL+(EntryPrice-SL)*0.20); } ExitShort("S손절",AtStop,EntryPrice+PriceScale*30); } if 종료시간 <= sTime and sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-01-08 17:10:05

안녕하세요 예스스탁입니다. input : short(12),long(26),sig(9),P1(3),P2(20),P3(50),P4(400); input : af(0.02),maxaf(0.1); input : 시작시간(080000), 진입종료(053000), 종료시간(060000); var : mav1(0),mav2(0),mav3(0),mav4(0); var : Tcond(False),BH(0),SL(0),para(0),HE(0),LE(0); mav1 = ma(c,P1); mav2 = ma(c,P2); mav3 = ma(c,P3); mav4 = ma(c,P4); para = sar(af,maxaf); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; } if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then{ Tcond = false; } //진입 if Tcond == true Then{ if mav4 > mav4[1] and crossup(mav2,mav3) Then buy("Buy"); if mav4 < mav4[1] and CrossDown(mav2,mav3) Then sell("Sell"); } //청산2 if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if MaxEntries == 1 Then HE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then HE = LatestEntryPrice(0); if BH >= EntryPrice+PriceScale*30 and BH < EntryPrice+PriceScale*30 Then{ ExitLong("B익절1",AtStop,BH-PriceScale*30); } if BH >= EntryPrice+PriceScale*40 then{ ExitLong("B익절%",AtStop,BH-(BH-EntryPrice)*0.20); } ExitLong("B손절",AtStop,HE-PriceScale*30); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if MaxEntries == 1 Then LE = LatestEntryPrice(0); if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then LE = LatestEntryPrice(0); if SL <= EntryPrice-PriceScale*30 and SL > EntryPrice-PriceScale*30 Then{ ExitShort("S익절1",AtStop,SL+PriceScale*30); } if SL <= EntryPrice-PriceScale*40 then{ ExitShort("S익절%",AtStop,SL+(EntryPrice-SL)*0.20); } ExitShort("S손절",AtStop,LE+PriceScale*30); } if 종료시간 <= sTime and sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } } 즐거운 하루되세요 > 라떼처럼 님이 쓴 글입니다. > 제목 : 수식문의드립니다. > 안녕하세요 시스템의 피라미딩 3번 사용시 시 손절의 경우 처음 들어간 기준으로 청산이 되는데 손절의 경우 피라미딩으로 들어간 포지션중 가장 높은 pt 를 기준으로 내려갈경우 손절 청산되는식으로 부탁드립니다 (수익 청산의 경우는 기존 시스템의 처음 들어간 기준으로 수익정산) input : short(12),long(26),sig(9),P1(3),P2(20),P3(50),P4(400); input : af(0.02),maxaf(0.1); input : 시작시간(080000), 진입종료(053000), 종료시간(060000); var : mav1(0),mav2(0),mav3(0),mav4(0); var : Tcond(False),BH(0),SL(0),para(0); mav1 = ma(c,P1); mav2 = ma(c,P2); mav3 = ma(c,P3); mav4 = ma(c,P4); para = sar(af,maxaf); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; } if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then{ Tcond = false; } //진입 if Tcond == true Then{ if mav4 > mav4[1] and crossup(mav2,mav3) Then buy("Buy"); if mav4 < mav4[1] and CrossDown(mav2,mav3) Then sell("Sell"); } //청산2 if MarketPosition == 1 Then{ BH = highest(H,BarsSinceEntry); if BH >= EntryPrice+PriceScale*30 and BH < EntryPrice+PriceScale*30 Then{ ExitLong("B익절1",AtStop,BH-PriceScale*30); } if BH >= EntryPrice+PriceScale*40 then{ ExitLong("B익절%",AtStop,BH-(BH-EntryPrice)*0.20); } ExitLong("B손절",AtStop,EntryPrice-PriceScale*30); } if MarketPosition == -1 Then{ SL = Lowest(L,BarsSinceEntry); if SL <= EntryPrice-PriceScale*30 and SL > EntryPrice-PriceScale*30 Then{ ExitShort("S익절1",AtStop,SL+PriceScale*30); } if SL <= EntryPrice-PriceScale*40 then{ ExitShort("S익절%",AtStop,SL+(EntryPrice-SL)*0.20); } ExitShort("S손절",AtStop,EntryPrice+PriceScale*30); } if 종료시간 <= sTime and sTime < 시작시간 then { if MarketPosition == 1 then{ ExitLong("B장종료"); } if MarketPosition == -1 then{ ExitShort("S장종료"); } }