커뮤니티

문의드립니다.

프로필 이미지
잡다백수
2018-01-25 09:07:09
516
글번호 116032
답변완료
도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 시스템 TS코드인데 예스코드로 수정부탁드립니다. inputs: SEC2( Close of Data2 ), SEC3( Close of Data3 ), STD(25), OB(90), D1(3), D2(25), DIVDAYS(50), IMDAYS(50), CR3CR(.8), DIVCRIT(75), LAG(3), STP(1.5), EXIT(11); variables: MA1(0),IM2(0),DIVSHORT(0), STOC(0),OS(0),LR(0), DIV2(0),RS1(0),RS2(0), b2(0),PRED2(0),a2(0), RS3(0),CR2(0),CR3(0); OS = 100-OB ; DIVSHORT = 100 - DIVCRIT ; stoc = ( Average( Close - Lowest( Low, STD ), 3 ) * 100 ) / ( Average( Highest( High, STD )- Lowest( Low, STD ), 3 ) ) ; MA1 = Average( Close, D2 ) ; LR = 100 * LinearRegSLOPE( Close, D2 ) ; //REGRESSION IF CurrentBar > D1 + D2 then begin RS1 = (Close / Close[D1] - 1 ) * 100 ; RS2 = ( SEC2 / SEC2[D1] - 1 ) * 100 ; RS3 = ( SEC3 / SEC3[D1] - 1 ) * 100 ; CR2 = CorrelationMK( RS1, RS2, DIVDAYS ) ; CR3 = CorrelationMK( RS1, RS3, DIVDAYS ) ; b2 = CR2 * StandardDev( RS1, DIVDAYS, 1 ) / ( StandardDev( RS2, DIVDAYS, 1 ) + .001 ) ; a2 = Average( RS1, DIVDAYS ) - b2 * Average( RS2, DIVDAYS ) ; PRED2 = b2 * RS2 + a2 ; DIV2 = PRED2 - RS1 ; end ; IM2 = ( Average( DIV2 - Lowest( DIV2, IMDAYS ), 2 ) * 100 ) / ( Average( Highest( DIV2, IMDAYS ) - Lowest( DIV2, IMDAYS ), 2 ) + .01 ) ; if CurrentBar > DIVDAYS + D1 + IMDAYS then begin //BUY if IM2[LAG] > DIVCRIT and IM2 < IM2[LAG] and IM2 > DIVSHORT and CR3 < CR3CR and ( LR >= LR[1] or Close > MA1 ) then Buy ("DIVJPY") this bar at Close ; //SHORT if IM2[LAG] < DIVSHORT and IM2>IM2[LAG] and IM2<DIVCRIT and CR3 < CR3CR and (LR <= LR[1] or Close < MA1 ) then SellShort ("NDIVJPY") this bar at Close ; end ; //EXIT if BarsSinceEntry > 3 and Close < Close[BarsSinceEntry] * ( 1 - STP / 100 ) and STOC > OS then Sell ("STOP") next bar at Market ; IF BarsSinceEntry > 7 and Close < Highest( Close, BarsSinceEntry ) * ( 1 - STP / 100 ) then Sell ("TRAIL") next bar at Market ; IF BarsSinceEntry > 3 and Close > Close[BarsSinceEntry] * ( 1 + STP / 100 ) and STOC < OB then BuyToCover ("INITIAL STOP") next bar at Market ; IF BarsSinceEntry > 7 and Close > Lowest( Close,BarsSinceEntry ) * ( 1 + STP / 100 ) then BuyToCover ("TRAIL COVER") next bar at Market ; If BarsSinceEntry >= EXIT then begin Sell ("TIME") all shares this bar at close ; BuyToCover ("TIMEX") all shares this bar at close ; end ;
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-01-25 11:21:05

