커뮤니티

수식 작성 부탁드립니다

프로필 이미지
푸른
2021-04-04 18:18:17
980
글번호 147633
답변완료

첨부 이미지

1. input : ntime(3),P(5); var : S1(0),D1(0),TM(0),TF(0),OO(0),기준선(0),mav(0); 기준선 = (highest(H,26)+lowest(L,26))/2; mav = ma(C,P); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { OO = O; } if OO > 기준선 and CrossUp(mav,OO) Then Buy(); if OO < 기준선 and CrossDown(mav,OO) Then Sell(); } input : 손실틱(15); var : 최소이익(30),손실범위(15); 최소이익 = PriceScale*30; 손실범위 = PriceScale*15; SetStopTrailing(손실범위 , 최소이익 , PointStop); ///////////////////////////////////////////////////////////////////// 2. input : StartTime(140000),EndTime(055000),xtime(055500); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); var : Tcond(false),S1(0),D1(0),TM(0); if sDate != sDate[1] then SetStopEndofday(xtime); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; } 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; var1 = Disparity(20); Var2 = ma(C,300); if Tcond == true Then { if 전환선 > 기준선 and crossup(전환선,선행스팬1) and var1 >= 99 Then buy("b"); if MarketPosition == 1 then { if 전환선 < 기준선 and CrossDown(전환선,선행스팬2) and var1 >= 99 Then exitlong("bx1"); if TM <= TM[BarsSinceEntry]+30 and CountIf(CrossUp(c,Var2),BarsSinceEntry) >= 1 Then ExitLong("bx2",AtStop,EntryPrice); if CrossDown(c,Var2) Then ExitLong("bx3"); } if 전환선 < 기준선 and CrossDown(전환선,선행스팬1) and var1 <= 100 Then sell("s"); if MarketPosition == -1 then { if 전환선 > 기준선 and CrossUp(전환선,선행스팬2) and var1 <= 100 Then ExitShort("sx1"); if TM <= TM[BarsSinceEntry]+30 and CountIf(CrossDown(c,Var2),BarsSinceEntry) >= 1 Then ExitShort("sx2",AtStop,EntryPrice); if CrossUp(c,Var2) Then ExitShort("sx3"); } } /////////////////////////////////////////////////////////////////////////// 3. input : StartTime(160000),EndTime(055000),xtime(055500); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); var : Tcond(false); if sDate != sDate[1] then SetStopEndofday(xtime); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); } 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; var1 = Disparity(60); if Tcond == true Then { if 전환선 > 기준선 and crossup(전환선,선행스팬1) and var1 >= 99 Then buy("b"); if MarketPosition == 1 then { if 전환선 < 기준선 and CrossDown(전환선,선행스팬2) and var1 >= 99 Then exitlong(); } if 전환선 < 기준선 and CrossDown(전환선,선행스팬1) and var1 <= 1000 Then sell("s"); if MarketPosition == -1 then { if 전환선 > 기준선 and CrossUp(전환선,선행스팬2) and var1 <= 1200 Then ExitShort(); } } ----------------------------------------- 위 3가지 수식어에 각각 청산방법변경후 수식어추가를 부탁 드립니다. 1. 청산방법 변경 buy > sell를 buy > exitlong , sell > buy를 sell > exitShort 2. 수식어 추가 1. 138 이평선 하단내에서 sell 청산만 가능 예외 :- 캔들이 138선 crossup일때 익절+35틱 손절-20틱 - 5~60선 골든크로스 2. 138 이평선 상단내에서 buy 청산만 가능 예외 :- 캔들이 138선 crossdown 일때 익절+35틱 손절20틱 - 5~60선 골든크로스
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-04-05 13:33:17

