Trading with automation (with IB)

Discussion in 'Journals' started by fullautotrading, Sep 8, 2015.

  1. It should be seen in detail what you mean by that. There are, of course, various possible degrees, from simple customization of current rules, to creation of new rules and mechanisms altogether, to complete rewrite of algorithmic engine :) ... and so on. For that, I think it's probably better to discuss privately, unless, of course, there are aspects which can be useful to the whole community of users and ET readers.

    There are a couple of points that I can note (based on my paste experiences):

    1. The "long term" results are relatively insensitive to open/close rules, as it is in fact the systematic recovery of the hedging (or liquidation) orders (which simplistically can be though as "stop orders") which essentially provides the long term edge. The technical device of players and superposition is merely a way to store and possibly reorganize (eg., player splitting) the necessary information to "undo" such stops, which would not be possible in any other architecture, which is instead reasoning in terms of overall position.

    2. Given the logic and the fact that the recovery of hedging orders will generally take place over a relatively long time (several months, years), and that price range of the traded instruments is usually relatively wide, in any case it is generally needed to be well capitalized in order to be able to sustain the game within the instrument range.

    So, if you are sufficiently capitalized for the venture, feel free to contact me in private for any additional information/discussion.
    (For more question/info generally useful to any ET reader, clearly feel free to continue posting here.)
    #191     Jan 13, 2017
  2. radex78


    I think we have own rules and parameter to analyze the market and movement that might occur on future, if we having own rules hence will also understand with own capacity
    #192     Jan 13, 2017
    fullautotrading likes this.
  3. I agree with that (concrete proof is that I went as far as to create my own platform, with a lot of effort and many years of dedication and investments).

    The only thing which, however, I would like to communicate is that, as far as I currently understand it, it's not a much matter of open/close rules, but rather a matter of general architecture.

    The reason for that is that keeping in memory the trading information about the hedging orders, causes a sort of "mandatory" (or "necessary") behavior for the trading engine (whatever have been the initial open/close rules) in order to recover the unfavorable trades, which become very numerous as times goes by and price sweeps through its range. So the "long term" edge is essentially in the "recovery" stage.

    (When such an information is not used, in practice almost any set of algorithmic rules could also be seen, from an higher point of view, as a recipe for initial random entries, due to the fact that we can model the price trajectory as a mixture of stochastic process, and therefore in the long term profit and loss will tend to converge to the same amount, with commission and interests slowly but inexorably building an unfavorable drift.)
    Last edited: Jan 13, 2017
    #193     Jan 13, 2017
  4. if you platform is on 24/7, to minimize the trades that you need to hedge numerous times, your platforms entry date need to coincide with pivotal human psychological inflection points, and price inflects at those times. Just using random entries in each derivative will lead to too much hedging and costs.

    the above shows the minimization of entries to crucial dates.. once entries occur just random profit or to the next crucial date to let the trend run the profits higher.
    #194     Jan 13, 2017
    fullautotrading likes this.
  5. > your platforms entry date need to coincide with pivotal human psychological inflection points

    That is right. Of course, I was not saying that I use "random" entries. I developed several years ago a specific indicator (called the SD ), signed direction index, which has the purpose to identify algorithmically those "inflection points" you talk about, or changes of directions.

    What I meant, is that clearly, it's all relative to the timeframe one is looking at. What looks like an inflection in a given widow, may appear completely different in a larger window. And the index therefore also takes the time window that the user specify.

    One could also inject initially the players "manually" or the entry points at some specific prices he likes (I call these "enqueued orders") and then let the algorithmic engine take care of the rest (this would make more sense with drifting ETFs)

    You quite wisely use the word "psychological", as in fact is just a human perception, and entry points suitability can vary either with the timeframe considered and even with the individual (depending on the fact that that they have or not a "contrarian" attitude).

    What matters is that the algorithmic engine does not care if your entry was "right" or "wrong". It eventually will "correct" most of its or your "mistakes" (orders which look "wrong" for a while), not matter how big they are.
    #195     Jan 13, 2017
  6. How many instruments does the platform track?
    What was the most number of players at any given time?
    Can you post a picture of equity curve since inception?
    #196     Jan 13, 2017
    fullautotrading likes this.
  7. (i meant the SDX in the post above, apparently I skipped the X while typing)

    In principle, there is no limit (apart your hardware). I would say there is a common-sense and ease-of-use limit: you usually don't want to go much beyond 100 instruments for each program instance. But it's really up to you. All rollovers of the same instrument count as just 1 instrument layer because they are automatically connected on the same layer. Further, cross-instrument rollover is also allowed (in practice that make sense for options with different strike/expiration, but in principle a flexible mind could use it creatively).

    However, you can run multiple instances of the application, each one with its set of instruments (and each instrument layer with its own setup). They can all point to the same account or different accounts, at will. Sometimes, I have been tracking a dozen instances from the same laptop.

    This question can be interpreted in various way, depending on what you mean by "number of players". The application memorizes for each layer the whole trading activity and price history (so all players which have been open and closed, plus all the "manual entry" positions), and a lot of information about how the instrument correlate, and a battery of indicators useful to follow what is going on. Again, there is no limit here (apart the hardware). In practice, for instance, with a 8 Mb ram memory laptop one can handle most of the individual setups, and several instances.

    If instead you mean how many buy/sell players can be open at a given time, and therefore your max (initial) exposure on one side, that is simply a game parameter that the user can set up at will.

    Sure. Here it is:


    In this incarnation, the net liquidation value has swung (figures from IB) between min: 301,505.35, max: 3,032,564.21 (here the min was caused mostly by too much manual overload). The maximum "recovery" capability expressed by the trading engine was therefore around 900% in the interval comprising the peaks (june 2016 - jan 2017). Which is a practical illustration of the recovery capabilities of the algorithmic (even against poor manual overloading).

    Current G-L is high, peaking at around 7M, thus showing a good "potential" for gain, incorporated in the currently open players, and at the same time there are quite good available funds to sustain the game.
    A situation quite different from what was going in June, where despite we also peaked at about 4M, the engine had to give up almost all the potential due to the fact that the fund were running short (with consequent liquidations, which caused a rapid fall of the G-L to about 1M) [if we had larger capital we could have taken advantage of that load].

    As an example of players waiting to be "closed", here is a CL layer, where there are several buy players sitting at high price, or sell players sitting at low prices (these were the result of IB liquidation + splitting) which are patiently waiting to be closed, sooner or later. This is "potential" for future gains, which the application keeps in memory, thus "undoing" when possible all the hedging orders (in this sense the trade will be "necessary" and not result of some more or less arguably random "signal" ultimately deriving from psychological/visual perception.)


    This is instead the same layer, if we display the orders executed:


    where we can see the scalping activity which has going on within the price range.

    The systematic recover of hedging order causes in the long term the profit to exceed the "natural" level of 50% + the commissions and other expenses. Provided, however that there is enough capital to sustain the trading game, and obviously correct expectation about DDs.

    Ideally, an instrument which would generate effortlessly large profits with this approach is one whose volatility develops mostly "horizontally" and whose price range is the shortest possible (or in any case "short" relative to the available capital).
    (Clearly, such an instrument does not exist.)
    Last edited: Jan 13, 2017
    #197     Jan 13, 2017
    Spectre2007 likes this.
  8. Today we have smashed a new profit record, spiking up to over 3.5 M, thus making well over 200% (in 548 days elapsed) from our initial 1.5 M. Over 12,000 filled orders, total commissions around 100K.


    At this point we have all layers turned positive, except a couple of layers (ES and ZM) which are still in an "investment phase", waiting to recover various stop orders.

    In essence, having enough patience and capital, we are generally able to turn most of the (recorded) "hedging orders" (initially causing losses) into profits. This works better for commodity futures which tend to fluctuate in ranges, that although pretty large, are however bounded.

    For "drifting" instruments (eg., mkt inverse leveraged ETFs) it is, instead, important to define "biased" trading games which ensure that there are not too many hedging orders open "against the drift" (or else we might never be able to recover them.)
    Last edited: Mar 9, 2017
    #198     Mar 9, 2017
  9. -- FINAL UPDATE --

    I am finally going to close this thread, as I think that - after 605 days and 12,396 filled orders - we might already have a sufficiently long test, for now.

    I am going to reset the account and start a newer public test trying to use some more wisdom matured during the meantime (btw, if anyone wishes to run a public test on their own paper trading account, just let me know).

    The present test started 8 Sept 2015 with about 1.5M in the account.

    I am attaching the final results and available broker statement.


    Most $$$ was made by CL (crude oil) and SI (silver). This is because these are the instruments which offer, we might say, a larger "horizontal development" of their volatility.

    Equity curve (cyan line) looked like this:


    ending with over 6M in the account and having burned almost 100K in commissions.


    Latest report produced by the IB reporting system is attached as a zip file (
    #199     May 6, 2017
    CALLumbus likes this.
  10. Briefly, 2.4M becomes 3.7M where net incom(difference) is 3.7M.

    Since the expense is 100K, the tax ratio is roughly 0.1/3.7=1/37=2.7%.

    Am I right?

    #200     May 6, 2017