커뮤니티

수식부탁드립니다.

프로필 이미지
라떼처럼
2017-08-15 15:53:11
131
글번호 112033
답변완료
감사합니다 청산식 부탁드립니다 포지션 1일때, 포지션-1일때 (수익청산) 30틱이상 상승하면 최대상승값 대비 15틱 하락하면 청산 50틱이상 상승하면 최대상승값 대비 20틱 하락하면 청산 (손절) 30틱이상 하락하면 최대하락값 대비 10틱 상승하면 청산 (종료) 구동 시간동안 청산 수익들의 합이 100틱 이면 거래 종료 input : short(12),long(26),sig(9),P1(5),P2(50),P3(200); input : 시작시간(220000), 종료시간(055000); var : mav1(0,data1),mav2(0,data1),mav3(0,data1); var : Bcond(false,data1),Scond(false,data1),Tcond(False); var : ii(0,data1),i1(0,data1),i2(0,data2),Bcount(0,data1),Scount(0,data1); mav1 = data1(ma(c,P1)); mav2 = data1(ma(c,P2)); mav3 = data1(ma(c,P3)); ii = data1(index); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } if CrossUp(mav1, mav2) Then{ i1 = ii; } if Crossdown(mav1, mav2) Then{ i1 = ii; } if CrossUp(mav2, mav3) Then{ i2 = ii; Bcount = 0; } if Crossdown(mav2, mav3) Then{ i2 = ii; Scount = 0; } if mav2 > mav3 and MarketPosition == 1 and MarketPosition[1] != MarketPosition Then Bcount = Bcount+1; if mav2 < mav3 and MarketPosition == -1 and MarketPosition[1] != MarketPosition Then Scount = Scount+1; //진입 if Tcond == true Then{ if Bcount < 2 and mav1 > mav1[1] and mav1 < mav2 and mav2 > mav3 and ii > i1 and i1 > i2 Then buy("Buy"); if Scount < 2 and mav1 < mav1[1] and mav1 > mav2 and mav2 < mav3 and ii > i1 and i1 > i2 Then sell("Sell"); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-08-21 11:32:46

안녕하세요 예스스탁입니다. input : short(12),long(26),sig(9),P1(5),P2(50),P3(200); input : 시작시간(220000), 종료시간(055000),당일수익틱수(100); var : mav1(0,data1),mav2(0,data1),mav3(0,data1),NP(0),N1(0),dayPL(0),당일수익(0); var : Bcond(false,data1),Scond(false,data1),Tcond(False),Xcond(false); var : ii(0,data1),i1(0,data1),i2(0,data2),Bcount(0,data1),Scount(0,data1); mav1 = data1(ma(c,P1)); mav2 = data1(ma(c,P2)); mav3 = data1(ma(c,P3)); ii = data1(index); NP = NetProfit; 당일수익 = PriceScale*당일수익틱수; if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ N1 = NetProfit; Tcond = true; Xcond = false; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } if TotalTrades > TotalTrades[1] and (IsExitName("dpb",1) or IsExitName("dsp",1)) Then Xcond = true; dayPL = NP-N1; if CrossUp(mav1, mav2) Then{ i1 = ii; } if Crossdown(mav1, mav2) Then{ i1 = ii; } if CrossUp(mav2, mav3) Then{ i2 = ii; Bcount = 0; } if Crossdown(mav2, mav3) Then{ i2 = ii; Scount = 0; } if mav2 > mav3 and MarketPosition == 1 and MarketPosition[1] != MarketPosition Then Bcount = Bcount+1; if mav2 < mav3 and MarketPosition == -1 and MarketPosition[1] != MarketPosition Then Scount = Scount+1; //진입 if Tcond == true and Xcond == false Then{ if Bcount < 2 and mav1 > mav1[1] and mav1 < mav2 and mav2 > mav3 and ii > i1 and i1 > i2 Then buy("Buy"); if Scount < 2 and mav1 < mav1[1] and mav1 > mav2 and mav2 < mav3 and ii > i1 and i1 > i2 Then sell("Sell"); } if MarketPosition == 1 Then{ ExitLong("dpb",Atlimit,EntryPrice+당일수익-daypl); value1 = highest(H,BarsSinceEntry); if value1 >= EntryPrice+PriceScale*30 and value1 < EntryPrice+PriceScale*50 Then ExitLong("bp1",AtStop,value1-PriceScale*15); if value1 >= EntryPrice+PriceScale*50 Then ExitLong("bp2",AtStop,value1-PriceScale*20); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*30 Then ExitLong("bl",AtLimit,lowest(L,BarsSinceEntry)+PriceScale*10); } if MarketPosition == -1 Then{ ExitShort("dsp",Atlimit,EntryPrice-당일수익+daypl); value2 = Lowest(L,BarsSinceEntry); if value2 <= EntryPrice-PriceScale*30 and value2 > EntryPrice-PriceScale*50 Then ExitShort("sp1",AtStop,value2+PriceScale*15); if value2 <= EntryPrice-PriceScale*50 Then ExitShort("sp2",AtStop,value2+PriceScale*20); if Highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*30 Then ExitShort("sl",AtLimit,Highest(H,BarsSinceEntry)-PriceScale*10); } 즐거운 하루되세요 > 라떼처럼 님이 쓴 글입니다. > 제목 : 수식부탁드립니다. > 감사합니다 청산식 부탁드립니다 포지션 1일때, 포지션-1일때 (수익청산) 30틱이상 상승하면 최대상승값 대비 15틱 하락하면 청산 50틱이상 상승하면 최대상승값 대비 20틱 하락하면 청산 (손절) 30틱이상 하락하면 최대하락값 대비 10틱 상승하면 청산 (종료) 구동 시간동안 청산 수익들의 합이 100틱 이면 거래 종료 input : short(12),long(26),sig(9),P1(5),P2(50),P3(200); input : 시작시간(220000), 종료시간(055000); var : mav1(0,data1),mav2(0,data1),mav3(0,data1); var : Bcond(false,data1),Scond(false,data1),Tcond(False); var : ii(0,data1),i1(0,data1),i2(0,data2),Bcount(0,data1),Scount(0,data1); mav1 = data1(ma(c,P1)); mav2 = data1(ma(c,P2)); mav3 = data1(ma(c,P3)); ii = data1(index); if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{ Tcond = true; } if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{ Tcond = false; } if CrossUp(mav1, mav2) Then{ i1 = ii; } if Crossdown(mav1, mav2) Then{ i1 = ii; } if CrossUp(mav2, mav3) Then{ i2 = ii; Bcount = 0; } if Crossdown(mav2, mav3) Then{ i2 = ii; Scount = 0; } if mav2 > mav3 and MarketPosition == 1 and MarketPosition[1] != MarketPosition Then Bcount = Bcount+1; if mav2 < mav3 and MarketPosition == -1 and MarketPosition[1] != MarketPosition Then Scount = Scount+1; //진입 if Tcond == true Then{ if Bcount < 2 and mav1 > mav1[1] and mav1 < mav2 and mav2 > mav3 and ii > i1 and i1 > i2 Then buy("Buy"); if Scount < 2 and mav1 < mav1[1] and mav1 > mav2 and mav2 < mav3 and ii > i1 and i1 > i2 Then sell("Sell"); }