Niv Goren Profile picture
Aug 21, 2023 17 tweets 4 min read Read on X
No Code Backtesting in Excel. Long guide.

Following recent discussion started by @TheShortBear regarding backtesting OHLC daily data -

Here are Exact formula’s, locates + fees & optimization to backtest your strategy (google sheets link at the end) 👇
Contrary to what many traders believe, OHLC data is enough to find an edge shorting small caps.

And today with Spikeet and excel - you can actually do it in under 10 minutes without coding skills.
First, some caveats for this method:

1. Intraday halts above your stop loss aren't reflected in OHLC data.

2. Unrealistic locates fees.

3. Serious overfitting risks - keep it simple
Missing intraday alpha.
But even with this disadvantages, it’s probably better than guessing based on your biased memory.

So here is a step by step guide:
1. Take a template you are interested in using @_spikeet. In this example I chose the small cap gappers. Image
2. Download the data to excel.

3. Choose a universe based on behavior. This will help you a lot in the optimization process.

Different universe = different behavior!
4. For this example, I will take all listed stocks under 500m market cap and more than $1 price that gapped more than 20% and PM volume more than 50k. That last one will save you from most of the un-tradable ones.
5. Add stop loss column. For this example I will use a 20% stop loss from open Image
6. In a new column - calculate the amount of shares to take.

For this example I will risk $100 per trade [100 / (SL - Open)] Image
7. Calculate your gross PNL. If high of day is above stop loss cover at stop loss, else - cover at the close. Image
8. Reduce fees.

I use 0.002 per share but you can use anything that is realistic for you. Image
9. Reduce locates.

There’s no exact science for this. I use a random function between 0 and 10% of my PNL.

Use whatever you see fit based on experience. Image
10. Now, insert a PNL chart:
11. Now the fun part that makes the strategy profitable.

Sort by different columns and see where the edge is by watching the PNL curve. I will optimize based on gap% and price:
You can clearly see that anything below $2.5 doesn’t really work.

Optimize based on gap%:
You can see that anything above 80% gap is getting parabolic!

So we got a strategy that:

1. Shorts the open if gap above 80% and price above $2.5

2. Cover at stop loss (20% from entry) or end of day. Image
Here is a google sheet with all the formulas:

docs.google.com/spreadsheets/d…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Niv Goren

Niv Goren Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @hackertrader

May 25, 2022
1/6
Looking for black & white rules for @Qullamaggie's breakout strategy?

I systemised his trading strategy based on what he published online, and backtested it on data since 2007.
Here are the exact rules you can use to get the same results:
2/6
The basic of the strategy is simple - buy the breakout. But of course god is in the details. The Rules:

☑️It starts with a pivot break out. A pivot is defined as the highest high among 3 candles on the
left and 3 candles on the right. Buy next open.
3/6
☑️ The stock market should be bullish. The specific stock should be bullish (definitions in the blog post below)
☑️Stop loss below the minimum between the last 3 candles
☑️Trailing stop below latest pivot low
☑️ Average Daily Range (ADR) > 5
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(