Manipulating Historical Data for Financial Instrument

kcjt2009

New Member
Joined
Feb 13, 2014
Messages
12
Hello:

I am playing around with some historical trading data for a financial instrument.

The data in this spreadsheet is the price history and reflects the daily price (open, high, low and close) as it is broken down into 5 minute periods of time. Nearly every day of data will have a maximum of 81 rows of data. However, there is one day that has fewer than 81 rows due to the markets closing early for a national holiday.

For my purposes, each day is independent of the next and nothing that occurs in one day should influence the results for the next day.

During the course of each day, I am trying to ascertain how often the market traded above the high of the 5 minute opening bar and how often it traded below the low of the 5 minute opening bar. Additionally, I am trying to ascertain the highest high and lowest low during these periods.

You will see on the spreadsheet that the “POSITION” column will meander from FLAT to SHORT to LONG to SHORT, etc.

The first row of every day should and will be labeled “FLAT”. On occasion, the second and third rows might also be labeled “FLAT” in the event the market wasn’t very volatile and prices did not exceed the high or low of the first 5 minute time period.

As an example, the first direction on the excel spreadsheet shows the market trading below the opening low as designated by cell I3. Therefore, I am interested in automatically finding the lowest low at cell E9, which is 1919.5.

Soon after, the market starts rising and goes above the opening high seen at cell I12. Now I am looking to find the highest high from that period until the next time it trades below the opening low or the end of the day (whichever occurs first). In this instance, the highest high would be visible at D14, or 1929.75.

Because these periods of time will vary in length I am pretty sure I need a vba macro to sift through this data, but I am not sure and my excel skills are decent, but not that great.

I have attached a link to the excel document below:

https://app.box.com/s/1gq8475p2a3zi4hghq7i
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,216,089
Messages
6,128,750
Members
449,466
Latest member
Peter Juhnke

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