0%

【Cont.】 How to save your silver bullets with MACD strategy?

At the beginning of this week (2020-Nov-16th), I have launched my script and traded live on the stock market. Again, having a professional habit of a project manager, I’m here to report how the project goes and what has been done.

Project brief and setup

Launch date Go live date Initial portfolio value Cost of time Cost of dollars
2020/09/18 2020/11/16 $42,523.13 (USD) 1. One week of studying
2. One month of research on Quantopian
3. Three weeks of building the framework and trading script
4. One week of QA and dry run
$198.00 for one-year Tiingo data

Result

Take away from QA and dry run

  1. I’ve found out that there’re scenarios that the order placed couldn’t be fulfilled while using the limit order. Therefore, the cash just sitting there doing nothing until triggering another trade, and see we can catch up with another wave. My take here is, since we’re implementing the momentum strategy, meaning the stocks in the list you’re holding should look promising in the short-run. If you’re using the limit order in order to make sure you’re not buying at a higher price, you might miss the chance to stand on the wave and surf. So, I switched to the market order.

  2. While I’m using apscheduler python library to manage the jobs to be run as cron job, I’m generating the buy_list and sell_list to see what stocks need to be traded every day before the market open. These two lists were passed between jobs as a form of parameters, which I found it’s not ideal as the action buy and sell rely on getting proper return values of another isolated job. Therefore I’m thinking of persisting the results so that the other two jobs will always get the data, even it’s outdated.

Just doesn’t seem right to generate public variables and have several jobs to access them without knowing the status of these public variables.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
...
buy_list = []
sell_list = []
...
# job to process data and generates buy and sell lists
__scheduler.add_job(
before_trade,
'cron',
args=[buy_list, sell_list],
day_of_week='mon-fri',
hour=9,
minute=0,
timezone=__est
)
# job to perform buy action according to buy_list
__scheduler.add_job(
trade_create_open,
'cron',
args=[buy_list],
day_of_week='mon-fri',
hour=9,
minute=35,
timezone=__est
)
# job to perform sell action according to sell_list
__scheduler.add_job(
trade_monitor_exit,
'cron',
args=[sell_list],
day_of_week='mon-fri',
hour=9,
minute=30,
timezone=__est
)
...

Summary

I wouldn’t say the project is a success after 5 days of launching only. Anyone who has made their effort in the stock market would know the fact that, you could lose every penny you have earned for a long time in one single trading day. So instead of calling this project case close, I would rather continue reporting how this strategy goes and perform in the market from time to time.

But I have to admit that, it does feel good and satisfied to see the portfolio value went up while doing nothing much in the past week. I have fixed a few tiny bugs in the code, looking for my next target strategy, and watched a couple of movies. Also found out my wife was addicted to an old TV show called 「You’re the Worst」, which talking about the romance (or say drama…) between a British guy and an American woman. I have watched it with my wife for 10 minutes or so and then thinking …, I probably would have watched it with her if I’m 10 years younger than I am now.

Further down the road, I’m thinking of adding more tracking stats in the script so that I can capture more detailed information to analyze the performance, risk, exposures, win rate (hit rate), and alpha later on. Please stay tuned and we’ll see.

Disclaimer: Nothing herein is financial advice or even a recommendation to trade real money. Many platforms exist for simulated trading (paper trading) which can be used for building and developing the strategies discussed. Please use common sense and consult a professional before trading or investing your hard-earned money.

Enjoy reading? Some donations would motivate me to produce more quality content