커뮤니티

부탁드립니다.

프로필 이미지
비류천
2020-12-02 02:25:20
603
글번호 144338
답변완료
시스템 수식 수정 부탁드립니다. 아래 수식에서 변수로 설정 부탁드립니다. 1.총누적 수익이 100point 이면 당일매매 종료 2.총누적 손실이 80point 이면 당일매매 종료 3.연속수익 3회 되면 당일매매 종료 4.연속손실 2회 되면 당일매매 종료 # 봉완성시 익절 input : StartTime(233500),EndTime(020000),진입횟수(6),익절(50),손절(50); Input: FastLen(8), MedLen(25), SlowLen(50); var : Tcond(false),entry(0); Var : FastAvg(0), MedAvg(0), SlowAvg(0); if EndTime > StartTime Then { SetStopEndofday(Endtime); } Else { if sdate != sDate[1] Then SetStopEndofday(Endtime); } 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; entry = 0; if EndTime <= StartTime Then SetStopEndofday(0); } FastAvg = MA(Close, FastLen); MedAvg = MA(Close, MedLen); SlowAvg = MA(Close, SlowLen); if Tcond == true Then { if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if entry < 진입횟수 Then { If (FastAvg[1] < MedAvg[1] OR MedAvg[1] < SlowAvg[1]) AND (FastAvg > MedAvg AND MedAvg > SlowAvg) Then Buy ("MAC3_LE"); If (FastAvg[1] > MedAvg[1] OR MedAvg[1] > SlowAvg[1]) AND (FastAvg < MedAvg AND MedAvg < SlowAvg) Then Sell ("MAC3_SE"); } } SetStopProfittarget(익절,PointStop); SetStopLoss(손절,PointStop);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-12-02 11:37:53

안녕하세요 예스스탁입니다. # 봉완성시 익절 input : StartTime(233500),EndTime(020000),진입횟수(6),익절(50),손절(50); Input : FastLen(8), MedLen(25), SlowLen(50); Input : 당일수익(100),당일손실(80),연속수익(3),연속손실(2); var : Tcond(false),entry(0),profit(0),loss(0),profitcnt(0),losscnt(0); Var : FastAvg(0), MedAvg(0), SlowAvg(0); Var : N1(0),dayPl(0),Xcond(false); if EndTime > StartTime Then { SetStopEndofday(Endtime); } Else { if sdate != sDate[1] Then SetStopEndofday(Endtime); } 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; entry = 0; Xcond = false; N1 = NetProfit; Profit = 0; ProfitCnt = 0; Loss = 0; LossCnt = 0; if EndTime <= StartTime Then SetStopEndofday(0); } FastAvg = MA(Close, FastLen); MedAvg = MA(Close, MedLen); SlowAvg = MA(Close, SlowLen); if Tcond == true and Xcond == False Then { if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 or daypl <= -당일손실 Then Xcond = true; if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; if PositionProfit(1) > 0 Then Profit = profit+1; Else profit = 0; if PositionProfit(1) < 0 Then loss = loss+1; Else loss = 0; } ProfitCnt = Profit; LossCnt = Loss; if MarketPosition != 0 Then { if PositionProfit(0) > 0 Then { ProfitCnt = Profit + 1; } if PositionProfit(0) < 0 Then { lossCnt = Losscnt+1;; } } if entry < 진입횟수 Then { If (FastAvg[1] < MedAvg[1] OR MedAvg[1] < SlowAvg[1]) AND (FastAvg > MedAvg AND MedAvg > SlowAvg) Then { if ProfitCnt < 연속수익 and LossCnt < 연속손실 Then Buy ("MAC3_LE"); Else ExitShort("sx"); } If (FastAvg[1] > MedAvg[1] OR MedAvg[1] > SlowAvg[1]) AND (FastAvg < MedAvg AND MedAvg < SlowAvg) Then { if ProfitCnt < 연속수익 and LossCnt < 연속손실 Then Sell ("MAC3_SE"); Else ExitLong("bx"); } } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts)); } } SetStopProfittarget(익절,PointStop); SetStopLoss(손절,PointStop); 즐거운 하루되세요 > 비류천 님이 쓴 글입니다. > 제목 : 부탁드립니다. > 시스템 수식 수정 부탁드립니다. 아래 수식에서 변수로 설정 부탁드립니다. 1.총누적 수익이 100point 이면 당일매매 종료 2.총누적 손실이 80point 이면 당일매매 종료 3.연속수익 3회 되면 당일매매 종료 4.연속손실 2회 되면 당일매매 종료 # 봉완성시 익절 input : StartTime(233500),EndTime(020000),진입횟수(6),익절(50),손절(50); Input: FastLen(8), MedLen(25), SlowLen(50); var : Tcond(false),entry(0); Var : FastAvg(0), MedAvg(0), SlowAvg(0); if EndTime > StartTime Then { SetStopEndofday(Endtime); } Else { if sdate != sDate[1] Then SetStopEndofday(Endtime); } 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; entry = 0; if EndTime <= StartTime Then SetStopEndofday(0); } FastAvg = MA(Close, FastLen); MedAvg = MA(Close, MedLen); SlowAvg = MA(Close, SlowLen); if Tcond == true Then { if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if entry < 진입횟수 Then { If (FastAvg[1] < MedAvg[1] OR MedAvg[1] < SlowAvg[1]) AND (FastAvg > MedAvg AND MedAvg > SlowAvg) Then Buy ("MAC3_LE"); If (FastAvg[1] > MedAvg[1] OR MedAvg[1] > SlowAvg[1]) AND (FastAvg < MedAvg AND MedAvg < SlowAvg) Then Sell ("MAC3_SE"); } } SetStopProfittarget(익절,PointStop); SetStopLoss(손절,PointStop);