TRIX
Posted: under ├ TRIX. Tags: TRIX, TRIX計算å¼, VBA, 指数平滑
Â
 
TRIXã«ã¤ã„ã¦ã§ã™ã€‚
 
TRIXã¯çµ‚値ã®è‡ªç„¶å¯¾æ•°ã‚’指数移動平å‡ï¼ˆEMA)ã§3回平å‡åŒ–ã—ãŸæ•°å€¤ã¨å‰æ—¥ã¨ã®å·®ã‹ã‚‰æ±‚ã‚られる指標ã§ã™ã€‚
 
>>計算å¼ï¼ˆNã¯è¶³æ•°ï¼‰
EMA1 = N(close)ã®N本指数平滑移動平å‡
※N(close)=終値ã®è‡ªç„¶å¯¾æ•°
EMA2 = EMA1ã®N本指数平滑移動平å‡
EMA3 = EMA2ã®N本指数平滑移動平å‡
TRIX = (EMA3 - 剿—¥ã®EMA3) × 10000
 
指数平滑移動平å‡ç·š)⇒ http://www.ibi-square.jp/blog/?cat=14
Â
>>ãƒãƒ£ãƒ¼ãƒˆ
(黄色線TRIX5 赤線TRIX30)
 
>>VBAコード
 
‘※ エクセルã®1列目(A列)ã«è¡Œç•ªå·ã€2列目(B列)ã«æ—¥æ™‚ã€
‘※ 3列目(C列)~6列目(F列)ã«å§‹å€¤ãƒ»é«˜å€¤ãƒ»å®‰å€¤ãƒ»çµ‚値
‘********************************
‘ n :TRIXã®æŽ¡ç”¨æœ¬æ•°
‘ num:ç¾åœ¨ã®è¡Œ
‘ r_now:ç¾åœ¨å€¤
‘ cell_ln:終値自然対数書込ã¿åˆ—
‘ cell_ema1:指数平滑線1計算値書込ã¿åˆ—
‘ cell_ema2:指数平滑線1計算値書込ã¿åˆ—
‘ cell_ema3:指数平滑線1計算値書込ã¿åˆ—
‘ cell_trix:指数平滑線1計算値書込ã¿åˆ—
‘********************************
‘*******自然対数
If Cells(num, 6) <> “” Then
   Cells(num, cell_ln) = Application.Ln(Cells(num, 6))
End If
‘*******EMA1
   If num - 2 = n Then
   Cells(num, cell_ema1) = Application.WorksheetFunction.Average _
   (.Range(Cells(num - (n - 1), cell_ln), Cells(num, cell_ln)))
   End If
   If num - 2 > n Then
   Cells(num, cell_ema1) = Cells(num - 1, cell_ema1) + _
   ((Cells(num, cell_ln) - Cells(num - 1, cell_ema1)) * 2 / (1 + n))
   End If
‘*******EMA2
   If num - 2 = n + (n - 1) Then
   Cells(num, cell_ema2) = Application.WorksheetFunction.Average _
   (.Range(Cells(num - (n - 1), cell_ema1), Cells(num, cell_ema1)))
   End If
   If num - 2 > n + (n - 1) Then
   Cells(num, cell_ema2) = Cells(num - 1, cell_ema2) + _
   ((Cells(num, cell_ema1) - Cells(num - 1, cell_ema2)) * 2 / (1 + n))
   End If
‘*******EMA3
   If num - 2 = 2 * n + (n - 2) Then
   Cells(num, cell_ema3) = Application.WorksheetFunction.Average _
   (.Range(Cells(num - (n - 1), cell_ema2), Cells(num, cell_ema2)))
   End If
   If num - 2 > 2 * n + (n - 2) Then
   Cells(num, cell_ema3) = Cells(num - 1, cell_ema3) + _
   ((Cells(num, cell_ema2) - Cells(num - 1, cell_ema3)) * 2 / (1 + n))
   End If
‘*******TRIX
   If Cells(num - 1, cell_ema3) <> “” Then
       Cells(num, cell_trix) = (Cells(num, cell_ema3) - _
       Cells(num - 1, cell_ema3)) * 10000
   End If
 
 
| <PR> |
![]() |
| <PR> |



