Fully Automated Stocks Trading

valeryn

Junior member
Messages
25
Likes
12
Would love to post here a bit about my trading, hopefully to meet likeminded individuals who trade systematically and extend my personal network. In the process, I am happy to answer any questions and hopefully, to create value for others.

I started trading about 8 years ago and eventually narrowed it down to fully mechanical/automated systems.
My biggest discretionary success was with shorting stocks, but that glued me to a screen for a whole day and I didn't really enjoy that aspect.

Today, most of my liquid assets are managed by automated mechanical systems with YTD my performance around +75%.
Exceptional volatility helped, but my method is designed for any market.
Basically volatility increases trade count => edge can be extracted more often.

Few randoms things about it:
  1. Account size 100-500k USD / IB is my broker
  2. My edge is statistical + software & execution + account size
  3. I use multiple, non correlated strategies. 5 at the moment, all running at the same time
  4. None of current strategies average down
  5. Trading vehicle is US stocks. All of them, just have to be liquid enough
  6. Different strategies leverage different anomalies, mean reversion, trend following, whatever works
  7. My software does a lot of trades, 935 from Jan till end of Aug this year
  8. Long/short trades split is about ~50/50
  9. Statistical edge on individual trades is pretty small but consistent
  10. All of my positions are "micro" sized. Anywhere from 3-10% of equity
  11. On average, I have ~10-15 positions open, sometimes gets up to ~30
  12. Average hold over all live trades is 2.4 days
  13. To develop strategies I use mostly EOD historical data, most testing done over multiple market cycles from 1990-now, sometimes I go as far as 1950. My data includes all delisted companies
  14. I am not looking at executions during a day, rather check automatically generated reports after-hours to make sure live vs model looks good
  15. On a weekends I look at account value / ~once a month I will do more extensive analysis to see how models are doing
  16. For execution I have created my own software, for backtesting I used to use AmiBroker but for last 2 years, I switched to another platform, developed by my mechanical trader friend called RealTest. It is specifically designed to model multiple strategies running together. Basically a portfolio of strategies

Systematic Account.png


This summer I started posting on ET and already shared quite a bit there. Here is a link

Glad to answer any questions.

Val
 
Hi,

Interesting system you have.

When you write fully automated system is it really so. I run a fully automated system on Forex but to be honest, do I read news and "stop" the trading sometimes. So the stop of the trading is not always done by the automated system.

As an example: How will your system handle the USA election?
 
Hi,

Interesting system you have.

When you write fully automated system is it really so. I run a fully automated system on Forex but to be honest, do I read news and "stop" the trading sometimes. So the stop of the trading is not always done by the automated system.

As an example: How will your system handle the USA election?

I love the news. They move the markets, they create volatility. The more markets move, the money money I make.

My personal opinion - news avoidance is due to inappropriate positions sizing. Basically if system "works" but during news you get wiped out that means trade size was too large.

Also, a thing to remember about news - they are unpredictable. They can come out any time. There is absolutely no way to completely avoid them so might just incorporate that expectation in your system design.

US Election is no different. My systems will keep trading exactly the same way they do.

Val
 
Last edited:
Election week is over so quick update - I did not change a thing coming into election week, as all my testing and system development is done over very long intervals incorporating many elections, adverse events, flash crashes etc.

PnL-wise, seems to be the biggest winning week of a year.

Hope everyone else did well too.

Val
 
Looks really interesting, I am myself looking into building one. What language do you use to trade with IB? I started looking at doing it in python but it looks not so simple to set it up. I am quite early in the journey but definitely looking at building something really soon.
 
Looks really interesting, I am myself looking into building one. What language do you use to trade with IB? I started looking at doing it in python but it looks not so simple to set it up. I am quite early in the journey but definitely looking at building something really soon.

Hi Alex.

I am using Kotlin. But in terms of easiest to get started - Python will do. After certain point in complexity Python programs, typically, reach their limit in maintainability and function. So I went with Java right away and converted into Kotlin later for safer coding practices.

