Forums  > Trading  > Application of Filtering Principles Towards Trading Stock Prices  
     
Page 1 of 1
Display using:  

amin


Total Posts: 304
Joined: Aug 2005
 
Posted: 2022-01-21 12:47
Read full post here and look at graphs at link below: https://lnkd.in/eFxJDBvS


Friends, I have previously mentioned on the forum that I have devised my own trading algorithms based on filtering theory applied in a different and innovative way. I am sharing performance of my algorithm on Tesla stock for 40 days from 5th of April 2021 to 30th of May 2021. I have posted graphs that show profits from my trading strategy and the Tesla stock price for 40 days. Title of each of the 40 graphs is the date on that trading day. On the graphs trades are marked and a the blue "+" means entering a buy side of the trade while a red "o" means entering a sell side of the trade. Black lines are profits and green line marked with trades is Tesla stock mid-price.

In these algorithms, I have traded mid-price i.e I buy and sell both on mid-price.The mid-price trading algorithm makes 27000 trades during 40 days and makes a cumulative profit of $411. Tesla stock price is roughly around $700 during this period. One trade lasts on average for slightly more than 30 seconds in my trading strategy.

I am attaching 40 graphs in jpg files for forty different days of trading mid-price on Tesla stock in next two posts. I have not included any spread profits that we would accumulate on the way. In final analysis mid-price trading profits would play a smaller role than bid-ask spread that we would collect on our 27000 trades. I have not included that in this analysis.

To make a prediction, I have used filtering techniques but in a way nobody has used them before. I am running the filter on 15 second log returns but I am not using classical filtering theory in predicting the returns instead I filter the parameters of the process and then use those parameters to generate a signal. I do not believe anybody has done this before as far as I know. Without a robust prediction technique, it would be totally impossible to profitably make trades on a scale of 15 seconds.

Market is noisy all the time. My algorithm quickly predicts the market for next 15 seconds. If I have already bought a share and my algorithm predicts that market will be up after 15 seconds, I will hold it and make no trade. However if my algorithm predicts that market will go down after 15 seconds, I will immediately sell the share in market at discounted bid-ask spread to sell the inventory I have. Mostly I would make the size of sell order 2X the size of shares traded so that I can simultaneously short the same amount of stock to have a negative position since the algorithm has indicated that price would go down after 15 seconds. You need a great prediction algorithm to predict the noise in the market every 15 seconds. Offsetting the buy inventory and entering a short are usually together in my algorithm but they can be decoupled as well.

After profits from bid-ask spread on limit orders are included, my trading strategy virtually has very little drawdown. After profits from bid-ask spread are included, I do not think there was a single day that strategy made a loss. Though some individual trades can make a loss during the day but over the entire day there is usually no drawdown. This is like high frequency trading but without the need for great infrastructure that is required for HFT. We just automate our program to keep making quick trades and keep earning small spreads. If we can consistently earn this spread, it becomes quite substantial and overall profit is quite high. I believe Renaissance follows similar trading strategies in spirit though I am sure their execution would be very refined as they are very experienced in the market.

Latency required should be just reasonable and should not be extremely high. We are not trading on nano-seconds scale at all. We need to make a trade after an average of 30 seconds. Trade time can vary from 15 seconds to several minutes as guided by the prediction algorithm. We want to be filled quickly but some noise is acceptable and we are not competing to be filled at every order. Some better than normal latency is acceptable.

My algorithm is based on filtering principles, it is very important that all the input variances and variances of parameters are close to reality and usually these variances are found by optimizations on the available data. I have optimized variance values for Tesla stock by playing around with data but I still have to write a proper optimization algorithm that will optimize filter parameter variances for various stocks. If we input bad variances in above analysis, the filter can make large losses but a properly optimized filter usually results in reasonable profits. I will be working in next few days to write the filter variances optimization program. Even for the Tesla stock I have shown, performance will be quite better when variances and other parameters are optimized.
Read full post here and look at graphs at link below:
https://lnkd.in/eFxJDBvS

ceh123


Total Posts: 3
Joined: Sep 2021
 
Posted: 2022-01-21 14:17
So many questions.

Why is the testing period only April-May 2021? Is this a backtest, and if so why not use more data?

Did you incorporate transaction costs into your model? Because with 27k trades that's going to be a super important factor.

$411 profit on what capital?

"After profits from bid-ask spread on limit orders are included, my trading strategy virtually has very little drawdown"
- Could you explain this more? How are you ensuring you're profiting from the spread?

Also what filter principles are you talking about exactly? I'm not familiar with that term in this context.

amin


Total Posts: 304
Joined: Aug 2005
 
Posted: 2022-01-21 14:56
Q. Why is the testing period only April-May 2021? Is this a backtest, and if so why not use more data?

A. I can definitely use more data but this project started in summers and at that time I bought a large amount of tick-data but two last months of data was downloaded separately and prepared the smaller set according to format that it could be used in initial experiments. Other files were too large and I did not bring them into proper format and it can take several days. Also I am still to write an automated optimization program and I would come back to testing larger data sets after that.

Q. Did you incorporate transaction costs into your model? Because with 27k trades that's going to be a super important factor.

A. For that kind of trades IB charges .35 dollars per trade contract. Assuming I am trading 100 shares, that is .0035 dollars per share per side of trade
27000*.0035 *2= $188 per single stock which is relatively insignificant. All my analysis is for a single share of stock.

Q. $411 profit on what capital

A. On a single Tesla share traded that is around $700 on average.

Q. "After profits from bid-ask spread on limit orders are included, my trading strategy virtually has very little drawdown"
- Could you explain this more? How are you ensuring you're profiting from the spread?

A. Since I got my mid very right on average, and the average Tesla spread in this period is 8 cents but I suppose that I could materialize only 4 cents when I enter the trades through limit orders. I think experienced market players can easily earn greater spread per trade than 4 cents.

Q. Also what filter principles are you talking about exactly? I'm not familiar with that term in this context.

A. May be this is a bad term but in the relevant last post on original forum I have given some pointers to threads where I have previously discussed these ideas. Please see here: https://forum.W****tt.com/viewtopic.php?f=4&t=99702&start=1140

tradeking


Total Posts: 33
Joined: May 2016
 
Posted: 2022-01-21 15:23
"One trade lasts on average for slightly more than 30 seconds in my trading strategy."

How can you assume in live trading, using real bid/ask prices instead of the mid, that you would get a fill every 30 seconds?

amin


Total Posts: 304
Joined: Aug 2005
 
Posted: 2022-01-21 15:51
Q. "One trade lasts on average for slightly more than 30 seconds in my trading strategy."
How can you assume in live trading, using real bid/ask prices instead of the mid, that you would get a fill every 30 seconds?

A. For that you have to have a complete strategy. And that is why I suggested in the calculations that I would be getting filled with a spread of 4 cents on average as opposed to prevailing spread of 8 cents. Even then there would be a few times when I would remain unfilled and I would need a strategy to deal with that.
BTW Tesla share was traded usually way more than 10,000 shares per 15 second period during the data analysis time window of two months.
Previous Thread :: Next Thread 
Page 1 of 1