커뮤니티

문의드립니다.

프로필 이미지
잡다백수
2018-03-02 09:05:01
300
글번호 117067
답변완료
도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 기타 시뮬레이션에 적용할 수 있는 코드로 코딩 변환 부탁드립니다. 중간에 업데이트가 금지어라고 나와서 영어 업데이트는 한글로 바꾸었습니다. 적당한 것으로 바꿔주심 됩니다. Function: TL_Zigzag inputs: Price( numericseries ), RetraceMethod( numericsimple ), { 1 = percent, 2 = number } retrace( numericsimple ), LineColor( numericsimple ), LineWidth( numericsimple ), PlotLine( truefalse ) ; variables: NewSwingPrice( 0 ), SwingPrice( Price ), { used as a convenient 2-element array } SwingDate( Date ), { used as a convenient 2-element array } SwingTime( Time ), { used as a convenient 2-element array } TLDir( 0 ), { TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + retrace * .01 ), RetraceFctrDn( 1 - retrace * .01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ), ZigZagTrend( 0 ) ; { Candidate swings are just confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } NewSwingPrice = SwingHigh( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if ( RetraceMethod = 1 and TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp ) or ( RetraceMethod = 2 and TLDir <= 0 and NewSwingPrice >= SwingPrice + Retrace ) then { prepare to add new up TL } begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir = 1 and NewSwingPrice >= SwingPrice then { prepare to 업데이트 prev up TL } begin SaveSwing = true ; 업데이트TL = true ; end ; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if (RetraceMethod = 1 and TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn) or (RetraceMethod = 2 and TLDir >= 0 and NewSwingPrice <= SwingPrice - retrace ) then { prepare to add new dn TL } begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir = -1 and NewSwingPrice <= SwingPrice then { prepare to 업데이트 prev dn TL } begin SaveSwing = true; 업데이트TL = true ; end ; end ; end ; if SaveSwing then { save new swing and reset SaveSwing } begin SwingPrice = NewSwingPrice ; SwingDate = Date[1] ; SwingTime = Time[1] ; SaveSwing = false ; end ; if AddTL then { add new TL and reset AddTL } begin if Plotline then begin TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, LineWidth ) ; TL_SetColor( TLRef, LineColor ) ; end ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin if PlotLine then TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; TL_ZigZag = SwingPrice ; Indicator: Zigzag Trend inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin print( SwingPrice, " ", SwingPrice[1] ) ; ZigZagTrend = 1 ; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1 ; end ; Plot1( ZigZagTrend, “Zig” ) ; print( date, " ", time, " ", SwingPrice, " ", SwingPrice[1], " ", zigZagtrend ) ; Strategy: Zigzag Trend Strat inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1; end; if ZigZagTrend =1 and ZigZagTrend[1]= -1 then buy next bar at market else if ZigZagTrend =-1 and ZigZagTrend[1]= 1 then sellshort next bar at market ; Function: CMO inputs: Length( numericsimple ); variables: CMO_1(0), CMO_2(0), CMO_Final(0); if C > C[1] then begin CMO_1 = C - C[1] ; CMO_2 = 0 ; end else begin CMO_1 = 0 ; CMO_2 = C[1] - C ; end; Value1 = Summation( CMO_1, Length ); Value2 = Summation( CMO_2, Length ) ; CMO = ( Value1 - Value2 )/( Value1 + Value2 ) * 50 + 50 ; Indicator: CMO inputs: Length( 14 ) ; if CurrentBar > Length then Plot1( CMO( Length ), “CMO” ) ; Plot2( 0, “Zero” ) ; print( plot1 ) ;
시스템
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2018-03-02 11:22:29

