Categories
Uncategorized

How I created 4 automatic strategies starting from a study: Crude Oil Futures case

I started my study by calculating the cumulative returns for each trading hour of the Futures on Crude Oil, so I used a 15-year history and a 60-minute TimeFrame based on the Exchange schedule.

I started my study by calculating the cumulative returns for each trading hour of the Futures on Crude Oil, so I used a 15-year history and a 60-minute TimeFrame based on the Exchange schedule.

I wrote a simple strategy that enters at the beginning of the bar and exits when it closes, then I extracted the data and loaded it on the data analysis software I use.

Here are the results:

As can be seen in the screen, there is a strong bearish bias that begins in the late afternoon and ends in the early hours of the next day; as well as a rise in prices from late morning to late afternoon.

As a timeframe for this system I decided to use the 15 minutes and as the second timeframe one at 480 minutes to better filter the results in the next phase.

So I started writing this simple bias: Short from 19:00 to 12:00, long from 12:00 to 19:00

Here is the code:

Results:

Now I start optimizing time entries and exits for the long and short side.

Long side:

Entry Time
Exit Time

Short side

Entry Time
Exit Time

Here are the performances:

Since it is an Intraday system I have decided not to keep the positions open on the weekend, so I have put a condition that I let me out on Friday afternoon before the close of the markets …

these are the results of optimizing the Friday exit time..

Here are the results of the system:

Once all the time exits have been added, it’s time to add a stoploss, for my custom I always use a monetary stoploss.

Once added I optimize the stop loss value, in the end I chose a stoploss of: $ 2300, these are the results:

The basic system is now complete but the performances are not satisfying me yet, so I decide to apply my market patterns.

As a first test I decide to use my patterns, below they have already been selected, condition 0 I do not apply any pattern, condition 1 I apply the patterns on the timeframe at 15 minutes, conditions 2, 3, 4 I apply the patterns at the timeframe at 480m.

Here are the pattern performances:

Since there were still too many trades I decide to use a volatility filter based on the Average True Range on data2 (480 min). That is to say:

AvgTrueRange (last bar) <AvgTrueRange (number of bars to be optimized)

= Market compression

AvgTrueRange (last bar)> AvgTrueRange (number of bars to be optimized)

= Market expansion

Now is the time to optimize our volatility filter for all 4 market patterns I have selected to create our strategies:

PATTERN 1

For this pattern, the market compression was found to be effective, here are the parameters I chose based also on their stability in optimization. In this example, the first column indicates the length of the AvgTrueRange.

long
short

PATTERN 2

For this pattern the compression was found to be better only for the short side, for the long side I opted for a market expansion.

long
short

PATTERN 3

Also for this pattern, the market compression was very positive for the system.

long
short

PATTERN 4

Finally, also for this pattern, the market compression was very positive for the system.

long
short

Finite systems! Thanks to the simple analysis of the underlying in question, I started from a very simple Bias engine idea and then created 4 different profitable systems in a few hours!

Below are the performances of the 4 systems in the portfolio, portfolio equity blue line, other single systems lines.