December 13, 2017

Do you have a plan for your screw ups?

You should have a plan for when you screw things up because I can guarantee it will happen. This is the screw up I did last night and how I handled it this morning. Enjoy this unplanned post.

 

The Nightly Ritual

Each night for 250 days of the year, I do the following for my trading.

Step 1: In the early evening, log into InteractiveBrokers, get the executions for the day, update my current positions and P&L spreadsheet. This is all done with a push of a couple of buttons. Last, push button in Excel that starts code that waits for data to be updated for the day and then runs my scans in AmiBroker and imports results into Excel. Time to do 2 minutes

Step 2: Walk away from computer for a couple of hours while it waits for data update and AmiBroker to run my scans.

Step 3: Review new trades to make sure nothing looks odd, push button to create basket file for orders, place the orders in InteravtiveBrokers. Time to do 2 minutes.

Step 4: Before going to sleep, try and remember if went down to my office that evening. If I can’t remember going down, then make sure orders were placed.

 

For 248 days of the year this works just great. But last night was a different night then normal. I had done steps 1 & 2. I then went to a birthday party. Then after that I had to get my son at a school event. When we got home, my son and I had to do something on my computer. Now this is the time I would have normally done step 3. But I did not because we had to then go up to his computer. Whoops, the start of the mistake. Then when I went to sleep, I thought yeah I had been down to the office so all was good.

On most days, I am in my office before the market opens. But of course, not today. Today, I get in 30 minutes after the market opens and then I see my spreadsheet open on my computer. First thought is “OH SHIT!” I forgot to place the orders. I log into IB and verify that the orders had not been placed.

The Plan

When this happens, my plan is to place all the orders. Now this is the key point of my plan for me. I simply place market orders. I do not try and play games by trying split the bid-ask price or anything else. I have learned from experience that trying to suddenly become a day trading, I will make things worse.

Prevention

One thiing I do when a mistake happens is what can I do to prevent it happening in the future.  Right now each night at 6:30 I have a simple program run that brings up a dialog to remind me to place the trades. Because of this mistake, I have added code to the program. Now if the dialog is still up at 9pm, it sends me an email/text to remind me to place my trades.

Final Thoughts

Does it suck making these stupid mistakes. Yes, it does. I have a process in place to minimize them. This mistake only happens once or twice a year and I know exactly what to do when it happens. I get mad briefly, take a breath and then execute my orders. Am I still mad? No. I more amused and thinking what can I do to make this less likely to happen. And if happens again, I have my plan to deal with my mistake. What is yours?

Good quant trading,

Click Here to Leave a Comment Below

Jim - December 13, 2017 Reply

Wouldn’t your life be simplified if you only traded Rydex or Profunds (open ended no load mutual funds) at end of day?

    Cesar Alvarez - December 13, 2017 Reply

    Not sure how that would make life easier. I still need to remember to place orders. But more importantly for me, I don’t have any strategies that trade those. I trade stocks and ETFs.

Carlos Mata - December 13, 2017 Reply

My setup is similar, but I’m in the middle East, so my scans run at 1-2am while I’m asleep. I get an email at 2am Qatar time, which my dad receives in Houston at around 5pm. He puts his orders that evening and if he has a problem he tells me. After I wake up, on my way to work, I check if he had any trouble, and then push my orders and send him a message. He then checks the message when he wakes up in Houston. A few hours later.

Some days there’s 2 orders. Other days there can be 20 orders to push to IB (limit, market, stop), so I made a software that compares the positions and orders from my trading system (what I ‘should have’) vs the positions and orders in the broker (what I actually have) then I press a button to reconcile both, to make sure the broker matches my trading system. If there is any mistake, like forgetting to push orders one day, the software should sort it out by doing market orders, to ensure a match.

It took longer to build this infrastructure than to develop the trading system but it has made it possible to execute the strategies. It’s a lot easier to have discipline of you just need 5 minutes per day to execute the system than if you have to spend 30-60 minutes putting orders by hand and double checking everything, etc.

I’m tracking my performance against the simulation (I run a full backtest every day) and using FundSeeder. Very nice service. Do you use it also??

    Cesar Alvarez - December 13, 2017 Reply

    It sounds like you have a good process in place. I do not use FundSeeder. I do my own tracking internally in comparing simulation vs actual.

Akshay - December 14, 2017 Reply

Hi Cesar
Great post. I would be very interested in understanding your whole process in more detail. Since I am also trying to automate things like you have done for my eod trading. Would be great if you share more details of the processes in a blog post.

Regards
Akshay

    Cesar Alvarez - December 14, 2017 Reply

    I am not sure that there is really that much more to add. Getting into more details would mostly apply to what I trade vs being general. Also, if I were to be starting from scratch today, I would do things differently. The tools and my knowledge have changed a lot in the last decade.

Bing - December 15, 2017 Reply

Hi Cesar,

Great post as usual.

Would you be able to elaborate on the process you use to import your trades from TWS into your spreadsheet and then reconcile with the orders that you submitted.

At the moment, if I submit an order to buy 500 IWM shares and TWS executes the order for the full 500 shares. If TWS executed the order in tiny chunks, the trade list report down to the chunk level and so the trade list might show 3 separate fills like BUY 100 IWM, Buy 150 IWM and Buy 250 IWM. This makes it difficult for my code to reconcile the trades that took place vs the actual order that I submitted because the quantities are different.

What I really need is an SQL group by capability within Excel itself to reconsolidate the TWS trade list quantities so that they match the order quantities.

I would imagine that this is something your code would need to take care of if you are to automate the checking of orders vs trades ??

    Cesar Alvarez - December 16, 2017 Reply

    I have the same issue about a single trade being spread out over several executions, this happens when I use a TWAP order. Part of the process when I import the executions into Excel is to combine all the executions down to one trade which is the avg price of the executions and total commissions. I do this using VBA code.

Kirk Dolan - December 9, 2021 Reply

Cesar, Thanks for the great post. I was fascinated to see to what degree you have automated the process, and enjoy reading the details. Most people, including myself, have made far more than 2-3 mistakes in preparing and executing the trades, so congratulations for being so consistent!

    Cesar Alvarez - December 9, 2021 Reply

    Oh, I have made lots of mistakes throughout the years. I now manage to keep it to 2-3 per year. Which is still 2-3 too many.

Leave a Reply: