Fully Automated Stocks Trading

Status
Not open for further replies.
Today post is somewhat outside of trading. I am big believer in sport. It helps to develop mental discipline and focus, builds up perseverance, self esteem, as well as will power.

Basically a great foundation for everything else in life.

To multiply the effects I personally pick something really difficult to achieve, so a lot of patience, repetition and failures will be required to get there.

Doing something extremely hard is certainly not necessary but I do because I am at the age when I can and mental benefits are multiplied. Otherwise - any sport activity is great. If you don't today, try to incorporate it in your life. It is ideal to get to a point when it is no longer optional and just becomes a part of life and routine.

Stay healthy everyone!

Attached one of my random workouts in a park while we were in a lockdown.
PS. I don’t do any weights or go to gyms.

upload_2020-9-19_12-45-27.png


Val
 
Right, majority of my systems are mean reversion with relatively high trade count. 1048 entries YTD, across all systems.

Re "multiple positions using daily bars" - it depends on what you mean. I use to use intraday data for backtesting in a past, but switched to EOD for 99% of my backtesting couple of years ago. It seems to be sufficient. And I do hold many positions at the same time. Typically anywhere from 6 to 30 across all strategies. There is prioritization between them as only one can take a position in the same symbol at the same time (for simplicity). Though, on rare occasion and depending on the exit type, I might have couple trades in the same ticker on the same day, let's say if one strategy hits a target very fast.

LMT orders - I do use them at some extend. Execution is almost an art. There is a lot of little edges there. That's why I created my own software to execute, monitor, manage positions and manage risk. It is called, very creatively, a "trader". Normally runs on its' own for weeks at the time and just sends me occasional reports. I can command it via Slack for convenience.

"With Amibroker it's somewhat complicated to code and backtest limit orders when you run multiple positions" - I'm not sure what you mean exactly. If you are talking about multiple strategies possibly taking positions in the same symbol at the same time - then yes, RealTest handles it very well out of the box. If that's what you are asking about of course. Check out a Documentation Marsten created, it is actually a full of nuggets coming from a real Market Wizard doing this stuff for 20+ years.. Here is how he handles Intraday Fills - https://mhptrading.com/realtest/docs/index.htm > Backtest Engine Details > Intraday Fills...

In general, Marsten tried to keep things very simple in RealTest and avoided introducing any real coding at any cost. So strategies looks very declaratively.

Val
The issue with trading multiple positions with a single strategy using limit orders with Amibroker is for example, my system might generate 100 buy signals or limit orders for one day for 12 positions that I have available. Say for example, that morning, 15 out of 100 of those limit orders get hit. If you use the built in backtester, it will fill all 12 of your positions. However, that assumes that you were able to send out 100 limit orders that day, something that isn't realistic. In this situation, you have to use a custom backtest with Amibroker. The custom backtest will rank those 100 buy signals and only select the top 12 that could possibly get hit that day. In reality, you might only get a couple of limit orders hit and just a couple of your 12 positions filled. The custom backtest will also take into account any of the 12 positions that you might have filled already from before. So if you had 4 positions full, it would rank the top 8 buy signals and only use those.

Another answer might be, why don't you just use margin. Say if you had 4X margin, you could work with 48 limit orders instead of just 12. That's a viable solution of course. One thing I would caution about in that situation, if you were running a mean reversion system and there was a serious downturn, you might get 48 positions filled with 36 if them on margin. If the market didn't revert, your losses could be huge. You might want to set something up with your broker where once so many limit orders got filled, you would cancel the rest of them.
 
Interactive Brokers and I assume any other broker, won't allow you to send out more orders than you have funds available. For example, if you were trading with an account of $120,000 and you want to run 12 positions at $10,000 each, IB would stop you after you sent out the 12th limit order at $10,000 even though all 12 orders are not likely to get filled. They wouldn't allow you to send out a 13th limit order.
 
Today post is somewhat outside of trading. I am big believer in sport. It helps to develop mental discipline and focus, builds up perseverance, self esteem, as well as will power.

Basically a great foundation for everything else in life.

To multiply the effects I personally pick something really difficult to achieve, so a lot of patience, repetition and failures will be required to get there.

Doing something extremely hard is certainly not necessary but I do because I am at the age when I can and mental benefits are multiplied. Otherwise - any sport activity is great. If you don't today, try to incorporate it in your life. It is ideal to get to a point when it is no longer optional and just becomes a part of life and routine.

Stay healthy everyone!

Attached one of my random workouts in a park while we were in a lockdown.
PS. I don’t do any weights or go to gyms.

View attachment 239694

Val
I have an exercise room right beside my trading office at home. I installed a 30 minute timer on the light switch for my office that signals me to do a few minutes of exercise before I sit for another 30 minutes. I find that I can work at my computer for hours and hours this way. Otherwise, if I never get up from my office chair, I'm mentally exhausted after a couple of hours. I've read that sitting for hours at a time can be just as unhealthy for you as smoking.
 
The issue with trading multiple positions with a single strategy using limit orders with Amibroker is for example, my system might generate 100 buy signals or limit orders for one day for 12 positions that I have available. Say for example, that morning, 15 out of 100 of those limit orders get hit. If you use the built in backtester, it will fill all 12 of your positions. However, that assumes that you were able to send out 100 limit orders that day, something that isn't realistic. In this situation, you have to use a custom backtest with Amibroker. The custom backtest will rank those 100 buy signals and only select the top 12 that could possibly get hit that day. In reality, you might only get a couple of limit orders hit and just a couple of your 12 positions filled. The custom backtest will also take into account any of the 12 positions that you might have filled already from before. So if you had 4 positions full, it would rank the top 8 buy signals and only use those.

Yes, RT supports it. That's where it shines. It has 2 built in easy to use ranking mechanisms - SetupScore/EntryScore. First controls how many setups from the previous day you will allow, second - up to how many entries you gonna take intraday. In general, it is better to use first one only, because that will make your system predictable, while the second creates a possibility of multiple outcomes. I wrote about this in details in this post. But you might want to define both. I personally try to design systems that don't have much of results deviations due to EntryScore.

Here is an example how you use it. Also checkout my second most favorite features - defining extra strategy or variation of existing one is super easy. Great for running a quick comparison. You can put as many strategies as you like in the same file.

Re using margin - certainly. This a one way to blow up or add extra stress in your life :)
I never use more than x2. Average account use is around 75% so basically mostly cash.

upload_2020-9-20_8-19-51.png


Val
 
Interactive Brokers and I assume any other broker, won't allow you to send out more orders than you have funds available. For example, if you were trading with an account of $120,000 and you want to run 12 positions at $10,000 each, IB would stop you after you sent out the 12th limit order at $10,000 even though all 12 orders are not likely to get filled. They wouldn't allow you to send out a 13th limit order.
I don't think this is correct. IB would certainly allow you you to send 100 buy orders. The orders get filled as long as you have the cash. Once you run out of cash will the remaining orders get blocked by IB.
 
  • Like
Reactions: d08
The custom backtest will rank those 100 buy signals and only select the top 12 that could possibly get hit that day. In reality, you might only get a couple of limit orders hit and just a couple of your 12 positions filled. The custom backtest will also take into account any of the 12 positions that you might have filled already from before. So if you had 4 positions full, it would rank the top 8 buy signals and only use those.

In addition to Val's reply, see also my first reply to you on this topic. The little script that I posted a picture of does exactly what you describe, without requiring any custom code.
 
Status
Not open for further replies.
Back
Top