Algorithmic Trading a large folio with small orders

Discussion in 'Journals' started by fullautotrading, May 3, 2012.

  1. mickson

    mickson

    Hi Tom

    As usual you are ever pushing the limit for improvement and moving the development at quite the pace.

    Comments from a high level:

    In a week of paper trading with quite a liberal folio rule of 0.50 cointegration I am only using about 18% of my margin. One can argue that this is prudent, but I would argue assuming that all instruments are not running correlations of 1 it isn't optimal use of my capital.

    As a Long Short fund manager I am used to viewing the beta adjusted longs and shorts and therefore my net exposure in relation to a benchmark or broad market index (how else would I calculate my beta ).

    The way GBot works, the way I understand it, is it has diverse instruments across multi-geographical (read: currencies) regions and therefore the correlation/cointegrations are only looking at exposures in terms of one to the other.

    I guess my question is, are you in essence creating an exposure matrix by means of a global volatility expression. Let me try and express that more clearly. You will provide the "Captain" with the ability to dictate the absolute levels of volatility that the account wishes to tolerate? What is happening now is that all you control is a level of correlation you are prepared to tolerate, you are going to take us a step further and say based on the volatilities present and given the correlations present, this is your current $ volatility exposure for the entire Folio. Further if you have inputted thresholds of $% volatility it will either block or allow further trades. If in fact I am understanding this correctly, will all that you are proposing work at just the folio level for a particular instance. You cannot make the calculations "global" in the sense that it calculates across all open instances? Now that will be cool.
    :D
     
    #61     Jun 12, 2012
  2. Very interesting questions mickson.

    About the "blocking", it's true that there is a lot of blocking, but is for our own good. It does not make much sense to let "overload" the "same price move" (we can control that by size) out of control so that it could easily blow us up. It's better instead to let open *only* positions which decrease our exposure. We can always enlarge the folio and look for more less correlated stuff (or use more "frequent " "games").

    Also in the next update i have introduced a new mechanism of "self-balancing" so that the "blocking" will allow the position grow on the "hedging side", and when this "grows enough" to get even, it will "unlock" the blocked instruments. This way we should have a system which will try to dynamically fluctuate around a situation of balance. So it's good to have many "competing" price curves to hedge a given exposure
    because this would accelerate the "rebalancing" process.

    About the <b>measure of global exposure</b> you brilliantly suggest, i have also just added it, and the next update will contain it. Starting from there we will certainly find further uses of it.

    The idea of this metric is as follows. We wish to have an idea of the global "exposure" we have, <b>given the current realtime cointegrations and volatilities</b>.

    Let's start with a practical example to understand. Take for instance 2 instruments with strong negative cointegration. (May imagine DIG and DUG or some other pair.) Now let's imagine for simplicity that these 2 instruments have about same volatility and prices not too distant.

    If we had in our folio 100 shares for each, their contributions to our exposure would be little, as the cointegrations makes these positions kind of neutral. If instead we are long on one and short on the other one, we have instead a sort of "double" exposure. Also if an instrument has larger volatility it has to contribute more to our exposure.

    So the idea is to create a global "measure of exposure" which puts together all these pairwise cointegration relationships and volatilities to provide a syntetic index suitable to express our "exposure".

    Referring the previous link, the most intuitive way to create that is to aggregate all the "volatility adjusted exposures" of the
    cointegrated set of instruments, as described in the previous post. This should work quite well.

    For the moment i have added it and we will see how well it works. With practice we will probably have more ideas to refine it further.
     
    #62     Jun 12, 2012
  3. The folio is doing ok.

    I am now watching 187 simultaneous instruments in this instance alone. Slowly selecting the most suitable for scalping.

    As mkt is reversing, most drawdown are being reabsorbed or scalped away, apart volatility which is still low (the still most negative guys are TVIX and TMV).

    With these sizes, commissions are terrible, eating up from 1/3 to 1/2 of PNL. Anyway min PNL on a single instrument never exceeded - $180, so let's say that we pay our sleep with commissions ;-))) [not that i sleep much ;-) anyway ]

    Clearly with a larger capital it would be ok.

    I am a little disappointed i am not receiving an invitation to the IB party anyway ;-))

    <img src="http://www.elitetrader.com/vb/attachment.php?s=&postid=3580412" width="1000" />
     
    #63     Jul 25, 2012
  4. Tom, hi, I have been following your work for the past few weeks, have been trying to catch up on Elite Trader and on your website. Congratulations on what you've built - you've obviously put a lot of work into this. Very intriguing, and I am interested.

    I have reviewed the materials, some of the language goes a little over my head, but I have a quick question. Is it fair to say that your objective is to run a portfolio of "mean reverting" type of trades (that allow for 'pressing up' at different tiers) among a basket of low correlation securities/instruments? And that runaway trends tend to be your "enemy" in this approach?

    Just want to make sure I understand the concept as I read on and learn more about G-Bot.
     
    #64     Jul 31, 2012
  5. Hi tmantrader,

    thank your for your kind words.
    Sorry about the language. Sometimes i make up new words ;-))

    The application has evolved now in a direction of great abstraction, so <b>it allows now to program an uncountable number of different approaches and games</b>. Those i <b>use currently</b> could perhaps be described by a post i wrote on <a href="http://www.linkedin.com/groups/I-would-be-curious-share-4394344.S.136154441?qid=99248e80-242d-44dc-86c2-d778989c6e6e&trk=group_most_recent_rich-0-b-ttl&goback=%2Egmr_4394344" target='blank'>linkedin<a/> some time ago:

    <i>"What will typically happen in this scenario is that some instruments will "run away" giving rise to what could be called the "real trades", as opposite to the continuous scalping activity ("noise trading"). The scalping activity will sustain a linear investment in the "runaway" instruments which in the meantime will reach a good position with an excellent cost basis (that is you will be on the "right side" of the mkt with a good size). In addition using "folio balancing" and "cointegration blocking" adds a lot of extra power to the whole procedure... ;-) (Clearly, i am referring to suitable instruments, mostly ETFs and futures, not stocks or similar...)"</i>

    So, considering that i start all trades with a relatively small position, what can happen is:

    1 The trade will close very soon with a small profit (small scalp: can last from 1 second o few minutes)
    2 The trade (or chain of orders) will close at a later time with a larger profit (swings: trades that can last hours or days)
    3 The chain of orders will have a long runaway which will eventually close in profit (after relatively long time)

    Now 1,2 are no problem. They create a nice <b>profit "cushion"</b> which can "sustain" type events 3. So what's remains is to be take care of ? Clearly that type 3 does not bankrupt the account.

    How do we achieve that? In several concurring ways:

    - <b>"Bounds"</b>: we limit the maximum drawdown to a given size (important especially when building up capital)
    - </b>Small initial size and linear or less than linear size increase</b> (to arrive with a good size at a good cost basis)
    - <b>"Scalping tails"</b>: trades will scalp even in drawdown
    - <b>T players</b>: scalping against the main trade
    - cointegration blocking: avoiding too max exposition
    - folio balancing: avoid that some instruments can potentially absorb "excessive" capital
    - careful entries and exits, on peak situations, etc.
    - (Instruments representing aggregates and rich of retracements and reversion)
    - etc ...

    Now all this stuff put together, and much more, changes dramatically our destiny. Clearly, it is also important <b>bullet proof execution an exceptional precision in the scalp computations</b> (as even tiny errors can add up in substantial losses) as only a software bot well programmed can do.

    So, to me the "runaways" are not unpleasant nor "enemies". To me they are somehow, put in a different way, the <b>"real trades"</b>. Among an <b>ocean of "noise capturing"</b>. Look for instance at <b>TVIX</b> now (picture below). It's being draw down to -$126. The biggest "loser" now. Am i scared ? Can i not sleep ? ;-)))

    No way: i am even "overloading" it with additional manual positions (the green circles) ;-)) I know as a fact that it will be the biggest winner in a while. Why do i know that ? Because the game is such that <b>profit is always proportional to the draw down</b> "suffered" (say, approximately constant Sharpe). There is no way it can scare me. It could even go to 0. There would be no problem.

    In some sense, it's all a matter of "relative sizing". And right "proportions", right "spacing" and right game.
    Clearly, the games could be programmed otherwise. This is just my current setting. (And i may evolve further, clearly)

    Below 2 "losers" (at the moment): TVIX and FAZ. (I included FAZ to show an example of the "scalping tail".)

    <img src="http://www.elitetrader.com/vb/attachment.php?s=&postid=3585684" width="1000" />
     
    #65     Jul 31, 2012
  6. Clearly the "runaways" are largely compensated by the massive scalping action.

    Here is an example of a good scalper (DDM) and below the current folio situation (ignore the 2 spikes down in the PNL just caused by outlier bid/ask when "resuming" session out of mkt hours).

    As one can see from the "gain" curve (green dotted line), which in essence expresses the <b>scalping activity</b>, it has scalped away almost 5K in over 1100 fills (with great joy of IB, i imagine).
    [remember that blu/red circles represent buy/Sell orders]

    The (few) losers will either reverse or continue scalping.

    In any case we are not going to leave a penny on the table ...

    <img src="http://www.elitetrader.com/vb/attachment.php?s=&postid=3586452" width="1000" />
     
    #66     Aug 1, 2012
  7. Very interesting Tom. Have you developed the rules for the scalping (and other games) using your own proprietary methods or is that something the user does in your software?

    Also does G-Bot trade IB Combos? I use IB to trade stock, option and ETF pairs (for example HD/LOW, MA/V, USO/UNG, GDX/GLD,) and have done a lot of mean reversion / scalp type trades manually (and with the IB scale trader).
     
    #67     Aug 1, 2012
  8. In time, i have slowly brought on the interface a good number of "trading rules" which were used internally and governing the, so called, "order cloud formation". I am also continuosly adding <b>new ones</b>, as ideas develop and mature (clearly, sustained by the fantastic feedback and work of many people and fund managers supporting me), making it more an more abstract.

    Changing these rules, it can change completely the trading behavior (even transform it in an incredible loser :))) ). In fact, it is totally possible that some traders/fund managers may come out with much better "games" than those i am currently using. (Clearly, they can also be tested in a "simulation system", using exactly the same engine which trades, also incorporated in the app, which i also improve continuosly.)

    Below a picture displaying a series of screenshots with some of those rules. I don't show the image on the thread page because i am pretty sure it would mess up the site, as it's pretty "high". Considering that this is only a small part which is brought "outside", you can have an idea of what is going on inside (with all the other supporting mechanisms: cointegrations, balancing, direction, speed, PNL computations, async orders, data filtering, stats, etc... ). In practice, a neverending challenging work, requiring a lot of detailed care and continuosly evolving with new ideas ...

    Being programmed entirely from scratch, basically i can make it behave in whatever way i might imagine. Clearly, i embark only in directions which reasonably promise improving $$$/risk and make sense to me ;-)) ["prediction" is banned: see also this thread on <a href="http://www.linkedin.com/groups/Does-Prediction-make-sense-in-4394344.S.107021793?qid=8a7ad97c-52f0-43e2-8635-6189837f2092&trk=group_items_see_more-0-b-ttl">Linkedin</a> <b><i>
    Does "Prediction" make sense in algorithmical trading or is it for "crackpots"</i></b> ? :) ]

    (I would not trade "stocks", as it somehow violates the logic behind the current games.
    Trading manually is pretty hard, i could never really "beat" the app :)) )
     
    #68     Aug 2, 2012
  9. Dr Who

    Dr Who

    I appreciate that this is an ongoing project but have you done any studies as to the longterm return you're getting compared to a buy and hold strategy ? It would be good to see a timeline of the return to see if your bot changes/additions are increasing/decreasing your return.
     
    #69     Aug 5, 2012
  10. Hi Dr Who,

    Well, i adopt changes only if they prove to be more effective performance-wise (in addition to have an intuitive meaning and value).
    I can't really stop, this is a continuous improvement. :)

    (The app has simulation facilities inside, to sample performances that over a vast space of price curves.)

    Further, anyone can trade on his own side local machines and see the impact of the various possible setting changes or explore new approaches.

    This is a context where volatility ("variance") plays absolutely the role of the lion. So what matters (to me) is the average performance and, even more importantly, it's stability or "robustness" (small coefficient of variation, good distribution, etc.) in the sampling space. I don't even look at the past performance or the performance on any single realization. (It can only be misleading, as far as i know.)

    [ btw, i am about to redistribute the app with the latest suggestions and enhancements, please let me know if i have missed any one of you people who have kindly requested it to participate in the project testing from my website: if i have, it was not intended, clearly :) ]
     
    #70     Aug 5, 2012