Could you perhaps post your excel/access file for the rest of us?
We could use it as a template.
I'd really appreciate that.
I'll post the access SQL and you can run it yourself. You need two tables, one called tblDaily with the following fields ID, TheDate, Open, High, Low, Close. The ID must be the key field, a number each bigger than the last with the lowest date first. The table needs sorted by date but the ID is the key field. The 2nd table I called tbl15Mins but any time frame can go in there (I tried it with 15 minute data first). The fields in tbl15Mins are ID, TheDate, TheTime, Open, High, Low, Close.
Multiply the Open, High, Low, & Close by 10000 for integers.
Run this query, it will create a table called tblDirections -
SELECT [tblDaily].[ID], [tblDaily].[TheDate], [tblDaily].[Open], [tblDaily].[High], [tblDaily].[Low], [tblDaily].[Close], IIf((SELECT Alias.Close FROM tblDaily AS Alias WHERE (Alias.ID+1=tblDaily.ID))>(SELECT Alias.Close FROM tblDaily AS Alias WHERE (Alias.ID+2=tblDaily.ID)),"Long","Short") AS Direction INTO tblDirections
FROM tblDaily
ORDER BY [tblDaily].[ID];
Then run this to create tblValues -
SELECT [tblDirections].[ID], [tblDirections].[TheDate], [tblDirections].[Open], [tblDirections].[High], [tblDirections].[Low], [tblDirections].[Close], [tblDirections].[Direction], IIf(Direction="Long",(SELECT Alias.High FROM tblDirections AS Alias WHERE (Alias.ID+1=tblDirections.ID))+3,(SELECT Alias.Low FROM tblDirections AS Alias WHERE (Alias.ID+1=tblDirections.ID))-3) AS Entry, IIf(Direction="Long",(SELECT Alias.High FROM tblDirections AS Alias WHERE (Alias.ID+1=tblDirections.ID))+12,(SELECT Alias.Low FROM tblDirections AS Alias WHERE (Alias.ID+1=tblDirections.ID))-12) AS Target, IIf(Direction="Long",(SELECT Alias.High FROM tblDirections AS Alias WHERE (Alias.ID+1=tblDirections.ID))-21,(SELECT Alias.Low FROM tblDirections AS Alias WHERE (Alias.ID+1=tblDirections.ID))+21) AS StopLossAt INTO tblValues
FROM tblDirections
ORDER BY [tblDirections].[ID];
Then run this -
SELECT [tblValues].[ID], [tblValues].[TheDate], [tblValues].[Open], [tblValues].[High], [tblValues].[Low], [tblValues].[Close], [tblValues].[Direction], [tblValues].[Entry], [tblValues].[Target], [tblValues].[StopLossAt], IIf(tblValues.Direction="Long",(SELECT MIN(Alias.TheTime) FROM tbl15Mins AS Alias WHERE (Alias.TheDate=tblValues.TheDate AND Alias.High>=tblValues.Entry)),(SELECT MIN(Alias.TheTime) FROM tbl15Mins AS Alias WHERE (Alias.TheDate=tblValues.TheDate AND Alias.Low<=tblValues.Entry))) AS EntryTime, IIf(tblValues.Direction="Long",(SELECT MIN(Alias.TheTime) FROM tbl15Mins AS Alias WHERE (Alias.TheDate=tblValues.TheDate AND Alias.High>=tblValues.Target)),(SELECT MIN(Alias.TheTime) FROM tbl15Mins AS Alias WHERE (Alias.TheDate=tblValues.TheDate AND Alias.Low<=tblValues.Target))) AS TargetTime INTO tblEntriesAndTargets
FROM tblValues
ORDER BY [tblValues].[ID];
Then finally this to create the results table tblResults -
SELECT [tblEntriesAndTargets].[ID], [tblEntriesAndTargets].[TheDate], [tblEntriesAndTargets].[Open], [tblEntriesAndTargets].[High], [tblEntriesAndTargets].[Low], [tblEntriesAndTargets].[Close], [tblEntriesAndTargets].[Direction], [tblEntriesAndTargets].[Entry], [tblEntriesAndTargets].[Target], [tblEntriesAndTargets].[StopLossAt], [tblEntriesAndTargets].[EntryTime], [tblEntriesAndTargets].[TargetTime], IIf(tblEntriesAndTargets.Direction="Long",(SELECT MIN(Alias.TheTime) FROM tbl15Mins AS Alias WHERE (Alias.TheDate=tblEntriesAndTargets.TheDate AND Alias.Low<=tblEntriesAndTargets.StopLossAt AND Alias.TheTime>=tblEntriesAndTargets.EntryTime)),(SELECT MIN(Alias.TheTime) FROM tbl15Mins AS Alias WHERE (Alias.TheDate=tblEntriesAndTargets.TheDate AND Alias.High>=tblEntriesAndTargets.StopLossAt AND Alias.TheTime>=tblEntriesAndTargets.EntryTime))) AS StopLossTime INTO tblResults
FROM tblEntriesAndTargets
ORDER BY [tblEntriesAndTargets].[ID];