ROBOT autotrading futures (through IB Gateway)

Discussion in 'Journals' started by fullautotrading, Jun 22, 2010.

  1. Tom,

    Your testing a large portfolio of instruments... how do you regulate the transaction speed/volatility between instruments at the folio level?
     
    #41     Aug 18, 2010
  2. Thanks, Dr Who, for your appreciation: I am glad that you have such a good feeling about this approach ;-)

    To respond to your question on the personal side, although probably not many are interested here, the "intellectual challenge" is, certainly, still an important part in anything I do. But, you know, most people can measure the strength and originality of your ideas only on the basis of the money they create. [I did other things which compared to this one are like Horton compared to the dust speck on his pink clover, and, I tell you, nobody ever noticed. Quite the contrary, in the neverending intellectual quest and effort one might miss the mundane "superficiality" and the networking which can get you a higher income and better position. ]

    So, it seemed appropriate to put a sparkle into trading algorithms too ;-)

    As to trading, note that the amount one trade should, in my opinion, be an almost negligible (or expendable) part of your asset, if you are a retail trader. We are talking about <b>"systematic creation of wealth"</b>, not "betting" here. Putting several hundred thousand dollars at work, while it may be "piece of cake" for a fund (or a group of investors), may not always be as straightforward for a single individual.

    Anyway, I am working on it too ;-) ... Even Croesus needed some divine aid :))

    Tom
     
    #42     Aug 18, 2010
  3. The bot has just closed all positions (around 13:35 edt).
    These 2 days have been an incredible performance.

    Most "lucky" performers include RB, CL, HO , although they have large spreads due to the distance from expiration (especially HO: now is around 6-10 ticks!).

    Over 20K PNL with a min PNL of -5K, max sum of abs positions: 30. (Experienced a real severe slippage at close).

    Very lucky "run" indeed (its "twin" with the previous algo version has still a negative PNL with 10K realized). Most other instruments were just "stopped" by the energy "crazy runners", and this calls for an insight on the interesting topic raised by Pocketchange in his last post (different instrument "speed" within the folio).

    So far it seems that this variation represents an improvement (as the backtesting done during the actually weekend suggested. But i do want to investigate further into the slippage issue and refine the tick filtering system.)

    Tom
     
    #43     Aug 18, 2010
  4. While the bot his doing its patient and inexorable work, we might have some nice discussion here.
    With his usual powerful insight, Pocketchange has evoked the concept of "speed/volatility" as a factor which could be used to regulate the folio behavior.

    Now we certainly intuitively see that the instruments of the folio might have a different "speed", in the sense that, in a given period or during
    a "run" (between 2 global close to "take profit") some instrument may actually "lead" and determine, with their activity, the result, while several other are being stopped, and possibly prevented from "running away".

    Now I'd like to stir the discussion on this subject, to see if some useful idea arises.

    So let's pose a few questions and I wish to see some contributions from you.

    First of all what is "speed" ? How does this concept overlay with the concept of "volatility" ? How would we measure it ?
    Are we already benefiting from it ? How can we use the concept to possibly improve the folio performances ?

    Feel free to respond or propose ideas, maybe pretending you are being interviewed to become a quant at a major firm ! ;-)


    Tom
     
    #44     Aug 19, 2010
  5. speed = (price value 1 hour ago - price value now) / price value 1 hour ago

    Experiment with time intervals until you find something that you like.

    One definition of volatility might be price range during a 1 hour interval. Volatility is different from speed in that suppose a price value series begins 1 hour ago at 10, decreases to 8, then increases to 13, and is now 10. Speed = 0 but volatility is 13 - 8 = 5. I might normalize by calculating volatility = range as a fraction of the initial value so 5 / 10 = 0.5.

    I might calculate speed of total equity and exit all positions if total equity speed exceeds some value - this system is vulnerable to big losses if instrument prices suddenly correlate and trend.
     
    #45     Aug 19, 2010
  6. Hi Hook,

    thank you for contributing to the discussion.

    1. your definition of "speed" does not coincide, in my opinion, with what we are considering here. So we either change the name for our concept, or we need to change your formula :)

    Let me make a counterexample. Assume at t0 the price is p0. Assume that in a hour we have N full large "oscillations" on an instrument. That instrument will probably make a large profit and possibly even cause the folio to "take profit".
    Assume after all these oscillations the prices returns to p0 (or nearby). According to your formula we would have 0 (or a small value), which is the exact opposite of the intuitive notion we are considering here.

    2. As to correlations, I have explained in previous posts as this algorithm turns in its favor correlations. Apart that the "normalized" scalp practically breaks down some of the correlations of traditionally correlated instruments (like the eminis), if 2 or more instruments are correlated, and one begins to "invest", all the other correlated ones are slowed down (as to entries) and delayed. This is so because we do not want to "concentrate" the "investments", to distribute better the drawdown among instruments. If you go back some posts, you will find these concepts. Let me know if not clear.

    Tom
     
    #46     Aug 19, 2010
  7. Fullautotrading, I do not clearly understand what you are asking.

    Suppose the system trades only two instruments, # 1 and # 2. Price volatility of price value series # 1 is greater than volatility of series # 2. Your system buys low and sells high, trades instrument # 1 more than instrument # 2. Your system calculates more profit from instrument # 1 more than instrument # 2.

    Do you choose to increase position size when trading instrument # 1?

    ---

    Regarding the delaying of trading correlated instruments, I am puzzled how this works. Your system calculates the correlation of instruments. Suppose price values of instrument # 1 and instrument # 2 show a high degree of correlation. Your system calculates a buy signal for instrument # 1. The system delays trading of instrument # 2 perhaps 30 minutes. When trading in instrument # 2 is enabled, is the buy signal still active?
     
    #47     Aug 20, 2010
  8. I think we are on the same page.. irrespective of the trading algo.. whether they all trade the same formula or some are on algo A a trend follower, Algo B scaling in and out, Algo C HF scalper..
    The question is at the folio level what types of rules are implemented to regulate the activity and risk.

    So for example If
    Instrument A is 6E a currency future that is running up in a deep move
    Instrument B is ES which is in a tight oscillation.
    Instrument C is CL doing both.

    All 3 instruments price action need to be made comparable either stand alone or based on the present positions held by the folio.

    If 6E's position is short 2 sitting at a loss in investment mode,
    ES is scalping the oscillations and making profits covering 6E's loss.
    Than if CL is in profits do you close out the folio?
    closeout CL and let the 6E investment/draw down run?

    If CL is losing but flat do you continue investing in 6E position?

    The folio itself becomes a dynamic index of sorts based on its positions...

    Should you close the folio at a set profit level, spread the risk and trade at a higher frequency... ie. Scale size and engage algo's based on volatility and try to capture profits every 30 minutes? Kind of like betting on horses: you have 12 to 20 - 30 minute races each trading day and take what the market gives you.

    or

    Use the folio to spread risk and invest in each position and wait out profits.

    Tom,

    I think the folio approach triggering different trading algos based on an instruments short term price action , correlation and overall risk is a powerful but complex play especially when you open the folio up to 20 instruments.



     
    #48     Aug 20, 2010
  9. Hi Hook ,

    I don't. As a general principle I (personally) tend to stay away from mechanisms of automatic increase of size (pyramiding, martingaling, etc). But something based on that idea might be actually be backtested.

    Well this is really the most creative part of the "folio game". As also Poketchange is pointing out, a folio is capable of generating "extra information" which may help in hedging. The extra power and information can be based for instance on correlations (but also on the "speed" concept that Pocketchange is proposing, and that we still need to define).

    Now, there are probably countless ways of implementing hedging mechanisms which exploit correlations, to turn them in our favor. I'd say this is an open area of research, and pretty interesting.
    Working with algorithms one realizes how actual implementation is even more important than the general strategy ideas, as just changing the implementation a huge range of all completely different returns can be obtained.
    So, implementation turns out to be as important as the strategy, if not even more.
    Intuitively, i can foresee several way to use correlations for hedging, but after the intuition has provided the hint, only backtesting and forwardwalking and careful user insight can really tell what are the most appropriate mechanisms.
    For instance, assuming a subset of correlated instruments, we might seek hedging using opposite entries, appropriately out of sync. Or another idea would be, if an instrument is "loading" (investing), "delay" (= space up) investments on correlated instruments, so that they make "more extreme" entries.
    I have implemented in here the latter idea (and also wish to try the other one). But again there are so many ways to implement it and it's worth to investigate them, as each variation can make a big deal of difference.
    By "delaying" here i do not mean "temporal" delay, but increasing distance between consecutive entries (time does not matter: only price matters).

    Tom
     
    #49     Aug 20, 2010
  10. MXP was a disappointment, it trades too little for my taste and does not seem suitable for autotrading :) I have "paused" (manual mode) it and "replaced" with QM. Anyway, was good to know about it. Must say that the instruments really suitable for autotrading are not many. NZD is probably another one to discard (and, maybe, ZF too).

    <img src="http://www.datatime.eu/public/gbot/mxp.png">

    Starting from Friday we had a significant drawdown. Yesterday GC and SI made pretty violent "corrections".

    Fortunately, had the previous version running too, so we can continue anyway our test. It seemed that the "revised" had results too good to be true. (In fact have discovered i also reintroduced the bug which caused erroneous order sizing)

    <img src="http://www.datatime.eu/public/gbot/Res_Sun_2010_08_15_2ps.png">

    Realized is 32K, P&L catching up.


    <b> ** New idea: FOLIO "SUPERIMPOSITION" ** </b>

    I just had another idea i am anxious to test, and i may be terminating soon this session! ;-)

    The idea is as follow. So far we have seen sort "cycles" in the algo PNL which may last from a week to 2 weeks (or so).
    This is probably due to the algo "riding" the price waves, so that periods of "investment" (drawdown) are often followed by periods where the investment yields profits.

    Now here is the idea. Assume i start with a folio of 10 selected instrument.
    Then, when the algo shows to enter or to be deep in the "investment" phase (drawdown) i can overlay another "run" of the same folio.

    We can do it in 2 ways:
    way 1: start another robot instance with the same folio (perhaps not the smartest way!)
    way 2: start, <b>within the same robot instance</b>, new trading instances of the same instruments

    Since way 1 is straightforward to understand. Let's focus on way 2.
    First of all, if we are using correctly correlations, way 2 should be slightly better, in theory, as we "replicate" the instruments.
    Second we have to note that we will be having <b>multiple instances </b>of the same instrument trading on the same account. This means that, each instrument will maintain "self-contained" and independent computations of position, PNL, etc., while the "actual" account, will clearly have the algebraic sum of the two.

    For example, if we have CL (1 instance) position 2 PNL 1K, and CL (instance 2) position -3 PNL -5K, in the account we will actually have position -1 PNL -4K.

    Hope it's understandable. I will make a practical example of this trading approach soon.

    In general I think it's always better to <b>"spread" the risk</b> as much as possible. I think that even if we had several millions as capital to trade, it would be anyway quite appropriate to continue trading with a min packet size = 1, but opening multiple instances of robots (out of sync) on the same account or on multiple accounts. And within the same robot, we could run multiple instance of the instruments, thus "overlying" folios.

    We attain 2 goals: we spread greatly the risk, and we go mostly "undetected" in the market ("stealth"), with no problem of liquidity.

    I'll show how to do that.

    Tom
     
    #50     Aug 25, 2010