読者です 読者をやめる 読者になる 読者になる

PU-METALのブログ

日銀にはウンザリなのでポンドル専になりました

ドル円8時間足ブレイクアウト

取り敢えず損益累計曲線

f:id:kohnodechu:20170315125352p:plain

駄目だ

ただロンドン時間の安値ブレイクだけは逸品。薄利だけど

4時間のEA作る前に下書きとしてこれ作ってみよ

 

5分足から8時間足作ってテストするところまで一連のプロシージャ

進化したので置いとこう

f:id:kohnodechu:20170315130904p:plain

Sub 番() '8時間足に1-3の番号をふる
Dim Rp As Range 'rpは日付
Dim Kai As Long '80000or70000サマータイム
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each Rp In Selection
With Rp
If .Offset(-1).Value <> .Value Then
If .Offset(, 1).Value = 70000 Then
Kai = 70000
ElseIf .Offset(, 1).Value = 80000 Then
Kai = 80000
End If
End If
If .Offset(, 1).Value - Kai >= 0 Then
.Offset(, 2).Value = Int((.Offset(, 1).Value - Kai) / 80000) + 1
Else
.Offset(, 2).Value = Int((240000 + .Offset(, 1).Value - Kai) / 80000) + 1
End If
End With
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

 

Sub 時間足()
Dim Rp As Range 'rpは日付
Dim Hh1 As Single, Th1 As Single, Yh1 As Single, Oh1 As Single '前日8時間足
Dim Hk1 As Single, Tk1 As Single, Yk1 As Single, Ok1 As Single '8時間足計算中
Dim Hh2 As Single, Th2 As Single, Yh2 As Single, Oh2 As Single
Dim Hk2 As Single, Tk2 As Single, Yk2 As Single, Ok2 As Single
Dim Hh3 As Single, Th3 As Single, Yh3 As Single, Oh3 As Single
Dim Hk3 As Single, Tk3 As Single, Yk3 As Single, Ok3 As Single
Dim Wa1 As Single, Wb1 As Single '値幅a前々b前
Dim Wa2 As Single, Wb2 As Single
Dim Wa3 As Single, Wb3 As Single
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each Rp In Selection
With Rp
Select Case .Offset(, 2).Value
Case Is = 1
If .Offset(-1, 2).Value = 3 Then
Hh1 = Hk1: Th1 = Tk1: Yh1 = Yk1: Oh1 = Ok1
Hk1 = .Offset(, 3).Value
Tk1 = .Offset(, 4).Value
Yk1 = .Offset(, 5).Value
Wa1 = Wb1
Wb1 = Th1 - Yh1
Else
If .Offset(, 4).Value > Tk1 Then
Tk1 = .Offset(, 4).Value
End If
If .Offset(, 5).Value < Yk1 Then
Yk1 = .Offset(, 5).Value
End If
If .Offset(1, 2).Value = 2 Then '最後に終値
Ok1 = .Offset(, 6).Value
End If
End If
.Offset(, 7).Value = Hh1
.Offset(, 8).Value = Th1
.Offset(, 9).Value = Yh1
.Offset(, 10).Value = Oh1
.Offset(, 11).Value = Wa1
.Offset(, 12).Value = Wb1
If Tk3 > Tk2 Then '前足と前々足の比較
.Offset(, 13).Value = 1
Else
.Offset(, 13).Value = 0
End If
If Yk3 < Yk2 Then
.Offset(, 14).Value = 1
Else
.Offset(, 14).Value = 0
End If
If Hk3 < Ok3 Then '前足の上下
.Offset(, 15).Value = 1
Else
.Offset(, 15).Value = -1
End If
Case Is = 2
If .Offset(-1, 2).Value = 1 Then
Hh2 = Hk2: Th2 = Tk2: Yh2 = Yk2: Oh2 = Ok2
Hk2 = .Offset(, 3).Value
Tk2 = .Offset(, 4).Value
Yk2 = .Offset(, 5).Value
Wa2 = Wb2
Wb2 = Th2 - Yh2
Else
If .Offset(, 4).Value > Tk2 Then
Tk2 = .Offset(, 4).Value
End If
If .Offset(, 5).Value < Yk2 Then
Yk2 = .Offset(, 5).Value
End If
If .Offset(1, 2).Value = 3 Then '最後に終値
Ok2 = .Offset(, 6).Value
End If
End If
.Offset(, 7).Value = Hh2
.Offset(, 8).Value = Th2
.Offset(, 9).Value = Yh2
.Offset(, 10).Value = Oh2
.Offset(, 11).Value = Wa2
.Offset(, 12).Value = Wb2
If Tk1 > Tk3 Then '前足と前々足の比較
.Offset(, 13).Value = 1
Else
.Offset(, 13).Value = 0
End If
If Yk1 < Yk3 Then
.Offset(, 14).Value = 1
Else
.Offset(, 14).Value = 0
End If
If Hk1 < Ok1 Then '前足の上下
.Offset(, 15).Value = 1
Else
.Offset(, 15).Value = -1
End If
Case Is = 3
If .Offset(-1, 2).Value = 2 Then
Hh3 = Hk3: Th3 = Tk3: Yh3 = Yk3: Oh3 = Ok3
Hk3 = .Offset(, 3).Value
Tk3 = .Offset(, 4).Value
Yk3 = .Offset(, 5).Value
Wa3 = Wb3
Wb3 = Th3 - Yh3
Else
If .Offset(, 4).Value > Tk3 Then
Tk3 = .Offset(, 4).Value
End If
If .Offset(, 5).Value < Yk3 Then
Yk3 = .Offset(, 5).Value
End If
If .Offset(1, 2).Value = 1 Then '最後に終値
Ok3 = .Offset(, 6).Value
End If
End If
.Offset(, 7).Value = Hh3
.Offset(, 8).Value = Th3
.Offset(, 9).Value = Yh3
.Offset(, 10).Value = Oh3
.Offset(, 11).Value = Wa3
.Offset(, 12).Value = Wb3
If Tk2 > Tk1 Then '前足と前々足の比較
.Offset(, 13).Value = 1
Else
.Offset(, 13).Value = 0
End If
If Yk2 < Yk1 Then
.Offset(, 14).Value = 1
Else
.Offset(, 14).Value = 0
End If
If Hk2 < Ok2 Then '前足の上下
.Offset(, 15).Value = 1
Else
.Offset(, 15).Value = -1
End If
End Select
End With
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

 

