COMPARE RECENT AND PRIOR PERIOD OPEN-HIGH-LOW-COSE price data (pattern recognition)

hgdev1

New Member
Joined
Apr 19, 2011
Messages
10
cross posted http://www.ozgrid.com/forum/showthread.php?t=152482
no hits as of 04/21/2011

(excel 14/2010)
(VBA beginner experience level)

I don't know where to begin with this project.
Use PERCENTRANK or QUARTILE, ARRAY?
The data is not always exact so a 'fuzzy match' has to be used I would guess.

The need is to COMPARE RECENT AND PRIOR PERIOD OPEN-HIGH-LOW-COSE price data (pattern recognition)
I am not trying to build charts from stock price data.
I am trying to compare the price data to 'reveal' what could resemble chart patterns.
Once a pattern is recognized the output/result can be copied into the ws calling the code.

So…the idea is to compare the daily stock price data by comparing the 3 most recent periods:
...the most recent day (TODAY)
...the previous day (YESTERDAY)
...the 2nd most previous day (DAY BEFORE YESTERDAY)

So yes, the idea is to find patterns in the data itself. For now I am only seeking one pattern (below).
You can also see the pattern by charting the "BAC" symbol below with the High-Low-Close stock chart(produces a BAR chart)
The numbers in the image refer to the OPEN and CLOSE.
This is image link http://i257.photobucket.com/albums/hh207/in4to5/3days.jpg
3days.jpg


You can also see it and the worksheet in these screenshots:
http://i257.photobucket.com/albums/hh207/in4to5/screen1.jpg
http://i257.photobucket.com/albums/hh207/in4to5/screen2.jpg
(if too small to see then right click and save image to desktop, open with Windows Picture Fax viewer and zoom)
You could say I am trying to establish a framework that can be changed depending on the pattern being sought.

Below is data from several days of DAILY data for a few stock symbols.
I have changed some of the data (symbol "BAC") so that it will reflect what I am seeking to calculate and display.

SYMBOL DATE VOLUME OPEN HIGH LOW CLOSE
AA 20101102 17751924 13.12 13.22 13.06 13.21
AA 20101103 21506200 13.19 13.25 12.96 13.14
AA 20101104 28025400 13.36 13.62 13.35 13.6
AA 20101105 32119300 13.67 14.08 13.52 14
BAC 20101102 176164608 11.46 11.55 11.31 11.52
BAC 20101103 175825696 11.56 11.65 11.28 11.36
BAC 20101104 310632192 11.12 11.18 10.89 10.95
BAC 20101105 405209504 10.96 11.2 10.9 11.12
BA 20101102 6378190 70.42 70.55 68.39 69.36
BA 20101103 4670800 69.66 69.73 68.04 68.94
BA 20101104 5758100 70 71.58 69.78 70.85
BA 20101105 3612600 70.85 71.65 70.5 71.27


Not much but it's a start!
Code:
Sub periodscan()

Application.ScreenUpdating = False

Dim SymbolData As Range
Dim vSymbol() 'stock ticker

Dim DateP2(), OpenP2(), HighP2(), LowP2(), CloseP2(), VolumeP2()
' "P2" signifies older Previous Period (if DAY data then would be DAY BEFORE YESTERDAY)

Dim DateP1(), OpenP1(), HighP1(), LowP1(), CloseP1(), VolumeP1()
' "P1" signifies recent Previous Period (if DAY data then would be YESTERDAY)

Dim DateL(), OpenL(), HighL(), LowL(), CloseL(), VolumeL()
' "L" signifies Latest Period (if DAY data then would be TODAY)

Set SymbolData = Worksheets("Data").Range("A1", Range("G" & Rows.Count).End(xlUp))



End Sub
Thanks for looking at this!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
...ADDING SOME CLARITY TO ORIGINAL POST...

So…the idea is to compare the daily stock price data by comparing the 3 most recent periods:
...the most recent day (TODAY)
...the previous day (YESTERDAY)
...the 2nd most previous day (DAY BEFORE YESTERDAY)
3days.jpg
...AND we are comparing the last 3 periods looking for the equivalent pattern in the image above!



The image represents a BAR chart, also known as an "open-high-low-close". Reason being that it begins with an 'open' price, then moves up or down in price(high and low), then has a 'close' (closing) price.

(when charting the sample data above, you will only find an 'open' price on the Candlestick stock chart, and not on the "HI-LO-CLOSE" as found in Excel. but remember idea is to compare the data...the graphic is only to give you a visual of the concept)

When thinking of the BARs on the chart you need to think backwards with reference to the DAYS.
So...

TODAY ...is the 5, 6 BAR...opens(5), goes lower, then a lot higher, a little lower then closes(6)

YESTERDAY ...is the 3, 4 BAR...opens(3)...closes(4)

DAY BEFORE YESTERDAY ...is the 1,2...opens(1)...closes(2)
 
Upvote 0
BUMP 4 days

I need suggestions on how to approach this or where to begin............code would be nice......but I would be happy and thankful for some direction :)

Should I post elsewhere?
 
Upvote 0

Forum statistics

Threads
1,224,504
Messages
6,179,144
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top