Most people coming from tech will not like what I have to say about tech part of trading.
Technology, for retail traders, does not make money.

You have to see technology as only automation of what already successfully working for you (reduction of your screen time) and enablement of something you can't do at all without technology (managing too many orders at ones for example).

Developing a trading system alone is a multi year journey, most traders never arrive to a point of having a profitable idea that will last thru different market cycles.

My recommendation, if you're just getting into trading - pick up a book on mean reversion by Howard Bandy and spend some time on testing different trading systems he is talking about. Go thru charts manually, look at trades systems will be taking, try to automate a test to generate 100s or better 1000s of trades, see if system is profitable long term. Till you have some idea on what types of systems you will be trading - you won't know what makes sense to automate.

Good luck on your journey.

Val
 
Hi Val,

That is really good advice thank you.

Being from a tech background, I am not surprised that you are saying that. Usually, we are more concerned about what is cool rather than what is profitable.

I started investing for a few years already and learning short term trading as well, I am actually doing exactly what you are saying, spending time day trading and not programming on the script yet.

Yes, it is definitely important to have a script that works in all conditions, I agree with you.
I noticed so far that moving averages can be quite profitable at any part of the cycle.

Thanks for recommending that book, I will have a look.

Do you trade/invest manually outside of your automated system? Or everything you do is automated on the market?
Is 75% your average annually? Have you done that consistently for the past 8 years?

I hope I do not ask too many questions, but this looks super interesting.
 
I started investing for a few years already and learning short term trading as well, I am actually doing exactly what you are saying, spending time day trading and not programming on the script yet.
That's good. Next step would be to try to make rules for what you think works and attempt to backtest them. It is always a good idea to separate definition of "script" or any technology piece from your trading system. It sounds like you are at the stage of looking for an edge and yet to develop a trading system that will be based on it.

It might not seem like a big difference, but can save you a few years down the road, as it will let you focus on the next right thing. You are not gonna be creating a script, but a tested set of rules first. Let's say if you think MA are what works - make formal rules on when you will enter and exit / how much money you bet, define what instruments you're trading, how many positions you will be taking max, maximum hold time etc. Then backtest manually over charts. Then, if shows promise - look into automating a test on a larger data set.

I'll strongly advice against writing your own automation of their testing. Use something like AmiBroker. Looking for an edge is hard enough already. Once you developed and tested a trading system - normally, you run it 100% manually but follow it blindly. if it shows a promise - then automation of execution starts.

Do you trade/invest manually outside of your automated system? Or everything you do is automated on the market?
Is 75% your average annually? Have you done that consistently for the past 8 years?
Yes, everything is automated.

Once in a few months I might do a discretionary trade but that's completely different story and is not impacting my PL much anyway.


Re performance - I aim for 20% AAR with <12% MaxDD. Anything outside of that is possible if market conditions are favourable. This year is a good example.

A bit of a history:

I made my first trade in AAPL about 8 years ago. And it was a disaster. After few of those I started looking into trading systems and backtesting. After 2 years I had success with discretionary shorting stocks but it was taking too much of screen time. Was glued to a monitor most of the session. Results were good, I had something like 45 winning days streaks. But cost was too high. Then I decided to look into automation and realized I couldn't automate that, too much discretion was involved.

Then I started a tech business and basically stopped trading for almost 5 years. Occasionally I'd learn more about trading but my focus was really on building a company. In 2019 I had a bit of spare time on weekends, reviewed all my previous work and decided to give full automation a go.

By end of 2019 it was 100% automated and ran this way since.

Val
 
Last edited:
If anyone wants to learn more - my ET journal link from my original post has about 28 pages by now and I talk about different aspects of trading automation and developing a trading system there.

I'm happy to answer any questions here, but that journal might give you a lot of insight.

Val
 
That's good. Next step would be to try to make rules for what you think works and attempt to backtest them. It is always a good idea to separate definition of "script" or any technology piece from your trading system. It sounds like you are at the stage of looking for an edge and yet to develop a trading system that will be based on it.

