Real time volume histogram

Discussion in 'Index Futures' started by piggie, Jul 19, 2006.

  1. The MD information during the day can add precision to trade entries and be used for the basis of a solid trade methodology.
    #61     Aug 5, 2006
  2. teuffy


    Hi Piggie,

    I am struggling to use to data I receive from IB (activex connection within matlab). I need help in order to use the real time data to plot it or store it in a vector. Do you know an easy way to handle it?
    Many thanks in advance

    #62     Aug 10, 2006
  3. bgp


    would one of you traders post a graph of the volume under a chart?

    #63     Aug 10, 2006
  4. piggie



    I started my programming project from this thread in IB's TWS API forum.

    The two files to get are connect_ib.m and TWSevents.m. This is for the ActiveX approach. You have to download from IB and install the API's. The concept is to first initiate the ActiveX component connection between Matlab and IB TWS, and then process the incoming events in Matlab. The callback function processes the events from TWS.

    #64     Aug 11, 2006
  5. piggie



    My programming project has been going well. I got true tick by tick data and am happy with the accuracy of my MD plots. 5Pillars is correct, IB's snap shot can be misleading at times, but this does not mean that you can't build a profitable strategy using IB's feed.

    I am moving into strategy development phase of my project, and just by chance through, I have the opportunity to join a trading firm to do the same thing. I will see how it goes, and hope to learn good and solid strategies from the traders in the firm.



    #65     Aug 11, 2006
  6. teuffy


    Thank you.
    As you can see I started with the same files. I have problem to hande the data I can see coming into matlab as I do not know how to save it or use it in real time. Can you show an easy example (chart or storing close in a vector or matrix wth the time).

    #66     Aug 11, 2006
  7. piggie


    The lines below are from the TWSevents file, containing the ActiveX callback function TWSevents.

    The incoming events are first assigned to variable sd, based the id and message type, and then stored in global variable ticker, which is a structure array, and can be access in other functions using the global variable declaration. The id corresponds to the stock symbols (ie ibm or aapl) you assigned to it. Type would be tickprice or ticksize, etc.

    It is in the other functions that you access the elements in each field of the structure, ticker, for further analysis. The Matlab help files have great examples on global variables and structures. Hopefully from this point on the code will become more transparent and self-explanatory.

    Be bold and creative on testing the codes. Knowing how to read the error message is important. I am not a computer science major, but happen to enjoy programming and have never been afraid to run the code and tackle the bugs one by one until everything makes sense to me.

    The Matlab news group is also a very useful site.

    best of luck.


    function TWSevents(varargin)

    global ticker account data p doprint


    % parse stream
    sd = varargin{length(varargin)-1}; % ?!
    % Use Type because EventID may change over time !!!
    switch sd.Type
    case 'tickPrice'
    % tickers are identified by id
    switch sd.tickType
    case 1
    myfprintf('BidPrice: %f\n',sd.price);
    case 2

    #67     Aug 11, 2006
  8. teuffy


    I try do disturb you one more time.
    Many thanks again for the details. I got to this point already (I apologize I was not clear enough).

    For Instance here is what I have within matlab




    then I have the updates coming ...
    I don't how to collect the information into a variable that I can query or do calculation on (for instance Is it possible to have all the bidprice that are coming + the time stamp stacked into a variable or vector?).
    If you can show me that I will really, really appreciate.
    Many thanks in advance
    #68     Aug 12, 2006