Recently in trading Category

Barron's Market Data Center

| | Comments (0) | TrackBacks (0)

Barron's has a really nice page for market data. In addition to the front page with index levels and market summaries, it has US stocks, ETFs, mutual funds, credit market data, currencies, futures, and calendars (including IPOs and earnings).

RSI trader blog

| | Comments (0)

[RSI trader blog] has end of day relative strength calculations for you to trade on, if you think that this analytic is a good signal.

Trending123.com

| | Comments (0) | TrackBacks (0)

Trending123 has stocks and ETFs broken down by sector. For each sector, you can see the components, the recent change and volume, high/low/close, and pivot points (resistance and support) for the entity.

[Stock/sector screening]

The Secret Science of Price and Volume

| | Comments (0) | TrackBacks (0)

The Secret Science of Price and Volume: Techniques for Spotting Market Trends, Hot Sectors, and the Best Stocks is yet another book on trading that I came across at Amazon. I'm familiar with looking at price and volume and I've seen top-down methods of stock selection, but I haven't seen a really integrated method. In particular, I haven't seen something that gives a good idea of where the market is heading, and that's one of the things this method relies on:

  • Gauge the sentiment of a market to determine if the trend is bullish or bearish, and whether a possible high or low is nearby
  • Evaluate breadth, volume, and momentum in order to identify triggers to enter the market
  • Find the best performing sectors that are aligned with the market
  • Select the strongest stocks within those sectors

Sell & Sell Short

| | Comments (0) | TrackBacks (0)

I saw Sell & Sell Short at Barnes and Noble the other day. Naturally, I returned home and ordered it from Amazon.

I've shorted a couple of times, but I think that I have to do it more often to make money in all markets. There aren't a lot of good books out there on shorting, so I am looking forward to working through this.

Here are some topics covered in the book:

  • How to control risk by linking the placement of your protective stop with your money management and position size
  • Where not to put your protective stops
  • Why using moving averages as profit targets works well in the early stages of an upmove
  • Why channels or envelopes are better targets when you are riding a trending stock
  • How to use support/resistance areas for profit targets and stop losses in long-term position trades
  • How to adjust your targets when market conditions change or your stock blows through the initial profit target

The descriptions of technical analysis algorithms are a bit annoying. They are written to calculate a single point, assuming a programming model that is non-vectorized. I really don't get why the algorithms are so poorly described.

Take this description of Money Flow Index as an example.

First off, this:

MoneyFlowIndex = 100 - (100 / (1 + MoneyRatio))

is the same as this:

MoneyFlowIndex = 100 * PositiveMoneyFlow /  (PositiveMoneyFlow + NegativeMoneyFlow)

or even:

MoneyFlowIndex = 100 * PositiveMoneyFlow / TotalMoneyFlow

Now we have a formula which works even when NegativeMoneyFlow is zero.

We have just two concepts, PositiveMoneyFlow and TotalMoneyFlow:

pmf = sum(mfi for mfi, reti in zip(mf, returns) if reti > 0)
tmf = sum(mf)
MoneyFlowIndex = pmf / tmf

where:

typ = [ (p.high + p.low + p.close) / 3 for p in prices ]
vol = [ p.volume for p in prices ]
returns = [ (typ[i] - typ[i-1]) / typ[i-1] 
    for i in range(1, len(typ)) ]

Okay, we turned a price series into typical prices, created daily returns and money flows from the typical prices, produced the positive money flow and total money flow, and finally got the money flow index. What did it buy us to do it with series like this?

Lots. The original algorithm totally glosses over the fact that we don't want a single money flow index -- we want a time series of money flow indexes. All of the basic series are viewed through a window, and windowing like this makes the basic algorithm really inefficient. The Positive Money Flow for the range 0..n differs in only two places from the range 1..n+1 (pmf[0] drops and pmf[n+1] is added) but a naive implementation will sum the series as if there were no overlap. To do this properly, we need series that have partial sums.

If you want to add up the m-sized windows on data of size n, you can optimize by creating a series that is the running total of the data seen so far and subtracting element[x] from element[x+m] to get the x'th window. You will iterate from 0 to n-m inclusive, giving you n-m+1 windows of size m. Here is how you make your running total:

def runningTotal(series) :
    result, s = [0], 0
    for ss in series :
        s += ss
        result.append(s)
    return result

Then we can write a summedSeries() function:

def summedSeries (series, length) :
    s = runningTotal(series)
    for i in xrange(len(s) - length) :
        yield s[i + length] - s[i]

