+ Reply to Thread
Results 1 to 5 of 5

Capturing Steaming Data Macro problem?

  1. #1
    Registered User
    Join Date
    10-05-2005
    Posts
    16

    Capturing Steaming Data Macro problem?

    Hello everyone...

    I am trying to capture the highest high and lowest low in streaming data. What I have done is not working correctly and I am at a loss how to correct it, here are the results:

    I am using this:

    If bid < oldlo Then
    lo = bid
    End If
    oldlo = lo

    If ask > oldhi Then
    hi = ask
    End If
    oldhi = hi


    I thought this would capture and latch the highest Hi value and lowest low of the stream and increment each time a new hi was or lo was reached.

    Instead of latching it, it enters the data request string, <=edemo|tik!id558?ask> into the cell and it does not latch the data as I expected it should, it enters the ask string rather than a value... I dont think it is possible to latch anything in the spreadsheet and to the best of my knowledge vb is the only way to accomplish this.

    I am very lost on how to handle data in this manner.

    Does anyone have an idea how I can get streaming data to latch and paint an output to a cell that can be further operated on once in excel?

    a snipped version of the code is below...

    Dim bid As String
    Dim ask As String
    Dim hi As String
    Dim lo As String
    Dim oldhi As String
    Dim oldlo As String

    bid = server & topic & id & "bid"
    ask = server & topic & id & "ask"

    'HOD and LOD
    If bid < oldlo Then
    lo = bid
    End If
    oldlo = lo

    If ask > oldhi Then
    hi = ask
    End If
    oldhi = hi

    ActiveCell.offset(0, 2).Value = bid
    ActiveCell.offset(0, 3).Value = ask
    ActiveCell.offset(0, 7).Value = hi
    ActiveCell.offset(0, 8).Value = lo

  2. #2
    Registered User
    Join Date
    09-20-2005
    Location
    Mönchengladbach, Germany
    Posts
    24
    Hi there,


    if you intend to capture the highest value of all incoming data, it'll be enough to check, if new data is greater than old highest value.
    For there is no output of oldhi I'm not quite sure if you have to save the value to hi first and then to oldhi.

    It would work like this:
    Please Login or Register  to view this content.
    Same with Lowest Value:
    Please Login or Register  to view this content.

    Regards,

    Simon

  3. #3
    Registered User
    Join Date
    10-05-2005
    Posts
    16
    Tnanks for the response Simon;

    using this:
    If bid < oldlo Then
    oldlo = bid
    End If
    If ask > oldhi Then
    oldhi = ask
    End If

    and this:
    ActiveCell.offset(0, reqOffset + 7).Value = oldhi
    ActiveCell.offset(0, reqOffset + 8).Value = oldlo

    gave the same results as the original does...

  4. #4
    Registered User
    Join Date
    10-05-2005
    Posts
    16
    Just thinking...

    Do you think it is possible that because it is streaming that it sort of resets itself with each new entry or something crazy like that? Somehting wierd mtst be going on because it seems to me both these methods should have worked...

  5. #5
    Registered User
    Join Date
    10-05-2005
    Posts
    16
    Here is another update:

    tried this and here are the results:

    cell p8 is <=edemo13|tik!id0?bid>
    cell p9 is <=edemo13|tik!id0?ask>

    in excel in cell 21 i entered <=p8> the cell for the bid and same with the ask where cell 22 <=q8>

    then I told vb to get the values and rewrite them into cells 23 and 24 respectively just to see if it would work and I get a type mismatch error...

    bid1 = ActiveCell.offset(0, 21).Value
    ask1 = ActiveCell.offset(0, 22).Value
    ActiveCell.offset(0, 23).Value = bid1
    ActiveCell.offset(0, 24).Value = ask1

    Everything I try doesnt work...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1