1623683340
Since the market crashed in March of 2020 the rebound has been swift and irrational.
Boeing, for example, is in many ways worse off than it was in March.
It’s clear air travel has plummeted and that airlines will be impacted for
years. Where will airlines get the money to purchase planes?
An example of one headline in April: “Boeing customers cancel staggering 150 Max plane orders”.
One thing I’ve noticed is that since the end of March you can
basically just buy every dip and expect a pop, selling the next day. I
mentioned this to a friend on Friday and decided to backtest it.
Well, sure enough it works!
I’ll mention I made one modification. Originally I wrote the system like so:
1. Check if Boeing is down more than 3% 15 minutes from close
2. If yes, buy with 100% of portfolio
3. The next day, 15 minutes from open liquidate the portfolio.
This worked OK. Great actually! It returned about 25%. But want to know what really kicked it up a notch?
Instead of just selling the next day, I only sell if the position is
sitting at a realized gain. So e.g. if the next day its flat or drops
another 1%, don’t sell it, just keep holding on until its up and THEN
sell. Of course, this is completely insane and you would have to expect
the market to only go up, but that’s what has been happening.
Guess what? This simple system returned a whopping 65% in two-ish months. Yeah, I know, crazy.
Check out the backtest screenshot:
And here are the raw trading logs for those that want to see the dates the trades were made:
Before we look at the code, I’ll just mention here are the details of the backtest:
start with 100k in cash
start at April first and go until last Friday (June 19th 2020)
end up with about 165k or a 65% return.
I wrote this little script on Quant Connect. The screenshot at the
top of the page is the backtest result, and the code below is everything you need to try this out.
Note the place I mentioned in the code you should comment if you want this to be a little bit less insane.
#algorithmic-trading #trading #python #algorithms #trading-algorithms
1623683340
Since the market crashed in March of 2020 the rebound has been swift and irrational.
Boeing, for example, is in many ways worse off than it was in March.
It’s clear air travel has plummeted and that airlines will be impacted for
years. Where will airlines get the money to purchase planes?
An example of one headline in April: “Boeing customers cancel staggering 150 Max plane orders”.
One thing I’ve noticed is that since the end of March you can
basically just buy every dip and expect a pop, selling the next day. I
mentioned this to a friend on Friday and decided to backtest it.
Well, sure enough it works!
I’ll mention I made one modification. Originally I wrote the system like so:
1. Check if Boeing is down more than 3% 15 minutes from close
2. If yes, buy with 100% of portfolio
3. The next day, 15 minutes from open liquidate the portfolio.
This worked OK. Great actually! It returned about 25%. But want to know what really kicked it up a notch?
Instead of just selling the next day, I only sell if the position is
sitting at a realized gain. So e.g. if the next day its flat or drops
another 1%, don’t sell it, just keep holding on until its up and THEN
sell. Of course, this is completely insane and you would have to expect
the market to only go up, but that’s what has been happening.
Guess what? This simple system returned a whopping 65% in two-ish months. Yeah, I know, crazy.
Check out the backtest screenshot:
And here are the raw trading logs for those that want to see the dates the trades were made:
Before we look at the code, I’ll just mention here are the details of the backtest:
start with 100k in cash
start at April first and go until last Friday (June 19th 2020)
end up with about 165k or a 65% return.
I wrote this little script on Quant Connect. The screenshot at the
top of the page is the backtest result, and the code below is everything you need to try this out.
Note the place I mentioned in the code you should comment if you want this to be a little bit less insane.
#algorithmic-trading #trading #python #algorithms #trading-algorithms
1624867080
Algorithm trading backtest and optimization examples.
#algorithms #optimization examples #algorithm trading backtest #algorithm #trading backtest
1624365480
While you’re studying technical indicators, you would definitely come across a list comprising curated indicators that are widely considered as ‘must-know’ indicators that need to be learned by you before getting your hands dirty in the real-world market. The indicator we are going to explore today adds to this list given its performance in the market. It’s none other than the Keltner Channel (KC).
In this article, we will first discuss what the Keltner Channel is all about, and the mathematics behind the indicator. Then, we will proceed to the programming part where we will use Python to build the indicator from scratch, construct a simple trading strategy based on the indicator, backtest the strategy on Intel stocks, and finally, compare the strategy returns with those of the SPY ETF (an ETF particularly designed to track the movements of the S&P 500 market index).
#finance #python #algorithmic trading with the keltner channel in python #algorithmic trading #the keltner channel #algorithmic trading with the keltner channel
1624372980
While having a look at the list of most popular momentum indicators that consists of the Relative Strength Index, and the Stochastic Oscillator, the one we are going to discuss today also joins the list when considering its usage and efficiency in the real world market. It’s none other than the Williams %R.
In this article, we are going to explore what Williams %R is all about, the math behind this indicator, and how a trading strategy based on it can be built with the help of python. As a bonus step, we will compare the returns of our Williams %R strategy returns with the returns of SPY ETF (an ETF specifically designed to track the movement of the S&P 500 Index) to get an idea of how well our strategy performs in the real-world market and can be considered as a step to evaluate the strategy. Considering your curiosity piqued, let’s dive into the article!
#python #algorithmic trading with williams %r in python #algorithmic trading with williams %r #algorithmic trading #williams %r
1593350632
This story explains how to implement the moving average trading algorithm with R. If you’re interested in setting up your automated trading pipeline, you should first read this article. This story is a purely technical guide focusing on programming and statistics, not financial advice.
Throughout this story, we will build an R function which takes historical stock data and arbitrary threshold as…
#programming #statistics #algorithmic-trading #trading #data-science #algorithms