PDA

View Full Version : Solution For Automatically Updating High/Low Values


FX42n
07-02-2006, 01:10 AM
':D Happy Day! After several weeks of conducting research and testing, I finally discovered comprehendable instructions for building a macro somewhat related to my needs.

Since I have not seen a working solution here, I thought to provide this solution for the benefit of others who may need to build a similar rule. My workbook was constructed starting with Column A, and set in the order listed below. It also includes a header row in Row 1, with the current period located in Row 2, and the data table is sorted by time, descending. The snippit was written to manipulate the fields "C2" (current high) and "D2" (current low) with the current Bid Price found in "G2."

___DATE/TIME____|OPEN___|HIGH___|LOW_____|CLOSE__|_______NOW________|BID______|ASK
6/30/2006 16:00__|114.43__|114.43__|114.42__|114.43__|30/06/2006 16:00:01__|114.43__|114.47

Snippit is as follows:
--------------------------------------------

Private Sub worksheet_change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False

If Range("G2").Value > Range("C2").Value Then
Range("G2").Select
Selection.Copy
Range("C2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
End If

If Range("G2").Value < Range("C2").Value Then
Range("G2").Select
Selection.Copy
Range("D2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
End If

ws_exit:
Application.EnableEvents = True
End Sub

--------------------------------------------

Because the FXCMRTD DDE is inactive today, being Saturday, I don't know if this actually works. I would have included the .xls file as a zip attachment for others to test, but this solution does not address a secondary problem: updating the data table with new periods when the current period expires. I will begin to address this issue shortly, if this snippit proves to be accurate and effective.

Best wishes in your trading....

aap21
09-18-2006, 08:28 PM
Were you able to find a solution on how to update after the period ends?

Thanks
Alex