Hi,👋 we have updated the app and fixed multiple bugs. We are lacking funds, request to free user not to use Adblock. Ads are non intrusive. 😊

✨ Visual Editor

close

palette Canvas & Background

Gradient:arrow_forward
Text Color:
135°

style Card Style

40px
16px

text_fields Typography

16px
Quant Science
@quantscience_
How to make a simple algorithmic trading strategy with a 472% return using Python.

A thread. 🧵
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
This strategy takes advantage of "flow effects", which is how certain points in time influence the value of an asset.

This strategy uses a simple temporal shift to determine when trades should exit relative to their entry for monthly boundary conditions.
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
The signals for when to go short, when to cover shorts, when to go long, and when to close longs are all linked to these recurring monthly cycles.

This periodic "flow" of signals—month-in, month-out—creates a systematic pattern.
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
1. Load the libraries and data

Import these libraries. Then run the code to ingest price data on TLT.
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
2. Generate Signals

We'll first set up an empty data frame to track the long/short signals.

Then we create short entry signals on each new month's 1st and 5th day.

Similarly, we make long signals 7 days and 1 day before the end of each month.
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
3. Run this code to get the Trade PnL

Use vbt.Portfolio.from_signals().
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
Use pf.stats() to return the portfolio stats summary tear sheet.
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
🚨Want to learn Algorithmic Trading Strategies (that actually work)?

On June 25th, we are hosting a free workshop to help you get started with algorithmic trading with Python.

Register here (500 seats): learn.quantscience.io/join
03:56 PM · Jun 15, 2026
Thread image
Quant Science
@quantscience_
That's a wrap! Over the next 24 days, I'm sharing my top 24 algorithmic trading concepts to help you get started.

If you enjoyed this thread:

1. Follow me @quantscience_ for more of these
2. RT the tweet below to share this thread with your audience
03:56 PM · Jun 15, 2026
Quant Science
@quantscience_
P.S. - Want Algorithmic Trading with Python tutorials every Sunday?

Register here to join our Sunday Quant Scientist Newsletter (it's free): learn.quantscience.io/quant-scientis…
04:30 PM · Jun 15, 2026
Generated by Thread Navigator
100%
view_carousel Carousel Studio NEW
Press ⌘ + S to quick-export