It might not seem like a big difference, but can save you a few years down the road, as it will let you focus on the next right thing. You are not gonna be creating a script, but a tested set of rules first. Let's say if you think MA are what works - make formal rules on when you will enter and exit / how much money you bet, define what instruments you're trading, how many positions you will be taking max, maximum hold time etc. Then backtest manually over charts. Then, if shows promise - look into automating a test on a larger data set.

I'll strongly advice against writing your own automation of their testing. Use something like AmiBroker. Looking for an edge is hard enough already. Once you developed and tested a trading system - normally, you run it 100% manually but follow it blindly. if it shows a promise - then automation of execution starts.


Yes, everything is automated.

Once in a few months I might do a discretionary trade but that's completely different story and is not impacting my PL much anyway.


Re performance - I aim for 20% AAR with <12% MaxDD. Anything outside of that is possible if market conditions are favourable. This year is a good example.

A bit of a history:

I made my first trade in AAPL about 8 years ago. And it was a disaster. After few of those I started looking into trading systems and backtesting. After 2 years I had success with discretionary shorting stocks but it was taking too much of screen time. Was glued to a monitor most of the session. Results were good, I had something like 45 winning days streaks. But cost was too high. Then I decided to look into automation and realized I couldn't automate that, too much discretion was involved.

Then I started a tech business and basically stopped trading for almost 5 years. Occasionally I'd learn more about trading but my focus was really on building a company. In 2019 I had a bit of spare time on weekends, reviewed all my previous work and decided to give full automation a go.

By end of 2019 it was 100% automated and ran this way since.

Val
Yeah, I think I am quite early in the process. So much to learn to get there. So do you still have your tech business now?
 
Yeah, I think I am quite early in the process. So much to learn to get there. So do you still have your tech business now?
Yes.

PS. Just recently realized that it is at a market cap bigger than some of the companies my systems trade :)
 
Hi Val. Very interesting. I first saw your thread over on ET a few weeks ago when I was looking around for people who had walked this road, but I have drifted more to T2W recently (seems more of a UK engagement which is where I am) and I'm rediscovering your stuff. I am in no ways as advanced as you but I have developed my own thing using a java based data manipulation tool called Talend. My background is data, and my premise is that I can just create data pielines which route to outcomes, and that's automated trading right there. It is 100% parameterised, so I can set up backtests where strategies are combinations of those parameters over a timescale and let them run. Live execution wise all I have yet is an overnight email telling me what signals I got and how to trade them (been using demo account up to now, just moved to real). Behind that is a routine that sees what day of the week it is and what it needs to run, refreshes EOD and company data accordingly and then runs whatever strategies are scheduled. Future steps are:

1. Put a front end on this so I can interact with the system instead of just getting an email!
2. Full automation of trading.
3. Learning a lot more about trading!

Your advice above reminds me of the importance of 3 before I can think about 2. Like you I am from a tech background so I can see how achievable all that side is, but it would be a thin and rather sad system if it wasn't giving me returns. So thanks!

Did you ever get to record that webinar? Wish I had seen it.
 
Hi Val. Very interesting. I first saw your thread over on ET a few weeks ago when I was looking around for people who had walked this road, but I have drifted more to T2W recently (seems more of a UK engagement which is where I am) and I'm rediscovering your stuff. I am in no ways as advanced as you but I have developed my own thing using a java based data manipulation tool called Talend. My background is data, and my premise is that I can just create data pielines which route to outcomes, and that's automated trading right there. It is 100% parameterised, so I can set up backtests where strategies are combinations of those parameters over a timescale and let them run. Live execution wise all I have yet is an overnight email telling me what signals I got and how to trade them (been using demo account up to now, just moved to real). Behind that is a routine that sees what day of the week it is and what it needs to run, refreshes EOD and company data accordingly and then runs whatever strategies are scheduled. Future steps are:

1. Put a front end on this so I can interact with the system instead of just getting an email!
2. Full automation of trading.
3. Learning a lot more about trading!

Your advice above reminds me of the importance of 3 before I can think about 2. Like you I am from a tech background so I can see how achievable all that side is, but it would be a thin and rather sad system if it wasn't giving me returns. So thanks!

