+$1,310
Showing posts with label daytrading. Show all posts
Showing posts with label daytrading. Show all posts
SP500 Day Trading Algorithm
The figure shows the result of Emini Futures Day Trading Algorithm, backtesting. The algorithm is an implementation of the Statistical Mechanics of Day Trading.
Introduction To Statistical Mechanics of Day Trading.
“Simplicity is the ultimate sophistication.”
Leonardo Da Vinci
ABSTRACT
This manuscript is an introduction to mechanical day trading. The proposed approach is based on empirical and mathematical evidence. The problems of Trading Edge and Risk Management were revisited. The result is a rational methodology for mechanical day trading providing that a market of interest is liquid. The manuscript should prove useful for small-scale traders interested in developing machine trading systems.
INTRODUCTION
A daily move in Emini futures can easily exceed $1000 while, for example, ThinkOrSwim (TOS) trading platform at the moment requires about $7000 as the initial margin to enter a trade. It is even wilder in the crude oil market where the initial margin on TOS is about $4000, while a $1000 daily move is commonplace. With this in mind, a day trader sees a lot of easy money opportunities. Like a moth to a flame, day traders are attracted by the idea of getting rich fast. Alas, more than 90% of them lose money in their first year of trading. “I can make 10% profit per month” is a typical daydream of a day trader. There's plenty of ego in this game but the statistics completely contrast with what the average trader expects.
To a significant extent, I earn my living as a Statistical Mechanics scholar. As a day trader, however, I followed the ordinary path of Technical Analysis-based trading (TA). The ever-growing complexity of my TA knowledge never resulted in trading with conviction nor any profit. At some point, randomness became the only sure thing in my day trading. Upon reflection, it made sense to employ statistics and to find out if there is a rational approach to day trading at all. With my experience in statistics and research, I managed to build a mathematical model of day trading. The result is presented here in a general form that is applicable to any liquid market. In the proposed model, similar to options pricing models, daily price evolution is described by the probability distribution of the daily return. Within this description, the complexity of day trading is reduced to strikingly simple mechanics known as stochastic binary games. The aforementioned simplicity is related to the ultimate complexity of a large trading ecosystem in a way similar to how the simplicity of the distribution laws in Statistical Mechanics is related to the ultimate complexity of a many-particle system, i. e. it is not necessary to trace the trajectory of all particles to figure out the physical properties of a many-particle system providing that the system is in the thermodynamic equilibrium; it is not necessary to know the position and intention of all market players to figure out the result of a day trading system providing that this market is fairly priced, i. e. in equilibrium, and liquid, i. e. the equilibrium arises from interactions of a large number of market participants. This methodology solves stop loss, take profit and risk management problems.
Statistical Mechanics of Day Trading.
- Probability Distribution of The Daily Return.
- Generic Algorithm of Day Trading.
- Take Profit & White Swans.
- Leverage Using The Kelly Criterion.
$3750, Algorithmic Day Trading , December 2018.
In the last month of 2018 my day trading algo collected 37.5 /ES points x 2 contracts, i.e. $3,750.00
Algorithmic Day Trading How To.
| 12/3/2018 | -9.5 |
| 12/4/2018 | 69 |
| 12/6/2018 | -29.5 |
| 12/7/2018 | 43 |
| 12/10/2018 | -37.5 |
| 12/11/2018 | 29 |
| 12/12/2018 | -16.75 |
| 12/13/2018 | 9.25 |
| 12/14/2018 | 29.25 |
| 12/17/2018 | -23.25 |
| 12/18/2018 | 34.25 |
| 12/19/2018 | 0 |
| 12/20/2018 | -17.25 |
| 12/21/2018 | 61.25 |
| 12/26/2018 | -38 |
| 12/27/2018 | -21.75 |
| 12/28/2018 | -26 |
| 12/31/2018 | -18 |
| 37.5 |
TA is a tale told by an idiot ...
( spoken by Macbeth)
Tomorrow, and tomorrow, and tomorrow,
Creeps in this petty pace from day to day,
To the last syllable of recorded time;
And all our yesterdays have lighted fools
The way to another loss. Out, out, flat!
Day trader's but a walking shadow, a poor player,
That struts and frets his hour upon the stage,
And then is heard no more. TA is a tale
Told by an idiot, full of sound and fury,
Signifying nothing
Algorithmic Daytrading : 2X milestone.
“Number rules the universe.”
Pythagoras
Algorithmic Day Trading How To.
Starting from the beginning of March 2018 Medved's algo scored 228 points per /ES contract. The risk was set to $10,000.00 per contract. It means that the 2X milestone is here ( after fees the algo doubled the risk money ). For now, I am taking a break from day trading. The idea is to see a significant drawdown in the performance of the algo. After it, I will restart my algo trading with 2X number of contracts.
| 11/1/2018 | 3.75 |
| 11/2/2018 | 10 |
| 11/5/2018 | 7.75 |
| 11/6/2018 | 10.5 |
| 11/7/2018 | 27.25 |
| 11/8/2018 | 0 |
| 11/9/2018 | 3.75 |
| Total: | 63 |
The previous period was posted here.
Day trading Octoberfest : 85 /ES points
Starting March 2018 the algorithm made 165 /ES points per contract.
| 10/1/2018 | -6 |
| 10/2/2018 | 0 |
| 10/3/2018 | 13.25 |
| 10/4/2018 | 0.25 |
| 10/5/2018 | 0 |
| 10/8/2018 | -9 |
| 10/9/2018 | -4.25 |
| 10/10/2018 | 81.25 |
| 10/11/2018 | 19.25 |
| 10/12/2018 | 0 |
| 10/15/2018 | 0 |
| 10/16/2018 | 27.75 |
| 10/17/2018 | -23.5 |
| 10/18/2018 | -15.75 |
| 10/19/2018 | -16.5 |
| 10/22/2018 | 0 |
| 10/23/2018 | -18.25 |
| 10/24/2018 | 46.5 |
| 10/25/2018 | -10.25 |
| 10/26/2018 | -43.25 |
| 10/29/2018 | 56.5 |
| 10/30/2018 | 0 |
| 10/31/2018 | -13 |
| Total: | 85 |
algorithmic day trading : -15.5 /ES points
| 8/31/2018 | -9 |
| 9/4/2018 | -11.5 |
| 9/5/2018 | -4.75 |
| 9/6/2018 | -3 |
| 9/7/2018 | -5.25 |
| 9/10/2018 | 2.5 |
| 9/11/2018 | 0 |
| 9/12/2018 | -8.25 |
| 9/13/2018 | 0 |
| 9/14/2018 | -1.75 |
| 9/17/2018 | 6 |
| 9/18/2018 | 2.75 |
| 9/19/2018 | 0 |
| 9/20/2018 | 9.75 |
| 9/21/2018 | 8.75 |
| 9/24/2018 | -4.25 |
| 9/25/2018 | 1.75 |
| 9/26/2018 | 0 |
| 9/27/2018 | 0 |
| 9/28/2018 | 0.75 |
| Total: | -15.5 |
The previous period was posted here.
-$600, Day Trading Algorithm
| 8/14/2018 | 4 |
| 8/15/2018 | -15.75 |
| 8/16/2018 | 3.25 |
| 8/20/2018 | -3.25 |
| 8/21/2018 | -5.75 |
| 8/24/2018 | 4.75 |
| 8/27/2018 | 4.25 |
| 8/28/2018 | 0.5 |
| 8/30/2018 | -3.5 |
| Total: | -11.5 |
Starting March, Medved's proprietary algorithm made 95 /ES points.
Mathematics of "Why Day Traders Lose Money"
Mathematical statistics explains three major reasons behind the frustrating reality that nearly all day traders lose money.
1. Instead of "cut your losses early and let your winners run" a trader usually is inclined to "take the profit early and let the losers run". This type of behavior is dictated by emotions while statistical analysis showed that taking profit early leads to a negative expectation. "Let the losers run and averaging losers" in day trading is a recipe of "how to lose your deposit quick".
2. The second reason has to deal with the mathematical fact that for a trader who has a limited capital having a strategy with a positive expectation is a necessary condition to win but it is not a sufficient one. Proper position sizing is required to be a profitable trader.
Let us describe the problem in simple terms. As I posted earlier, day trading can be approximated by a toss of a biased coin. Now imagine that a trader has $1000 and knows a strategy equal to a coin biased as follows - 2/3 heads and 1/3 tails. If this trader every time goes all in on heads than, at some point, all wins and the initial $1000 will be lost. There is a limit to the fraction of the capital this trader can bet on a single toss to avoid the ruin and there is the optimal bet which allows growing the capital with the fastest rate. The mathematical solution to this problem is known as the Kelly criterion. For the coin used in the example above, the Kelly gives 2/3-1/3=1/3 as the optimal fraction of the capital to bet. This solution involves a mathematical idealization that the capital can be dived as many times as it requires and an infinitesimally small bet is possible. Unfortunately, unless a trader has enough money to start with say 100 emini contracts, the Kelly criterion can't be used directly by a small-scale day trader. However, this criterion still can be used to prevent a day trading strategy from running into a ruin.
To summarize, the problem of the optimal bet in the leveraged trading on time frames with the quasi-normal distribution of the return (day or shorter time frames) is still, at least to me, an open question.
I will try to look into this problem.
Update: Leveraged Trading Using The Kelly Criterion.
3. The third reason is the cost of trading which includes trading fees and slippage. The quasi-normal distribution of the daily return results in close to zero expectation of trading. That is many wins and losses eventually just cancel each other while, as time passes by, the cost of trading steadily adds to the loss. For this reason, many quant strategies that look good on paper do not deliver in real life. Here one has to :
a) daytrade using only liquid trading instruments;
b) choose a broker with a better fee structure;
c) use the realistic cost of trading in calculating the expected return of a trading model.
Let us describe the problem in simple terms. As I posted earlier, day trading can be approximated by a toss of a biased coin. Now imagine that a trader has $1000 and knows a strategy equal to a coin biased as follows - 2/3 heads and 1/3 tails. If this trader every time goes all in on heads than, at some point, all wins and the initial $1000 will be lost. There is a limit to the fraction of the capital this trader can bet on a single toss to avoid the ruin and there is the optimal bet which allows growing the capital with the fastest rate. The mathematical solution to this problem is known as the Kelly criterion. For the coin used in the example above, the Kelly gives 2/3-1/3=1/3 as the optimal fraction of the capital to bet. This solution involves a mathematical idealization that the capital can be dived as many times as it requires and an infinitesimally small bet is possible. Unfortunately, unless a trader has enough money to start with say 100 emini contracts, the Kelly criterion can't be used directly by a small-scale day trader. However, this criterion still can be used to prevent a day trading strategy from running into a ruin.
To summarize, the problem of the optimal bet in the leveraged trading on time frames with the quasi-normal distribution of the return (day or shorter time frames) is still, at least to me, an open question.
I will try to look into this problem.
Update: Leveraged Trading Using The Kelly Criterion.
3. The third reason is the cost of trading which includes trading fees and slippage. The quasi-normal distribution of the daily return results in close to zero expectation of trading. That is many wins and losses eventually just cancel each other while, as time passes by, the cost of trading steadily adds to the loss. For this reason, many quant strategies that look good on paper do not deliver in real life. Here one has to :
a) daytrade using only liquid trading instruments;
b) choose a broker with a better fee structure;
c) use the realistic cost of trading in calculating the expected return of a trading model.
+$800, Algorithmic Day Trading SP500
Recently I posted the historical statistics of SP500 daily return. It turned out that the Efficient Market Hypothesis is very close to reality in the case of SP500 day trading. Most of the time the probability of win is a randomly distributed variable and no chances for a day trader to outperform the market. However, if optimized, "cut your losses early and let your winners run" algorithm has a theoretical chance to beat the market. Keep in mind that the real working algorithm needs more ingredients.
Below are the results (in /ES points) for the past two weeks of medved's proprietary day trading robot :
Below are the results (in /ES points) for the past two weeks of medved's proprietary day trading robot :
| 8/2/2018 | 24 |
| 8/7/2018 | 0.5 |
| 8/8/2018 | -4 |
| 8/9/2018 | -4.25 |
| Total: | 16.25 |
+ $700 after fees, #SP500 #daytrading #algotrading
In the past two weeks, Medved's day trading algorithm generated 6 trades. The result is 15.75 points of emini futures which is slightly more than $700 USD after fees.
| 7/16/2018 | 1.75 |
| 7/20/2018 | -2 |
| 7/23/2018 | 11 |
| 7/24/2018 | -6.5 |
| 7/26/2018 | -5 |
| 7/27/2018 | 16.5 |
| Total: | 15.75 |
#SP500 #daytrading #algotrading : 6 points after fees
In the past week, Medved's day trading algorithm generated 5 trades. The results ( in emini futures points) are as follows:
The previous period was posted here.
| 7/9/2018 | 8 |
| 7/10/2018 | -5.25 |
| 7/11/2018 | -7.5 |
| 7/12/2018 | 8.25 |
| 7/13/2018 | 3.25 |
| Total: | 6.75 |
The previous period was posted here.
+$500 : #SP500 #daytrading #algotrading
Since June 21st, medved's day trading algorithm generated 5 trades. The results ( in emini futures points) are as follows:
The previous period was posted here.
| 6/25/2018 | 2.75 |
| 6/27/2018 | -15 |
| 6/28/2018 | 18 |
| 6/29/2018 | -11.75 |
| 7/2/2018 | 16.5 |
| Total: | 10.5 |
The previous period was posted here.
#SP500 $ES_F #daytrading #algotrading : 5 points #Solstice #Trade
Today. June 21st, medved's SP500 daytrading algorithm went short and scored 5 points The algo has generated another two trades during this week to the total profit of 15 points. The algo fully recovered the big loss. Year to date in 2018 the algorithm has generated 90 points per one emini contract.
Solstice Trade:
#SP500 $ES_F #daytrading #algotrading : 12 points
I continue SP500 daytrading using the statistics-based algorithm. The algo has generated only one trade during the last 5 trading days. It was a successful trade, 12 points. The algo needs another 7 points win to fully recover from the big loss. Year to date in 2018 the algorithm generated 70 points per one emini contract.
#SP500 #daytrading $ES_F : 4 points
Playing time frames: Good ole follow the trend trade combined with good ole contrarian trade.
The trade was posted live @tfo_medved.
The trade was posted live @tfo_medved.
| Exec Time | Spread | Side | Qty | Pos Effect | Symbol | Exp | Strike | Type | Price | Net Price | Order Type |
| 5/29/2018 11:30 | FUTURE | BUY | 1 | TO CLOSE | /ESM8 | 18-Jun | FUTURE | 2698 | 2698 | LMT | |
| 5/29/2018 11:28 | FUTURE | SELL | -1 | TO OPEN | /ESM8 | 18-Jun | FUTURE | 2702 | 2702 | LMT |
Subscribe to:
Posts (Atom)




