# Tag Info

## Hot answers tagged algorithm

23

I've worked at a hedge fund that allowed GA-derived strategies. For safety, it required that all models be submitted long before production to make sure that they still worked in the backtests. So there could be a delay of up to several months before a model would be allowed to run. It's also helpful to separate the sample universe; use a random half of the ...

21

As mentioned elsewhere on this site, Lo, Mamaysky, and Wang (2000) do exactly what you're talking about, namely algorithmic detection of head and shoulders patterns. Their definition: Head-and-shoulders (HS) and inverted head-and-shoulders (IHS) patterns are characterized by a sequence of five consecutive local extrema $E_1,...,E_5$ such that  HS ...

16

I think the biggest problem that genetic algorithms have are overfitting, data snooping bias and that they are black boxes (not so much like Neural Networks but still - it depends on the way they are implemented). I think they are not used very much. I guess there are a few hedge funds out there that use it but all in all they were hyped and then busted. ...

14

There are tons of languages used in this field. As for Java-based trading platforms, Marketcetera is popular with customers. To justify switching languages, you'd need to show that there is a bottleneck preventing your team from collecting more P&L. Have you run a profiler and compared the results with tcpdump? You must show that your existing platform ...

12

I would recommend that you read "Evidence-Based Technical Analysis" by David Aronson. Firstly, I am mentioning it because it is a highly worthwhile book. Secondly, on pp151--161 he attempts to "objectify subjective TA", using the head-and-shoulders pattern as an example.

12

I've applied GA to all sorts of things. I had some success in the deterministic world where a pattern actually existed and I knew that some physical structure existed (seismic analysis, vibration analysis, inventory calcs, etc). After I found a GA model that behaved, the real work started....figuring out why it behaved. I also generated a lot of GA ...

12

Oracle hosted a Trading Applications Developer Workshop in New York on March 15th, 2011. The slides from each of the presentations are here. One of them covers java for Trading Applications, and it seemed to me that the biggest issue raised by the audience was garbage collection. The presentation talks about some configuration parameters that can limit ...

10

