커뮤니티

스토캐스틱 수식 수정 부탁드립니다.

프로필 이미지
승부사1
2018-10-04 22:10:12
165
글번호 122443
답변완료
아래의 수식으로 매매를 진행하다 보면 손실제한 규정에 의하여 매매가 제한이 됩니다. 그럼 포지션이 없는 상태로 장이 마감이 되고 익일 시초가 상에 스토캐스틱이 정배열 상태이면 매수진입을하고 스토캐스틱이 역배열 상태이면 매도진입 되도록 수정 부탁드립니다. - 아 래 - Input : 당일누적수익틱수(80),당일누적손실틱수(30),P(120); input : startdate(20180903),starttime(090000),enddate(20181031),endtime(153000); input : sto1(20),sto2(12),sto3(12); VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0); if (sdate == enddate and sdate != sdate[1] and stime >= endtime) or (sdate == enddate and sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { Tcond = false; if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if (sdate >= startdate and sdate != sdate[1] and stime >= starttime) or (sdate >= startdate and sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then { Xcond = false; N1 = NetProfit; Tcond = true; } 당일누적수익 = PriceScale*당일누적수익틱수; 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; stok = StochasticsK(sto1,sto2); stod = StochasticsD(sto1,sto2,sto3); if Tcond == true and Xcond == false then { if crossup(stok,stod) Then buy(); if CrossDown(stok,stod) Then sell(); } 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)); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-10-05 13:15:02

안녕하세요 예스스탁입니다. Input : 당일누적수익틱수(80),당일누적손실틱수(30),P(120); input : startdate(20180903),starttime(090000),enddate(20181031),endtime(153000); input : sto1(20),sto2(12),sto3(12); VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0); stok = StochasticsK(sto1,sto2); stod = StochasticsD(sto1,sto2,sto3); if (sdate == enddate and sdate != sdate[1] and stime >= endtime) or (sdate == enddate and sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { Tcond = false; if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if (sdate >= startdate and sdate != sdate[1] and stime >= starttime) or (sdate >= startdate and sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then { Xcond = false; N1 = NetProfit; Tcond = true; if MarketPosition == 0 and MarketPosition(1) != 0 and stok > stod Then buy(); if MarketPosition == 0 and MarketPosition(1) != 0 and stok < stod Then sell(); } 당일누적수익 = PriceScale*당일누적수익틱수; 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; if Tcond == true and Xcond == false then { if crossup(stok,stod) Then buy(); if CrossDown(stok,stod) Then sell(); } 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)); } 즐거운 하루되세요 > 승부사1 님이 쓴 글입니다. > 제목 : 스토캐스틱 수식 수정 부탁드립니다. > 아래의 수식으로 매매를 진행하다 보면 손실제한 규정에 의하여 매매가 제한이 됩니다. 그럼 포지션이 없는 상태로 장이 마감이 되고 익일 시초가 상에 스토캐스틱이 정배열 상태이면 매수진입을하고 스토캐스틱이 역배열 상태이면 매도진입 되도록 수정 부탁드립니다. - 아 래 - Input : 당일누적수익틱수(80),당일누적손실틱수(30),P(120); input : startdate(20180903),starttime(090000),enddate(20181031),endtime(153000); input : sto1(20),sto2(12),sto3(12); VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false),stok(0),stod(0); if (sdate == enddate and sdate != sdate[1] and stime >= endtime) or (sdate == enddate and sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { Tcond = false; if MarketPosition == 1 Then ExitLong("bx"); if MarketPosition == -1 Then ExitShort("sx"); } if (sdate >= startdate and sdate != sdate[1] and stime >= starttime) or (sdate >= startdate and sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then { Xcond = false; N1 = NetProfit; Tcond = true; } 당일누적수익 = PriceScale*당일누적수익틱수; 당일누적손실 = PriceScale*당일누적손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] and (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; stok = StochasticsK(sto1,sto2); stod = StochasticsD(sto1,sto2,sto3); if Tcond == true and Xcond == false then { if crossup(stok,stod) Then buy(); if CrossDown(stok,stod) Then sell(); } 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)); }