Sub テストTO()
Dim Rp As Range 'rpは日付
Dim T As Single, Y As Single '前日高安
Dim Ek As Single, Eu As Single '-1はエントリーしない
Dim Hk As Single, Hu As Single '勝敗価格
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Ek = -1: Eu = -1
For Each Rp In Selection
With Rp
If .Offset(, 2).Value = 3 And .Offset(1, 2).Value = 1 Then '5min前決済
If Ek > 0 Then
.Offset(, 16).Value = .Offset(, 3).Value - Ek
End If
If Eu > 0 Then
.Offset(, 17).Value = Eu - .Offset(, 3).Value - 0.01
End If
Ek = -1: Eu = -1: Hk = 0: Hu = 0
ElseIf .Offset(-1, 2).Value = 3 And .Offset(, 2).Value = 1 Then '3になった時
T = .Offset(, 8).Value
Y = .Offset(, 9).Value
Hk = .Offset(, 12).Value
Hu = .Offset(, 12).Value
If .Offset(, 3).Value < T Then
Ek = 0
End If
If .Offset(, 3).Value > Y Then
Eu = 0
End If
End If
'勝ち
If Ek > 0 And Ek + Hk < .Offset(, 4).Value Then
.Offset(, 16).Value = Hk
Ek = -1: Hk = 0
End If
If Eu > 0 And Eu - Hu - 0.01 > .Offset(, 5).Value Then
.Offset(, 17).Value = Hu
Eu = -1: Hu = 0
End If
'負け
If Ek > 0 And Ek - Hk > .Offset(, 5).Value Then
.Offset(, 16).Value = -Hk
Ek = -1: Hk = 0
End If
If Eu > 0 And Eu + Hu - 0.01 < .Offset(, 4).Value Then
.Offset(, 17).Value = -Hu
Eu = -1: Hu = 0
End If
'エントリー
If Ek = 0 And T < .Offset(, 4).Value Then
Ek = T + 0.01
.Offset(, 16).Value = 0
End If
If Eu = 0 And Y > .Offset(, 5).Value Then
Eu = Y
.Offset(, 17).Value = 0
End If
End With
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub