我今天有問題向您請教:
真善美的世界
2026年1月13日 星期二
EMA vs RMA
我今天有問題向您請教:
2026年1月7日 星期三
台指近全
2025年12月29日 星期一
8次拋物線
準備計算數據
好,我需要請求數據來計算係數,並為用戶提供一個表格結構,這樣他們可以直接粘貼數據然後使用公式進行計算。還要遵循格式規範:使用標題、水平分隔線、以及標粗的列表標題。當涉及數學公式時,記得使用 LaTeX 格式。這樣一來,我就能確保一切都準備好了!
What I need to solve your coefficients
- Data ranges: Please share the exact ranges for (x) (time/index) and (y) (price) you want fitted.
- Window choice: Length: number of points per fit; mode: rolling window or full-sample.
- Scaling: Confirm if we center/scale (x) (recommended) or use raw (x).
If you give me these, I’ll return your full set of coefficients (\beta_0 \ldots \beta_8) directly.
The polynomial trend8 model
Model:
[ y = \beta_0 + \beta_1 z + \beta_2 z2 + \cdots + \beta_8 z8 ]
Center-scale (x) to (z):
[ z = \frac{x - \mu_x}{\sigma_x} ]
This stabilizes coefficients and reduces multicollinearity.
Excel-only setup (fastest to get coefficients)
- Prepare columns:
- z: ((x - \text{AVERAGE}(x))/\text{STDEV.S}(x))
- z1 … z8: create eight columns for powers.
- Get coefficients:
- Select 9 horizontal cells and enter:
=LINEST(y_range, z1:z8_range, TRUE, FALSE)
- This returns (\beta_8, \ldots, \beta_1, \beta_0) in one row.
- Select 9 horizontal cells and enter:
- Trend values:
- Compute (\hat{y} = \beta_0 + \beta_1 z + \cdots + \beta_8 z^8) in a new column to plot.
Tip: Use a rolling window (e.g., last 60–120 bars) to avoid overfitting and Runge effects.
VBA helper (drop-in to produce β0…β8)
- Coefficients function (paste into a standard module):
Function Trend8Coeffs(yRange As Range, xRange As Range) As Variant
Dim ws As WorksheetFunction: Set ws = Application.WorksheetFunction
Dim n As Long, i As Long: n = yRange.Rows.Count
Dim mu As Double, sd As Double: mu = ws.Average(xRange): sd = ws.StDev_S(xRange)
Dim z() As Double: ReDim z(1 To n)
For i = 1 To n: z(i) = (xRange.Cells(i, 1).Value - mu) / sd: Next i
Dim Xvar As Variant, Yvar As Variant, p As Long
ReDim Xvar(1 To n, 1 To 8)
ReDim Yvar(1 To n, 1 To 1)
For i = 1 To n
Yvar(i, 1) = yRange.Cells(i, 1).Value
Dim zp As Double: zp = z(i)
For p = 1 To 8
If p = 1 Then
Xvar(i, p) = zp
Else
zp = zp * z(i)
Xvar(i, p) = zp
End If
Next p
Next i
Trend8Coeffs = ws.LinEst(Yvar, Xvar, True, False) ' returns β8..β1, β0
End Function
- Trend value at any x:
Function Trend8Value(xVal As Double, coeffs As Range, mu As Double, sd As Double) As Double
Dim z As Double: z = (xVal - mu) / sd
Dim yhat As Double: yhat = coeffs.Cells(1, 9).Value ' β0
Dim p As Integer, zpow As Double: zpow = z
For p = 1 To 8
yhat = yhat + coeffs.Cells(1, 9 - p).Value * zpow
zpow = zpow * z
Next p
Trend8Value = yhat
End Function
- Use:
- Coeffs:
=Trend8Coeffs(Y_window, X_window)→ place across 9 cells (β8…β1, β0). - Trend:
=Trend8Value(X_i, coeffs_row, mu, sd)to plot fitted line.
- Coeffs:
Direct matrix form (if you want the full system)
Design matrix:
[ X = \begin{bmatrix} 1 & z_1 & z_12 & \cdots & z_18 \ \vdots & \vdots & \vdots & & \vdots \ 1 & z_n & z_n2 & \cdots & z_n8 \end{bmatrix},\quad \beta = \begin{bmatrix} \beta_0 \ \beta_1 \ \vdots \ \beta_8 \end{bmatrix} ]
Normal equations:
[ (X^{\top}X),\beta = X^{\top}y ]
Solve:
[ \beta = (X^{\top}X){-1}X{\top}y ]
In practice, use QR or SVD to improve stability; in Excel, LINEST already does a robust solve.
Guardrails to keep coefficients meaningful
- Short windows: Fit on the most recent 60–120 bars to avoid boundary oscillations.
- Center-scale: Always use (z), not raw (x).
- Compare orders: Plot 4th, 6th, and 8th together; if 8th diverges, prefer 6th.
- Versioning: Save each coefficient set per window time to archive your “章法的神經”。
Next step
- If you share your x/y ranges (e.g., last 80 bars of 15-minute 00663L), I will compute and return your exact (\beta_0 \ldots \beta_8) here.
- If you prefer a template, I can provide an Excel sheet layout with formulas ready to paste your data.
2025年12月20日 星期六
I'm done
2025年12月18日 星期四
星星教英文 - All you do
- Expressing agreement: When someone asks for help or assistance, you can respond with "No worries" to indicate that you are willing to help.
- Responding to gratitude: If someone thanks you, you might say "No worries" to convey that it was no trouble.
- Providing reassurance: In situations where someone is apologizing, you can use "No worries" to show that you are not worried about it.
本來無一物何處惹塵埃
**************************************************
**************************************************
**************************************************
**************************************************
2025年12月16日 星期二
鎮住全場的口語
2025年12月11日 星期四
每日30句精選英語跟讀 - 第十集
The sink is clogged again. 水槽又堵了。
*******************************************
Could you help me move this sofa?
The light bulb needs changing. 燈泡需要更換。
〔The light bulb needs to be replaced.〕
〔The light bulb needs replacing.〕
- changing 在句中是動名詞,充當受詞。
- 在 need / want / require + V-ing 結構裡,動名詞帶有 被動意義,這是英語的特殊慣用法。
- 這種用法在英式英語常見,美式英語則偏好完整的 to be + past participle。
There's a draft comeing from the window. 窗戶裡吹進來一陣風。
2025年12月10日 星期三
厲害了,我的國
1096年蘇東坡吟詩 vs 牛津大學成立
1602年明萬歷託孤鬧劇 vs 荷蘭阿姆斯特丹股票交易所成立
1636年皇太極改國號為大清 vs 哈佛大學成立
1708-1722年清康熙九子奪嫡 vs 德國實行義務教育
1730年清雍正華妃甄嬛爭寵 vs 德國小女孩已經穿上連衣裙接受義務教育
1730年清雍正華妃甄嬛爭寵 vs 法國老太太已經在炒股
1776年清乾隆的四庫全書還在編撰文字獄鼎盛 vs 美國證券交易所成立
1896年李鴻章進紐約摩天大樓不知有電梯 vs 美國早已工業文明及教育制度完善
1912年四月 - 英國停在港口的鐵達尼號 vs 孫中山的南京政府
1916年騎電動車的英國女士 vs 1918年上海的人力車
1964年 - 日本新幹線開通

