Skip to main content
11 votes
Accepted

What is the pseudo code for a pairs trading strategy?

The following link has a good summary of a typical pair trading strategy: https://www.quantstart.com/articles/Backtesting-An-Intraday-Mean-Reversion-Pairs-Strategy-Between-SPY-And-IWM It actually ...
KarolisR's user avatar
  • 693
8 votes

Programmatically detect RSI divergence

I was searching for answers to the same question and came across your question. After some thought and research, here is the plan I have developed. I will be working in Python. Calculate relative ...
Casey Jones's user avatar
7 votes

How to identify technical analysis chart patterns algorithmically?

One idea is Dynamic time warping (DTW). There is an R package for that: dtw Here is the vignette:Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Packageby Toni Giorgino And ...
vonjd's user avatar
  • 27.5k
5 votes

Which algorithms do robo-advisors use?

Well, I did some modest research on this topic, looking at peers. Most of them use Modern Portfolio Theory, see this pic: You can find this small survey here: https://www.linkedin.com/pulse/...
RockZen's user avatar
  • 51
4 votes
Accepted

Neural Networks for Estimation of Unmarked Private Asset Returns from Market Data

Based on an my updated understanding of your problem you have a portfolio consisting of $N$ illiquid assets. Valuations are not real time and usually lagged, by say, upto 3 months (or slightly longer),...
Attack68's user avatar
  • 10.5k
4 votes

What's the rationale behind having several orders on each each side for market makers

I've read this question and the other question you asked and I hope I can help. The important thing to realize that in any market multiple market makers operate and they are all trying to optimize ...
Bob Jansen's user avatar
  • 8,562
3 votes

Programmatically detect RSI divergence

I want to implement exactly same principle in C# and realized that i should start opposite. Start from finding Higher High or Lower Low and then checking RSI. After finding HH or LL checking RSI is ...
valentasm's user avatar
  • 131
3 votes

Literature on credit risk premia

Two papers by AQR might be of use: Asvanunt, A. and S. Richardson (2016), “The Credit Risk Premium”: Despite theoretical and intuitive reasons for a credit risk premium, past research has found ...
AK88's user avatar
  • 1,840
3 votes
Accepted

How to (efficiently) calculate the maximum possible return of a perfect "crystal ball" investment strategy?

This answer seems to be wrong. Please read the edit and the comments. To me, that smelled like dynamic programming too. After implementing a dynamic programming solution according to http://www.cs.rpi....
wehnsdaefflae's user avatar
3 votes

Genetic Algorithm - Portfolio Optimization / Index Tracking crossover process

Genetic Algorithms are typically used to pick the subset of securities used in the final portfolio, so you would crossover the stocks. You wouldn’t crossover the stock weights because, as you point ...
Tim Wilding's user avatar
  • 1,406
3 votes

Online algorithm for calculating EWMA at irregular intervals?

The above code for an irregular EWMA doesn't quite give a half-life - the code is missing the $e^{\ln(.5)}$ term found in the preceding formula. To get a true half-life, the code should look like ...
Steve Landers's user avatar
3 votes

Fastest algorithm for calculating retrospective maximum drawdown

In Python, a very slick implementation that exploits the rolling functionality in pandas is like this ...
Vim's user avatar
  • 903
3 votes

What is the formula to calculate Implied Volatility Percentile

As volatility has a great influence on option prices, you'd like to sell options in high volatility environments and purchase options in moments of low volatility. But what is high/low volatility? ...
Kevin's user avatar
  • 16k
2 votes

Thoughts on how quantitative hedge funds use machine learning to invest in the stock market (algorithms, examples of data, etc.)

This may not directly answer your questions. There's a class offered by Georgia Tech called Machine Learning for Trading, you might find it useful. https://www.udacity.com/course/machine-learning-for-...
Hao's user avatar
  • 313
2 votes

Backtesting algorithms

