🔍
How to Create a Trading System on RBOB Gasoline from A to Z (with open-source code) - YouTube
Channel: Unger Academy USA
[0]
Hey hey, good to be back! Welcome everyone, I’m
one of the coaches at Unger Academy, and today
[5]
we're going to be looking at a bias system, namely
a system that exploits the recurring behaviors of
[11]
a certain market, but we're going to talk about
a bias that is a little bit more particular than
[15]
the traditional intraday bias, because today
we're going to analyze an intraweek bias.
[22]
As always before we begin I invite
you to please leave us a Like
[26]
to support our work, to subscribe to our channel,
and go and click on the bell to stay updated
[30]
on the release of all our new content.
And there's lot coming up, so make sure you do that. Thanks so much!
[54]
So I started out using proprietary software from
Unger Academy that lets you examine different
[59]
types of biases. This includes intraday
biases, which means buying from hour to
[64]
hour during the day, weekly biases,
which means buying during the week,
[69]
monthly biases and of course yearly biases. In
our case, we’re going to focus on the weekly bias.
[75]
So, I just looked at the weekly performance
of this future, which is the Nymex-listed
[79]
RBOB Gasoline. This underlying asset
looks pretty explosive and volatile.
[84]
Indeed, it has normally very high
volatility however it also has some
[88]
very interesting features, especially
in terms of this kind of approach.
[93]
In this chart we can see what happens on
average during the week, so from the Sunday
[97]
opening until the Friday closing, buying the
underlying asset at different times of the week.
[102]
After that, this equity is created, which is a
composite of what would happen at any given time
[108]
during the week, so we can track the average
weekly trend of a certain underlying asset.
[113]
What immediately catches my eye is that this
underlying on average, in the different periods
[119]
of historical data considered… Because, as you can
see each of the four lines refers to a different
[124]
historical period… On average this underlying
tends to go down from the Sunday opening
[130]
or shortly after the Sunday opening
throughout the day on Monday.
[134]
After that, the trend on Tuesday seems a
bit confusing, let's say it doesn't seem so
[139]
straightforward, looking at the different periods,
especially the blue line, which takes into account
[144]
all available data. Then, you can see that prices
tend to rise on Wednesday, Thursday, and Friday.
[151]
So, let's say that the idea of the underlying
system that we're trying to develop
[155]
is to try to ride the downtrend with a short
trade on Monday, so after the stock market opens,
[160]
stay flat on Tuesday and look for a long
entry on Wednesday, Thursday, or Friday.
[166]
This is the equity line we get from this system.
[170]
It's certainly interesting and will allow
for other studies to be done as well.
[174]
Now here's the system code. The code is, as
you can see, pretty simple. We can say that
[179]
the basic conditions are simply these two,
namely, we'll have to trade short on Monday,
[185]
while to trade long we'll use condition2, so
the day of the week will have to be equal to 3,
[190]
4, or 5. So we can trade long on
Wednesday, Thursday, or Friday.
[194]
At this point here, I've written basic conditions,
[197]
so I'll operate on neither the first nor the last
session bar to avoid possible backtesting errors.
[203]
Plus, I added the condition of making
only one entry per day to avoid entries
[208]
if stop losses, breakevens, or profit
targets are hit during the same session.
[212]
At this point, I'll use condition1
for a short entry, so on Monday,
[217]
and we'll enter short at the breakout
of a Donchian channel with a stop order.
[222]
Specifically, here I optimized the number of
bars used for the Donchian channel for the short
[228]
and I got the value of 4. And this is something
that does not surprise me. Because let’s we go
[234]
back to the previous chart: as you can see,
the last bars of the week are generally bullish
[239]
and at the beginning of the week
there seems to be a small gap up,
[243]
so if we tried a short entry over a larger
number of bars we might enter very late.
[247]
Also because, as we said, this system
can make short entries only on Monday,
[252]
so the number of four bars was a stable value
and I decided to take it as the final value.
[258]
On the other hand, when I optimized the number of
bars of the long side I got a value of 21 bars,
[263]
which is almost a whole session. In fact the
session lasts 23 bars: we’re using a 60-minute
[269]
chart and the RBOB session goes from 6 p.m. to
5 p.m. the following day, so that's 23 hours.
[275]
So 21 bars was a stable value
very close to a full session,
[279]
so since it gave very good
results, I decided to use it.
[283]
So, the conditions are simply that to enter short
we have to be on Monday plus the basic conditions
[288]
that I described to you earlier. And at this
point, we try to enter on the lowest low of the
[293]
last 4 bars. Whereas for the long side, condition2
applies, so it has to be either Wednesday or
[299]
Thursday or Friday, and we'll put a breakout
order on the highest high of the last 21 bars.
[304]
At this point when the conditions will no
longer be present, we'll exit at the next bar,
[309]
namely the first useful bar. And after
that, we'll also have the conditions to
[313]
manage the position through stop
loss, breakeven, and take profit.
[317]
I optimized the values a bit and
tried to choose the most stable ones
[321]
and the ones that made the most sense to
me, also based on my experience. In the end,
[326]
I chose $1,700 as the stop loss, $1,500 as the
breakeven, and $5,000 as the profit target.
[333]
So, let's go and see the results
of this strategy. I had already
[338]
spoilered the equity line to you a little bit
at the beginning. In any case it's very good,
[342]
it's a rising equity line. Especially
in the last part on the long side.
[346]
Also, because if we take a look at the Buy
and Hold, we can see that there has been
[350]
a surge in gasoline and so this certainly has
favored the long side more than the short side,
[355]
especially in more recent times.
[357]
If we look at the short side, however, especially
if we consider the growth of the Buy and Hold,
[362]
it hasn't suffered too much. It even had
a few recovery attempts given what it
[367]
obviously could do in this
very powerful bullish trend.
[371]
Let's also look at the equity curve with drawdown.
[374]
Considering that this is the RBOB and that
the drawdown remains contained around $20,000,
[379]
we can say that this drawdown is more than
acceptable. Also because the net profit of
[385]
the strategy, which is $534,000 using only
one contract, is certainly pretty good.
[392]
At this point, let’s take a look at the average
trade. The overall average trade is $321.
[399]
The percent win is 48.8%, but I remind you that
although the number of winning trades is higher
[405]
than the number of losing trades, in this case,
we have many trades that end up at breakeven
[410]
because of the rather short breakeven stop.
And these are not counted in the profitable
[415]
trades because they are break-even
trades and not profitable trades.
[420]
Consequently, this 48.8% is also affected by the
fact that there are a fair number of trades closed
[426]
in breakeven, but still, the number of winning
trades is higher than the number of losing trades.
[432]
The average trade of the long
trades only is very good,
[435]
however, we also have to consider the fact that
it can stay in position for up to three days,
[440]
so the trade has time to develop
from Wednesday to Friday.
[444]
Clearly since the long positions can
be much longer than the short ones,
[447]
which can stay open only on Monday, the resulting
average trade will be a little bit higher, as well
[452]
as the number of long trades will be higher
than the number of short trades because there
[456]
will be more days when it can enter, although
the trigger is a little bit more restrictive.
[462]
All in all, the short still works well and
can cope with commissions and slippage.
[466]
And the overall average trade is pretty good, so
you know, I would say keep the system this way.
[472]
Let’s also take a look at the annual period
analysis, which is pretty interesting.
[477]
Here we can see that all the years are
positive. However, you have to consider that
[482]
in a year like 2020, for example, if you had
traded this system, you would have lost money
[487]
because the average trade for that year
would have been $24.87, which is very low,
[493]
and so it wouldn't have protected you from
the impact of slippage and commissions.
[496]
The same is true for 2018, where you most
likely wouldn't have broken even with a $57
[501]
average trade anyway.
[503]
Gasoline is a very volatile underlying.
[507]
When it touches some extreme levels it's likely
to be very explosive in breaks and thus cause
[512]
very high slippage. So, I'd still recommend
that if you work with this underlying asset,
[516]
you shouldn't take particularly low average
trades because they could put you at risk.
[522]
And with that, this video is over! However,
before we say goodbye I'd like to leave you
[527]
with a piece of advice. If you are interested in
learning more about how systematic trading works,
[532]
check out the link you find in the description
of this video. That link will take you to
[536]
a page from where you can access a free
presentation by Andrea Unger, our founder
[541]
and the only 4-time world trading champion.
You'll also be able to order your free copy
[546]
of our best-selling book, "The Unger Method", or
even book a free call with a member of our team.
[551]
If you liked this video please don't forget
to leave us a like, subscribe to our channel
[556]
and go and click on the bell to stay updated on
the release of all our new and upcoming videos.
[562]
Thank you again so much for
watching this video and I
[564]
will see you again in our next video, bye-bye!
Most Recent Videos:
You can go back to the homepage right here: Homepage