and rewrite the Money Flow Index function like this:

pmf = ((mfi if reti > 0 else 0) 
    for mfi, reti in zip(mf, returns) )
return [ 100.0 * pos/tot for pos, tot in 
    zip(summedSeries(pmf, n), summedSeries(mf, n)) ]

Now we have an optimized function that works on price and volume time series and returns a Money Flow Index time series. And once you get your head around python, it even feels right.

[ mfi.py ] [ msft.csv ]

Technical analysis library

| | Comments (0) | TrackBacks (0)

I had a brief look at the C++ source for TA-Lib: Technical Analysis Library today. It's an open source project I mentioned the other day. It may well be good code, but reading through it is really hard sledding. It's evidently all machine-generated, and I can't work out where the source is. (If I have the choice of reading machine-generated C++ or the source, I'll choose the source.)

But it's not a dead loss. The documentation on the associated site is pretty strong and gives good references. In particular, there are links to FM Labs, and I like the descriptions given of TA algorithms there.

I'm also intrigued by the Technical Analysis Programmer's Toolkit. I'll download a demo and report back on its suitability.

More open source financial applications

| | Comments (0) | TrackBacks (0)

Open source projects that do technical analysis, portfolio management, and FIX. See also [Open Source Trading Systems]

[TA-Lib: Technical Analysis Library]
Technical analysis library with indicators like ADX, MACD, RSI, Stochastic, TRIX... includes also candlestick pattern recognition. Useful for trading application developers using either Excel, .NET, Mono, Java, Perl or C/C++.

[QuickFIX]
QuickFIX is the world's first Open Source C++ FIX (Financial Information eXchange) engine, helping financial institutions easily integrate with each other.

[FIX4NET]
A 100% pure .NET Financial Information eXchange (FIX) protocol library. Includes a TCP/IP engine, messages (4.0/4.2/4.4), and message database.

[nFIX]
nFix is a 100% native .NET object orientated FIX (Financial Information eXchange) API and engine.

[OneUnified.GeneticProgramming]
A C# implementation of a Genetic Programming method for optimizing a financial trading strategy. Most code designed for use with SmartQuant's QD/OQ products, but key code can be extracted for use in other projects.

[PortfolioLib]
A free/open-source C++ library for financial portfolio management. At its core, it aims to represent a collection of financial instruments as defined by QuantLib, called a Portfolio.

[ScreenFire.Net Financial Charts]
ScreenFire.Net Financial Charts is a financial market charting API for the .Net framework. It is a sub-part of the TradeWeapon project here at sourceforge.net. It will focus on prividing financial market charts like OHLC, Candlestick charts and Scatter

Last night, I bought this book. There are several very positive reviews of the book from Brett Steenbarger and Charles Kirk, two traders I really respect:

In Technical Analysis Using Multiple Timeframes, Brian Shannon takes the reader through the essentials of technical analysis and then illustrates how to integrate those into a coherent trading methodology. From the phases of stock movement to price/volume relationships and risk management, Brian brings his topics to life with concrete and practical illustrations and explanations. This is an excellent resource for all technically-oriented traders; anyone who has enjoyed Brian's video insights on the Alpha Trends blog will surely appreciate the way he synthesizes those lessons in this book.

Brett N. Steenbarger, Ph.D.

and

When Brian contacted me awhile back to read and provide a review of his new book Technical Analysis Using Multiple Timeframes, I couldn't have been more excited. Brian has been blogging about stocks for a long time and his video chart presentations are a unique offering that many find useful. His intense passion for the market and deep love of the game itself is evident in everything Brian does and shares with his readers.

In my opinion, Brian's book is an excellent resource because he is great instructor. Unlike many books on trading written by traders who frankly have a difficult time explaining their methods, Brian shows his skills by breaking down relatively complex ideas in a straightforward manner. Ultimately this makes his book particularly good for traders who are just starting out on the learning curve and those who've found other trading books too complex or difficult to implement in the real world.

Charles Kirk

I hadn't heard of Brian Shannon before but I am really looking forward to getting my hands on this book.

How to Tell if a Rally Is Real

| | Comments (0) | TrackBacks (0)

The New York Times on signals for a real rally:

  • willingness to buy speculative (small-cap) assets
  • strength in sensitive sectors, like technology and consumer discretionary
  • strengthening dollar

Powered by Movable Type 4.1

About this Archive

This page is a archive of recent entries in the trading category.

software is the previous category.

travel is the next category.

Find recent content on the main index or look in the archives to find all content.