Forums > Trading for a Living > Journals > ROBOT autotrading futures (through IB Gateway)

Thread Tools
Old Jun 23rd, 2010, 05:57 PM   #7
Join Date: Mar 2010
Location: a watery planet in the Milky Way, about 643 LYs from Betelgeuse
Posts: 859
Now will begin saying something to respond to the second part of kxvid contribution.

I think that a good way to describe this strategy
is that: it tries, at any time, to "wrap" the price making "extreme" entries (buy low, sell high).

Clearly, it does that by adjusting to "volatility".

So, i would not use the word "neutral" to describe this approach, because it may imply a "directional" view of the market.
On the contrary my (personal) view, for this strategy, is actually "static", the price range is seen as a battlefield and the flowing of time is not important. Only the price level matters.
Trending or countertrending are concepts associated with time flowing. So i would not use none of those terms to describe this game.

In my opinion, a strategy should always be "symmetrical", in the sense to avoid any skew which could lead to easy curve fitting.

In fact it's always advisable to backtest strategies simultaneously on datasets which have a predominance of uptrend / downtrend / sideways to keep off the danger of overfitting. More than how much data, is important "what data". One can backtest tons of ticks and still be overfitting. Or use much less, but more wisely (and diversified).

Old Jun 24th, 2010, 02:12 PM   #8
Join Date: Mar 2010
Location: a watery planet in the Milky Way, about 643 LYs from Betelgeuse
Posts: 859

Chart update

I think will stop here for the moment to resume the testing on sunday. (After all have averaged more than 1K per day.)

I noticed that the trade size is probably a little too large and some oscillations may have been missed. After all, did not see excessive drawdown.

For the session starting sunday will probably use a smaller "trade size" parameter. Will do some more backtesting in the weekend to check out drawdown.

Any question welcome

Old Jun 24th, 2010, 04:14 PM   #9
Join Date: Mar 2010
Location: a watery planet in the Milky Way, about 643 LYs from Betelgeuse
Posts: 859
PNL view within application with legenda:

AbsPos = sum of abs positions
P&L = "Net" P&L (liquidation value)
Real = Realized
Unr = Unrealized
Comms = Commissions
DD = current drawdown
MDD = max drawdown ever seen
AbsVal = sum of abs values
MinP/Max P = min/max position
Min/Max P&L = min/max P&L

Blue Line = "Net" P&L (liquidation value)
Dotted lines: are unrealized (pink), realized (light green)
Old Jun 28th, 2010, 11:39 AM   #10
Join Date: Mar 2010
Location: a watery planet in the Milky Way, about 643 LYs from Betelgeuse
Posts: 859
Restarted on sunday

Chart update

During the weekend have been carrying out some more backtesting.
Actually backtesting and tuning results say that the value of "trade size" parameter I am currently using for this test is probably even too small. The most common best values found through tuning are 420$, 480$, 360$, 380$.

To double check, i have also launched another test session with larger "trade size" on port 4001, to compare results.

Clearly a larger "trade size" should be able to cope better with large sudden price moves and break out (up or down).

Old Jun 29th, 2010, 02:00 PM   #11
Join Date: Mar 2010
Location: a watery planet in the Milky Way, about 643 LYs from Betelgeuse
Posts: 859
Quote from ZMiniTrader:

Hi, How much $ approx. do you risk per trade ?
Hi ZMiniTrader, thanks for your question.

The processes of searching consistent profitability involves a lot of struggling which in time, may change completely the way one approaches trading and make realize that most of concept found on some websites (not ET! clearly ;-) or books, about trading, are often misleading, as they actually lead to systematic unprofitability. So during this process there is often a radical change of perspective and development of new perspectives.

Why i am saying that ? Well, simply because, as i see it, i do not have the concept of "risk per trade" because a single "trade" itself is not actually defined. I see a "strategy" as a continuous flow orders which are issued with an objective, which is the maximization of the overall ratio AvgProfit / Max drawdown. Anyway, i see where you are leading and the real question probably becomes: how does this particular algo (strategy) manages to hedge ? The idea, as anticipated, is that, at any time, it would try to "embrace" the price curve with (low) buys and (high) sells:

SELL.....................x x x
price curve
BUY......................x x x x

Now, it is evident that, especially at the beginning of the trading session, the price will "escape" several times those (dynamic) "bounds" breaking up or down. And, in the case of futures the break up / down can sometimes be sudden and deep. When there is "break up/down", clearly, while one side is "profiting", there is always one side (the opposite one) which is causing drawdown, either because there will be buys above the new current price (break down) or because there will be sells below the new current price (break up).
The algorithm discussed here manages to recover from this (temporary) drawdowns by "wrapping again" the price on the new "range". Clearly, the entity of drawdown is dependent on the nature and magnitude of the break outs. If they could always be of relatively small or moderate entity you might actually never see any negative P&L because usually the trades inside the buy/sell (sideways movement) often readily create a protective, hedging, profit "cushion". If, instead, several instruments break up or down all simultaneously and violently, as not uncommonly happen with correlated futures, then the drawdown can be more significant and last longer, while the algo manages to "take control" of the new price range.
To determine what is the capital necessary to manage these events, depending on the algorithms parameters, backtesting (and or experience) is very useful. The actual values could also be worked out theoretically as a function of the minimum distance between orders (what i have called improperly "trade size", just to simplify) and the rate of increase of order distance as a function of instrument volatility.

I'd like to point out that another way to look at this algorithm is like having 2 traders sharing one account. Assume that periodically - say when the price moves M ticks - they both make simultaneously an order:

TRADER L (always playing long) buys I contract
TRADER S (always playing short) sells I contract

