📄 stock.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "股票预报"
ClientHeight = 4860
ClientLeft = 3135
ClientTop = 1965
ClientWidth = 6255
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4860
ScaleWidth = 6255
Begin VB.TextBox Text2
Height = 375
Left = 3000
TabIndex = 1
Text = "5"
Top = 4200
Width = 615
End
Begin VB.ListBox List5
Height = 2940
Left = 1440
TabIndex = 14
Top = 480
Width = 1215
End
Begin VB.ListBox List4
Height = 2940
Left = 4800
TabIndex = 10
Top = 480
Width = 1335
End
Begin VB.ListBox List3
Height = 2940
Left = 3360
TabIndex = 9
Top = 480
Width = 1335
End
Begin VB.ListBox List2
Height = 2940
Left = 2760
TabIndex = 8
Top = 480
Width = 495
End
Begin VB.CommandButton qbqc
Caption = "全部清除"
Height = 375
Left = 2760
TabIndex = 4
Top = 3480
Width = 1215
End
Begin VB.CommandButton qc
Caption = "清除"
Height = 375
Left = 1440
TabIndex = 3
Top = 3480
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 4080
TabIndex = 7
Top = 4200
Width = 1215
End
Begin VB.CommandButton start
Caption = "开始运算"
Height = 375
Left = 4080
TabIndex = 5
Top = 3480
Width = 1215
End
Begin VB.CommandButton zj
Caption = "增加"
Height = 375
Left = 120
TabIndex = 2
Top = 3480
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
Left = 120
TabIndex = 0
Top = 4200
Width = 2535
End
Begin VB.ListBox List1
Height = 2940
Left = 120
TabIndex = 6
Top = 480
Width = 1215
End
Begin VB.Label Label7
Caption = "1阶累加"
Height = 255
Left = 120
TabIndex = 18
Top = 3960
Width = 1095
End
Begin VB.Label Label6
Caption = "输出项数"
Height = 255
Left = 2880
TabIndex = 17
Top = 3960
Width = 1095
End
Begin VB.Label Label5
Caption = "Xt1"
Height = 255
Left = 1440
TabIndex = 16
Top = 240
Width = 1215
End
Begin VB.Label Label4
Caption = "Xt0"
Height = 255
Left = 120
TabIndex = 15
Top = 240
Width = 1095
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "回测值"
Height = 255
Left = 4800
TabIndex = 13
Top = 240
Width = 1335
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "模型值"
Height = 255
Left = 3360
TabIndex = 12
Top = 240
Width = 1335
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "t"
Height = 255
Left = 2760
TabIndex = 11
Top = 240
Width = 375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
End Sub
Private Sub Command3_Click()
Set Form = Nothing
End
End Sub
Private Sub qbqc_Click()
List1.Clear
End Sub
Private Sub qc_Click()
If List1.ListIndex = -1 Then Exit Sub
List1.RemoveItem List1.ListIndex
End Sub
Private Sub start_Click()
num = List1.ListCount
output_num = Val(Text2.Text)
If num < 2 Or output_num < 1 Then Exit Sub
ReDim xt0(1 To num) As Double
ReDim xt1(1 To num) As Double
ReDim bjz(1 To num - 1) As Double
ReDim BTB(1 To 2, 1 To 2) As Double
ReDim BTY5(1 To 2) As Double
ReDim ajz(1 To 2) As Double
Dim va As Double
Dim result As Double
List5.Clear
For i = 1 To num
xt0(i) = List1.List(i - 1)
Next i
For i = 1 To num
For j = 1 To i
xt1(i) = xt1(i) + xt0(j)
Next j
List5.AddItem Format$(xt1(i))
Next i
For j = 1 To num - 1
bjz(j) = -(xt1(j) + xt1(j + 1)) / 2
Next j
a = 0
b = 0
For j = 1 To num - 1
a = a + bjz(j) ^ 2
b = b + bjz(j)
Next j
c = b
d = num - 1
DD = a * d - b * c
BTB(1, 1) = d / DD
BTB(1, 2) = -b / DD
BTB(2, 1) = -c / DD
BTB(2, 2) = a / DD
For j = 1 To num - 1
BTY5(1) = BTY5(1) + bjz(j) * xt0(j + 1)
BTY5(2) = BTY5(2) + xt0(j + 1)
Next j
ajz(1) = BTB(1, 1) * BTY5(1) + BTB(1, 2) * BTY5(2)
ajz(2) = BTB(2, 1) * BTY5(1) + BTB(2, 2) * BTY5(2)
List2.Clear
List3.Clear
List4.Clear
For t = 1 To output_num
List2.AddItem Format$(t)
va = ajz(2) / ajz(1)
result = (xt0(1) - va) * (2.7182818284) ^ (-ajz(1) * (t - 1)) + va
List3.AddItem Format$(Int(result * 1000000) / 1000000)
If t >= 2 Then
hc = result - List3.List(t - 2)
Else
hc = result
End If
List4.AddItem Format$(Int(hc * 1000000) / 1000000)
Next t
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then zj_Click
End Sub
Private Sub zj_Click()
If Text1.Text = "" Then Exit Sub
List1.AddItem Text1.Text
Text1.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -