The Mathematics of Scalping
- goldorak
- Posts: 0
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
@luli395: What is this beautiful GUI that gives you results with very useful two digits precision?
If you are not living on the edge you are taking up too much space.
- radikal
- Posts: 0
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
I'm pretty confused by this logic as it feels a bit backwards to me..
I generally think of market making with the goal of "scalping" as asking:
- Which or perhaps when are order flows not toxic?
- Given a set of circumstances where I think I'm providing liquidity to a non-toxic flow, what do my pnl distributions look like given some assumptions?
- In thinner markets, it's sometimes better to ask (given flow of size N, what is forward distribution condition on N, and really conditioned on various buckets of N)
If every time your crappy product moves more than 2 ticks, it moves 5+ ticks, then, well, there's not much point in providing dickbags liquidity at levels 2-4. And "dickbag" is the technical term I think.
I generally think of market making with the goal of "scalping" as asking:
- Which or perhaps when are order flows not toxic?
- Given a set of circumstances where I think I'm providing liquidity to a non-toxic flow, what do my pnl distributions look like given some assumptions?
- In thinner markets, it's sometimes better to ask (given flow of size N, what is forward distribution condition on N, and really conditioned on various buckets of N)
If every time your crappy product moves more than 2 ticks, it moves 5+ ticks, then, well, there's not much point in providing dickbags liquidity at levels 2-4. And "dickbag" is the technical term I think.
There are no surprising facts, only models that are surprised by facts
-
iwanttobelieve
- Posts: 1
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
I tend to agree the article is not so rigorous but it gives a couple if insights. First if you think in a static/distribution manner, and not a process/stopping times - you could change the argument as follow:
1)Assume any entry (the alpha model you don't need)
2)After 1 min, either, take profit at +p, or stop at -s, or do nothing and keep your position for next bar.
3) Your profit is E[X | -s lower than X lower than p]
If you do take a gaussian distribution, then practical s and p parameters are going to be a couple of sigma away, and then it does not matter where you put your cut-off, it's too far away to make an impact. The fact that you have higher order moments is the key. If you chop only one tail of a fat-tailed distribution, you actually shift the expectation one side or an other significantly.
To improve further, it runs in 2 modes, conditioning by the level of volatility. It is pretty straight-forward to test, with limited assumptions. You can just use the empirical distribution with a smoothing kernel and max over (s, p), and yes there exist optimal values for (s, p).
Now the question remains, can this edge offset:
- the commissions of your broker
- your speed disavantage if you get lower priority in the limit execution queue compared to player that do layering i.e. pre-place orders and cancel them instead of placing them - to get higher priority, the bid-ask is also going to weight, or market makers that might have special priority in some cases
- the bias on the drift
possibly.. but the article is only scratching the surface.
1)Assume any entry (the alpha model you don't need)
2)After 1 min, either, take profit at +p, or stop at -s, or do nothing and keep your position for next bar.
3) Your profit is E[X | -s lower than X lower than p]
If you do take a gaussian distribution, then practical s and p parameters are going to be a couple of sigma away, and then it does not matter where you put your cut-off, it's too far away to make an impact. The fact that you have higher order moments is the key. If you chop only one tail of a fat-tailed distribution, you actually shift the expectation one side or an other significantly.
To improve further, it runs in 2 modes, conditioning by the level of volatility. It is pretty straight-forward to test, with limited assumptions. You can just use the empirical distribution with a smoothing kernel and max over (s, p), and yes there exist optimal values for (s, p).
Now the question remains, can this edge offset:
- the commissions of your broker
- your speed disavantage if you get lower priority in the limit execution queue compared to player that do layering i.e. pre-place orders and cancel them instead of placing them - to get higher priority, the bid-ask is also going to weight, or market makers that might have special priority in some cases
- the bias on the drift
possibly.. but the article is only scratching the surface.
-
unsmt
- Posts: 0
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
Of course one can try more or less successfully to use the strategy in practice. On the other hand to make it popular or sell it one needs to provide some numeric characteristics to make it attractive. In this case we should use some assumptions. For example this idea embedded in the next statement
"Let’s make the rather heroic assumption that market returns are Normally distributed (in fact, we know from empirical research that they are not – but this is a starting point, at least). And let’s assume for the moment that our trader has been filled on a limit buy order and is looking to decide where to place his profit target and stop loss limit orders."
Dealing with observations and trying to use math statistics we need first to explain which observations we identify as independent observation of a random variable we are going to use for the test in our case test of normality. In this case we can use test formally as it used in math statistics. If we do not want to randomize past historical data and simply assume that future asset price is a normal or lognormal random process then what does it mean remark "in fact, we know from empirical research that they are not". One could not justify or reject the distribution. It is just an assumption. On the other hand if one can randomize past historical data it should be set an independent observations of the asset return and explained or verified independence of observations. In order to set problem in such a way we should clarify something that do not in general visible now
"Let’s make the rather heroic assumption that market returns are Normally distributed (in fact, we know from empirical research that they are not – but this is a starting point, at least). And let’s assume for the moment that our trader has been filled on a limit buy order and is looking to decide where to place his profit target and stop loss limit orders."
Dealing with observations and trying to use math statistics we need first to explain which observations we identify as independent observation of a random variable we are going to use for the test in our case test of normality. In this case we can use test formally as it used in math statistics. If we do not want to randomize past historical data and simply assume that future asset price is a normal or lognormal random process then what does it mean remark "in fact, we know from empirical research that they are not". One could not justify or reject the distribution. It is just an assumption. On the other hand if one can randomize past historical data it should be set an independent observations of the asset return and explained or verified independence of observations. In order to set problem in such a way we should clarify something that do not in general visible now
-
luli395
- Posts: 0
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
Thanks, Mr. iwanttobelieve, but I'm not intelligent enough to fully comprehend your views. I feel unsure about some of your statements:
1.
"2)After 1 min, either, take profit at +p, or stop at -s, or do nothing and keep your position for next bar."
Do you mean that profit or loss is only taken when the return exactly equals +p or -s after 1 min, otherwise wait for next bar until the return reaches +p or -s?
2.What do you mean by "The fact that you have higher order moments is the key. "?
Could you please clarify these points? Thanks again.
1.
"2)After 1 min, either, take profit at +p, or stop at -s, or do nothing and keep your position for next bar."
Do you mean that profit or loss is only taken when the return exactly equals +p or -s after 1 min, otherwise wait for next bar until the return reaches +p or -s?
2.What do you mean by "The fact that you have higher order moments is the key. "?
Could you please clarify these points? Thanks again.
-
luli395
- Posts: 0
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
The screenshot is from the article "http://jonathankinlay.com/index.php/2014/05/implementation-of-a-scalping-strategy/" . The gui seems to be part of tradeStation.
- Maggette
- Posts: 0
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
"The screenshot is from the article "http://jonathankinlay.com/index.php/2014/05/implementation-of-a-scalping-strategy/" . The gui seems to be part of tradeStation."
You are aware of the fact that goldorak wasn't asking about the GUI but was making a snarky remark about the lack of common sense manifested ijn this screenshot?:)
You are aware of the fact that goldorak wasn't asking about the GUI but was making a snarky remark about the lack of common sense manifested ijn this screenshot?:)
Ich kam hierher und sah dich und deine Leute lächeln, und sagte mir: Maggette, scheiss auf den small talk, lass lieber deine Fäuste sprechen...
-
iwanttobelieve
- Posts: 1
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
1. For a given day, if you take the one minute returns, 390 of those, this creates an empirical distribution of 1 minute returns.
Assume that somehow you can estimate this distribution, e.g. take the previous day/days samples.
If the distribution stays the same (it does over some period of time, but to be more precise you can condition by additional variables in your estimation. In the article implicitely, it is conditioned by some volatility forecast), then you can consider those 390 observations to be somewhat iid and thus the expectation 'E' notation. If you do not get stopped, basically I artificially created a period and the PnL is the conditional expectation that I mentioned. Basically you do nothing but from an accounting point of view, you assume you have an other period.
So - Pnl = N x E[ X | -s \le x \le p] ~ sum_{i=1}^N PNL(i)
2. If you do look at the second moment, of 1 minutes returns then 1 ticks away is more or less already 1 standard deviation or more. So if you cut 8 ticks away, or 30 ticks away it does not matter and you cannot shift the expectation in case of gaussian distribution. That is why it would not work with gaussian distributions (unless you have zero bid-ask of course)
Assume that somehow you can estimate this distribution, e.g. take the previous day/days samples.
If the distribution stays the same (it does over some period of time, but to be more precise you can condition by additional variables in your estimation. In the article implicitely, it is conditioned by some volatility forecast), then you can consider those 390 observations to be somewhat iid and thus the expectation 'E' notation. If you do not get stopped, basically I artificially created a period and the PnL is the conditional expectation that I mentioned. Basically you do nothing but from an accounting point of view, you assume you have an other period.
So - Pnl = N x E[ X | -s \le x \le p] ~ sum_{i=1}^N PNL(i)
2. If you do look at the second moment, of 1 minutes returns then 1 ticks away is more or less already 1 standard deviation or more. So if you cut 8 ticks away, or 30 ticks away it does not matter and you cannot shift the expectation in case of gaussian distribution. That is why it would not work with gaussian distributions (unless you have zero bid-ask of course)
-
iwanttobelieve
- Posts: 1
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
Ok, I suggest the following exercice (this is actually what i did when i bumped into the article)
1. Get some data, e.g. http://www.google.com/finance/getprices?i=60&p=10d&f=d,o,h,l,c,v&df=cpct&q=SPY
2. Create an empirical distribution out of it - you need some smoothing
http://en.wikipedia.org/wiki/Kernel_density_estimation
3. Compute f(s,p) = E [ X | -s \le X \le p] by numerical quadrature
http://en.wikipedia.org/wiki/Numerical_integration
4. Compute Max_{s,p} f(s, p), with your prefered optimizer, or alternatively, just create a heat-map table for various values of s and p
5. Repeat over multiple days, and try to identify if there are values of s and p that work over some period of time
Note: depending on your set-up it can take you 5 min or couple of hours
You can replace the distribution by a gaussian one, e.g. using the empirical second moment, you will see that s, p are not practical...
1. Get some data, e.g. http://www.google.com/finance/getprices?i=60&p=10d&f=d,o,h,l,c,v&df=cpct&q=SPY
2. Create an empirical distribution out of it - you need some smoothing
http://en.wikipedia.org/wiki/Kernel_density_estimation
3. Compute f(s,p) = E [ X | -s \le X \le p] by numerical quadrature
http://en.wikipedia.org/wiki/Numerical_integration
4. Compute Max_{s,p} f(s, p), with your prefered optimizer, or alternatively, just create a heat-map table for various values of s and p
5. Repeat over multiple days, and try to identify if there are values of s and p that work over some period of time
Note: depending on your set-up it can take you 5 min or couple of hours
You can replace the distribution by a gaussian one, e.g. using the empirical second moment, you will see that s, p are not practical...
-
Mat001
- Posts: 0
- Joined: Thu Jan 01, 2004 12:00 am
The Mathematics of Scalping
The paper tries to apply descriptive statistics to predictive analysis. Do we forget commission? How much does a scalper pay roundturn? Futures trading is zero sum game. You can go reverse, i.e. what happens to profitable systems when commission is added.See this for example.