안녕하세요 예스스탁입니다. input : STDP(25), OB(90), D1(3), D2(25), DIVDAYS(50), IMDAYS(50), CR3CR(.8), DIVCRIT(75), LAG(3), STP(1.5), EXIT(11); var : MA1(0),IM2(0),DIVSHORT(0), STOC(0),OS(0), LR(0), DIV2(0),RS1(0),RS2(0), b2(0), PRED2(0),a2(0), RS3(0),CR2(0),CR3(0); var : SEC2(0,data2),SEC3(0,data3); SEC2 = data2(c); SEC3 = data3(c); OS = 100-OB ; DIVSHORT = 100 - DIVCRIT ; stoc = data1(( ma( Close -Lowest( Low, STDP ), 3 ) * 100 ) / ( ma( Highest( High, STDP )-Lowest( Low, STDP ), 3 ) ) ); MA1 = data1(ma( Close, D2 )); LR = data1(100 * LRS( Close, D2 )) ; //REGRESSION IF CurrentBar > D1 + D2 then begin RS1 = data1((Close / Close[D1] - 1 ) * 100); RS2 = ( SEC2 / SEC2[D1] - 1 ) * 100 ; RS3 = ( SEC3 / SEC3[D1] - 1 ) * 100 ; CR2 = data1(CorrelationMK( RS1, RS2, DIVDAYS )); CR3 = data1(CorrelationMK( RS1, RS3, DIVDAYS )) ; b2 = data1(CR2 * STD( RS1, DIVDAYS) / ( STD( RS2, DIVDAYS) + .001 )) ; a2 = data1(ma( RS1, DIVDAYS ) - b2 * ma( RS2, DIVDAYS )); PRED2 = b2 * RS2 + a2 ; DIV2 = PRED2 - RS1 ; end ; IM2 = data1(( ma( DIV2 -Lowest( DIV2, IMDAYS ), 2 ) * 100 ) / ( ma( Highest( DIV2, IMDAYS ) -Lowest( DIV2, IMDAYS ), 2 ) + .01 )); if CurrentBar > DIVDAYS + D1 + IMDAYS then begin //BUY if IM2[LAG] > DIVCRIT and IM2 < IM2[LAG] and IM2 > DIVSHORT and CR3 < CR3CR and ( LR >= LR[1] or Close > MA1 ) then Buy("DIVJPY",OnClose); //SHORT if IM2[LAG] < DIVSHORT and IM2>IM2[LAG] and IM2<DIVCRIT and CR3 < CR3CR and (LR <= LR[1] or Close < MA1 ) then Sell("NDIVJPY",OnClose); end; //EXIT if BarsSinceEntry > 3 and Close < Close[BarsSinceEntry] * ( 1 - STP / 100 ) and STOC > OS then ExitLong("STOP",AtMarket); IF BarsSinceEntry > 7 and Close < Highest( Close, BarsSinceEntry ) * ( 1 - STP / 100 ) then ExitLong("TRAIL",AtMarket); IF BarsSinceEntry > 3 and Close > Close[BarsSinceEntry] * ( 1 + STP / 100 ) and STOC < OB then ExitShort("INITIAL STOP",AtMarket); IF BarsSinceEntry > 7 and Close > Lowest( Close,BarsSinceEntry ) * ( 1 + STP / 100 ) then ExitShort("TRAIL COVER",AtMarket); If BarsSinceEntry >= EXIT then begin ExitLong("TIME",OnClose); ExitShort("TIMEX",OnClose); end ; 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 시스템 TS코드인데 예스코드로 수정부탁드립니다. inputs: SEC2( Close of Data2 ), SEC3( Close of Data3 ), STD(25), OB(90), D1(3), D2(25), DIVDAYS(50), IMDAYS(50), CR3CR(.8), DIVCRIT(75), LAG(3), STP(1.5), EXIT(11); variables: MA1(0),IM2(0),DIVSHORT(0), STOC(0),OS(0),LR(0), DIV2(0),RS1(0),RS2(0), b2(0),PRED2(0),a2(0), RS3(0),CR2(0),CR3(0); OS = 100-OB ; DIVSHORT = 100 - DIVCRIT ; stoc = ( Average( Close - Lowest( Low, STD ), 3 ) * 100 ) / ( Average( Highest( High, STD )- Lowest( Low, STD ), 3 ) ) ; MA1 = Average( Close, D2 ) ; LR = 100 * LinearRegSLOPE( Close, D2 ) ; //REGRESSION IF CurrentBar > D1 + D2 then begin RS1 = (Close / Close[D1] - 1 ) * 100 ; RS2 = ( SEC2 / SEC2[D1] - 1 ) * 100 ; RS3 = ( SEC3 / SEC3[D1] - 1 ) * 100 ; CR2 = CorrelationMK( RS1, RS2, DIVDAYS ) ; CR3 = CorrelationMK( RS1, RS3, DIVDAYS ) ; b2 = CR2 * StandardDev( RS1, DIVDAYS, 1 ) / ( StandardDev( RS2, DIVDAYS, 1 ) + .001 ) ; a2 = Average( RS1, DIVDAYS ) - b2 * Average( RS2, DIVDAYS ) ; PRED2 = b2 * RS2 + a2 ; DIV2 = PRED2 - RS1 ; end ; IM2 = ( Average( DIV2 - Lowest( DIV2, IMDAYS ), 2 ) * 100 ) / ( Average( Highest( DIV2, IMDAYS ) - Lowest( DIV2, IMDAYS ), 2 ) + .01 ) ; if CurrentBar > DIVDAYS + D1 + IMDAYS then begin //BUY if IM2[LAG] > DIVCRIT and IM2 < IM2[LAG] and IM2 > DIVSHORT and CR3 < CR3CR and ( LR >= LR[1] or Close > MA1 ) then Buy ("DIVJPY") this bar at Close ; //SHORT if IM2[LAG] < DIVSHORT and IM2>IM2[LAG] and IM2<DIVCRIT and CR3 < CR3CR and (LR <= LR[1] or Close < MA1 ) then SellShort ("NDIVJPY") this bar at Close ; end ; //EXIT if BarsSinceEntry > 3 and Close < Close[BarsSinceEntry] * ( 1 - STP / 100 ) and STOC > OS then Sell ("STOP") next bar at Market ; IF BarsSinceEntry > 7 and Close < Highest( Close, BarsSinceEntry ) * ( 1 - STP / 100 ) then Sell ("TRAIL") next bar at Market ; IF BarsSinceEntry > 3 and Close > Close[BarsSinceEntry] * ( 1 + STP / 100 ) and STOC < OB then BuyToCover ("INITIAL STOP") next bar at Market ; IF BarsSinceEntry > 7 and Close > Lowest( Close,BarsSinceEntry ) * ( 1 + STP / 100 ) then BuyToCover ("TRAIL COVER") next bar at Market ; If BarsSinceEntry >= EXIT then begin Sell ("TIME") all shares this bar at close ; BuyToCover ("TIMEX") all shares this bar at close ; end ;