커뮤니티

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

프로필 이미지
승부사1
2018-09-27 20:34:15
175
글번호 122277
답변완료
아래의 수식에서 기준선을 제외하고 스토캐스틱 20,12,12 골든크로스 발생시 매도청산, 매수진입 스토캐스틱 20,12,12 데드크로스 발생시 매수청산, 매도진입 으로 수정하고 싶습니다. 부탁 드리겠습니다. - 아 래 - Input : 당일누적수익틱수(20),당일누적손실틱수(20),P(120); input : starttime(090000),endtime(153000); VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false); if (sdate != sdate[1] and stime >= endtime) or (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 != sdate[1] and stime >= starttime) or (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; var1 = (highest(H,P)+lowest(L,P))/2; if Tcond == true and Xcond == false then { if crossup(c,var1) Then buy(); if CrossDown(c,var1) 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-09-28 10:55:39

안녕하세요 예스스탁입니다. Input : 당일누적수익틱수(20),당일누적손실틱수(20),P(120); input : starttime(090000),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 != sdate[1] and stime >= endtime) or (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 != sdate[1] and stime >= starttime) or (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 님이 쓴 글입니다. > 제목 : 스토캐스틱 수식 수정 부탁드립니다. > 아래의 수식에서 기준선을 제외하고 스토캐스틱 20,12,12 골든크로스 발생시 매도청산, 매수진입 스토캐스틱 20,12,12 데드크로스 발생시 매수청산, 매도진입 으로 수정하고 싶습니다. 부탁 드리겠습니다. - 아 래 - Input : 당일누적수익틱수(20),당일누적손실틱수(20),P(120); input : starttime(090000),endtime(153000); VARS: Tcond(false),N1(0),dayPl(0),당일누적수익(0),당일누적손실(0),Xcond(false); if (sdate != sdate[1] and stime >= endtime) or (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 != sdate[1] and stime >= starttime) or (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; var1 = (highest(H,P)+lowest(L,P))/2; if Tcond == true and Xcond == false then { if crossup(c,var1) Then buy(); if CrossDown(c,var1) 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)); }