In this blog post I describe how to backtest trading strategies with R: Backtest Trading Strategies Like a Real Quant It gives a step-by-step template which consists of the following steps: Load ...
vonjd's user avatar
  • 27.5k
2 votes

Backtesting algorithms

There are many resources on the web but you need to think why you would want to do this in the first place. Are there not packages or frameworks out there already that will do what you need? Also ...
MJB's user avatar
  • 161
2 votes

Online algorithm for calculating EWMA at irregular intervals?

You count the number of 'unit intervals' within that irregular duration between two events and repeat the update function by the count. Amortized time is the average number of unit intervals. In ...
madilyn's user avatar
  • 5,240
2 votes

Comparing account equity vs maintenance margin on large number of positions

I don't actually know the answer to this question but the problem you describe is just a linear algebra problem. Imagine a matrix X whose rows represent the ordered ...
Attack68's user avatar
  • 10.5k
2 votes
Accepted

Algorithm for calculating Capped Index weightings

I figured it out! See the second tab of my spreadsheet for the solution. And for what it's worth, here's my Java code. No recursion needed! ...
Corey's user avatar
  • 41
2 votes

What are known algorithms to detect potential wrongdoings in funding distribution?

You could start with the law of anomalous numbers: Benford's Law. I'm not sure if it is the exact answer you are looking for, though it has been used in many forms to detect anomalies within financial ...
amdopt's user avatar
  • 4,348
2 votes

How to Manage Large Orders

Most institutional brokers, and certainly prime brokers, offer a range of automated execution strategies. You can check out the list of algos supported by IB to get started. The basic algos split ...
Sergei Rodionov's user avatar
2 votes
Accepted

What does it mean to "compute" an Itô integral?

Note that SDE (4) does have a "closed-form" representation. Let $X$ be $$X := S^p, $$ so (4) is a geometric Brownian motion SDE $$dX = (p\alpha + 2^{-1}p(p-1) \sigma^2) X dt + p \sigma X dW,...
ir7's user avatar
  • 5,043
2 votes
Accepted

Applicability of AAD(Adjoint automatic differentiation) to an indifferentiable function at some point

In 2017, I organised a Mini-symposium on automatic differentiation and its applications in the financial industry to share thoughts with other academics on the way AAD could be applied to financial ...
lehalle's user avatar
  • 12.2k
1 vote

Implied volatility is returning infinity

Assume we are in the Black Scholes for call option settings, and let’s ignore the dividend. For the implied vol, we can treat all other variables as constant, and focus on the price of the call option ...
Magic is in the chain's user avatar
1 vote
Accepted

Custom normalisation from 0 to 20

Essentially you are creating a mapping, or a function here. In the first instance you had a maximal score of 10, and you mapped as follows: $$f(volume) = \left \{ \begin{matrix} 10* volume/200, \...
Attack68's user avatar
  • 10.5k
1 vote

What are common risk controls banks use when utilizing Trading Algorithims

There's 2 different types of risk controls that you're referring to. The first class (for execution algos) is at a regulatory level and has to do with broker dealer requirements mandated by rules ...
madilyn's user avatar
  • 5,240
1 vote

How buying/selling pairs and entering/exiting trade works in pairs trading?

Your reasoning is correct. To answer your last question: the current prices alone don't decide how many shares to sell and buy in each of the stocks. That is decided by the hedge ratio. In fact, the ...
Slug Pue's user avatar
  • 337
1 vote

Thoughts on how quantitative hedge funds use machine learning to invest in the stock market (algorithms, examples of data, etc.)

Another example might be, if companies that exhibit certain revenue growth metrics, or margin improvement, would that signal a potential buy opportunity? Or perhaps if certain words in their annual ...
Chris Taylor's user avatar
  • 5,931
1 vote

Thoughts on how quantitative hedge funds use machine learning to invest in the stock market (algorithms, examples of data, etc.)

Read Max Dama on Automated trading (PDF) - This is the best introduction to algorithmic trading out there: http://www.decal.org/download/2582
QuantScientist's user avatar

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