In a typical HFT scenario (process incoming UDP quotes and send TCP order entry responses) well written Java can compete with C++ for pure speed. If you need more speed, look to improve the following: Your code (setup a good benchmark and then profile and tune) Your networking environment (low-latency switches, DMA NICs) Your architecture (are you doing ...

10

There's a lot of people here talking about how GAs are empirical, don't have theoretical foundations, are black-boxes, and the like. I beg to differ! There's a whole branch of economics devoted to looking at markets in terms of evolutionary metaphors: Evolutionary Economics! I highly recommend the Dopfer book, The Evolutionary Foundations of Economics, ...

9

Assuming you avoid data-snooping bias and all the potential pitfalls of using the past to predict the future, trusting genetic algorithms to find the "right" solution pretty much boils down to the same bet you make when you actively manage a portfolio, whether quantitatively or discretionary. If you believe in market efficiency then increasing your ...

9

I have these posts favorited from stackoverflow. They might help you. High Frequency Trading What programming language(s) is algorithmic trading software written in? Why does a derivative trading position always require C++ knowledge? Jane Street Capital, a high-frequency market making firm, uses OCaml. Here are videos from the head programmer where he ...

9

For years, I performed this brute-force search daily on my universe of tradable stocks and futures. It is a waste of time. If your computer discovers that hog futures and MSFT are cointegrated, for example, do you really care? I would never trade that pair. There is no economic connection between hogs and Microsoft, so I must assume that the reported, small ...

8

Theoretically, the answer to the question is yes, a correlation matrix for potential pairs trades can be computed in $O\left((n^2t)^{(\omega+\epsilon)/3}\right)$ time, for any $\epsilon > 0$, where $\omega < 2.38$ is the so-called exponent of matrix multiplication. However, these algorithms have a reputation for having a very large constant factor ...

7

Measuring expected shortfall (also known as conditional value-at-risk) answers the simpler question of "what is my average expected loss at the i-th quantile?" given the empirical distribution of returns. A variation is value-at-risk which measures the loss at the i-th quantile. Arguably you could leave at this this and you have your answer. You probably ...

6

I have worked with C++, java and C# implementing a google like search engine for DOD in along with many other software that require high performance (using low level memory mapping and named pipes/tcp). In my experience, you cannot match speed of C++ with the managed code. In managed code, every call to new, garbage collection, etc. requires multiple ...

6

The most basic strategy is beta-based quantiles. That is to say, you first control for losses on your individual stock versus overall market performance. (Your trading strategy may or may not wish to hedge away the market factor using, say, SPX futures). Then you choose a quantile, call it the 5th percentile, beyond which you consider a move to be ...

5

All things being equal, stocks with the highest bid-ask spread present the greatest opportunity for the market maker The size of the opportunity (i.e. revenue expectation) can be represented as Volume * Bid-Ask Spread. Your algorithm should rank-order that revenue expectation Stocks with high current market values will tend to have narrower spreads and be ...

4

Dynamic Time Warping, recursive, time-delayed feedforward neural networks, wavelets, empirical mode decomposition, ..., there's plenty of it. BUT If you want my advice, don't go this way, I wasted too much time doing things like that. Neither big nor small players (profitably and consistently) trade this way and for a good reason. Technical analysis is a ...

4

I won't give you the answer delivered on a silver platter but hopefully the following will get your started: a) you need to define exactly over which look-back period you aim to derive the maximum drawdown. b) you need to keep track of the max price while you iterate the look-back window. c) you need to keep track of the min price SUBSEQUENT to any NEW ...

4

You question is quite strange: so you do not want to use methods inspired by bioinfo and genetics (neural networks, GA, geometry of folding, etc) but methods that are used in these fields? In terms of modeling, the problematics in bioinfo and genetics are mainly: tree or graph matching (to build metrics in the space of molecules), like in SIGMA: a ...

3

Mathematically speaking that is an impossible thing to do. There are simply too many variables and randomness that you cannot do it. Rather than analyzing competitors trade data; why don't you analyze the market. You can consider every bar; as a trade. If the bar was up; it means you went long and made a profit. If the bar was down; it means you went short ...

3

Zipline, the opensource python backtester, has a batch and iterative implementation for max drawdown. Here is the batch: https://github.com/quantopian/zipline/blob/master/zipline/finance/risk.py#L284 Here is the iterative: https://github.com/quantopian/zipline/blob/master/zipline/finance/risk.py#L578 disclosure: I'm one of the zipline maintainers

2

The late Thomas Cover , (likely the leading "Information Theorist" of his generation), considered "Universal" approaches to things like data compression and portfolio allocations as true genetic algorithms. Evolution has no parameters to fit or train. Why should true genetic algorithms? Universal approaches make no assumptions about the underlying ...

2

Another reason for C++ is control, or at least the illusion of it. If you really care about what exactly is going to happen and when it is going to happen then C++ is the best option. If you are prepared to put in the effort you can know and control everything all the way down to the metal. Of course the price for more control in C++ is that you often have ...

2

I do recommend to you the chapter 8 of the Ernest Chan book "Quantitative Trading: How to Build Your Own Algorithmic Trading Business" The chapter's name is "Conclusion: Can Independent Traders Succeed? " The conclusion is that yes but I now cant remember very well the chapter...

2

Yes there is a way to find kth largest element in an unsorted list in linear time here. However, depending on what program you are using, implementing the algorithm might not increase performance. The built-in sort function is probably optimized in C, and hence is very fast.

2

This paper by R. Marschinski and H. Kantz may be able to help: "Learning the Optimal Trading Strategy". I have not read it but the authors have published other work which is quite innovative. Within a realistic model of the stockmarket, we derive the most successful trading strategy. We first identify the agent who has realized the largest percentual ...

2

How about an O(N log(n)) solution ? To be a viable trading strategy, you often expect them variances to be similar, so just calculate ordinary volatility and put it in an ordered array. Of course that's going to be period dependent, so pick a few arbitrary periods and see which instruments end up being together. Then you get clusters of vastly smaller ...

2

Some reading that may be of interest to you and which proceeds along similar lines of thought is that of Shmilovici in "Predicting Stock Returns Using a Variable Order Markov Tree Model". Abstract: "The weak form of the Efficient Market Hypothesis (EMH) states that the current market price fully reflects the information of past prices and rules out ...

2

Perhaps to detect fractal behaviour you could fit something like a Daubechies wavelet. That is, $W(a,b) := \frac{1}{\sqrt{|a|}} \int_{-\infty}^{\infty} f(t) \phi((t-b)/a)dt$. Then you want to check the set $\{W(a,b) : a \in \mathbb{R}_+\}$ where $a$ is the scale, for some fixed $b$. If all the coefficients are similar then this might be some indication of ...

Only top voted, non community-wiki answers of a minimum length are eligible