안녕하세요 예스스탁입니다. 1 input : ntime(3),P(5); var : S1(0),D1(0),TM(0),TF(0),OO(0),기준선(0),mav(0); 기준선 = (highest(H,26)+lowest(L,26))/2; mav = ma(C,P); value1 = ma(C,5); value2 = ma(C,60); value3 = ma(C,138); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { OO = O; } if OO > 기준선 and CrossUp(mav,OO) and C < Value3 Then Sell(); if OO < 기준선 and CrossDown(mav,OO) and C > Value3 Then Buy(); } input : 손실틱(15); var : 최소이익(30),손실범위(15); 최소이익 = PriceScale*30; 손실범위 = PriceScale*15; SetStopTrailing(손실범위 , 최소이익 , PointStop); if MarketPosition == -1 Then { if CrossUp(value1,Value2) Then ExitShort(); } if MarketPosition == 1 Then { if CrossDown(value1,Value2) Then ExitLong(); } SetStopProfittarget(PriceScale*35,PointStop); SetStopLoss(PriceScale*20,PointStop); 2 input : StartTime(140000),EndTime(055000),xtime(055500); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); var : Tcond(false),S1(0),D1(0),TM(0); if sDate != sDate[1] then SetStopEndofday(xtime); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; } 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; var1 = Disparity(20); Var2 = ma(C,300); value1 = ma(C,5); value2 = ma(C,60); value3 = ma(C,138); if Tcond == true Then { if 전환선 > 기준선 and crossup(전환선,선행스팬1) and var1 >= 99 and C < Value3 Then Sell("s"); if MarketPosition == -1 and C < Value3 then { if 전환선 < 기준선 and CrossDown(전환선,선행스팬2) and var1 >= 99 Then ExitShort("sx1"); if TM <= TM[BarsSinceEntry]+30 and CountIf(CrossUp(c,Var2),BarsSinceEntry) >= 1 Then ExitShort("sx2",AtStop,EntryPrice); if CrossDown(c,Var2) Then ExitShort("sx3"); } if 전환선 < 기준선 and CrossDown(전환선,선행스팬1) and var1 <= 100 and C > Value3 Then Buy("b"); if MarketPosition == 1 and C > Value3 then { if 전환선 > 기준선 and CrossUp(전환선,선행스팬2) and var1 <= 100 Then ExitLong("bx1"); if TM <= TM[BarsSinceEntry]+30 and CountIf(CrossDown(c,Var2),BarsSinceEntry) >= 1 Then ExitLong("bx2",AtStop,EntryPrice); if CrossUp(c,Var2) Then ExitLong("bx3"); } } if MarketPosition == -1 Then { if CrossUp(value1,Value2) Then ExitShort(); } if MarketPosition == 1 Then { if CrossDown(value1,Value2) Then ExitLong(); } SetStopProfittarget(PriceScale*35,PointStop); SetStopLoss(PriceScale*20,PointStop); 3 input : StartTime(160000),EndTime(055000),xtime(055500); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); var : Tcond(false); if sDate != sDate[1] then SetStopEndofday(xtime); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); } 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; var1 = Disparity(60); value1 = ma(C,5); value2 = ma(C,60); value3 = ma(C,138); if Tcond == true Then { if 전환선 > 기준선 and crossup(전환선,선행스팬1) and var1 >= 99 and C < Value3 Then Sell("s"); if MarketPosition == -1 and C < Value3 then { if 전환선 < 기준선 and CrossDown(전환선,선행스팬2) and var1 >= 99 Then ExitShort(); } if 전환선 < 기준선 and CrossDown(전환선,선행스팬1) and var1 <= 1000 and C > Value3 Then Buy("b"); if MarketPosition == 1 and C > Value3 then { if 전환선 > 기준선 and CrossUp(전환선,선행스팬2) and var1 <= 1200 Then ExitLong(); } } if MarketPosition == -1 Then { if CrossUp(value1,Value2) Then ExitShort(); } if MarketPosition == 1 Then { if CrossDown(value1,Value2) Then ExitLong(); } SetStopProfittarget(PriceScale*35,PointStop); SetStopLoss(PriceScale*20,PointStop); 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 수식 작성 부탁드립니다 > 1. input : ntime(3),P(5); var : S1(0),D1(0),TM(0),TF(0),OO(0),기준선(0),mav(0); 기준선 = (highest(H,26)+lowest(L,26))/2; mav = ma(C,P); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; TF = TM%ntime; if Bdate != Bdate[1] or (Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or (Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or (Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then { OO = O; } if OO > 기준선 and CrossUp(mav,OO) Then Buy(); if OO < 기준선 and CrossDown(mav,OO) Then Sell(); } input : 손실틱(15); var : 최소이익(30),손실범위(15); 최소이익 = PriceScale*30; 손실범위 = PriceScale*15; SetStopTrailing(손실범위 , 최소이익 , PointStop); ///////////////////////////////////////////////////////////////////// 2. input : StartTime(140000),EndTime(055000),xtime(055500); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); var : Tcond(false),S1(0),D1(0),TM(0); if sDate != sDate[1] then SetStopEndofday(xtime); if Bdate != Bdate[1] Then { S1 = TimeToMinutes(stime); D1 = sdate; } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); } if D1 > 0 then { if sdate == D1 Then TM = TimeToMinutes(stime)-S1; Else TM = TimeToMinutes(stime)+1440-S1; } 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; var1 = Disparity(20); Var2 = ma(C,300); if Tcond == true Then { if 전환선 > 기준선 and crossup(전환선,선행스팬1) and var1 >= 99 Then buy("b"); if MarketPosition == 1 then { if 전환선 < 기준선 and CrossDown(전환선,선행스팬2) and var1 >= 99 Then exitlong("bx1"); if TM <= TM[BarsSinceEntry]+30 and CountIf(CrossUp(c,Var2),BarsSinceEntry) >= 1 Then ExitLong("bx2",AtStop,EntryPrice); if CrossDown(c,Var2) Then ExitLong("bx3"); } if 전환선 < 기준선 and CrossDown(전환선,선행스팬1) and var1 <= 100 Then sell("s"); if MarketPosition == -1 then { if 전환선 > 기준선 and CrossUp(전환선,선행스팬2) and var1 <= 100 Then ExitShort("sx1"); if TM <= TM[BarsSinceEntry]+30 and CountIf(CrossDown(c,Var2),BarsSinceEntry) >= 1 Then ExitShort("sx2",AtStop,EntryPrice); if CrossUp(c,Var2) Then ExitShort("sx3"); } } /////////////////////////////////////////////////////////////////////////// 3. input : StartTime(160000),EndTime(055000),xtime(055500); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); var : Tcond(false); if sDate != sDate[1] then SetStopEndofday(xtime); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); } 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; var1 = Disparity(60); if Tcond == true Then { if 전환선 > 기준선 and crossup(전환선,선행스팬1) and var1 >= 99 Then buy("b"); if MarketPosition == 1 then { if 전환선 < 기준선 and CrossDown(전환선,선행스팬2) and var1 >= 99 Then exitlong(); } if 전환선 < 기준선 and CrossDown(전환선,선행스팬1) and var1 <= 1000 Then sell("s"); if MarketPosition == -1 then { if 전환선 > 기준선 and CrossUp(전환선,선행스팬2) and var1 <= 1200 Then ExitShort(); } } ----------------------------------------- 위 3가지 수식어에 각각 청산방법변경후 수식어추가를 부탁 드립니다. 1. 청산방법 변경 buy > sell를 buy > exitlong , sell > buy를 sell > exitShort 2. 수식어 추가 1. 138 이평선 하단내에서 sell 청산만 가능 예외 :- 캔들이 138선 crossup일때 익절+35틱 손절-20틱 - 5~60선 골든크로스 2. 138 이평선 상단내에서 buy 청산만 가능 예외 :- 캔들이 138선 crossdown 일때 익절+35틱 손절20틱 - 5~60선 골든크로스