Skip to main content
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
6 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,729
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
  • 13.3k
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
  • 16.8k
3 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
  • 13k
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
  • 933
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,436
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
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

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
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
  • 13.3k
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

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
  • 28.1k
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,428
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,273
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

Weak Stationarity for Neural Network Input?

Yes, it is essential to ensure that your time-series exhibit atleast some form of stationarity for predictive time-series based ML models. When estimating a Neural Network (NN) or other machine ...
Pleb's user avatar
  • 4,951
2 votes
Accepted

Forex data API endpoint that provide last closed candle's HLOC

You can use Oanda's Rest-V20 API to achieve what you want, although you'll need to open either a Live or free Practice account and get an access token to do so. I've been using this API for years now ...
babelproofreader's user avatar
1 vote

Algorithm for Identifying NDF FX Trades as Buy or Sell

I had a look at the data and produced this chart: When you see all these trades it is clearly difficult to know if a buyer or a seller initiated it. moreover, I had a look at the columns Event type: ...
lehalle's user avatar
  • 13k
1 vote

Calibrating the Heston with the Levenberg-Marquardt algorithm

The situation is a little more complicated than expected. We use this notation for the damped least squares equation $$ [J^{T}J + \lambda I_{d}] \Delta \theta = -\nabla f(\theta) $$ where $\theta$ is ...
SimoPape's user avatar
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
  • 13.3k
1 vote

Spectral clustering in finance

One spectral analysis technique involves decomposing a univariate time series using SVD, assigning eigenvectors to two or more groups with k-means or another clustering algorithm, with the least ...
Sergei Rodionov's user avatar
1 vote
Accepted

The quality of an trading algorithm

As regards a commentary made by another user, the Sharp Ratio is not a standalone measure because it requires the selection of a benchmark rate of return. While it is common practice in financial ...
Stéphane's user avatar
  • 2,596
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,308
1 vote

How to apply the "Knapsack Problem" to minimise a portfolio's volatility?

If you're happy with equal stock weightings, then this can certainly be done iteratively. I don't know of any closed-form equation. It works for a universe of 100 stocks, but the calculations ...
demully's user avatar
  • 5,221
1 vote

Fastest algorithm for calculating retrospective maximum drawdown

I use a quick and dirty C++ solution: ...
Stefano Falasca's user avatar

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