Sub Psycho()
'''-----http://www.samurai-logic.com/
'''-----Project of Trading System Development
'''------------------------------------------------------------------
''----B列(日付)、C列(始値)、D列(高値)、E列(安値)、F列(終値)
''----
''----TextBox1にEMA1の期間、TextBox2にEMA2の期間、
''----TextBox3にシグナルの期間
''--------------------------------------------------------------------
Dim Temp!, length1%, length2%, i&, j&
Application.ScreenUpdating = False
Worksheets("サイコロジカルライン").Activate
LastRow = Range("B4").End(xlDown).Row
length1 = CInt(ActiveSheet.TextBox1.Value)
Range("H3") = "Psycho.:" & length1
Range("H5:H5000").ClearContents
For i = length1 + 5 To LastRow
Temp = 0
For j = 1 To length1
If Cells(i - (length1) + j, 6).Value > _
Cells(i - (length1) + j - 1, 6).Value Then
Temp = Temp + 1
End If
Next j
Cells(i, 8).Value = Temp / length1 * 100
Next i
Range("H5", "H" & LastRow).NumberFormatLocal = "0.00"
Application.ScreenUpdating = True
End Sub