Did you ever get to record that webinar? Wish I had seen it.

Re t2w - I'm not sure why, but I get perception there is more activity on ET. Well I'm in PST so might be more of a North American thing. Either way - my journal there is 30+ pages and the reason I started was exactly to help other hard working folks to get a sense that it is possible, give some hints on what matters, have info re one trading method layout in a consistent way etc. I'll keep replying here if anyone has any questions, but not likely to publish much new stuff as it's double effort.

Re recording - someone else did. I've got a recording but somewhat hesitant to send it around. I'll probably do another presentation in a month or so if more people want it. In a slightly different format.

Feel free to PM me, I'll put you a list.

What you are doing with ETL sounds pretty smart. Taking advantage of what you already now is a good ROI. No need to learn new stuff from 0 if what you know works just fine.

Re your plan
1. I recommend to check Slack and consider writing your Slack bot. It is way less time than writing your UI and works great for remote control + you can dump all your reports and key events there
2. Sounds like the next step here would be generating orders automatically. Which is not that hard to do if broker offers API
3. That should be #1. Automation WILL distract you. Trading system is what makes money. It's not as fun as playing with tech (at least for us, tech guys), but nothing makes sense unless you have a system that shows promise. When I wrote my first automation it was really simple order generation just to avoid typo mistakes in prices / shares I want to buy. I didn't put anything more advanced until I had ~50-100 first trades and some confidence that what I see live matches my backtesting expectations.

The only two things you case about as systematic trader -
a. Are you models staying within their historical parameters or stopped working
b. Are you live executions matching your models

Once you have sufficient proof - go nuts and automate more so it doesn't take too much time to execute / monitor.

Val
 
Last edited:
Re t2w - I'm not sure why, but I get perception there is more activity on ET. Well I'm in PST so might be more of a North American thing. Either way - my journal there is 30+ pages and the reason I started was exactly to help other hard working folks to get a sense that it is possible, give some hints on what matters, have info re one trading method layout in a consistent way etc. I'll keep replying here if anyone has any questions, but not likely to publish much new stuff as it's double effort.

Re recording - someone else did. I've got a recording but somewhat hesitant to send it around. I'll probably do another presentation in a month or so if more people want it. In a slightly different format.

Feel free to PM me, I'll put you a list.

What you are doing with ETL sounds pretty smart. Taking advantage of what you already now is a good ROI. No need to learn new stuff from 0 if what you know works just fine.

Re your plan
1. I recommend to check Slack and consider writing your Slack bot. It is way less time than writing your UI and works great for remote control + you can dump all your reports and key events there
2. Sounds like the next step here would be generating orders automatically. Which is not that hard to do if broker offers API
3. That should be #1. Automation WILL distract you. Trading system is what makes money. It's not as fun as playing with tech (at least for us, tech guys), but nothing makes sense unless you have a system that shows promise. When I wrote my first automation it was really simple order generation just to avoid typo mistakes in prices / shares I want to buy. I didn't put anything more advanced until I had ~50-100 first trades and some confidence that what I see live matches my backtesting expectations.

The only two things you case about as systematic trader -
a. Are you models staying within their historical parameters or stopped working
b. Are you live executions matching your models

Once you have sufficient proof - go nuts and automate more so it doesn't take too much time to execute / monitor.

Val
Hi Val. Thanks for your thoughts. I like the Slack bot idea but I fear what I can do there is limited as all my stuff is running locally at present. I plan to push it up to AWS when I need too but until then it is a mysql db and some java running off Task Scheduler. Bit 90s but I don't want to waste AWS spend until it's worth it. I know they have the free tier but I always get caught out and end up with a bill!
 
Hi again Val. Above you recommend a mean reversion book by Howard Bandy. I have heard other good words about him so I am up to have a look at his stuff. But can you clarify which book you recommend? One is Mean Reversion Trading Systems. But a couple of the Amazon reviews say it is a bit light, and refers to detail in one or more of his other books.
 
Top