They are both attempting to catch a so-called "trend" (TRADER L hopes the price goes up, while TRADER S has an opposite hope). On the other end, while both these trades will have a "position", an external observer looking at the shared account will see actually a 0 position on the account. If Trader L, for instance, gets lucky and he catches a trend and then, at a certain point, takes profit, our external observer will perceive that the account has now position -1. This just to say that, depending on how we like to look at it, the game of trying to "wrap" an expanding range could be seen, at the same time, as "trending", or "countertrending", depending on the perspective. Personally, i dont embrace any of these 2 points of view and prefer to look at it as dynamic process where orders at any time attempt to wrap the price, by expanding with volatility.

Using a folio, usually causes that while some instruments break out, several other ones will have the price wrapped inside buy/sell (a profitable situation) which, in time, provides a sort of "cushion" to hedge against the periodical break up/down, which are anyway necessary to continue profiting.
Clearly, very large, or simultaneous, break up/down (as currently happening) will take longer to recover (and, eventually, turn into profit).

The june 28 gold vertical plunge (27$ less in 1 our and a half) and simultaneous break down of several folio instruments (aud, cad, es, nq, ym) is providing a manual example of drawdown in a nasty scenario. Also CL (over 400 ticks) and EUR (almost 250) dropped down. Now, while someone can talk about market manipulation prior to option expiration:

[see for instance:
"The extreme concentration of paper short positions by 4 or fewer banks is certainly fishy ... As a trader, you can utilize the trend documented above in order to seek short-term trading opportunities. As a long-term investor, you should realize that the sharp sell-offs in precious metals just prior to expiration dates are likely manufactured and almost always short-lived. Therefore, don’t be a panic seller and play into their game. If you believe in the fundamentals and long-term prospects for gold, clutch your precious metals with strong hands and don’t let your emotions force you to sell at the wrong times. You will invariably have to buy back at higher prices, incur additional trading fees and create high levels of undue stress in the process"]

whether manipulation theories are paranoid or actually accurate, the robot simply could not care less, and certainly does not get scared by these (speculative or not) movements. It simply sistematically adjusts to buy/sell at lower/higher levels, to "wrap" again the price according to its predefined logic.

This is not, clearly, a particularly favourable configuration just at the beginning of our forward test, but it will be a good occasion to see how the algorithm behaves versus very unfavourable situations and high volatility, and whether it is actually able to recover from such events and survive profitably in the market (and perhaps will suggest ideas to devise additional protection mechanisms at folio level). Also provides an order of magnitude for drawdowns.

Currently, most of drawdown is due to CL and ES (and aud, eur): later will show drawdown charts, also comparing the drawdown obtained with a larger "trade size" parameter.

Old Jul 9th, 2010, 04:15 PM   #12
Join Date: Mar 2010
Location: a watery planet in the Milky Way, about 643 LYs from Betelgeuse
Posts: 859
Ok let's take a look at the first days of trading.

Well, looks like I have chosen one of the best week of the year to start.
If i were looking for a volatile and tough scenario, I have been suited well ;-)
(Should not complain too much however, as we already know that since when banks have been allowed to play with deposits it's quite difficult to see in price curves a resemblance with a "random walk" ;-))

While this would provide some good data for future strategy backtesting, anyway, still the drawdown seen during these notable events did not reach the levels I have seen in my backtesting.
As far as i know, this values should be still considered "normal", considering we are in the game seeking
"consistent profitability" (over a relatively long timespan), mainly along big banks and other manipulators.

Note even at the deepest drawdown, the algorithm was still increasing the "realized" (see "realized" curve).

Since, by design, the "realized" cannot decrease, in time there is no drawdown that well be able to "pull" the P&L below zero. A greater volatility just make the process slower, but cannot stop it (if there is clearly enough cash reserve to stay in the market).
The "realize force" (how i call it) of the current test seem still to exceed 1K per day.

The key in the game of consistent profitability boils down to be able to calibrate algorithm parameters in such a way that it is possible to stay in the market and continue trading, with the given capital (based on historical volatility) and cash reserve.
[ And it's certainly not placing a stop on each trade that any consistent profitability can be attained (that would lead, in algorithmic procedures, in very the best and lucky of cases to a zero profit game). ]

A common problem with HF scalpers is that while they also have (by definition) large "realize force" they, instead, have the problem that the "unrealized" can grow at a rate much higher of the "realized" (in volatile markets), which causes larger and often unbearable drawdowns. Here this problem is not present cause, from an intuitive point of view it's, practically, like we worked within an "ever expanding" scalping range which in time contains and bounds the growth of the "unrealized" component of P&L.

Within the current algorithm, the drawdown can be seen intuitively as the investment necessary to "bound" the unrealized component (and it is therefore proportional to volatility and price range expansion).

In time, since the realized is monotonic increasing, it will pull up inesorably the P&L.

As a rough estimate, a folio like this one, should be tradable with a cash reserve of 500K. And hopefully ensure, in the relatively long run, an average daily profit above 1K.

Chart Update
Thread Tools

Forum Jump

   Conduct Rules   Privacy Policy   Sitemap Copyright © 2014, Elite Trader. All rights reserved.   

Advantage Futures
Futures Trading & Clearing
AMP Global Clearing
Futures and FX Trading
Automated Trading Services
Futures Trading Software
NinjaTrader Consulting
Trading Software Provider
Forex Trading Services
Global Futures
Futures, Options & FX Trading
Interactive Brokers
Pro Gateway to World Markets
JC Trading Group
Direct Access Trading
MB Trading
Direct Access Trading
Trading Software Provider
Option Trading & Education
Futures Trade Execution Platform
Direct Access Trading
Spread Trading Instruction
FX, Gold, & Stock Signals
System Building & Backtesting
Equity and Options Trading
Trading Technologies
Trading Software Provider