Chabah on Automated Trading Redux

Discussion in 'Automated Trading' started by Chabah, Jan 8, 2010.

  1. Chabah


    Hello again, friends old and new. I have been busy with non-automated trading, and except for getting crushed by the swoon a year ago I've been doing quite well with my simple system. Now that I've decided to cash out my 401K and go at it big time ($50k) with my TradeStation account, I am planning to automate my system(s). This should help enforce standards and consistency and generally scale my methods to a larger account with potentially more positions. Also, someone (thing) needs to rule the roost when I am not able to watch the market (that being all day).

    So this automation is different than last time (, as I have developed and discovered some new guiding principles. I'll be laying them out here for discussion, so please join in and let me know what you think. Rather than dump them all at once, we'll go through them carefully one at a time.

    Here is the first tenet:

    Path Independence
    Systems should be able to determine the current position at any given time, regardless of trade history. It should not matter what the position was last period - the current period is controlling. An exception to this is buffer zones (areas around inflection points where positions are not changed in order to avoid over-trading), provided the buffer zones are determined independent of the trading history.
  2. Chabah


    Pre-determined Risk

    Each position should have a specific risk measure which, if lost, triggers the close of the position. In such cases, a new position of the same sort should not be opened immediately, but rather be governed by a safety period or manual reset. This is intended to prevent over-trading in adverse conditions or technical failure. Additionally, whenever possible the exit order should be entered into the brokerage in case of system failure - the system should not rely on being connected in order to enter exit orders (this does not apply to profit taking).
  3. Chabah


    Pre-determined Targets
    When opened, a position should have a specific target price at which the system profit protection function is enacted. Combined with the pre-determined risk, this allows for risk-reward analysis by the governing system functions. Note that profit protection is a system governance function - strategies themselves should be path independent.


    This tenet touches on two ideas. The first is that we should know where we are headed when we enter a trade. This is to enforce discipline in strategy design. How a trade is handled after the profit target has been reached can be controlled by the overall trading system, or by the specific strategy. The strategies should be path independent, while the system routines may be controlled by the operator depending on non-strategy factors such as overall market outlook, early market close, or the desire to go on vacation. We'll discuss system governance functions after I share all the tenets.

    The second point is reward-risk ratio. The operator can set a minimum ratio. So if a strategy enters at $100, has a stop loss at $95, and a profit target of $110, that indicates a reward-risk ratio of 2 ($10/$5). Now imagine you have a lot of stocks and your account is almost fully deployed, and perhaps the market is hot. As an operator, you may not want automatic trades to be opened if they have too small of an upside - you want to keep your capital in the high-flying systems. In this case, you could raise your minimum reward-risk ratio and prevent certain trades from happening. Likewise, if your capital is not deployed "enough" you can lower the threshold to encourage more strategy trades.

    This sort of tuning may or may not be very valuable in practice - for now I am including it, as it is easy to leave the controls off and important to include such considerations as part of the system architecture.
  4. I'm watching & I like where you are going with this.
  5. Add some code- good thread though
  6. Chabah


    Risk Robustness
    When the market is closed, a given position should not pose a risk to the portfolio greater than the system setting, based on its own initial size or pre-determined risk (whichever is larger). For long positions, this applies if the maximum position risk is less than 100%. Short positions should always be insured prior to the market close. This robustness is implemented as a system governance function.
    Long example: If long 100 shares at $100, if maximum position risk is 50%, then 100 put options at $50 should be held during market close. Therefore if the stock drops below $50 the options will cover the long position losses below $50 per share.
    Short example: If short 100 shares at $100, if maximum position risk is 50%, then 100 call options at $150 should be held during market close. Therefore if the stock were to surpass $150 the options will cover the short position losses beyond $50 per share.
    In either example, since a 50% loss should be extremely rare, the given option should be very inexpensive. Such coverage can be either automated or set-up as part of manual market close procedures (provided the order is executed prior to market close, not after).


    Thanks for the feedback.

    I will be sharing code - just be patient.

    I am a software developer, and this is the requirements phase of this project. Right now we are laying down the ground rules. I'll be using the Agile methodology to create the system, which means that we'll start working on User Stories pretty soon. Then, we get a "Walking Skeleton" that does the minimum possible useful functionality. Then we build on that while maintaining a functional system. I'll share the code, which you can use and modify to your own liking. For example, I may use a $ trailing stop but you might like to substitute a % stop, or perhaps some kind of chandelier algorithm or whatever. The framework is the valuable part.

    Regarding the Risk Robustness tenet, this was my big take-away from Fooled By Randomness by Nassim Nicholas Taleb. Great book and an easy read for such important points. Anyway it may seem pretty crazy, but it helps accomplish three points. 1) Learn how Options work in practice 2) Protect the overall portfolio from "Black Swans" like the 1987 crash and 3) Gain practice automating the process in preparation for creating trading strategies based on options.

    Thanks again for the brief feedback - be patient, and there will be more tangible items forthcoming. It may only make sense, though, if these tenets also make sense.
  7. Chabah


    Here's a little bonus - a system I designed last year, but haven't yet implemented. Pretty entertaining, and I think a pretty solid system. We'll implement this as one of our first sample systems and see how it works within the larger system, which I'm just calling DZD for now.

    Note that this system is not complete - there are areas that indicate more research to be finished. I'm not sure if I will do this. Feel free to use this strategy, but the content of the document should not be re-used without permission.

    Finally, note that this strategy doesn't yet utilize the robust risk protection that I now consider a tenet of my new system. As a short strategy I would recommend always protecting against upside danger via options. I haven't done this yet personally, but plan to as part of my 2010 trading.

  8. I would be interested in how you calculate your risk.
  9. Corey


    One of the things I found in my studies is that strict stop amounts, whether based on a given percentage or ATR, always hurts a trading strategy because it doesn't recognize the current dynamics of the market. Though ATR gets closer, the best system I found was one that used linear regression to find supports and resistances to identify points of demand/supply weakness in the market, and put my risk controls below those.

    I would definitely be interested in hearing more about how you handle your 'pre-determined' risk.
  10. Chabah



    I think stops are the most frustrating part of a system. I have a function, which I call a Support Buffer, which basically "protects" a stop. So if your stop is $100 with a $1 buffer, the position won't close until $99. But if the price gets back to $101, it would re-purchase. I would be using something like 15 or 30 minute charts, so it shouldn't overtrade. Overtrading is a potential risk though, if the channel just bounces all over your buffer, so there can be other controls (limit number of trades, automatically expand the buffer after a certain number, etc). We'll be investigating, coding, and testing this function over the next month or so. I have traded it in the past, but I will probably improve it this go around.


    #10     Jan 12, 2010