안녕하세요 예스스탁입니다. 1 사용자함수 상용자함수명 : TL_ZigZag 반환갑형 : 숫자형 inputs: Price( numericseries ), RetraceMethod( numericsimple ), #{ 1 = percent, 2 = number } retrace( numericsimple ), LineColor( numericsimple ), LineWidth( numericsimple ), PlotLine( numericseries ) ; variables: NewSwingPrice( 0 ), SwingPrice(0), #{ used as a convenient 2-element array } SwingDate(0), #{ used as a convenient 2-element array } SwingTime(0), #{ used as a convenient 2-element array } TLDir( 0 ), #{ TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + retrace * .01 ), RetraceFctrDn( 1 - retrace * .01 ), SaveSwing( false ), AddTL( false ), up_dateTL( false ), TLRef( 0 ), ZigZagTrend( 0 ) ; #{ Candidate swings are just confirmed, 3-bar (Str=1), SwingHi’s andSwingLo’s } NewSwingPrice = SwingHigh(1, Price, 1, 2,4); if NewSwingPrice <> -1 then begin if ( RetraceMethod == 1 and TLDir <= 0 and NewSwingPrice >=SwingPrice * RetraceFctrUp ) or ( RetraceMethod == 2 and TLDir <=0 and NewSwingPrice >= SwingPrice + Retrace ) then #{ prepare to add new up TL } begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir == 1 and NewSwingPrice >= SwingPrice then #{ prepare to up_date prev up TL } begin SaveSwing = true ; up_dateTL = true ; end ; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if (RetraceMethod == 1 and TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn) or (RetraceMethod == 2 and TLDir >= 0 and NewSwingPrice <= SwingPrice - retrace ) then #{ prepare to add new dn TL } begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir == -1 and NewSwingPrice <= SwingPrice then #{ prepare to up_date prev dn TL } begin SaveSwing = true; up_dateTL = true ; end ; end ; end ; if SaveSwing then #{ save new swing and reset SaveSwing } begin SwingPrice = NewSwingPrice ; SwingDate = Date[1] ; SwingTime = Time[1] ; SaveSwing = false ; end ; if AddTL then #{ add new TL and reset AddTL } begin if Plotline == 1 then begin TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, LineWidth ) ; TL_SetColor( TLRef, LineColor ) ; end ; AddTL = false ; end else if up_dateTL then #{ up_date prev TL and reset up_dateTL } begin if PlotLine == 1 then TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; up_dateTL = false ; end ; TL_ZigZag = SwingPrice ; 2 지표 inputs: RetraceMethod( 1 ),# { 1 = percent, 2 = number } retrace( 0.75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( 1 ) ; variables: Price(0), SwingPrice( Price ), #{ used as a convenient 2-element array } ZigZagTrend( 0 ) ; #{ Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s andSwingLo’s } Price = Close; SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor,LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1 ; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1 ; end ; Plot1( ZigZagTrend,"Zig") ; 3 CMO는 기본지표로 제공되고 있는 내용입니다. 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 기타 시뮬레이션에 적용할 수 있는 코드로 코딩 변환 부탁드립니다. 중간에 업데이트가 금지어라고 나와서 영어 업데이트는 한글로 바꾸었습니다. 적당한 것으로 바꿔주심 됩니다. Function: TL_Zigzag inputs: Price( numericseries ), RetraceMethod( numericsimple ), { 1 = percent, 2 = number } retrace( numericsimple ), LineColor( numericsimple ), LineWidth( numericsimple ), PlotLine( truefalse ) ; variables: NewSwingPrice( 0 ), SwingPrice( Price ), { used as a convenient 2-element array } SwingDate( Date ), { used as a convenient 2-element array } SwingTime( Time ), { used as a convenient 2-element array } TLDir( 0 ), { TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + retrace * .01 ), RetraceFctrDn( 1 - retrace * .01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ), ZigZagTrend( 0 ) ; { Candidate swings are just confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } NewSwingPrice = SwingHigh( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if ( RetraceMethod = 1 and TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp ) or ( RetraceMethod = 2 and TLDir <= 0 and NewSwingPrice >= SwingPrice + Retrace ) then { prepare to add new up TL } begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir = 1 and NewSwingPrice >= SwingPrice then { prepare to 업데이트 prev up TL } begin SaveSwing = true ; 업데이트TL = true ; end ; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if (RetraceMethod = 1 and TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn) or (RetraceMethod = 2 and TLDir >= 0 and NewSwingPrice <= SwingPrice - retrace ) then { prepare to add new dn TL } begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir = -1 and NewSwingPrice <= SwingPrice then { prepare to 업데이트 prev dn TL } begin SaveSwing = true; 업데이트TL = true ; end ; end ; end ; if SaveSwing then { save new swing and reset SaveSwing } begin SwingPrice = NewSwingPrice ; SwingDate = Date[1] ; SwingTime = Time[1] ; SaveSwing = false ; end ; if AddTL then { add new TL and reset AddTL } begin if Plotline then begin TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, LineWidth ) ; TL_SetColor( TLRef, LineColor ) ; end ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin if PlotLine then TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; TL_ZigZag = SwingPrice ; Indicator: Zigzag Trend inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin print( SwingPrice, " ", SwingPrice[1] ) ; ZigZagTrend = 1 ; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1 ; end ; Plot1( ZigZagTrend, “Zig” ) ; print( date, " ", time, " ", SwingPrice, " ", SwingPrice[1], " ", zigZagtrend ) ; Strategy: Zigzag Trend Strat inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1; end; if ZigZagTrend =1 and ZigZagTrend[1]= -1 then buy next bar at market else if ZigZagTrend =-1 and ZigZagTrend[1]= 1 then sellshort next bar at market ; Function: CMO inputs: Length( numericsimple ); variables: CMO_1(0), CMO_2(0), CMO_Final(0); if C > C[1] then begin CMO_1 = C - C[1] ; CMO_2 = 0 ; end else begin CMO_1 = 0 ; CMO_2 = C[1] - C ; end; Value1 = Summation( CMO_1, Length ); Value2 = Summation( CMO_2, Length ) ; CMO = ( Value1 - Value2 )/( Value1 + Value2 ) * 50 + 50 ; Indicator: CMO inputs: Length( 14 ) ; if CurrentBar > Length then Plot1( CMO( Length ), “CMO” ) ; Plot2( 0, “Zero” ) ; print( plot1 ) ;
프로필 이미지

잡다백수

2018-03-02 12:04:41

코딩감사합니다. 아래에 있는 저 전략은 작동하지 않는 코딩인지요. Zigzag Trend Strat > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의드립니다. > 안녕하세요 예스스탁입니다. 1 사용자함수 상용자함수명 : TL_ZigZag 반환갑형 : 숫자형 inputs: Price( numericseries ), RetraceMethod( numericsimple ), #{ 1 = percent, 2 = number } retrace( numericsimple ), LineColor( numericsimple ), LineWidth( numericsimple ), PlotLine( numericseries ) ; variables: NewSwingPrice( 0 ), SwingPrice(0), #{ used as a convenient 2-element array } SwingDate(0), #{ used as a convenient 2-element array } SwingTime(0), #{ used as a convenient 2-element array } TLDir( 0 ), #{ TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + retrace * .01 ), RetraceFctrDn( 1 - retrace * .01 ), SaveSwing( false ), AddTL( false ), up_dateTL( false ), TLRef( 0 ), ZigZagTrend( 0 ) ; #{ Candidate swings are just confirmed, 3-bar (Str=1), SwingHi’s andSwingLo’s } NewSwingPrice = SwingHigh(1, Price, 1, 2,4); if NewSwingPrice <> -1 then begin if ( RetraceMethod == 1 and TLDir <= 0 and NewSwingPrice >=SwingPrice * RetraceFctrUp ) or ( RetraceMethod == 2 and TLDir <=0 and NewSwingPrice >= SwingPrice + Retrace ) then #{ prepare to add new up TL } begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir == 1 and NewSwingPrice >= SwingPrice then #{ prepare to up_date prev up TL } begin SaveSwing = true ; up_dateTL = true ; end ; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if (RetraceMethod == 1 and TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn) or (RetraceMethod == 2 and TLDir >= 0 and NewSwingPrice <= SwingPrice - retrace ) then #{ prepare to add new dn TL } begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir == -1 and NewSwingPrice <= SwingPrice then #{ prepare to up_date prev dn TL } begin SaveSwing = true; up_dateTL = true ; end ; end ; end ; if SaveSwing then #{ save new swing and reset SaveSwing } begin SwingPrice = NewSwingPrice ; SwingDate = Date[1] ; SwingTime = Time[1] ; SaveSwing = false ; end ; if AddTL then #{ add new TL and reset AddTL } begin if Plotline == 1 then begin TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, LineWidth ) ; TL_SetColor( TLRef, LineColor ) ; end ; AddTL = false ; end else if up_dateTL then #{ up_date prev TL and reset up_dateTL } begin if PlotLine == 1 then TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; up_dateTL = false ; end ; TL_ZigZag = SwingPrice ; 2 지표 inputs: RetraceMethod( 1 ),# { 1 = percent, 2 = number } retrace( 0.75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( 1 ) ; variables: Price(0), SwingPrice( Price ), #{ used as a convenient 2-element array } ZigZagTrend( 0 ) ; #{ Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s andSwingLo’s } Price = Close; SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor,LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1 ; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1 ; end ; Plot1( ZigZagTrend,"Zig") ; 3 CMO는 기본지표로 제공되고 있는 내용입니다. 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 기타 시뮬레이션에 적용할 수 있는 코드로 코딩 변환 부탁드립니다. 중간에 업데이트가 금지어라고 나와서 영어 업데이트는 한글로 바꾸었습니다. 적당한 것으로 바꿔주심 됩니다. Function: TL_Zigzag inputs: Price( numericseries ), RetraceMethod( numericsimple ), { 1 = percent, 2 = number } retrace( numericsimple ), LineColor( numericsimple ), LineWidth( numericsimple ), PlotLine( truefalse ) ; variables: NewSwingPrice( 0 ), SwingPrice( Price ), { used as a convenient 2-element array } SwingDate( Date ), { used as a convenient 2-element array } SwingTime( Time ), { used as a convenient 2-element array } TLDir( 0 ), { TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + retrace * .01 ), RetraceFctrDn( 1 - retrace * .01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ), ZigZagTrend( 0 ) ; { Candidate swings are just confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } NewSwingPrice = SwingHigh( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if ( RetraceMethod = 1 and TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp ) or ( RetraceMethod = 2 and TLDir <= 0 and NewSwingPrice >= SwingPrice + Retrace ) then { prepare to add new up TL } begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir = 1 and NewSwingPrice >= SwingPrice then { prepare to 업데이트 prev up TL } begin SaveSwing = true ; 업데이트TL = true ; end ; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if (RetraceMethod = 1 and TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn) or (RetraceMethod = 2 and TLDir >= 0 and NewSwingPrice <= SwingPrice - retrace ) then { prepare to add new dn TL } begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir = -1 and NewSwingPrice <= SwingPrice then { prepare to 업데이트 prev dn TL } begin SaveSwing = true; 업데이트TL = true ; end ; end ; end ; if SaveSwing then { save new swing and reset SaveSwing } begin SwingPrice = NewSwingPrice ; SwingDate = Date[1] ; SwingTime = Time[1] ; SaveSwing = false ; end ; if AddTL then { add new TL and reset AddTL } begin if Plotline then begin TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, LineWidth ) ; TL_SetColor( TLRef, LineColor ) ; end ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin if PlotLine then TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; TL_ZigZag = SwingPrice ; Indicator: Zigzag Trend inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin print( SwingPrice, " ", SwingPrice[1] ) ; ZigZagTrend = 1 ; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1 ; end ; Plot1( ZigZagTrend, “Zig” ) ; print( date, " ", time, " ", SwingPrice, " ", SwingPrice[1], " ", zigZagtrend ) ; Strategy: Zigzag Trend Strat inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1; end; if ZigZagTrend =1 and ZigZagTrend[1]= -1 then buy next bar at market else if ZigZagTrend =-1 and ZigZagTrend[1]= 1 then sellshort next bar at market ; Function: CMO inputs: Length( numericsimple ); variables: CMO_1(0), CMO_2(0), CMO_Final(0); if C > C[1] then begin CMO_1 = C - C[1] ; CMO_2 = 0 ; end else begin CMO_1 = 0 ; CMO_2 = C[1] - C ; end; Value1 = Summation( CMO_1, Length ); Value2 = Summation( CMO_2, Length ) ; CMO = ( Value1 - Value2 )/( Value1 + Value2 ) * 50 + 50 ; Indicator: CMO inputs: Length( 14 ) ; if CurrentBar > Length then Plot1( CMO( Length ), “CMO” ) ; Plot2( 0, “Zero” ) ; print( plot1 ) ;
프로필 이미지

