| Private Sub 計算_Click() |
| '************************************************* |
| ' 売買FLAGのセットと売買FLAGに応じた処理 |
| '************************************************* |
| ' |
| ' 売買FLAG(B_flag_cnt)の説明 |
| ' |
| ' 0:初期状態 |
| ' 10:売り仕掛け 20:買い仕掛け |
| ' 11:売り手仕舞待ち 21:買い手仕舞待ち |
| ' 15:売り当日手仕舞 25:買い当日手仕舞 当プログラムでは未使用 |
| ' 16:売り当日損気り 26:買い当日損切り 当プログラムでは未使用 |
| ' 18:売り手仕舞い 28:買い手仕舞い |
| ' 19:売り損切り 29:買い損切り |
| ' |
| Dim Index_cnt As Integer |
| Dim Hajimene_cnt As Long |
| Dim Takane_cnt As Long |
| Dim Yasune_cnt As Long |
| Dim Owarine_cnt As Long |
| Dim K_point_cnt As Long |
| Dim K_sonkiri_point_cnt As Long |
| Dim U_point_cnt As Long |
| Dim U_sonkiri_point_cnt As Long |
| Dim K_hantei_cnt As String |
| Dim U_hantei_cnt As String |
| Dim B_flag_cnt As Integer |
| Dim U_tanka_cnt As Long |
| Dim U_sonkiri_tanka_cnt As Long |
| Dim U_tejimai_tanka_cnt As Long |
| Dim U_soneki_cnt As Long |
| Dim K_tanka_cnt As Long |
| Dim K_sonkiri_tanka_cnt As Long |
| Dim K_tejimai_tanka_cnt As Long |
| Dim K_soneki_cnt As Long |
| Dim Bb_flag_cnt As Integer |
| Dim I As Integer |
| Dim Start_index_cnt As Integer |
| Dim Last_index_cnt As Integer |
| ' |
| I = 9 |
| Start_index_cnt = 0 |
| Do While Start_index_cnt = 0 |
| I = I + 1 |
| K_point_cnt = Cells(I, 15) |
| ' |
| If K_point_cnt <> 0 Then |
| Start_index_cnt = I |
| Else |
| End If |
| Loop |
| ' |
| I = 259 |
| Last_index_cnt = 0 |
| Do While Last_index_cnt = 0 |
| I = I - 1 |
| Hajimene_cnt = Cells(I, 3) |
| ' |
| If Hajimene_cnt <> 0 Then |
| Last_index_cnt = I |
| Else |
| End If |
| Loop |
| ' |
| For Index_cnt = Start_index_cnt To Last_index_cnt |
| Hajimene_cnt = Cells(Index_cnt, 3) |
| Takane_cnt = Cells(Index_cnt, 4) |
| Yasune_cnt = Cells(Index_cnt, 5) |
| Owarine_cnt = Cells(Index_cnt, 6) |
| K_point_cnt = Cells(Index_cnt, 15) |
| K_sonkiri_point_cnt = Cells(Index_cnt, 16) |
| U_point_cnt = Cells(Index_cnt, 17) |
| U_sonkiri_point_cnt = Cells(Index_cnt, 18) |
| K_hantei_cnt = Cells(Index_cnt, 19) |
| U_hantei_cnt = Cells(Index_cnt, 20) |
| Bb_flag_cnt = Cells(Index_cnt - 1, 21) |
| U_tanka_cnt = 0 |
| U_sonkiri_tanka_cnt = 0 |
| U_tejimai_tanka_cnt = 0 |
| U_soneki_cnt = 0 |
| K_tanka_cnt = 0 |
| K_sonkiri_tanka_cnt = 0 |
| K_tejimai_tanka_cnt = 0 |
| K_soneki_cnt = 0 |
| ' |
| If Bb_flag_cnt = 10 Or Bb_flag_cnt = 11 Then |
| U_tanka_cnt = Cells(Index_cnt - 1, 22) |
| U_sonkiri_tanka_cnt = Cells(Index_cnt - 1, 23) |
| U_tejimai_tanka_cnt = 0 |
| U_soneki_cnt = 0 |
| K_tanka_cnt = 0 |
| K_sonkiri_tanka_cnt = 0 |
| K_tejimai_tanka_cnt = 0 |
| K_soneki_cnt = 0 |
| Else |
| If Bb_flag_cnt = 20 Or Bb_flag_cnt = 21 Then |
| U_tanka_cnt = 0 |
| U_sonkiri_tanka_cnt = 0 |
| U_tejimai_tanka_cnt = 0 |
| U_soneki_cnt = 0 |
| K_tanka_cnt = Cells(Index_cnt - 1, 26) |
| K_sonkiri_tanka_cnt = Cells(Index_cnt - 1, 27) |
| K_tejimai_tanka_cnt = 0 |
| K_soneki_cnt = 0 |
| Else |
| End If |
| End If |
| ' |
| If Bb_flag_cnt = 15 Then |
| Bb_flag_cnt = 0 |
| ElseIf Bb_flag_cnt = 16 Then |
| Bb_flag_cnt = 0 |
| ElseIf Bb_flag_cnt = 18 Then |
| Bb_flag_cnt = 0 |
| ElseIf Bb_flag_cnt = 19 Then |
| Bb_flag_cnt = 0 |
| ElseIf Bb_flag_cnt = 25 Then |
| Bb_flag_cnt = 0 |
| ElseIf Bb_flag_cnt = 26 Then |
| Bb_flag_cnt = 0 |
| ElseIf Bb_flag_cnt = 28 Then |
| Bb_flag_cnt = 0 |
| ElseIf Bb_flag_cnt = 29 Then |
| Bb_flag_cnt = 0 |
| Else |
| End If |
| ' |
| If Bb_flag_cnt = 0 Then '初期状態 |
| If U_hantei_cnt = "売り" Then '売り仕掛け処理 |
| B_flag_cnt = 10 |
| U_tanka_cnt = U_point_cnt |
| U_sonkiri_tanka_cnt = U_sonkiri_point_cnt |
| Else |
| If K_hantei_cnt = "買い" Then '買い仕掛け処理 |
| B_flag_cnt = 20 |
| K_tanka_cnt = K_point_cnt |
| K_sonkiri_tanka_cnt = K_sonkiri_point_cnt |
| Else '初期状態継続 |
| B_flag_cnt = 0 |
| End If |
| End If |
| Else '仕掛け状態処理 |
| If Bb_flag_cnt = 10 Or Bb_flag_cnt = 11 Then '売り継続処理 |
| If U_sonkiri_tanka_cnt <= Takane_cnt Then '売り損切り処理 |
| B_flag_cnt = 19 |
| U_tejimai_tanka_cnt = U_sonkiri_tanka_cnt |
| U_soneki_cnt = U_tanka_cnt - U_tejimai_tanka_cnt |
| Else |
| If K_hantei_cnt = "買い" Then ' '売り手仕舞い処理 |
| B_flag_cnt = 18 |
| U_tejimai_tanka_cnt = K_point_cnt |
| U_soneki_cnt = U_tanka_cnt - U_tejimai_tanka_cnt |
| Else '売り仕掛け処理 |
| B_flag_cnt = 11 |
| End If |
| End If |
| Else |
| If Bb_flag_cnt = 20 Or Bb_flag_cnt = 21 Then '買い継続処理 |
| If K_sonkiri_tanka_cnt >= Yasune_cnt Then '買い損切り処理 |
| B_flag_cnt = 29 |
| K_tejimai_tanka_cnt = K_sonkiri_tanka_cnt |
| K_soneki_cnt = K_tejimai_tanka_cnt - K_tanka_cnt |
| Else |
| If U_hantei_cnt = "売り" Then ' '買い手仕舞い処理 |
| B_flag_cnt = 28 |
| K_tejimai_tanka_cnt = U_point_cnt |
| K_soneki_cnt = K_tejimai_tanka_cnt - K_tanka_cnt |
| Else '買い仕掛け処理 |
| B_flag_cnt = 21 |
| End If |
| End If |
| End If |
| End If |
| End If |
| ' |
| Cells(Index_cnt, 21) = B_flag_cnt |
| Cells(Index_cnt, 22) = U_tanka_cnt |
| Cells(Index_cnt, 23) = U_sonkiri_tanka_cnt |
| Cells(Index_cnt, 24) = U_tejimai_tanka_cnt |
| Cells(Index_cnt, 25) = U_soneki_cnt |
| Cells(Index_cnt, 26) = K_tanka_cnt |
| Cells(Index_cnt, 27) = K_sonkiri_tanka_cnt |
| Cells(Index_cnt, 28) = K_tejimai_tanka_cnt |
| Cells(Index_cnt, 29) = K_soneki_cnt |
| ' |
| Next Index_cnt |
| End Sub |