커뮤니티

문의드립니다.

프로필 이미지
잡다백수
2018-03-30 11:29:31
535
글번호 117817
답변완료
도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 코딩 변환 부탁드립니다. 쓰기금지어 업데이트는 다 한글로 바꿨습니다. 이거 그런데 일목균형표처럼 차트 오른쪽 란 좀 넓혀서 보게 만들 수 있나요? Function: TimeForecast inputs: PresentDate( NumericSimple ) , PresentTime( NumericSimple ) , DaysAhead( NumericSimple ) , HoursAhead( NumericSimple ) , MinutesAhead( NumericSimple ) , oFutureDate( NumericRef ) , oFutureTime( NumericRef ) ; variables: DateTime( 0 ) , FutureDateTime( 0 ) ; DateTime = DateToJulian( PresentDate ) + ( TimeToMinutes( PresentTime ) / 60 / 24 ) ; FutureDateTime = DateTime + DaysAhead + ( HoursAhead / 24 ) + ( MinutesAhead / 60 / 24 ) ; if DayOfWeekFromDateTime( FutureDateTime ) = Saturday then FutureDateTime = FutureDateTime - 1 else if DayOfWeekFromDateTime( FutureDateTime ) = Sunday then FutureDateTime = FutureDateTime + 1 ; oFutureDate = JulianToDate( IntPortion( FutureDateTime ) ) ; oFutureTime = MinutesToTime( FracPortion( FutureDateTime ) * 60 * 24 ) ; TimeForecast = FutureDateTime ; Function: FibTimeForecasts inputs: PivotValues[ MaxSize1, MaxSize2 ]( NumericArray ), { ZigZagPivots[Row1-6, 1] = price } { ZigZagPivots[Row1-6, 2] = date } FibDateTime[MaxSize3]( NumericArrayRef ) ; variables: Counter( 0 ), FirstCall( true ) ; arrays: FibNumbers[5]( 0 ), FibSwingRange[5]( 0 ) ; if FirstCall then begin FibNumbers[1] = 0.382 ; FibNumbers[2] = 0.5 ; FibNumbers[3] = 0.618 ; FibNumbers[4] = 0.707 ; FibNumbers[5] = 1 ; FirstCall = false ; end ; for Counter = 1 to 5 begin FibSwingRange[Counter] = PivotValues[ Counter + 1, 2 ] - PivotValues[ Counter, 2] ; { $f$9 through $f$13 } end ; for Counter = 1 to 5 begin FibDateTime[Counter] = FibNumbers[Counter] * FibSwingRange[5] + PivotValues[6, 2] ; end ; for Counter = 6 to 10 begin FibDateTime[Counter] = FibNumbers[ Counter - 5 ] * FibSwingRange[4] + PivotValues[6, 2] ; end ; for Counter = 11 to 15 begin FibDateTime[Counter] = FibNumbers[ Counter - 10 ] * FibSwingRange[2] + PivotValues[6, 2] ; end ; for Counter = 16 to 20 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[3, 2] ) * FibNumbers[ Counter - 15 ] + PivotValues[5, 2] ; end ; for Counter = 21 to 25 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[1, 2] ) * FibNumbers[ Counter - 20 ] + PivotValues[5, 2] ; end ; FibTimeForecasts = 1 ; Indicator: SqOf9_FibTimeComment { Square of Nine portions taken from: http://www.tradestationworld.com/discussions/Topic.aspx? TOPIC_ID=8289 Fibonacci time forecasts come directly from the TASC 1992 Robert Minor article, “A Spreadsheet for Time Ratio Analysis”. The commentary features were written by Mitch Shack of TradeStation Securities, Inc. Any misinterpretations of Fibonacci and Gann are my own. Mark Mills, TradeStation Securities, Inc. } inputs: YestDate( ELDate( 8, 10, 2004 ) ), TextPlaceTime( 1200 ), TextColor( White ), LineColor( Yellow ), LineStyle_1to5(1), ForecastWidth_0to6( 4 ), PriceForecastRange( 3 ), BaseNumber( 10 ), Price( Close ), RetracePct( 5 ), ZigZagLineWidth( 1 ), TextMinMoveOffset( -5 ) ; variables: xloop( 0 ), Counter( 0 ), ColumnEnd( 0 ), HighRange( 0 ), LowRange( 0 ), Degree( “” ), ID( -1 ), DaysAhead( 0 ), HoursAhead( 0 ), MinutesAhead( 0 ), oFutureDate( 0 ), oFutureTime( 0 ), ValueSpace( 8 ), ValueSpace2( 11 ), { Print spacing } ValueSpace3( 4 ), ValueSpace4( 13 ), ValueSpace5( 14 ), YesClose( 0 ), ZeroDegrees( 1 ), FortyFiveDegrees( 2 ), NinetyDegrees( 3 ), OneThirtyFiveDegrees( 4 ), OneEightyDegrees( 5 ), TwoTwentyFiveDegrees( 6 ), TwoSeventyDegrees( 7 ), ThreeFifteenDegrees( 8 ), { Array Index Positions } DegreeSections( 8 ), FullArrayCount( 49 ), MyBaseNumber( 0 ), 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 + RetracePct * 0.01 ), RetraceFctrDn( 1 - RetracePct * 0.01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ) ; arrays: ZigZagPivots[6, 2]( 0 ), { ZigZagPivots[Row1-6, 1] = price, ZigZagPivots[Row1-6, 2] = date } FibTimeTargets[25]( 0 ), DegreeOfAngle[8, 49]( 0 ), DegreeOfAngleWord[8]( “” ) ; if CurrentBar = 1 then begin MyBaseNumber = BaseNumber * 7 ; DegreeOfAngle[ ZeroDegrees, 0 ] = BaseNumber * 2 ; DegreeOfAngle[ FortyFiveDegrees, 0 ] = BaseNumber * 3 ; DegreeOfAngle[ NinetyDegrees, 0 ] = BaseNumber * 4 ; DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] = BaseNumber * 5 ; DegreeOfAngle[ OneEightyDegrees, 0 ] = BaseNumber * 6 ; DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] = BaseNumber * 7 ; DegreeOfAngle[ TwoSeventyDegrees, 0 ] = BaseNumber * 8 ; DegreeOfAngle[ ThreeFifteenDegrees, 0 ] = BaseNumber * 9 ; Degree = “ deg” ; { the degree symbol number } DegreeOfAngleWord[ ZeroDegrees ] = “ - 0” + Degree ; DegreeOfAngleWord[ FortyFiveDegrees ] = “ - 45” + Degree ; DegreeOfAngleWord[ NinetyDegrees ] = “ - 90” + Degree ; DegreeOfAngleWord[ OneThirtyFiveDegrees ] = “ - 135” + Degree ; DegreeOfAngleWord[ OneEightyDegrees ] = “ - 180” + Degree ; DegreeOfAngleWord[ TwoTwentyFiveDegrees ] = “ - 225” + Degree ; DegreeOfAngleWord[ TwoSeventyDegrees ] = “ - 270” + Degree ; DegreeOfAngleWord[ ThreeFifteenDegrees ] = “ - 315” + Degree ; for xLoop = 1 to FullArrayCount begin DegreeOfAngle[ ZeroDegrees, xLoop ] = DegreeOfAngle[ ZeroDegrees, xloop - 1 ] + DegreeOfAngle[ ZeroDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ FortyFiveDegrees, xLoop ] = DegreeOfAngle[ FortyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ FortyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ NinetyDegrees, xLoop ] = DegreeOfAngle[ NinetyDegrees, xloop - 1 ] + DegreeOfAngle[ NinetyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneThirtyFiveDegrees, xLoop ] = DegreeOfAngle[ OneThirtyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneEightyDegrees, xLoop ] = DegreeOfAngle[ OneEightyDegrees, xloop - 1 ] + DegreeOfAngle[ OneEightyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoTwentyFiveDegrees, xLoop ] = DegreeOfAngle[ TwoTwentyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoSeventyDegrees, xLoop ] = DegreeOfAngle[ TwoSeventyDegrees, xloop - 1 ] + DegreeOfAngle[ TwoSeventyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ ThreeFifteenDegrees, xLoop ] = DegreeOfAngle[ ThreeFifteenDegrees, xloop - 1 ] + DegreeOfAngle[ ThreeFifteenDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; end ; end ; { CurrentBar = 1 } if Date <> Date[1] then YesClose = Close[1] ; { if new day get the SO9 compare number } { ZigZag Calculations } { 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 TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp 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 TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn 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 Plot1( Close ) ; { marks the point at which a leg of pivot is locked down } { push the pivot date and time into the array } { ZigZagPivots[Row1 - 6, 1] = price, ZigZagPivots[Row1 - 6, 2] = date, row 1 is the oldest } for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 2 ] = ZigZagPivots[ Value1 + 1, 2 ] ; end ; ZigZagPivots[6,2] = DateToJulian( SwingDate ) + TimeToMinutes( SwingTime ) / ( 24 * 60 ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 1] = ZigZagPivots[ Value1 + 1, 1 ] ; end ; ZigZagPivots[6,1] = SwingPrice ; Value1 = FibTimeForecasts( ZigZagPivots, FibTimeTargets ) ; { back to the original ZigZag code } TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, ZigZagLineWidth ) ; TL_SetColor( TLRef, LineColor ) ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; if AtCommentaryBar then begin xLoop = 0 ; ColumnEnd = 0 ; while xLoop < FullArrayCount and ColumnEnd = 0 begin xLoop = xLoop + 1 ; if DegreeOfAngle[ ZeroDegrees, xLoop ] > YesClose then ColumnEnd = xLoop ; { searching for SO9 numbers that are between YesClose } end ; LowRange = IntPortion( YesClose - PriceForecastRange ) ; HighRange = IntPortion( YesClose + PriceForecastRange ) ; for Counter = ColumnEnd - 1 to ColumnEnd begin for xLoop = 1 to DegreeSections begin if IFFLogic( DegreeOfAngle[ xLoop, Counter ] >= LowRange and DegreeOfAngle[ xLoop, Counter] <= HighRange, true, false ) then begin for Value99 = 1 to 25 begin MinutesAhead = ( IntPortion( FibTimeTargets[Value99] - ( DateToJulian ( date ) + ( TimeToMinutes( Time ) / ( 60 * 24 ) ) ) ) ) * ( 60 * 24 ) ; Value1 = TimeForecast( Date, Time, 0, 0, MinutesAhead, oFutureDate, oFutureTime ) ; Value1 = TL_New( oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ], oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ] - MinMove / PriceScale ) ; TL_SetStyle(Value1,LineStyle_1to5); TL_SetSize( Value1, ForecastWidth_0to6 ) ; ID = Text_New( Date, TextPlaceTime, DegreeOfAngle[ xLoop, Counter ] + TextMinMoveOffset * MinMove / PriceScale, NumToStr( DegreeOfAngle[ xLoop, Counter ], 0 ) + DegreeOfAngleWord[xLoop] ) ; Value1 = Text_SetColor( ID, TextColor ) ; end ; { FibTimeTargets loop } end ; { IFFLogic } end ; { xLoop } end ; { Counter } end ; { Date = }
시스템
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2018-04-02 09:20:10

안녕하세요 예스스탁입니다. 일부 지원되지 않는 내용이 있어 해당 부분 제외하고 올려드립니다. 1 사용자함수 : TimeForecast inputs: PresentDate( NumericSimple ) , PresentTime( NumericSimple ) , DaysAhead( NumericSimple ) , HoursAhead( NumericSimple ) , MinutesAhead( NumericSimple ) , oFutureDate( NumericRef ) , oFutureTime( NumericRef ) ; variables: DateTime( 0 ) , FutureDateTime( 0 ) ; DateTime = DateToJulian( PresentDate ) +( TimeToMinutes( PresentTime ) / 60 / 24 ) ; FutureDateTime = DateTime + DaysAhead + ( HoursAhead /24 ) + ( MinutesAhead / 60 / 24 ) ; if DayOfWeek( FutureDateTime ) == 6 then FutureDateTime = FutureDateTime - 1; else if DayOfWeek( FutureDateTime ) == 0 then FutureDateTime = FutureDateTime + 1 ; oFutureDate = JulianToDate( IntPortion(FutureDateTime ) ) ; oFutureTime = MinutesToTime( FracPortion(FutureDateTime ) * 60 * 24 ) ; TimeForecast = FutureDateTime ; 2 사용자함수 : FibTimeForecasts inputs: PivotValues[ MaxSize1, MaxSize2 ]( NumericArray ), #{ ZigZagPivots[Row1-6, 1] = price } #{ ZigZagPivots[Row1-6, 2] = date } FibDateTime[MaxSize3]( NumericArrayRef ) ; variables: Counter( 0 ), FirstCall( true ) ; arrays: FibNumbers[5]( 0 ), FibSwingRange[5]( 0 ) ; if FirstCall then begin FibNumbers[1] = 0.382 ; FibNumbers[2] = 0.5 ; FibNumbers[3] = 0.618 ; FibNumbers[4] = 0.707 ; FibNumbers[5] = 1 ; FirstCall = false ; end ; for Counter = 1 to 5 begin FibSwingRange[Counter] = PivotValues[ Counter + 1,2 ] - PivotValues[ Counter, 2] ; #{ $f$9 through$f$13 } end ; for Counter = 1 to 5 begin FibDateTime[Counter] = FibNumbers[Counter] * FibSwingRange[5] + PivotValues[6, 2] ; end; for Counter = 6 to 10 begin FibDateTime[Counter] = FibNumbers[ Counter - 5 ] * FibSwingRange[4] + PivotValues[6, 2] ; end ; for Counter = 11 to 15 begin FibDateTime[Counter] = FibNumbers[ Counter - 10 ] * FibSwingRange[2] + PivotValues[6, 2] ; end ; for Counter = 16 to 20 begin FibDateTime[Counter] = ( PivotValues[5, 2] -PivotValues[3, 2] ) * FibNumbers[ Counter - 15 ] +PivotValues[5, 2] ; end ; for Counter = 21 to 25 begin FibDateTime[Counter] = ( PivotValues[5, 2] -PivotValues[1, 2] ) * FibNumbers[ Counter - 20 ] +PivotValues[5, 2] ; end ; FibTimeForecasts = 1 ; 3 inputs: YestDate( 20040810 ), TextPlaceTime( 120000 ), TextColor( White ), LineColor( Yellow ), LineStyle_1to5(1), ForecastWidth_0to6( 4 ), PriceForecastRange( 3 ), BaseNumber( 10 ), Price( Close ), RetracePct( 5 ), ZigZagLineWidth( 1 ), TextMinMoveOffset( -5 ) ; variables: xloop( 0 ), Counter( 0 ), ColumnEnd( 0 ), HighRange( 0 ), LowRange( 0 ), Degree( "" ), ID( -1 ), DaysAhead( 0 ), HoursAhead( 0 ), MinutesAhead( 0 ), oFutureDate( 0 ), oFutureTime( 0 ), ValueSpace( 8 ), ValueSpace2( 11 ), #{ Print spacing } ValueSpace3( 4 ), ValueSpace4( 13 ), ValueSpace5( 14 ), YesClose( 0 ), ZeroDegrees( 1 ), FortyFiveDegrees( 2 ), NinetyDegrees( 3 ), OneThirtyFiveDegrees( 4 ), OneEightyDegrees( 5 ), TwoTwentyFiveDegrees( 6 ), TwoSeventyDegrees( 7 ), ThreeFifteenDegrees( 8 ), DegreeSections( 8 ), FullArrayCount( 49 ), MyBaseNumber( 0 ), NewSwingPrice( 0 ), SwingPrice( Price ), #{ used as a convenient2-element array } SwingDate( Date ), #{ used as a convenient2-element array } SwingTime( Time ), #{ used as a convenient2-element array } TLDir( 0 ), #{ TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + RetracePct * 0.01 ), RetraceFctrDn( 1 - RetracePct * 0.01 ), SaveSwing( false ), AddTL( false ), Up_dateTL( false ), TLRef( 0 ) ; arrays: ZigZagPivots[6, 2]( 0 ), #{ ZigZagPivots[Row1-6, 1] =price, ZigZagPivots[Row1-6, 2] = date } FibTimeTargets[25]( 0 ), DegreeOfAngle[8, 49]( 0 ), DegreeOfAngleWord[8]( "" ) ; if CurrentBar == 1 then begin MyBaseNumber = BaseNumber * 7 ; DegreeOfAngle[ ZeroDegrees, 0 ] = BaseNumber * 2 ; DegreeOfAngle[ FortyFiveDegrees, 0 ] =BaseNumber * 3 ; DegreeOfAngle[ NinetyDegrees, 0 ] = BaseNumber * 4 ; DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] = BaseNumber * 5 ; DegreeOfAngle[ OneEightyDegrees, 0 ] = BaseNumber * 6 ; DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] = BaseNumber * 7 ; DegreeOfAngle[ TwoSeventyDegrees, 0 ] = BaseNumber * 8 ; DegreeOfAngle[ ThreeFifteenDegrees, 0 ] = BaseNumber * 9 ; Degree = " deg" ; #{ the degree symbol number } DegreeOfAngleWord[ ZeroDegrees ] = " - 0" + Degree ; DegreeOfAngleWord[ FortyFiveDegrees ] = " - 45" +Degree ; DegreeOfAngleWord[ NinetyDegrees ] = " - 90" + Degree ; DegreeOfAngleWord[ OneThirtyFiveDegrees ] = " - 135" + Degree ; DegreeOfAngleWord[ OneEightyDegrees ] = " - 180" + Degree ; DegreeOfAngleWord[ TwoTwentyFiveDegrees ] = " - 225" + Degree ; DegreeOfAngleWord[ TwoSeventyDegrees ] = " - 270" + Degree ; DegreeOfAngleWord[ ThreeFifteenDegrees ] = " - 315" + Degree ; for xLoop = 1 to FullArrayCount begin DegreeOfAngle[ ZeroDegrees, xLoop ] = DegreeOfAngle[ ZeroDegrees, xloop - 1 ] + DegreeOfAngle[ ZeroDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ FortyFiveDegrees, xLoop ] = DegreeOfAngle[ FortyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ FortyFiveDegrees, 0 ]+ MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ NinetyDegrees, xLoop ] = DegreeOfAngle[ NinetyDegrees, xloop - 1 ] + DegreeOfAngle[ NinetyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneThirtyFiveDegrees, xLoop ] = DegreeOfAngle[ OneThirtyFiveDegrees,xloop - 1 ] + DegreeOfAngle[ OneThirtyFiveDegrees, 0 ]+ MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneEightyDegrees, xLoop ] = DegreeOfAngle[ OneEightyDegrees, xloop - 1 ] + DegreeOfAngle[ OneEightyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoTwentyFiveDegrees, xLoop ] = DegreeOfAngle[ TwoTwentyFiveDegrees,xloop - 1 ]+ DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoSeventyDegrees, xLoop ] = DegreeOfAngle[ TwoSeventyDegrees, xloop - 1 ] + DegreeOfAngle[ TwoSeventyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ ThreeFifteenDegrees, xLoop ] = DegreeOfAngle[ ThreeFifteenDegrees, xloop - 1 ] + DegreeOfAngle[ ThreeFifteenDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; end ; end; if Date <> Date[1] then YesClose = Close[1] ; NewSwingPrice = SwingHigh(1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp then begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir == 1 and NewSwingPrice >= SwingPrice then begin SaveSwing = true ; end; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn then begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir == -1 and NewSwingPrice <= SwingPrice then begin SaveSwing = true ; Up_dateTL = true ; end ; end ; end; plot99(TLDir); if SaveSwing then begin SwingPrice = NewSwingPrice ; SwingDate = sDate[1] ; SwingTime = sTime[1] ; SaveSwing = false ; end ; if AddTL then begin Plot1( Close ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 2 ] = ZigZagPivots[ Value1 +1, 2 ] ; end; ZigZagPivots[6,2] = DateToJulian( SwingDate ) + TimeToMinutes( SwingTime ) / ( 24 * 60 ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 1] = ZigZagPivots[ Value1 +1, 1 ] ; end ; ZigZagPivots[6,1] = SwingPrice ; Value1 = FibTimeForecasts( ZigZagPivots,FibTimeTargets ) ; TLRef = TL_New( SwingDate, SwingTime, SwingPrice,SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, ZigZagLineWidth ) ; TL_SetColor( TLRef, LineColor ) ; AddTL = false ; end else if Up_dateTL then begin TL_SetEnd( TLRef, SwingDate, SwingTime,SwingPrice ) ; Up_dateTL = false ; end ; 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 코딩 변환 부탁드립니다. 쓰기금지어 업데이트는 다 한글로 바꿨습니다. 이거 그런데 일목균형표처럼 차트 오른쪽 란 좀 넓혀서 보게 만들 수 있나요? Function: TimeForecast inputs: PresentDate( NumericSimple ) , PresentTime( NumericSimple ) , DaysAhead( NumericSimple ) , HoursAhead( NumericSimple ) , MinutesAhead( NumericSimple ) , oFutureDate( NumericRef ) , oFutureTime( NumericRef ) ; variables: DateTime( 0 ) , FutureDateTime( 0 ) ; DateTime = DateToJulian( PresentDate ) + ( TimeToMinutes( PresentTime ) / 60 / 24 ) ; FutureDateTime = DateTime + DaysAhead + ( HoursAhead / 24 ) + ( MinutesAhead / 60 / 24 ) ; if DayOfWeekFromDateTime( FutureDateTime ) = Saturday then FutureDateTime = FutureDateTime - 1 else if DayOfWeekFromDateTime( FutureDateTime ) = Sunday then FutureDateTime = FutureDateTime + 1 ; oFutureDate = JulianToDate( IntPortion( FutureDateTime ) ) ; oFutureTime = MinutesToTime( FracPortion( FutureDateTime ) * 60 * 24 ) ; TimeForecast = FutureDateTime ; Function: FibTimeForecasts inputs: PivotValues[ MaxSize1, MaxSize2 ]( NumericArray ), { ZigZagPivots[Row1-6, 1] = price } { ZigZagPivots[Row1-6, 2] = date } FibDateTime[MaxSize3]( NumericArrayRef ) ; variables: Counter( 0 ), FirstCall( true ) ; arrays: FibNumbers[5]( 0 ), FibSwingRange[5]( 0 ) ; if FirstCall then begin FibNumbers[1] = 0.382 ; FibNumbers[2] = 0.5 ; FibNumbers[3] = 0.618 ; FibNumbers[4] = 0.707 ; FibNumbers[5] = 1 ; FirstCall = false ; end ; for Counter = 1 to 5 begin FibSwingRange[Counter] = PivotValues[ Counter + 1, 2 ] - PivotValues[ Counter, 2] ; { $f$9 through $f$13 } end ; for Counter = 1 to 5 begin FibDateTime[Counter] = FibNumbers[Counter] * FibSwingRange[5] + PivotValues[6, 2] ; end ; for Counter = 6 to 10 begin FibDateTime[Counter] = FibNumbers[ Counter - 5 ] * FibSwingRange[4] + PivotValues[6, 2] ; end ; for Counter = 11 to 15 begin FibDateTime[Counter] = FibNumbers[ Counter - 10 ] * FibSwingRange[2] + PivotValues[6, 2] ; end ; for Counter = 16 to 20 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[3, 2] ) * FibNumbers[ Counter - 15 ] + PivotValues[5, 2] ; end ; for Counter = 21 to 25 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[1, 2] ) * FibNumbers[ Counter - 20 ] + PivotValues[5, 2] ; end ; FibTimeForecasts = 1 ; Indicator: SqOf9_FibTimeComment { Square of Nine portions taken from: http://www.tradestationworld.com/discussions/Topic.aspx? TOPIC_ID=8289 Fibonacci time forecasts come directly from the TASC 1992 Robert Minor article, “A Spreadsheet for Time Ratio Analysis”. The commentary features were written by Mitch Shack of TradeStation Securities, Inc. Any misinterpretations of Fibonacci and Gann are my own. Mark Mills, TradeStation Securities, Inc. } inputs: YestDate( ELDate( 8, 10, 2004 ) ), TextPlaceTime( 1200 ), TextColor( White ), LineColor( Yellow ), LineStyle_1to5(1), ForecastWidth_0to6( 4 ), PriceForecastRange( 3 ), BaseNumber( 10 ), Price( Close ), RetracePct( 5 ), ZigZagLineWidth( 1 ), TextMinMoveOffset( -5 ) ; variables: xloop( 0 ), Counter( 0 ), ColumnEnd( 0 ), HighRange( 0 ), LowRange( 0 ), Degree( “” ), ID( -1 ), DaysAhead( 0 ), HoursAhead( 0 ), MinutesAhead( 0 ), oFutureDate( 0 ), oFutureTime( 0 ), ValueSpace( 8 ), ValueSpace2( 11 ), { Print spacing } ValueSpace3( 4 ), ValueSpace4( 13 ), ValueSpace5( 14 ), YesClose( 0 ), ZeroDegrees( 1 ), FortyFiveDegrees( 2 ), NinetyDegrees( 3 ), OneThirtyFiveDegrees( 4 ), OneEightyDegrees( 5 ), TwoTwentyFiveDegrees( 6 ), TwoSeventyDegrees( 7 ), ThreeFifteenDegrees( 8 ), { Array Index Positions } DegreeSections( 8 ), FullArrayCount( 49 ), MyBaseNumber( 0 ), 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 + RetracePct * 0.01 ), RetraceFctrDn( 1 - RetracePct * 0.01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ) ; arrays: ZigZagPivots[6, 2]( 0 ), { ZigZagPivots[Row1-6, 1] = price, ZigZagPivots[Row1-6, 2] = date } FibTimeTargets[25]( 0 ), DegreeOfAngle[8, 49]( 0 ), DegreeOfAngleWord[8]( “” ) ; if CurrentBar = 1 then begin MyBaseNumber = BaseNumber * 7 ; DegreeOfAngle[ ZeroDegrees, 0 ] = BaseNumber * 2 ; DegreeOfAngle[ FortyFiveDegrees, 0 ] = BaseNumber * 3 ; DegreeOfAngle[ NinetyDegrees, 0 ] = BaseNumber * 4 ; DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] = BaseNumber * 5 ; DegreeOfAngle[ OneEightyDegrees, 0 ] = BaseNumber * 6 ; DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] = BaseNumber * 7 ; DegreeOfAngle[ TwoSeventyDegrees, 0 ] = BaseNumber * 8 ; DegreeOfAngle[ ThreeFifteenDegrees, 0 ] = BaseNumber * 9 ; Degree = “ deg” ; { the degree symbol number } DegreeOfAngleWord[ ZeroDegrees ] = “ - 0” + Degree ; DegreeOfAngleWord[ FortyFiveDegrees ] = “ - 45” + Degree ; DegreeOfAngleWord[ NinetyDegrees ] = “ - 90” + Degree ; DegreeOfAngleWord[ OneThirtyFiveDegrees ] = “ - 135” + Degree ; DegreeOfAngleWord[ OneEightyDegrees ] = “ - 180” + Degree ; DegreeOfAngleWord[ TwoTwentyFiveDegrees ] = “ - 225” + Degree ; DegreeOfAngleWord[ TwoSeventyDegrees ] = “ - 270” + Degree ; DegreeOfAngleWord[ ThreeFifteenDegrees ] = “ - 315” + Degree ; for xLoop = 1 to FullArrayCount begin DegreeOfAngle[ ZeroDegrees, xLoop ] = DegreeOfAngle[ ZeroDegrees, xloop - 1 ] + DegreeOfAngle[ ZeroDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ FortyFiveDegrees, xLoop ] = DegreeOfAngle[ FortyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ FortyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ NinetyDegrees, xLoop ] = DegreeOfAngle[ NinetyDegrees, xloop - 1 ] + DegreeOfAngle[ NinetyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneThirtyFiveDegrees, xLoop ] = DegreeOfAngle[ OneThirtyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneEightyDegrees, xLoop ] = DegreeOfAngle[ OneEightyDegrees, xloop - 1 ] + DegreeOfAngle[ OneEightyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoTwentyFiveDegrees, xLoop ] = DegreeOfAngle[ TwoTwentyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoSeventyDegrees, xLoop ] = DegreeOfAngle[ TwoSeventyDegrees, xloop - 1 ] + DegreeOfAngle[ TwoSeventyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ ThreeFifteenDegrees, xLoop ] = DegreeOfAngle[ ThreeFifteenDegrees, xloop - 1 ] + DegreeOfAngle[ ThreeFifteenDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; end ; end ; { CurrentBar = 1 } if Date <> Date[1] then YesClose = Close[1] ; { if new day get the SO9 compare number } { ZigZag Calculations } { 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 TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp 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 TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn 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 Plot1( Close ) ; { marks the point at which a leg of pivot is locked down } { push the pivot date and time into the array } { ZigZagPivots[Row1 - 6, 1] = price, ZigZagPivots[Row1 - 6, 2] = date, row 1 is the oldest } for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 2 ] = ZigZagPivots[ Value1 + 1, 2 ] ; end ; ZigZagPivots[6,2] = DateToJulian( SwingDate ) + TimeToMinutes( SwingTime ) / ( 24 * 60 ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 1] = ZigZagPivots[ Value1 + 1, 1 ] ; end ; ZigZagPivots[6,1] = SwingPrice ; Value1 = FibTimeForecasts( ZigZagPivots, FibTimeTargets ) ; { back to the original ZigZag code } TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, ZigZagLineWidth ) ; TL_SetColor( TLRef, LineColor ) ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; if AtCommentaryBar then begin xLoop = 0 ; ColumnEnd = 0 ; while xLoop < FullArrayCount and ColumnEnd = 0 begin xLoop = xLoop + 1 ; if DegreeOfAngle[ ZeroDegrees, xLoop ] > YesClose then ColumnEnd = xLoop ; { searching for SO9 numbers that are between YesClose } end ; LowRange = IntPortion( YesClose - PriceForecastRange ) ; HighRange = IntPortion( YesClose + PriceForecastRange ) ; for Counter = ColumnEnd - 1 to ColumnEnd begin for xLoop = 1 to DegreeSections begin if IFFLogic( DegreeOfAngle[ xLoop, Counter ] >= LowRange and DegreeOfAngle[ xLoop, Counter] <= HighRange, true, false ) then begin for Value99 = 1 to 25 begin MinutesAhead = ( IntPortion( FibTimeTargets[Value99] - ( DateToJulian ( date ) + ( TimeToMinutes( Time ) / ( 60 * 24 ) ) ) ) ) * ( 60 * 24 ) ; Value1 = TimeForecast( Date, Time, 0, 0, MinutesAhead, oFutureDate, oFutureTime ) ; Value1 = TL_New( oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ], oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ] - MinMove / PriceScale ) ; TL_SetStyle(Value1,LineStyle_1to5); TL_SetSize( Value1, ForecastWidth_0to6 ) ; ID = Text_New( Date, TextPlaceTime, DegreeOfAngle[ xLoop, Counter ] + TextMinMoveOffset * MinMove / PriceScale, NumToStr( DegreeOfAngle[ xLoop, Counter ], 0 ) + DegreeOfAngleWord[xLoop] ) ; Value1 = Text_SetColor( ID, TextColor ) ; end ; { FibTimeTargets loop } end ; { IFFLogic } end ; { xLoop } end ; { Counter } end ; { Date = }
프로필 이미지

잡다백수

2018-04-02 09:47:29

코딩감사합니다. 한번 실시간차트에 실행해봤는데요. 외부변수에 시간을 나올만한 시간으로 한 뒤 실행했는데도 아무 것도 안나옵니다. 말씀하신 몇가지 기능을 빼면 실행이 안되는 지표인지요. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의드립니다. > 안녕하세요 예스스탁입니다. 일부 지원되지 않는 내용이 있어 해당 부분 제외하고 올려드립니다. 1 사용자함수 : TimeForecast inputs: PresentDate( NumericSimple ) , PresentTime( NumericSimple ) , DaysAhead( NumericSimple ) , HoursAhead( NumericSimple ) , MinutesAhead( NumericSimple ) , oFutureDate( NumericRef ) , oFutureTime( NumericRef ) ; variables: DateTime( 0 ) , FutureDateTime( 0 ) ; DateTime = DateToJulian( PresentDate ) +( TimeToMinutes( PresentTime ) / 60 / 24 ) ; FutureDateTime = DateTime + DaysAhead + ( HoursAhead /24 ) + ( MinutesAhead / 60 / 24 ) ; if DayOfWeek( FutureDateTime ) == 6 then FutureDateTime = FutureDateTime - 1; else if DayOfWeek( FutureDateTime ) == 0 then FutureDateTime = FutureDateTime + 1 ; oFutureDate = JulianToDate( IntPortion(FutureDateTime ) ) ; oFutureTime = MinutesToTime( FracPortion(FutureDateTime ) * 60 * 24 ) ; TimeForecast = FutureDateTime ; 2 사용자함수 : FibTimeForecasts inputs: PivotValues[ MaxSize1, MaxSize2 ]( NumericArray ), #{ ZigZagPivots[Row1-6, 1] = price } #{ ZigZagPivots[Row1-6, 2] = date } FibDateTime[MaxSize3]( NumericArrayRef ) ; variables: Counter( 0 ), FirstCall( true ) ; arrays: FibNumbers[5]( 0 ), FibSwingRange[5]( 0 ) ; if FirstCall then begin FibNumbers[1] = 0.382 ; FibNumbers[2] = 0.5 ; FibNumbers[3] = 0.618 ; FibNumbers[4] = 0.707 ; FibNumbers[5] = 1 ; FirstCall = false ; end ; for Counter = 1 to 5 begin FibSwingRange[Counter] = PivotValues[ Counter + 1,2 ] - PivotValues[ Counter, 2] ; #{ $f$9 through$f$13 } end ; for Counter = 1 to 5 begin FibDateTime[Counter] = FibNumbers[Counter] * FibSwingRange[5] + PivotValues[6, 2] ; end; for Counter = 6 to 10 begin FibDateTime[Counter] = FibNumbers[ Counter - 5 ] * FibSwingRange[4] + PivotValues[6, 2] ; end ; for Counter = 11 to 15 begin FibDateTime[Counter] = FibNumbers[ Counter - 10 ] * FibSwingRange[2] + PivotValues[6, 2] ; end ; for Counter = 16 to 20 begin FibDateTime[Counter] = ( PivotValues[5, 2] -PivotValues[3, 2] ) * FibNumbers[ Counter - 15 ] +PivotValues[5, 2] ; end ; for Counter = 21 to 25 begin FibDateTime[Counter] = ( PivotValues[5, 2] -PivotValues[1, 2] ) * FibNumbers[ Counter - 20 ] +PivotValues[5, 2] ; end ; FibTimeForecasts = 1 ; 3 inputs: YestDate( 20040810 ), TextPlaceTime( 120000 ), TextColor( White ), LineColor( Yellow ), LineStyle_1to5(1), ForecastWidth_0to6( 4 ), PriceForecastRange( 3 ), BaseNumber( 10 ), Price( Close ), RetracePct( 5 ), ZigZagLineWidth( 1 ), TextMinMoveOffset( -5 ) ; variables: xloop( 0 ), Counter( 0 ), ColumnEnd( 0 ), HighRange( 0 ), LowRange( 0 ), Degree( "" ), ID( -1 ), DaysAhead( 0 ), HoursAhead( 0 ), MinutesAhead( 0 ), oFutureDate( 0 ), oFutureTime( 0 ), ValueSpace( 8 ), ValueSpace2( 11 ), #{ Print spacing } ValueSpace3( 4 ), ValueSpace4( 13 ), ValueSpace5( 14 ), YesClose( 0 ), ZeroDegrees( 1 ), FortyFiveDegrees( 2 ), NinetyDegrees( 3 ), OneThirtyFiveDegrees( 4 ), OneEightyDegrees( 5 ), TwoTwentyFiveDegrees( 6 ), TwoSeventyDegrees( 7 ), ThreeFifteenDegrees( 8 ), DegreeSections( 8 ), FullArrayCount( 49 ), MyBaseNumber( 0 ), NewSwingPrice( 0 ), SwingPrice( Price ), #{ used as a convenient2-element array } SwingDate( Date ), #{ used as a convenient2-element array } SwingTime( Time ), #{ used as a convenient2-element array } TLDir( 0 ), #{ TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + RetracePct * 0.01 ), RetraceFctrDn( 1 - RetracePct * 0.01 ), SaveSwing( false ), AddTL( false ), Up_dateTL( false ), TLRef( 0 ) ; arrays: ZigZagPivots[6, 2]( 0 ), #{ ZigZagPivots[Row1-6, 1] =price, ZigZagPivots[Row1-6, 2] = date } FibTimeTargets[25]( 0 ), DegreeOfAngle[8, 49]( 0 ), DegreeOfAngleWord[8]( "" ) ; if CurrentBar == 1 then begin MyBaseNumber = BaseNumber * 7 ; DegreeOfAngle[ ZeroDegrees, 0 ] = BaseNumber * 2 ; DegreeOfAngle[ FortyFiveDegrees, 0 ] =BaseNumber * 3 ; DegreeOfAngle[ NinetyDegrees, 0 ] = BaseNumber * 4 ; DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] = BaseNumber * 5 ; DegreeOfAngle[ OneEightyDegrees, 0 ] = BaseNumber * 6 ; DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] = BaseNumber * 7 ; DegreeOfAngle[ TwoSeventyDegrees, 0 ] = BaseNumber * 8 ; DegreeOfAngle[ ThreeFifteenDegrees, 0 ] = BaseNumber * 9 ; Degree = " deg" ; #{ the degree symbol number } DegreeOfAngleWord[ ZeroDegrees ] = " - 0" + Degree ; DegreeOfAngleWord[ FortyFiveDegrees ] = " - 45" +Degree ; DegreeOfAngleWord[ NinetyDegrees ] = " - 90" + Degree ; DegreeOfAngleWord[ OneThirtyFiveDegrees ] = " - 135" + Degree ; DegreeOfAngleWord[ OneEightyDegrees ] = " - 180" + Degree ; DegreeOfAngleWord[ TwoTwentyFiveDegrees ] = " - 225" + Degree ; DegreeOfAngleWord[ TwoSeventyDegrees ] = " - 270" + Degree ; DegreeOfAngleWord[ ThreeFifteenDegrees ] = " - 315" + Degree ; for xLoop = 1 to FullArrayCount begin DegreeOfAngle[ ZeroDegrees, xLoop ] = DegreeOfAngle[ ZeroDegrees, xloop - 1 ] + DegreeOfAngle[ ZeroDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ FortyFiveDegrees, xLoop ] = DegreeOfAngle[ FortyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ FortyFiveDegrees, 0 ]+ MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ NinetyDegrees, xLoop ] = DegreeOfAngle[ NinetyDegrees, xloop - 1 ] + DegreeOfAngle[ NinetyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneThirtyFiveDegrees, xLoop ] = DegreeOfAngle[ OneThirtyFiveDegrees,xloop - 1 ] + DegreeOfAngle[ OneThirtyFiveDegrees, 0 ]+ MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneEightyDegrees, xLoop ] = DegreeOfAngle[ OneEightyDegrees, xloop - 1 ] + DegreeOfAngle[ OneEightyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoTwentyFiveDegrees, xLoop ] = DegreeOfAngle[ TwoTwentyFiveDegrees,xloop - 1 ]+ DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoSeventyDegrees, xLoop ] = DegreeOfAngle[ TwoSeventyDegrees, xloop - 1 ] + DegreeOfAngle[ TwoSeventyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ ThreeFifteenDegrees, xLoop ] = DegreeOfAngle[ ThreeFifteenDegrees, xloop - 1 ] + DegreeOfAngle[ ThreeFifteenDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; end ; end; if Date <> Date[1] then YesClose = Close[1] ; NewSwingPrice = SwingHigh(1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp then begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir == 1 and NewSwingPrice >= SwingPrice then begin SaveSwing = true ; end; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn then begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir == -1 and NewSwingPrice <= SwingPrice then begin SaveSwing = true ; Up_dateTL = true ; end ; end ; end; plot99(TLDir); if SaveSwing then begin SwingPrice = NewSwingPrice ; SwingDate = sDate[1] ; SwingTime = sTime[1] ; SaveSwing = false ; end ; if AddTL then begin Plot1( Close ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 2 ] = ZigZagPivots[ Value1 +1, 2 ] ; end; ZigZagPivots[6,2] = DateToJulian( SwingDate ) + TimeToMinutes( SwingTime ) / ( 24 * 60 ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 1] = ZigZagPivots[ Value1 +1, 1 ] ; end ; ZigZagPivots[6,1] = SwingPrice ; Value1 = FibTimeForecasts( ZigZagPivots,FibTimeTargets ) ; TLRef = TL_New( SwingDate, SwingTime, SwingPrice,SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, ZigZagLineWidth ) ; TL_SetColor( TLRef, LineColor ) ; AddTL = false ; end else if Up_dateTL then begin TL_SetEnd( TLRef, SwingDate, SwingTime,SwingPrice ) ; Up_dateTL = false ; end ; 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 코딩 변환 부탁드립니다. 쓰기금지어 업데이트는 다 한글로 바꿨습니다. 이거 그런데 일목균형표처럼 차트 오른쪽 란 좀 넓혀서 보게 만들 수 있나요? Function: TimeForecast inputs: PresentDate( NumericSimple ) , PresentTime( NumericSimple ) , DaysAhead( NumericSimple ) , HoursAhead( NumericSimple ) , MinutesAhead( NumericSimple ) , oFutureDate( NumericRef ) , oFutureTime( NumericRef ) ; variables: DateTime( 0 ) , FutureDateTime( 0 ) ; DateTime = DateToJulian( PresentDate ) + ( TimeToMinutes( PresentTime ) / 60 / 24 ) ; FutureDateTime = DateTime + DaysAhead + ( HoursAhead / 24 ) + ( MinutesAhead / 60 / 24 ) ; if DayOfWeekFromDateTime( FutureDateTime ) = Saturday then FutureDateTime = FutureDateTime - 1 else if DayOfWeekFromDateTime( FutureDateTime ) = Sunday then FutureDateTime = FutureDateTime + 1 ; oFutureDate = JulianToDate( IntPortion( FutureDateTime ) ) ; oFutureTime = MinutesToTime( FracPortion( FutureDateTime ) * 60 * 24 ) ; TimeForecast = FutureDateTime ; Function: FibTimeForecasts inputs: PivotValues[ MaxSize1, MaxSize2 ]( NumericArray ), { ZigZagPivots[Row1-6, 1] = price } { ZigZagPivots[Row1-6, 2] = date } FibDateTime[MaxSize3]( NumericArrayRef ) ; variables: Counter( 0 ), FirstCall( true ) ; arrays: FibNumbers[5]( 0 ), FibSwingRange[5]( 0 ) ; if FirstCall then begin FibNumbers[1] = 0.382 ; FibNumbers[2] = 0.5 ; FibNumbers[3] = 0.618 ; FibNumbers[4] = 0.707 ; FibNumbers[5] = 1 ; FirstCall = false ; end ; for Counter = 1 to 5 begin FibSwingRange[Counter] = PivotValues[ Counter + 1, 2 ] - PivotValues[ Counter, 2] ; { $f$9 through $f$13 } end ; for Counter = 1 to 5 begin FibDateTime[Counter] = FibNumbers[Counter] * FibSwingRange[5] + PivotValues[6, 2] ; end ; for Counter = 6 to 10 begin FibDateTime[Counter] = FibNumbers[ Counter - 5 ] * FibSwingRange[4] + PivotValues[6, 2] ; end ; for Counter = 11 to 15 begin FibDateTime[Counter] = FibNumbers[ Counter - 10 ] * FibSwingRange[2] + PivotValues[6, 2] ; end ; for Counter = 16 to 20 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[3, 2] ) * FibNumbers[ Counter - 15 ] + PivotValues[5, 2] ; end ; for Counter = 21 to 25 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[1, 2] ) * FibNumbers[ Counter - 20 ] + PivotValues[5, 2] ; end ; FibTimeForecasts = 1 ; Indicator: SqOf9_FibTimeComment { Square of Nine portions taken from: http://www.tradestationworld.com/discussions/Topic.aspx? TOPIC_ID=8289 Fibonacci time forecasts come directly from the TASC 1992 Robert Minor article, “A Spreadsheet for Time Ratio Analysis”. The commentary features were written by Mitch Shack of TradeStation Securities, Inc. Any misinterpretations of Fibonacci and Gann are my own. Mark Mills, TradeStation Securities, Inc. } inputs: YestDate( ELDate( 8, 10, 2004 ) ), TextPlaceTime( 1200 ), TextColor( White ), LineColor( Yellow ), LineStyle_1to5(1), ForecastWidth_0to6( 4 ), PriceForecastRange( 3 ), BaseNumber( 10 ), Price( Close ), RetracePct( 5 ), ZigZagLineWidth( 1 ), TextMinMoveOffset( -5 ) ; variables: xloop( 0 ), Counter( 0 ), ColumnEnd( 0 ), HighRange( 0 ), LowRange( 0 ), Degree( “” ), ID( -1 ), DaysAhead( 0 ), HoursAhead( 0 ), MinutesAhead( 0 ), oFutureDate( 0 ), oFutureTime( 0 ), ValueSpace( 8 ), ValueSpace2( 11 ), { Print spacing } ValueSpace3( 4 ), ValueSpace4( 13 ), ValueSpace5( 14 ), YesClose( 0 ), ZeroDegrees( 1 ), FortyFiveDegrees( 2 ), NinetyDegrees( 3 ), OneThirtyFiveDegrees( 4 ), OneEightyDegrees( 5 ), TwoTwentyFiveDegrees( 6 ), TwoSeventyDegrees( 7 ), ThreeFifteenDegrees( 8 ), { Array Index Positions } DegreeSections( 8 ), FullArrayCount( 49 ), MyBaseNumber( 0 ), 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 + RetracePct * 0.01 ), RetraceFctrDn( 1 - RetracePct * 0.01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ) ; arrays: ZigZagPivots[6, 2]( 0 ), { ZigZagPivots[Row1-6, 1] = price, ZigZagPivots[Row1-6, 2] = date } FibTimeTargets[25]( 0 ), DegreeOfAngle[8, 49]( 0 ), DegreeOfAngleWord[8]( “” ) ; if CurrentBar = 1 then begin MyBaseNumber = BaseNumber * 7 ; DegreeOfAngle[ ZeroDegrees, 0 ] = BaseNumber * 2 ; DegreeOfAngle[ FortyFiveDegrees, 0 ] = BaseNumber * 3 ; DegreeOfAngle[ NinetyDegrees, 0 ] = BaseNumber * 4 ; DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] = BaseNumber * 5 ; DegreeOfAngle[ OneEightyDegrees, 0 ] = BaseNumber * 6 ; DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] = BaseNumber * 7 ; DegreeOfAngle[ TwoSeventyDegrees, 0 ] = BaseNumber * 8 ; DegreeOfAngle[ ThreeFifteenDegrees, 0 ] = BaseNumber * 9 ; Degree = “ deg” ; { the degree symbol number } DegreeOfAngleWord[ ZeroDegrees ] = “ - 0” + Degree ; DegreeOfAngleWord[ FortyFiveDegrees ] = “ - 45” + Degree ; DegreeOfAngleWord[ NinetyDegrees ] = “ - 90” + Degree ; DegreeOfAngleWord[ OneThirtyFiveDegrees ] = “ - 135” + Degree ; DegreeOfAngleWord[ OneEightyDegrees ] = “ - 180” + Degree ; DegreeOfAngleWord[ TwoTwentyFiveDegrees ] = “ - 225” + Degree ; DegreeOfAngleWord[ TwoSeventyDegrees ] = “ - 270” + Degree ; DegreeOfAngleWord[ ThreeFifteenDegrees ] = “ - 315” + Degree ; for xLoop = 1 to FullArrayCount begin DegreeOfAngle[ ZeroDegrees, xLoop ] = DegreeOfAngle[ ZeroDegrees, xloop - 1 ] + DegreeOfAngle[ ZeroDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ FortyFiveDegrees, xLoop ] = DegreeOfAngle[ FortyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ FortyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ NinetyDegrees, xLoop ] = DegreeOfAngle[ NinetyDegrees, xloop - 1 ] + DegreeOfAngle[ NinetyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneThirtyFiveDegrees, xLoop ] = DegreeOfAngle[ OneThirtyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneEightyDegrees, xLoop ] = DegreeOfAngle[ OneEightyDegrees, xloop - 1 ] + DegreeOfAngle[ OneEightyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoTwentyFiveDegrees, xLoop ] = DegreeOfAngle[ TwoTwentyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoSeventyDegrees, xLoop ] = DegreeOfAngle[ TwoSeventyDegrees, xloop - 1 ] + DegreeOfAngle[ TwoSeventyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ ThreeFifteenDegrees, xLoop ] = DegreeOfAngle[ ThreeFifteenDegrees, xloop - 1 ] + DegreeOfAngle[ ThreeFifteenDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; end ; end ; { CurrentBar = 1 } if Date <> Date[1] then YesClose = Close[1] ; { if new day get the SO9 compare number } { ZigZag Calculations } { 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 TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp 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 TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn 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 Plot1( Close ) ; { marks the point at which a leg of pivot is locked down } { push the pivot date and time into the array } { ZigZagPivots[Row1 - 6, 1] = price, ZigZagPivots[Row1 - 6, 2] = date, row 1 is the oldest } for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 2 ] = ZigZagPivots[ Value1 + 1, 2 ] ; end ; ZigZagPivots[6,2] = DateToJulian( SwingDate ) + TimeToMinutes( SwingTime ) / ( 24 * 60 ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 1] = ZigZagPivots[ Value1 + 1, 1 ] ; end ; ZigZagPivots[6,1] = SwingPrice ; Value1 = FibTimeForecasts( ZigZagPivots, FibTimeTargets ) ; { back to the original ZigZag code } TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, ZigZagLineWidth ) ; TL_SetColor( TLRef, LineColor ) ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; if AtCommentaryBar then begin xLoop = 0 ; ColumnEnd = 0 ; while xLoop < FullArrayCount and ColumnEnd = 0 begin xLoop = xLoop + 1 ; if DegreeOfAngle[ ZeroDegrees, xLoop ] > YesClose then ColumnEnd = xLoop ; { searching for SO9 numbers that are between YesClose } end ; LowRange = IntPortion( YesClose - PriceForecastRange ) ; HighRange = IntPortion( YesClose + PriceForecastRange ) ; for Counter = ColumnEnd - 1 to ColumnEnd begin for xLoop = 1 to DegreeSections begin if IFFLogic( DegreeOfAngle[ xLoop, Counter ] >= LowRange and DegreeOfAngle[ xLoop, Counter] <= HighRange, true, false ) then begin for Value99 = 1 to 25 begin MinutesAhead = ( IntPortion( FibTimeTargets[Value99] - ( DateToJulian ( date ) + ( TimeToMinutes( Time ) / ( 60 * 24 ) ) ) ) ) * ( 60 * 24 ) ; Value1 = TimeForecast( Date, Time, 0, 0, MinutesAhead, oFutureDate, oFutureTime ) ; Value1 = TL_New( oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ], oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ] - MinMove / PriceScale ) ; TL_SetStyle(Value1,LineStyle_1to5); TL_SetSize( Value1, ForecastWidth_0to6 ) ; ID = Text_New( Date, TextPlaceTime, DegreeOfAngle[ xLoop, Counter ] + TextMinMoveOffset * MinMove / PriceScale, NumToStr( DegreeOfAngle[ xLoop, Counter ], 0 ) + DegreeOfAngleWord[xLoop] ) ; Value1 = Text_SetColor( ID, TextColor ) ; end ; { FibTimeTargets loop } end ; { IFFLogic } end ; { xLoop } end ; { Counter } end ; { Date = }
프로필 이미지

예스스탁 예스스탁 답변

2018-04-02 09:56:13

안녕하세요 예스스탁입니다. 첨부된 그림처럼 나타나는 지표입니다. 수식 그대로 적용한 내용입니다. 수식은 변경은 문법에 맞춰 변경만 해드립니다. 수식 내용에 대해 저희가 파악하는 것은 아닙니다. 변수 변경등을 하셔서 직접 적용해 보셔야 합니다. 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : Re : Re : 문의드립니다. > 코딩감사합니다. 한번 실시간차트에 실행해봤는데요. 외부변수에 시간을 나올만한 시간으로 한 뒤 실행했는데도 아무 것도 안나옵니다. 말씀하신 몇가지 기능을 빼면 실행이 안되는 지표인지요. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의드립니다. > 안녕하세요 예스스탁입니다. 일부 지원되지 않는 내용이 있어 해당 부분 제외하고 올려드립니다. 1 사용자함수 : TimeForecast inputs: PresentDate( NumericSimple ) , PresentTime( NumericSimple ) , DaysAhead( NumericSimple ) , HoursAhead( NumericSimple ) , MinutesAhead( NumericSimple ) , oFutureDate( NumericRef ) , oFutureTime( NumericRef ) ; variables: DateTime( 0 ) , FutureDateTime( 0 ) ; DateTime = DateToJulian( PresentDate ) +( TimeToMinutes( PresentTime ) / 60 / 24 ) ; FutureDateTime = DateTime + DaysAhead + ( HoursAhead /24 ) + ( MinutesAhead / 60 / 24 ) ; if DayOfWeek( FutureDateTime ) == 6 then FutureDateTime = FutureDateTime - 1; else if DayOfWeek( FutureDateTime ) == 0 then FutureDateTime = FutureDateTime + 1 ; oFutureDate = JulianToDate( IntPortion(FutureDateTime ) ) ; oFutureTime = MinutesToTime( FracPortion(FutureDateTime ) * 60 * 24 ) ; TimeForecast = FutureDateTime ; 2 사용자함수 : FibTimeForecasts inputs: PivotValues[ MaxSize1, MaxSize2 ]( NumericArray ), #{ ZigZagPivots[Row1-6, 1] = price } #{ ZigZagPivots[Row1-6, 2] = date } FibDateTime[MaxSize3]( NumericArrayRef ) ; variables: Counter( 0 ), FirstCall( true ) ; arrays: FibNumbers[5]( 0 ), FibSwingRange[5]( 0 ) ; if FirstCall then begin FibNumbers[1] = 0.382 ; FibNumbers[2] = 0.5 ; FibNumbers[3] = 0.618 ; FibNumbers[4] = 0.707 ; FibNumbers[5] = 1 ; FirstCall = false ; end ; for Counter = 1 to 5 begin FibSwingRange[Counter] = PivotValues[ Counter + 1,2 ] - PivotValues[ Counter, 2] ; #{ $f$9 through$f$13 } end ; for Counter = 1 to 5 begin FibDateTime[Counter] = FibNumbers[Counter] * FibSwingRange[5] + PivotValues[6, 2] ; end; for Counter = 6 to 10 begin FibDateTime[Counter] = FibNumbers[ Counter - 5 ] * FibSwingRange[4] + PivotValues[6, 2] ; end ; for Counter = 11 to 15 begin FibDateTime[Counter] = FibNumbers[ Counter - 10 ] * FibSwingRange[2] + PivotValues[6, 2] ; end ; for Counter = 16 to 20 begin FibDateTime[Counter] = ( PivotValues[5, 2] -PivotValues[3, 2] ) * FibNumbers[ Counter - 15 ] +PivotValues[5, 2] ; end ; for Counter = 21 to 25 begin FibDateTime[Counter] = ( PivotValues[5, 2] -PivotValues[1, 2] ) * FibNumbers[ Counter - 20 ] +PivotValues[5, 2] ; end ; FibTimeForecasts = 1 ; 3 inputs: YestDate( 20040810 ), TextPlaceTime( 120000 ), TextColor( White ), LineColor( Yellow ), LineStyle_1to5(1), ForecastWidth_0to6( 4 ), PriceForecastRange( 3 ), BaseNumber( 10 ), Price( Close ), RetracePct( 5 ), ZigZagLineWidth( 1 ), TextMinMoveOffset( -5 ) ; variables: xloop( 0 ), Counter( 0 ), ColumnEnd( 0 ), HighRange( 0 ), LowRange( 0 ), Degree( "" ), ID( -1 ), DaysAhead( 0 ), HoursAhead( 0 ), MinutesAhead( 0 ), oFutureDate( 0 ), oFutureTime( 0 ), ValueSpace( 8 ), ValueSpace2( 11 ), #{ Print spacing } ValueSpace3( 4 ), ValueSpace4( 13 ), ValueSpace5( 14 ), YesClose( 0 ), ZeroDegrees( 1 ), FortyFiveDegrees( 2 ), NinetyDegrees( 3 ), OneThirtyFiveDegrees( 4 ), OneEightyDegrees( 5 ), TwoTwentyFiveDegrees( 6 ), TwoSeventyDegrees( 7 ), ThreeFifteenDegrees( 8 ), DegreeSections( 8 ), FullArrayCount( 49 ), MyBaseNumber( 0 ), NewSwingPrice( 0 ), SwingPrice( Price ), #{ used as a convenient2-element array } SwingDate( Date ), #{ used as a convenient2-element array } SwingTime( Time ), #{ used as a convenient2-element array } TLDir( 0 ), #{ TLDir = -1 implies prev TL dn, +1 implies prev TL up } RetraceFctrUp( 1 + RetracePct * 0.01 ), RetraceFctrDn( 1 - RetracePct * 0.01 ), SaveSwing( false ), AddTL( false ), Up_dateTL( false ), TLRef( 0 ) ; arrays: ZigZagPivots[6, 2]( 0 ), #{ ZigZagPivots[Row1-6, 1] =price, ZigZagPivots[Row1-6, 2] = date } FibTimeTargets[25]( 0 ), DegreeOfAngle[8, 49]( 0 ), DegreeOfAngleWord[8]( "" ) ; if CurrentBar == 1 then begin MyBaseNumber = BaseNumber * 7 ; DegreeOfAngle[ ZeroDegrees, 0 ] = BaseNumber * 2 ; DegreeOfAngle[ FortyFiveDegrees, 0 ] =BaseNumber * 3 ; DegreeOfAngle[ NinetyDegrees, 0 ] = BaseNumber * 4 ; DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] = BaseNumber * 5 ; DegreeOfAngle[ OneEightyDegrees, 0 ] = BaseNumber * 6 ; DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] = BaseNumber * 7 ; DegreeOfAngle[ TwoSeventyDegrees, 0 ] = BaseNumber * 8 ; DegreeOfAngle[ ThreeFifteenDegrees, 0 ] = BaseNumber * 9 ; Degree = " deg" ; #{ the degree symbol number } DegreeOfAngleWord[ ZeroDegrees ] = " - 0" + Degree ; DegreeOfAngleWord[ FortyFiveDegrees ] = " - 45" +Degree ; DegreeOfAngleWord[ NinetyDegrees ] = " - 90" + Degree ; DegreeOfAngleWord[ OneThirtyFiveDegrees ] = " - 135" + Degree ; DegreeOfAngleWord[ OneEightyDegrees ] = " - 180" + Degree ; DegreeOfAngleWord[ TwoTwentyFiveDegrees ] = " - 225" + Degree ; DegreeOfAngleWord[ TwoSeventyDegrees ] = " - 270" + Degree ; DegreeOfAngleWord[ ThreeFifteenDegrees ] = " - 315" + Degree ; for xLoop = 1 to FullArrayCount begin DegreeOfAngle[ ZeroDegrees, xLoop ] = DegreeOfAngle[ ZeroDegrees, xloop - 1 ] + DegreeOfAngle[ ZeroDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ FortyFiveDegrees, xLoop ] = DegreeOfAngle[ FortyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ FortyFiveDegrees, 0 ]+ MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ NinetyDegrees, xLoop ] = DegreeOfAngle[ NinetyDegrees, xloop - 1 ] + DegreeOfAngle[ NinetyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneThirtyFiveDegrees, xLoop ] = DegreeOfAngle[ OneThirtyFiveDegrees,xloop - 1 ] + DegreeOfAngle[ OneThirtyFiveDegrees, 0 ]+ MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneEightyDegrees, xLoop ] = DegreeOfAngle[ OneEightyDegrees, xloop - 1 ] + DegreeOfAngle[ OneEightyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoTwentyFiveDegrees, xLoop ] = DegreeOfAngle[ TwoTwentyFiveDegrees,xloop - 1 ]+ DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoSeventyDegrees, xLoop ] = DegreeOfAngle[ TwoSeventyDegrees, xloop - 1 ] + DegreeOfAngle[ TwoSeventyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ ThreeFifteenDegrees, xLoop ] = DegreeOfAngle[ ThreeFifteenDegrees, xloop - 1 ] + DegreeOfAngle[ ThreeFifteenDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; end ; end; if Date <> Date[1] then YesClose = Close[1] ; NewSwingPrice = SwingHigh(1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp then begin SaveSwing = true ; AddTL = true ; TLDir = 1 ; end else if TLDir == 1 and NewSwingPrice >= SwingPrice then begin SaveSwing = true ; end; end else begin NewSwingPrice = SwingLow( 1, Price, 1, 2,4 ) ; if NewSwingPrice <> -1 then begin if TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn then begin SaveSwing = true ; AddTL = true ; TLDir = -1 ; end else if TLDir == -1 and NewSwingPrice <= SwingPrice then begin SaveSwing = true ; Up_dateTL = true ; end ; end ; end; plot99(TLDir); if SaveSwing then begin SwingPrice = NewSwingPrice ; SwingDate = sDate[1] ; SwingTime = sTime[1] ; SaveSwing = false ; end ; if AddTL then begin Plot1( Close ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 2 ] = ZigZagPivots[ Value1 +1, 2 ] ; end; ZigZagPivots[6,2] = DateToJulian( SwingDate ) + TimeToMinutes( SwingTime ) / ( 24 * 60 ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 1] = ZigZagPivots[ Value1 +1, 1 ] ; end ; ZigZagPivots[6,1] = SwingPrice ; Value1 = FibTimeForecasts( ZigZagPivots,FibTimeTargets ) ; TLRef = TL_New( SwingDate, SwingTime, SwingPrice,SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, ZigZagLineWidth ) ; TL_SetColor( TLRef, LineColor ) ; AddTL = false ; end else if Up_dateTL then begin TL_SetEnd( TLRef, SwingDate, SwingTime,SwingPrice ) ; Up_dateTL = false ; end ; 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 코딩 변환 부탁드립니다. 쓰기금지어 업데이트는 다 한글로 바꿨습니다. 이거 그런데 일목균형표처럼 차트 오른쪽 란 좀 넓혀서 보게 만들 수 있나요? Function: TimeForecast inputs: PresentDate( NumericSimple ) , PresentTime( NumericSimple ) , DaysAhead( NumericSimple ) , HoursAhead( NumericSimple ) , MinutesAhead( NumericSimple ) , oFutureDate( NumericRef ) , oFutureTime( NumericRef ) ; variables: DateTime( 0 ) , FutureDateTime( 0 ) ; DateTime = DateToJulian( PresentDate ) + ( TimeToMinutes( PresentTime ) / 60 / 24 ) ; FutureDateTime = DateTime + DaysAhead + ( HoursAhead / 24 ) + ( MinutesAhead / 60 / 24 ) ; if DayOfWeekFromDateTime( FutureDateTime ) = Saturday then FutureDateTime = FutureDateTime - 1 else if DayOfWeekFromDateTime( FutureDateTime ) = Sunday then FutureDateTime = FutureDateTime + 1 ; oFutureDate = JulianToDate( IntPortion( FutureDateTime ) ) ; oFutureTime = MinutesToTime( FracPortion( FutureDateTime ) * 60 * 24 ) ; TimeForecast = FutureDateTime ; Function: FibTimeForecasts inputs: PivotValues[ MaxSize1, MaxSize2 ]( NumericArray ), { ZigZagPivots[Row1-6, 1] = price } { ZigZagPivots[Row1-6, 2] = date } FibDateTime[MaxSize3]( NumericArrayRef ) ; variables: Counter( 0 ), FirstCall( true ) ; arrays: FibNumbers[5]( 0 ), FibSwingRange[5]( 0 ) ; if FirstCall then begin FibNumbers[1] = 0.382 ; FibNumbers[2] = 0.5 ; FibNumbers[3] = 0.618 ; FibNumbers[4] = 0.707 ; FibNumbers[5] = 1 ; FirstCall = false ; end ; for Counter = 1 to 5 begin FibSwingRange[Counter] = PivotValues[ Counter + 1, 2 ] - PivotValues[ Counter, 2] ; { $f$9 through $f$13 } end ; for Counter = 1 to 5 begin FibDateTime[Counter] = FibNumbers[Counter] * FibSwingRange[5] + PivotValues[6, 2] ; end ; for Counter = 6 to 10 begin FibDateTime[Counter] = FibNumbers[ Counter - 5 ] * FibSwingRange[4] + PivotValues[6, 2] ; end ; for Counter = 11 to 15 begin FibDateTime[Counter] = FibNumbers[ Counter - 10 ] * FibSwingRange[2] + PivotValues[6, 2] ; end ; for Counter = 16 to 20 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[3, 2] ) * FibNumbers[ Counter - 15 ] + PivotValues[5, 2] ; end ; for Counter = 21 to 25 begin FibDateTime[Counter] = ( PivotValues[5, 2] - PivotValues[1, 2] ) * FibNumbers[ Counter - 20 ] + PivotValues[5, 2] ; end ; FibTimeForecasts = 1 ; Indicator: SqOf9_FibTimeComment { Square of Nine portions taken from: http://www.tradestationworld.com/discussions/Topic.aspx? TOPIC_ID=8289 Fibonacci time forecasts come directly from the TASC 1992 Robert Minor article, “A Spreadsheet for Time Ratio Analysis”. The commentary features were written by Mitch Shack of TradeStation Securities, Inc. Any misinterpretations of Fibonacci and Gann are my own. Mark Mills, TradeStation Securities, Inc. } inputs: YestDate( ELDate( 8, 10, 2004 ) ), TextPlaceTime( 1200 ), TextColor( White ), LineColor( Yellow ), LineStyle_1to5(1), ForecastWidth_0to6( 4 ), PriceForecastRange( 3 ), BaseNumber( 10 ), Price( Close ), RetracePct( 5 ), ZigZagLineWidth( 1 ), TextMinMoveOffset( -5 ) ; variables: xloop( 0 ), Counter( 0 ), ColumnEnd( 0 ), HighRange( 0 ), LowRange( 0 ), Degree( “” ), ID( -1 ), DaysAhead( 0 ), HoursAhead( 0 ), MinutesAhead( 0 ), oFutureDate( 0 ), oFutureTime( 0 ), ValueSpace( 8 ), ValueSpace2( 11 ), { Print spacing } ValueSpace3( 4 ), ValueSpace4( 13 ), ValueSpace5( 14 ), YesClose( 0 ), ZeroDegrees( 1 ), FortyFiveDegrees( 2 ), NinetyDegrees( 3 ), OneThirtyFiveDegrees( 4 ), OneEightyDegrees( 5 ), TwoTwentyFiveDegrees( 6 ), TwoSeventyDegrees( 7 ), ThreeFifteenDegrees( 8 ), { Array Index Positions } DegreeSections( 8 ), FullArrayCount( 49 ), MyBaseNumber( 0 ), 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 + RetracePct * 0.01 ), RetraceFctrDn( 1 - RetracePct * 0.01 ), SaveSwing( false ), AddTL( false ), 업데이트TL( false ), TLRef( 0 ) ; arrays: ZigZagPivots[6, 2]( 0 ), { ZigZagPivots[Row1-6, 1] = price, ZigZagPivots[Row1-6, 2] = date } FibTimeTargets[25]( 0 ), DegreeOfAngle[8, 49]( 0 ), DegreeOfAngleWord[8]( “” ) ; if CurrentBar = 1 then begin MyBaseNumber = BaseNumber * 7 ; DegreeOfAngle[ ZeroDegrees, 0 ] = BaseNumber * 2 ; DegreeOfAngle[ FortyFiveDegrees, 0 ] = BaseNumber * 3 ; DegreeOfAngle[ NinetyDegrees, 0 ] = BaseNumber * 4 ; DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] = BaseNumber * 5 ; DegreeOfAngle[ OneEightyDegrees, 0 ] = BaseNumber * 6 ; DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] = BaseNumber * 7 ; DegreeOfAngle[ TwoSeventyDegrees, 0 ] = BaseNumber * 8 ; DegreeOfAngle[ ThreeFifteenDegrees, 0 ] = BaseNumber * 9 ; Degree = “ deg” ; { the degree symbol number } DegreeOfAngleWord[ ZeroDegrees ] = “ - 0” + Degree ; DegreeOfAngleWord[ FortyFiveDegrees ] = “ - 45” + Degree ; DegreeOfAngleWord[ NinetyDegrees ] = “ - 90” + Degree ; DegreeOfAngleWord[ OneThirtyFiveDegrees ] = “ - 135” + Degree ; DegreeOfAngleWord[ OneEightyDegrees ] = “ - 180” + Degree ; DegreeOfAngleWord[ TwoTwentyFiveDegrees ] = “ - 225” + Degree ; DegreeOfAngleWord[ TwoSeventyDegrees ] = “ - 270” + Degree ; DegreeOfAngleWord[ ThreeFifteenDegrees ] = “ - 315” + Degree ; for xLoop = 1 to FullArrayCount begin DegreeOfAngle[ ZeroDegrees, xLoop ] = DegreeOfAngle[ ZeroDegrees, xloop - 1 ] + DegreeOfAngle[ ZeroDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ FortyFiveDegrees, xLoop ] = DegreeOfAngle[ FortyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ FortyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ NinetyDegrees, xLoop ] = DegreeOfAngle[ NinetyDegrees, xloop - 1 ] + DegreeOfAngle[ NinetyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneThirtyFiveDegrees, xLoop ] = DegreeOfAngle[ OneThirtyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ OneThirtyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ OneEightyDegrees, xLoop ] = DegreeOfAngle[ OneEightyDegrees, xloop - 1 ] + DegreeOfAngle[ OneEightyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoTwentyFiveDegrees, xLoop ] = DegreeOfAngle[ TwoTwentyFiveDegrees, xloop - 1 ] + DegreeOfAngle[ TwoTwentyFiveDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ TwoSeventyDegrees, xLoop ] = DegreeOfAngle[ TwoSeventyDegrees, xloop - 1 ] + DegreeOfAngle[ TwoSeventyDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; DegreeOfAngle[ ThreeFifteenDegrees, xLoop ] = DegreeOfAngle[ ThreeFifteenDegrees, xloop - 1 ] + DegreeOfAngle[ ThreeFifteenDegrees, 0 ] + MyBaseNumber + ( 8 * ( xLoop - 1 ) ) ; end ; end ; { CurrentBar = 1 } if Date <> Date[1] then YesClose = Close[1] ; { if new day get the SO9 compare number } { ZigZag Calculations } { 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 TLDir <= 0 and NewSwingPrice >= SwingPrice * RetraceFctrUp 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 TLDir >= 0 and NewSwingPrice <= SwingPrice * RetraceFctrDn 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 Plot1( Close ) ; { marks the point at which a leg of pivot is locked down } { push the pivot date and time into the array } { ZigZagPivots[Row1 - 6, 1] = price, ZigZagPivots[Row1 - 6, 2] = date, row 1 is the oldest } for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 2 ] = ZigZagPivots[ Value1 + 1, 2 ] ; end ; ZigZagPivots[6,2] = DateToJulian( SwingDate ) + TimeToMinutes( SwingTime ) / ( 24 * 60 ) ; for Value1 = 1 to 5 begin ZigZagPivots[ Value1, 1] = ZigZagPivots[ Value1 + 1, 1 ] ; end ; ZigZagPivots[6,1] = SwingPrice ; Value1 = FibTimeForecasts( ZigZagPivots, FibTimeTargets ) ; { back to the original ZigZag code } TLRef = TL_New( SwingDate, SwingTime, SwingPrice, SwingDate[1], SwingTime[1], SwingPrice[1] ) ; TL_SetExtLeft( TLRef, false ) ; TL_SetExtRight( TLRef, false ) ; TL_SetSize( TLRef, ZigZagLineWidth ) ; TL_SetColor( TLRef, LineColor ) ; AddTL = false ; end else if 업데이트TL then { 업데이트 prev TL and reset 업데이트TL } begin TL_SetEnd( TLRef, SwingDate, SwingTime, SwingPrice ) ; 업데이트TL = false ; end ; if AtCommentaryBar then begin xLoop = 0 ; ColumnEnd = 0 ; while xLoop < FullArrayCount and ColumnEnd = 0 begin xLoop = xLoop + 1 ; if DegreeOfAngle[ ZeroDegrees, xLoop ] > YesClose then ColumnEnd = xLoop ; { searching for SO9 numbers that are between YesClose } end ; LowRange = IntPortion( YesClose - PriceForecastRange ) ; HighRange = IntPortion( YesClose + PriceForecastRange ) ; for Counter = ColumnEnd - 1 to ColumnEnd begin for xLoop = 1 to DegreeSections begin if IFFLogic( DegreeOfAngle[ xLoop, Counter ] >= LowRange and DegreeOfAngle[ xLoop, Counter] <= HighRange, true, false ) then begin for Value99 = 1 to 25 begin MinutesAhead = ( IntPortion( FibTimeTargets[Value99] - ( DateToJulian ( date ) + ( TimeToMinutes( Time ) / ( 60 * 24 ) ) ) ) ) * ( 60 * 24 ) ; Value1 = TimeForecast( Date, Time, 0, 0, MinutesAhead, oFutureDate, oFutureTime ) ; Value1 = TL_New( oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ], oFutureDate, oFutureTime, DegreeOfAngle[ xLoop, Counter ] - MinMove / PriceScale ) ; TL_SetStyle(Value1,LineStyle_1to5); TL_SetSize( Value1, ForecastWidth_0to6 ) ; ID = Text_New( Date, TextPlaceTime, DegreeOfAngle[ xLoop, Counter ] + TextMinMoveOffset * MinMove / PriceScale, NumToStr( DegreeOfAngle[ xLoop, Counter ], 0 ) + DegreeOfAngleWord[xLoop] ) ; Value1 = Text_SetColor( ID, TextColor ) ; end ; { FibTimeTargets loop } end ; { IFFLogic } end ; { xLoop } end ; { Counter } end ; { Date = }