예스스탁 예스스탁 답변

2018-03-02 12:40:30

안녕하세요 예스스탁입니다. 식에 누락이 있었습니다. 시스템 식입니다. inputs: RetraceMethod( 1 ), #{ 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( 1 ) ; variables: Price(0), SwingPrice( Price ),# { used as a convenient 2-element array } ZigZagTrend( 0 ) ; #{ Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’sand SwingLo’s } Price = Close; SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor,LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1; end; if ZigZagTrend ==1 and ZigZagTrend[1] == -1 then buy("b",AtMarket); if ZigZagTrend ==-1 and ZigZagTrend[1]== 1 then sell("s",AtMarket); 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : Re : Re : 문의드립니다. > 코딩감사합니다. 아래에 있는 저 전략은 작동하지 않는 코딩인지요. Zigzag Trend Strat > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의드립니다. > 안녕하세요 예스스탁입니다. 1 사용자함수 상용자함수명 : TL_ZigZag 반환갑형 : 숫자형 inputs: Price( numericseries ), RetraceMethod( numericsimple ), #{ 1 = percent, 2 = number } retrace( numericsimple ), LineColor( numericsimple ), LineWidth( numericsimple ), PlotLine( numericseries ) ; variables: NewSwingPrice( 0 ), SwingPrice(0), #{ used as a convenient 2-element array } SwingDate(0), #{ used as a convenient 2-element array } SwingTime(0), #{ used as a convenient 2-element array } TLDir( 0 ), #{ TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + retrace * .01 ), RetraceFctrDn( 1 - retrace * .01 ), SaveSwing( false ), AddTL( false ), up_dateTL( false ), TLRef( 0 ), ZigZagTrend( 0 ) ; #{ Candidate swings are just confirmed, 3-bar (Str=1), SwingHi’s andSwingLo’s } NewSwingPrice = SwingHigh(1, Price, 1, 2,4); if NewSwingPrice <> -1 then begin if ( RetraceMethod == 1 and TLDir <= 0 and NewSwingPrice >=SwingPrice * RetraceFctrUp ) or ( RetraceMethod == 2 and TLDir <=0 and NewSwingPrice >= SwingPrice + Retrace ) then #{ prepare to add new up TL } begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir == 1 and NewSwingPrice >= SwingPrice then #{ prepare to up_date prev up TL } begin SaveSwing = true ; up_dateTL = true ; end ; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if (RetraceMethod == 1 and TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn) or (RetraceMethod == 2 and TLDir >= 0 and NewSwingPrice <= SwingPrice - retrace ) then #{ prepare to add new dn TL } begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir == -1 and NewSwingPrice <= SwingPrice then #{ prepare to up_date prev dn TL } begin SaveSwing = true; up_dateTL = true ; end ; end ; end ; if SaveSwing then #{ save new swing and reset SaveSwing } begin SwingPrice = NewSwingPrice ; SwingDate = Date[1] ; SwingTime = Time[1] ; SaveSwing = false ; end ; if AddTL then #{ add new TL and reset AddTL } begin if Plotline == 1 then begin TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, LineWidth ) ; TL_SetColor( TLRef, LineColor ) ; end ; AddTL = false ; end else if up_dateTL then #{ up_date prev TL and reset up_dateTL } begin if PlotLine == 1 then TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; up_dateTL = false ; end ; TL_ZigZag = SwingPrice ; 2 지표 inputs: RetraceMethod( 1 ),# { 1 = percent, 2 = number } retrace( 0.75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( 1 ) ; variables: Price(0), SwingPrice( Price ), #{ used as a convenient 2-element array } ZigZagTrend( 0 ) ; #{ Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s andSwingLo’s } Price = Close; SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor,LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1 ; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1 ; end ; Plot1( ZigZagTrend,"Zig") ; 3 CMO는 기본지표로 제공되고 있는 내용입니다. 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 기타 시뮬레이션에 적용할 수 있는 코드로 코딩 변환 부탁드립니다. 중간에 업데이트가 금지어라고 나와서 영어 업데이트는 한글로 바꾸었습니다. 적당한 것으로 바꿔주심 됩니다. Function: TL_Zigzag inputs: Price( numericseries ), RetraceMethod( numericsimple ), { 1 = percent, 2 = number } retrace( numericsimple ), LineColor( numericsimple ), LineWidth( numericsimple ), PlotLine( truefalse ) ; variables: NewSwingPrice( 0 ), SwingPrice( Price ), { used as a convenient 2-element array } SwingDate( Date ), { used as a convenient 2-element array } SwingTime( Time ), { used as a convenient 2-element array } TLDir( 0 ), { TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + retrace * .01 ), RetraceFctrDn( 1 - retrace * .01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ), ZigZagTrend( 0 ) ; { Candidate swings are just confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } NewSwingPrice = SwingHigh( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if ( RetraceMethod = 1 and TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp ) or ( RetraceMethod = 2 and TLDir <= 0 and NewSwingPrice >= SwingPrice + Retrace ) then { prepare to add new up TL } begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir = 1 and NewSwingPrice >= SwingPrice then { prepare to 업데이트 prev up TL } begin SaveSwing = true ; 업데이트TL = true ; end ; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2 ) ; if NewSwingPrice <> -1 then begin if (RetraceMethod = 1 and TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn) or (RetraceMethod = 2 and TLDir >= 0 and NewSwingPrice <= SwingPrice - retrace ) then { prepare to add new dn TL } begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir = -1 and NewSwingPrice <= SwingPrice then { prepare to 업데이트 prev dn TL } begin SaveSwing = true; 업데이트TL = true ; end ; end ; end ; if SaveSwing then { save new swing and reset SaveSwing } begin SwingPrice = NewSwingPrice ; SwingDate = Date[1] ; SwingTime = Time[1] ; SaveSwing = false ; end ; if AddTL then { add new TL and reset AddTL } begin if Plotline then begin TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, LineWidth ) ; TL_SetColor( TLRef, LineColor ) ; end ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin if PlotLine then TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; TL_ZigZag = SwingPrice ; Indicator: Zigzag Trend inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin print( SwingPrice, " ", SwingPrice[1] ) ; ZigZagTrend = 1 ; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1 ; end ; Plot1( ZigZagTrend, “Zig” ) ; print( date, " ", time, " ", SwingPrice, " ", SwingPrice[1], " ", zigZagtrend ) ; Strategy: Zigzag Trend Strat inputs: Price( Close ), RetraceMethod( 1 ), { 1 = percent, 2 = number } retrace( .75 ), LineColor( Yellow ), LineWidth( 1 ), PlotLine( true ) ; variables: SwingPrice( Price ), { used as a convenient 2-element array } ZigZagTrend( 0 ) ; { Candidate swings are just-confirmed, 3-bar (Str=1), SwingHi’s and SwingLo’s } SwingPrice = TL_ZigZag( Price, RetraceMethod, retrace, LineColor, LineWidth, PlotLine ) ; if SwingPrice > SwingPrice[1] then begin ZigZagTrend = 1; end else if SwingPrice < SwingPrice[1] then begin ZigZagTrend = -1; end; if ZigZagTrend =1 and ZigZagTrend[1]= -1 then buy next bar at market else if ZigZagTrend =-1 and ZigZagTrend[1]= 1 then sellshort next bar at market ; Function: CMO inputs: Length( numericsimple ); variables: CMO_1(0), CMO_2(0), CMO_Final(0); if C > C[1] then begin CMO_1 = C - C[1] ; CMO_2 = 0 ; end else begin CMO_1 = 0 ; CMO_2 = C[1] - C ; end; Value1 = Summation( CMO_1, Length ); Value2 = Summation( CMO_2, Length ) ; CMO = ( Value1 - Value2 )/( Value1 + Value2 ) * 50 + 50 ; Indicator: CMO inputs: Length( 14 ) ; if CurrentBar > Length then Plot1( CMO( Length ), “CMO” ) ; Plot2( 0, “Zero” ) ; print( plot1 ) ;