Title: 10 Minute Bar Analysis Update
1- 10 Minute Bar Analysis - Update
- Metastock User Group
- 2/5/2008
- Leland Brode
- leland_at_elbsoftware.com
210 Minute Bar Analysis
- Outline
- Objective
- Data
- Tools (Excel, VBA)
- Looking for Profitable Patterns
- Profitable Results
310 Minute Bar Analysis
- Objective
- Find patterns for intraday profits based on price
action in first half hour of trading. - Analyze the status of Opening Gap looking for
Gap Up or Gap Down - Analyze the first three 10 minute bars
410 Minute Bar Analysis
- Data
- 10 minute bar data captured from Metastock via
eSignal and Quotecenter data feeds - 238 spreadsheets 1 per security, 1 year of data
per security, sample from 2004 to 2007 - 2.3 millions spreadsheet rows, (ie. 10 min bars)
- SP 100, Nasdaq 100, ETFs and a few other stocks
- Includes SPY, QQQQ, IWM to analyze index trading
510 Minute Bar Analysis
- Tools
- Excel / Visual Basic for Applications (VBA)
- Included with Excel
- Functionality is large subset of the real VB,
integrated into Excel (and Access, Word,
Powerpoint) - VB program can address cells, worksheets
(within workbook), workbooks, files - Debug - Run, set Breakpoints, Watch variables
- Uses Excels Macro capability
6VBA - sample
- Simple Macro Example with VBA Code added
- - select Tools Macro Record New Macro
to record a macro, then - - select Tools Macro Visual Basic
Editor in to view VBA code - Sub MacroTest()
- '
- ' MacroTest Macro
- ' Macro recorded 9/30/2007 by Leland
- '
- ' Keyboard Shortcut Ctrlq
- Range("A1").Select
- For x 1 To 20
- Cells(x, 1) x
- Next x
-
- End Sub
I added this code
7VBA - sample
Spreadsheet data
1st bar of day
VBA code To find Gap Up in above spreadsheet, N
1st row If Cells(N, 3) gt Cells(N-1, 6) is
Open gt Prev Close Then gap_up Yes Else
gap_up No
8VBA from actual program
- Is Gap Up ? (Open gt High MajorGapUp)
- If Cells(N, 3).Value gt Cells(N - 1, 4).Value
Then - ' is 1st and 2nd and 3rd bar up
- If Cells(N, 6) gt Cells(N, 3) And Cells(N
1, 6) gt Cells(N 1, 3) And Cells(N 2, 6) gt
Cells(N 2, 3) Then - ' now is it up before 1200
- If MornHigh gt Cells(N 2, 4).Value
UpAmt Then - MjUpAM3 MjUpAM3 1
- MjGapUp3 MjGapUp3 1
- holdDelta Abs(MornHigh - Cells(N
2, 4).Value) - U UBound(MjUpAM3Delta)
- ReDim Preserve MjUpAM3Delta(U 1)
- MjUpAM3Delta(U 1) holdDelta
- Else ' no just Gap Up
- MjGapUp3 MjGapUp3 1
- End If
- is it Up during the day
- If DayHigh gt Cells(N 2, 4).Value
UpAmt Then - MjUpDay3 MjUpDay3 1
- holdDelta Abs(DayHigh - Cells(N
2, 4).Value)
9Bar Analysis Questions
- Pattern Questions using 10 minute bars
- Is it a Gap at Open ?
- Gap Up
- Minor gap (O gt prev C)
- Major gap (O gt prev H)
- Gap Down
- Minor gap (O lt prev C)
- Major gap (O lt prev L)
- For each Gap
- Is 1st bar Up
- Is 1st and 2nd bar Up
- Is 1st, 2nd, and 3rd bar Up
- Is 1st bar Up, then 2nd bar Down
- Is 1st bar Down, then 2nd bar Up
- Is 1st bar Up, 2nd bar Down, then 3rd bar Up
10Analysis Results
- Results for each question
- What is probability price goes Up
- Up in AM (by noon cst)
- Up in Day
- Up at Close
- What is price increase (delta)
- When is price highest (Hi of day)
- -- looking for more questions !
11Opening 10 minute bar patterns
3 white soldiers 1st bar up
up/down/up dark cloud piercing
line 2 bars up
Probability Up during day Min Gap Up
.694 .643 .599
.578 .439
.553 Maj Gap Up .713 .649
.601 .510
.440 .550
Min Gap Dn .637 .621 .592
.616
.453 .586 Maj Gap Dn
.624 .545 .593
.580 .454
.581 see Appendix for actual criteria
for determining above pattern
Each line is consolidated probability for all
stocks meeting each pattern
12Opening 10 minute bar patterns
3 black crows 2 down, 1 up
2 bar engulf Harami separating
lines morning star
Next open gt50
25
50
Probability Up during day Min Gap Up .509
.674 .491
.558 .476
.802 Maj Gap Up .513 .681
.494 .545
.452 .806 Min Gap Dn
.509 .709 .512
.554 .519
.808 Maj Gap Dn .526
.699 .506
.530 .518
.811 see Appendix for actual criteria for
determining above pattern
1310 Minute Bar Analysis - amount of increase for
1st scenario
- Gap Type Bars Up When Up Min Max Mode Ave Median S
td Dev Freq - Maj_GapUp 3rdBarUp UpDay 0.000 1.000 1.000 0.713 0
.750 0.217 8.44 - Ave Price Delta
- Min Max Mode Ave Median Std Dev
- 0 1.59 0 .423 .360 .268
- Median Price Delta
- Min Max Mode Ave Median Std Dev
- 0 1.31 0 .382 .310 .248
- Max Price Delta
- Min Max Mode Ave Median Std Dev
- 0 5.55 0 .982 .770 .792
- Each security has an Average Delta for this
scenario - Data to left is Max, Ave, Median for this
consolidated Average Delta - Each security has a Median Delta for this
scenario - Data to left is Max, Ave, Median for this
consolidated Median Delta - Each security has a Maximum Delta for this
scenario - Data to left is Max, Ave, Median for this
consolidated Maximum Delta
1410 Minute Bar Analysis - Time of High of Day
15Setup Instructions to run Analysis
Data One spreadsheet per security - must look
like following - with 10 minute bar
data Date Time Open High Low Close Volume O
pen Int. 8/30/2004 840 AM 32.76 33.11 32.76 33.1
121200 0 8/30/2004 850 AM 33.1 33.14 33.05 33.05
115500 0 Other Files "_symbols.txt" - contains
list of security spreadsheet files - one entry
per spreadsheet file - example follows the
program uses this file to figure out which
spreadsheets to open and process a.xls
aapl.xls abt.xls Output file
the provided "_results_generic_empty.xls" is the
template for all output result spreadsheets. One
spreadsheet is created for each run of the
program. The file must look like
"_results_generic_empty.xls" - so Open
_results_generic_empty.xls and SaveAs to
create a new "empty" file for your output. You
can name it anything you like, but must be
setup in the Customize section of the VBA
program - "Ouputsheet YourFileName.xls" Crit
eria In the Customize section of the VBA
program you must 1) name your 3 criteria (8
character name) - Criteria1 "3barsup" for
example 2) build your If statement -
Criteria1doc "If Cells(N, C_) gt Cells(N, O_)
Then" for example 3) modify the actual If
statement in the VBA program after the VBA
comment -- Criteria1 - , etc. Your Criteria
for this run.. 1/8/2008 UpHalf If
Cells(N1, C_) gt (((Cells(N, H_) - Cells(N,
L_))/2 Cells(N, L_)) And Cells(N2, C_) gt
(((Cells(N, H_) - Cells(N, L_))/2 Cells(N, L_))
Then 3rdBarHi If Cells(N2, H_) gt PrevHi(N)
Then 2ndBarHi If Cells(N1, H_) gt PrevHi(N)
Then Top Level Filter Criteria if any.
16Results
Your Criteria for this run.. 1/7/2008 2ndEngulf
If Cells(N 1, 3) lt ((Cells(N, 4) -
Cells(N, 5)) 0.25 Cells(N, 5)) And Cells(N
1, 4) gt Cells(N, 4) And Cells(N 1, 6) gt Cells(N
1, 3) Then Harami If Cells(N, 6) lt
Cells(N, 3) And Cells(N 1, 5) gt Cells(N, 5) And
Cells(N 1, 4) lt Cells(N, 4) And Cells(N 2, 3)
gt ((Cells(N 1, 4) - Cells(N 1, 5)) / 2)
Cells(N 1, 5) Then SepLines If Cells(N 1, 5)
gt ((Cells(N, 4) - Cells(N, 5)) 0.5 Cells(N,
5)) And Cells(N 1, 6) gt Cells(N 1, 3) And
Cells(N 1, 4) gt Cells(N, 4) Then
- Gap Bars Up Result Min Max Mode Ave Median StDev
- Min_GapUp SepLines Freq 2.000 34.000 15.000 17.396
17.000 4.385 - Min_GapDn SepLines Freq 0.000 39.000 13.000 17.234
17.000 5.829 - Min_GapUp Harami Freq 0.000 23.000 6.000 8.081 8.0
00 3.732 - Min_GapDn Harami Freq 0.000 19.000 6.000 6.285 6.0
00 3.374 - Maj_GapDn SepLines Freq 0.000 13.000 5.000 4.285 4
.000 2.353 - Maj_GapUp SepLines Freq 0.000 11.000 3.000 4.226 4
.000 2.206 - Min_GapUp 2ndEngulf Freq 0.000 10.000 2.000 3.421
3.000 2.183 - Min_GapDn 2ndEngulf Freq 0.000 9.000 2.000 3.149 3
.000 2.019 - Maj_GapUp Harami Freq 0.000 8.000 2.000 2.345 2.00
0 1.714 - Maj_GapDn Harami Freq 0.000 8.000 1.000 1.374 1.00
0 1.364 - Maj_GapDn 2ndEngulf Freq 0.000 4.000 0.000 0.745 0
.000 0.949 - Maj_GapUp 2ndEngulf Freq 0.000 5.000 0.000 0.711 0
.000 0.934 - Min_GapUp 2ndEngulf UpDay 0.000 1.000 1.000 0.703
0.750 0.326 - Min_GapDn 2ndEngulf UpDay 0.000 1.000 1.000 0.685
0.778 0.350 - Min_GapDn Harami UpDay 0.000 1.000 1.000 0.662 0.7
00 0.259 - Min_GapUp 2ndEngulf UpAM 0.000 1.000 1.000 0.652 0
.667 0.335 - Min_GapUp Harami UpDay 0.000 1.000 0.500 0.652 0.6
67 0.217
17Results
Your Criteria for this run.. 1/8/2008 3BarDn
If Cells(N, 6) lt Cells(N, 3) And Cells(N 1, 6)
lt Cells(N, 6) And Cells(N 2, 6) lt Cells(N 1,
6) Then MornStar If Cells(N, 6) lt
Cells(N, 3) And Cells(N 1, 6) gt Cells(N 1, 3)
And Cells(N 2, 6) gt Cells(N 2, 3) And Cells(N
2, 3) gt ((Cells(N, 4) - Cells(N, 5)) / 2
Cells(N, 5)) Then Dn3rdUp If Cells(N, 6) lt
Cells(N, 3) And Cells(N 1, 6) lt Cells(N, 6) And
Cells(N 2, 6) gt Cells(N 1, 3) Then
- Gap Bars Up Result Min Max Mode Ave Median StDev
- Min_GapUp 3BarDn Freq 3.000 30.000 15.000 12.404 1
2.000 4.559 - Min_GapDn 3BarDn Freq 2.000 21.000 7.000 9.660 9.0
00 3.577 - Min_GapUp MornStar Freq 1.000 17.000 6.000 7.974 8
.000 3.106 - Min_GapDn MornStar Freq 0.000 15.000 5.000 6.774 6
.000 3.049 - Min_GapUp Dn3rdUp Freq 0.000 15.000 5.000 5.566 5.
000 2.547 - Min_GapDn Dn3rdUp Freq 0.000 15.000 3.000 4.766 4.
000 2.569 - Maj_GapUp 3BarDn Freq 0.000 9.000 3.000 3.209 3.00
0 2.018 - Maj_GapUp MornStar Freq 0.000 6.000 2.000 2.034 2.
000 1.405 - Maj_GapDn 3BarDn Freq 0.000 9.000 2.000 2.017 2.00
0 1.508 - Maj_GapDn MornStar Freq 0.000 7.000 1.000 1.485 1.
000 1.295 - Maj_GapUp Dn3rdUp Freq 0.000 5.000 1.000 1.306 1.0
00 1.195 - Maj_GapDn Dn3rdUp Freq 0.000 5.000 0.000 0.817 1.0
00 0.950 - Min_GapDn MornStar UpDay 0.000 1.000 1.000 0.814 0
.857 0.218 - Min_GapUp MornStar UpDay 0.000 1.000 1.000 0.802 0
.833 0.191 - Min_GapDn MornStar UpAM 0.000 1.000 1.000 0.757 0.
800 0.233 - Min_GapUp MornStar UpAM 0.000 1.000 1.000 0.754 0.
778 0.202 - Maj_GapUp MornStar UpDay 0.000 1.000 1.000 0.684 1
.000 0.416
18Results
Your Criteria for this run.. 1/8/2008 3barsUp
If Cells(N, 6) gt Cells(N, 3) And Cells(N 1,
6) gt Cells(N 1, 3) And Cells(N 2, 6) gt
Cells(N 2, 3) Then 2barsUp If Cells(N,
6) gt Cells(N, 3) And Cells(N 1, 6) gt Cells(N
1, 3) Then 1barUp If Cells(N, 6) gt Cells(N, 3)
Then
- Gap Bars Up Result Min Max Mode Ave Median StDev
- Min_GapDn 1barUp Freq 1.000 109.000 49.000 58.004
56.000 15.947 - Min_GapUp 1barUp Freq 10.000 89.000 52.000 53.621
53.000 11.518 - Min_GapDn 2barsUp Freq 0.000 60.000 28.000 27.770
27.000 9.299 - Min_GapUp 2barsUp Freq 3.000 46.000 24.000 25.557
25.000 6.334 - Maj_GapDn 1barUp Freq 0.000 32.000 14.000 13.855 1
3.000 5.561 - Min_GapDn 3barsUp Freq 0.000 30.000 14.000 13.111
13.000 5.559 - Maj_GapUp 1barUp Freq 2.000 28.000 11.000 11.549 1
1.000 4.804 - Min_GapUp 3barsUp Freq 0.000 24.000 11.000 11.506
11.000 4.106 - Maj_GapDn 2barsUp Freq 0.000 21.000 7.000 6.962 7.
000 3.311 - Maj_GapUp 2barsUp Freq 0.000 15.000 3.000 5.626 5.
000 2.699 - Maj_GapDn 3barsUp Freq 0.000 12.000 3.000 3.200 3.
000 2.195 - Maj_GapUp 3barsUp Freq 0.000 9.000 2.000 2.426 2.0
00 1.686 - Min_GapUp 3barsUp UpDay 0.000 1.000 1.000 0.883 0.
917 0.149 - Min_GapUp 3barsUp UpAM 0.000 1.000 1.000 0.854 0.8
89 0.168 - Min_GapDn 3barsUp UpDay 0.000 1.000 1.000 0.851 0.
882 0.159 - Min_GapDn 3barsUp UpAM 0.000 1.000 1.000 0.808 0.8
46 0.187 - Maj_GapUp 3barsUp UpDay 0.000 1.000 1.000 0.781 1.
000 0.363
19Results
Your Criteria for this run.. 1/8/2008 UpDnUp
If Cells(N, 6) gt Cells(N, 3) And Cells(N 1, 6)
lt Cells(N, 3) And Cells(N 2, 6) gt Cells(N, 3)
Then Up2ndDn If Cells(N, 6) gt Cells(N, 3)
And Cells(N 1, 6) lt Cells(N, 6) Then 1barUp If
Cells(N, 6) lt Cells(N, 3) And Cells(N 1, 6) gt
Cells(N, 6) Then
- Gap Bars Up Result Min Max Mode Ave Median StDev
- Min_GapDn Up2ndDn Freq 1.000 52.000 28.000 28.251
28.000 8.185 - Min_GapUp 1DnUp Freq 2.000 45.000 26.000 28.200 28
.000 6.456 - Min_GapUp Up2ndDn Freq 6.000 48.000 26.000 25.864
26.000 7.231 - Min_GapDn 1DnUp Freq 3.000 39.000 20.000 22.821 23
.000 5.771 - Maj_GapUp 1DnUp Freq 0.000 18.000 6.000 7.140 7.00
0 3.260 - Maj_GapDn Up2ndDn Freq 0.000 17.000 5.000 6.477 6.
000 3.272 - Maj_GapUp Up2ndDn Freq 0.000 17.000 5.000 5.549 5.
000 3.014 - Maj_GapDn 1DnUp Freq 0.000 14.000 5.000 4.940 5.00
0 2.642 - Min_GapDn UpDnUp Freq 0.000 9.000 2.000 2.719 2.00
0 1.839 - Min_GapUp UpDnUp Freq 0.000 8.000 2.000 2.379 2.00
0 1.655 - Maj_GapDn 1DnUp UpDay 0.000 1.000 1.000 0.605 0.60
0 0.282 - Min_GapDn 1DnUp UpDay 0.000 1.000 0.667 0.593 0.61
5 0.162 - Maj_GapDn UpDnUp Freq 0.000 4.000 0.000 0.583 0.00
0 0.830 - Maj_GapUp 1DnUp UpDay 0.000 1.000 0.500 0.576 0.60
0 0.244 - Min_GapUp 1DnUp UpDay 0.000 0.848 0.667 0.574 0.58
8 0.144 - Min_GapDn UpDnUp UpDay 0.000 1.000 1.000 0.530 0.5
00 0.381 - Maj_GapDn 1DnUp UpAM 0.000 1.000 0.500 0.527 0.500
0.283
20Results
Your Criteria for this run.. 1/8/2008 UpHalf
If Cells(N1, C_) gt (((Cells(N, H_) - Cells(N,
L_))/2 Cells(N, L_)) And Cells(N2, C_) gt
(((Cells(N, H_) - Cells(N, L_))/2 Cells(N, L_))
Then 3rdBarHi If Cells(N2, H_) gt
PrevHi(N) Then 2ndBarHi If Cells(N1, H_) gt
PrevHi(N) Then
- Table of Results from PercentUp
Calculations - Gap Bars Up Result Min Max Mode Ave Median S
tDev - Min_GapUp UpHalf Freq 4.000 77.000 42.000 46.396 4
5.000 8.380 - Min_GapDn UpHalf Freq 2.000 83.000 49.000 46.034 4
5.000 11.927 - Min_GapUp 2ndBarHi Freq 5.000 71.000 44.000 43.000
43.000 9.215 - Min_GapUp 3rdBarHi Freq 3.000 68.000 41.000 41.468
41.000 8.760 - Maj_GapUp 2ndBarHi Freq 3.000 45.000 21.000 22.711
22.000 7.317 - Maj_GapUp 3rdBarHi Freq 2.000 43.000 25.000 21.404
21.000 6.979 - Min_GapDn 3rdBarHi Freq 0.000 26.000 9.000 11.562
11.000 4.407 - Maj_GapDn UpHalf Freq 1.000 27.000 11.000 11.260 1
1.000 4.334 - Maj_GapUp UpHalf Freq 0.000 27.000 9.000 10.791 10
.000 4.073 - Min_GapDn 2ndBarHi Freq 0.000 22.000 9.000 10.034
10.000 3.828 - Min_GapUp UpHalf UpDay 0.136 0.980 0.857 0.758 0.7
83 0.136 - Maj_GapUp UpHalf UpDay 0.000 1.000 1.000 0.748 0.7
78 0.182 - Min_GapDn UpHalf UpDay 0.000 1.000 0.667 0.745 0.7
80 0.147 - Maj_GapDn UpHalf UpDay 0.000 1.000 1.000 0.738 0.7
78 0.189 - Min_GapUp UpHalf UpAM 0.068 0.979 0.667 0.703 0.73
2 0.154 - Maj_GapUp UpHalf UpAM 0.000 1.000 0.667 0.692 0.71
4 0.202
21Summary
- There are tradeable patterns based on Morning
Gap, and action of the first three 10 minute bars
with probabilities of higher prices in the 60, 70
and 80 range. An entry point for the trade is
on the 2nd or 3rd bar depending on the pattern.
The analysis is not complete because an Exit
strategy has not been discussed. There has been
no discussion of how to determine the High of the
day and therefore when to exit the trade. Also
there are many more patterns to review. I plan
to do analysis of the probability of price
Decrease after finding the patterns. - I am also working on streamlining the VBA program
so that there is only one program with the
ability input the pattern to look for.