Excel Help

Discussion in 'Strategy Building' started by JDConner, Feb 8, 2006.

  1. JDConner

    JDConner

    Im using a DDE feed.
     
    #11     Feb 9, 2006
  2. From where? OS is right, they probably have a high/low field in there already....


    - The New Guy
     
    #12     Feb 9, 2006
  3. JDConner

    JDConner

    They do. What I'm doing is taking the difference in 2 stocks to create the spread price, thats why I would like to know the high and low of the spread for the day.
     
    #13     Feb 9, 2006
  4. gotcha, are you familiar with VBA?

    - The New Guy
     
    #14     Feb 9, 2006
  5. omniscient

    omniscient Guest

    i'm not sure i follow. is this your scenario?

    stock A (H/L): 25.00/24.00
    stock B (H/L): 25.10/24.20

    so the spread between these two stocks is:

    25.10 (max of the stocks) - 24.00 (min of the stocks)
     
    #15     Feb 9, 2006
  6. JDConner

    JDConner

    Not at all, I'm new to Excel. I went to the book store yesterday but their was to many books on Excel, any suggestions?
     
    #16     Feb 9, 2006
  7. JDConner

    JDConner

    No I'm looking at intraday.

    Stock A 25.40

    Stock B 25.10

    Spread .30
     
    #17     Feb 9, 2006
  8. This should work

    Private Sub Workbook_SheetCalculate(ByVal Sh As Object)

    If IsNumeric(Sheets("sheet1").Range("A1")) Then

    If Sheets("sheet1").Range("A1") > Sheets("sheet1").Range("B1") Then
    Sheets("sheet1").Range("B1") = Sheets("sheet1").Range("A1")
    End If

    If Sheets("sheet1").Range("A1") < Sheets("sheet1").Range("C1") Then
    Sheets("sheet1").Range("C1") = Sheets("sheet1").Range("A1")
    End If

    End If

    End Sub

    Where Sheet1 is the name of whatever sheet the cells in question are on, A1 has the DDE value, and B1 is the cell you want to copy the Max value to, and C1 is the min. Remember, blank cells are treated as 0, that might be important for the Min side of this.

    To plug this in, open your excel workbook, hit Alt-F11 and double click on "this workbook" in the list on the left (much easier if only one excel file is open at the time, because each workbook will have "this workbook") and paste the code in there.

    Save the work book and everytime it recalculates any value from then on it will check the Min/Max and copy them over if it is higher/lower than the value in B1/C1.

    Hope that all makes sense....

    - The New Guy

    PS not too sure about good books, but do some google searches on "Excel VBA" and you should get some good resources.
     
    #18     Feb 9, 2006
  9. T-REX

    T-REX

    A long time many Excel spreadsheets were posted here with numerous examples of trading strategies. Do a search for trading methods and strategies and you will find them.

    It should be a good place to start.
     
    #19     Feb 10, 2006