Categories
Uncategorized

Systems Selector! My new tools to find and select your best trading systems!

Well well well well, today I want to introduce you to my 3 tool, essential if like me you have more than 200 trading systems and every month you never know which one to choose!

Welcome to this new article, I am an algorithmic trader and today I will introduce you to my new tool!

Let’s start from the beginning, I had just started with algorithmic trading but I already had a few systems and therefore every month I found myself having to choose among my systems which ones to put live.

For a while I relied on a proprietary program, it wasn’t very performing but it had everything needed to compare systems and above all to be able to upload reports and immediately have the metrics of each system available. Over time I realized that this program didn’t measure some performances very well and there were quite a few discrepancies! So I began my online search for better software that was more accurate and offered me viable alternatives. I have not found it.

( you can find the link to the tool at the bottom of the article ) 

I didn’t understand how many automatic/algorithmic/systematic traders could choose between their strategies without comparing them 2 at a time, I still ask myself this question, I created my own answer and now I make it available to all of you.

I have been using this program for months now and every time I added new things and comparison metrics, now we are at a definitive version.

The tool allows you to load as many systems as you want, otherwise it will do everything on its own.

The first part you will see will be the filtering of your strategy reports, you will be able to choose which data to take from the report and measure each metric on the chosen data, you will have three possibilities:

  • Last 5% of trades made
  • Last 2 months
  • Entire report

This system will allow you to compare all the systems based on the chosen filtering and consider different points of view, personally I first use the last 5% of the trades made to evaluate the systems, and finally I move on to the last 2 months.

Having chosen the criterion that most interests you, let’s get to the important point. You will see a table like this:

This is the list of systems that I have uploaded, as an index you will have the name of the systems uploaded and then a series of metrics, the dataframe is interactive, so you can sort the columns as you like, I prefer the initial configuration which sorts according to the Net Profit

( you can find the link to the tool at the bottom of the article )

Let’s take a closer look at these metrics!

The first 5 columns therefore: Net Profit, Average Trade, % Profit and Profit Factor we know them very well, they need no explanation, they are based on the filtering criterion chosen above so if you choose the last 5% of the trades we will have the Net Profit of the last 5% of the trades for each system, if you choose “Last 2 Months” you will have the Net Profit of the last 2 months.

2 Months Positive is a metric I always look at, if the box is checked it means that the system has made profits in the last two months (excluding the current one).

New Highs last but not least, this simple box reports what it says, i.e. whether the system is making new highs!

Num Trade reports the number of trades made based on the filtering system previously chosen

Finally, Last Trading Day will tell you the date of the last open trade.

Now let’s see the graphics…

Below the table you will see these four graphs:

Naturally they are all interactive, so you can zoom them in and go into more detail, let’s see them one at a time..

Profitability Chart: Profit Factor / % Profit

This chart will show you the systems that have a higher Profit Factor based on % Profit, very useful indeed.

Profitability Chart: Net Profit / Num Trade

No less useful than the previous one we have this graph that will show you the systems that have achieved a higher Net Profit with fewer Trades, very useful for comparing the effectiveness between the various systems.

Max Drawdown / Systems

Here you will have all the Systems sorted by Drawdown, from the one that took the least losses to the one that made the most.

Net Profit / Systems

Last chart, you will get list of all systems in order of Net Profit.

I hope you like this tool and above all it will be useful to you, I created it out of necessity, I adapted it to the values I thought were most appropriate to evaluate automatic trading systems and compare them with each other, if you have any requests or suggestions do not hesitate to contact me, I will do my best to meet your requests!

The completely free tool can be found at this link.

Goodbye and see you in the next article!


Buy my 👉 Trading Systems

Join the 👉 Telegram group

Follow me on 👉 LinkedIn

If you want discounts for the platform I use contact me privately or buy via this 👉 MultiCharts

Categories
Uncategorized

Using the Herrick Payoff Index and Channel Breakout on Close Indicator for Trading Opportunities

The Herrick Payoff Index (HPI) is a complex formula that evaluates changes in price, volume, and open interest. HPI measures the flow of money into and out of a market.

Because its calculation includes open interest, HPI can only be used for futures and not for stocks. Another restriction of the HPI is that it can only be applied to daily data because there is no such thing as intraday or weekly open interest.

HPI can be used to confirm price action. When HPI rallies to a new high along with a new price high, volume (the number of contracts that change hands during a specified time period) and

open interest are confirming the bullish price action, and when HPI falls to a new low along with a new low in price, volume and open interest are confirming the bearish price action.

( I remind you that if you want to download the entire strategy you can find it at the bottom of the article, just join the Telegram channel )

However, when a new price high is accompanied by the failure of HPI to also make a new high, the price action is not confirmed by volume and open interest. A bearish divergence exists between the higher price high and the lower HPI high. Similarly, when a new price low is not matched by a new HPI low, the price action is unconfirmed by volume and open interest, and a condition of bullish divergence exists.

Bullish and bearish divergences are early warning signs of a possible change in trend. HPI confirmation of new price highs and new price lows suggests that the current trend is more likely to continue than to reverse.

Another component of this system is the channel breakout on close. When a market closes above the highest high of a specified number of bars, price action is bullish, and when a market closes below the lowest low of a specified number of bars, the market is bearish.

A system combining the Channel Breakout on Close Indicator and the Herrick Payoff Index should alert us to good trading opportunities. After a bullish setup, we’ll enter long at the high of the setup bar plus one point, and after a bearish setup, we’ll enter short at the low of the setup bar minus one point. The setup remains in effect for five days after the setup bar.

Our initial stop and trailing stop when long will be at the four-day low, and our initial stop and trailing stop when short will be at the four-day high. We’ll exit long positions on the close when HPI crosses below zero and exit short positions on the close when HPI crosses above zero.

Defining your Trading Rules

In this system, we defined both long entries and short entries as well as exit orders. We also did some setup work to calculate the Channel Breakout on Close Indicator and the Herrick Payoff Index, as well as their to compare them. The setup, entries and exits are described next.

Setup

Calculate the HPI values.

Look for confirmation of bearish price action by consistency between the closing price and the HPI. The closing price will be lower than the lowest low of the last 10 bars and the HPI will be lower than the lowest HPI of the last 10 bars. This is our sell setup.

Look for confirmation of bullish price action by consistency between the closing price and the HPI. The closing price will be higher than the highest high of the last 10 bars and the HPI will be higher than the highest HPI of the last 10 bars. This is our buy setup.

Long Entries

After a bullish or buy setup, we’ll enter long at the high of the setup bar plus one point.This setup will remain in effect for five days after the setup bar.

Short Entries

After a bearish or sell setup, we’ll enter short at the low of the setup bar minus one point. This setup will remain in effect for five days after the setup bar.

Exit Orders

Our initial stop and trailing stop when long will be at the 4-day low, and our initial stop and trailing stop when short will be at the 4-day high.

We’ll also exit long positions on the close when HPI crosses below zero and exit short positions on the close when HPI crosses above zero.

Designing & Formatting

This section presents the EasyLanguage instructions and formatting for the system, with the EasyLanguage instructions broken down and explained line by line.

( I remind you that if you want to download the entire strategy you can find it at the bottom of the article, just join the Telegram channel )

Inputs

Following is the list of all the inputs we used in this system:

In addition to these inputs, we define the following variables (notice that our variables CountL

and CountS are initialized to 5):

Vars: HPIVal(0), CountL(5), CountS(5);

Setup

We begin by calculating the HPI value using the HPI function and a contract value of 100 and a smoothing factor of .1. We store the resulting value in the variable HPIVal.

HPIVal = HPI(Mult, Factor);

Then we perform four comparisons and store the results in four different variables, Condition1 through Condition4. First, we check to see if the close of the current bar is greater than the highest high of the last 10 bars. We store the result in Condition1. Then we check to make sure the value in HPIVal is greater than the highest HPIVal value for the last 10 bars and make sure HPIVal is greater than zero. The result is stored in Condition2.

Next we check to see if the close of the current bar is less than the lowest low of the last 10 bars. We store the result in Condition3. And finally, we check to see if HPIVal is less than the lowest HPIVal value for the last 10 bars and make sure HPIVal is less than zero. The result is stored in Condition4.

Condition1 = Close > Highest(High, Length)[1];

Condition2 = HPIVal > Highest(HPIVal, Length)[1] AND HPIVal > 0;

Condition3 = Close < Lowest(Low, Length)[1];

Condition4 = HPIVal < Lowest(HPIVal, Length)[1) AND HPIVal < 0;

We use two counters, CountL and CountS. We increment these with each bar and reset them to 1 each time a buy setup or sell setup occurs, respectively. This way, we can keep a count and use them to keep buy and sell orders active for 5 bars:

CountL = CountL + 1; CountS = CountS + 1;

If the criteria specified in the conditional statements above, as appropriate, are true and the variables CountL or CountS is greater than 5, then CountL or CountS is reset to one. Since the buy or sell setup criteria is true, we want to place buy or sell orders, respectively, therefore, we need to set the counters to 1 so the next set of instructions are carried out.

If Condition1 AND Condition2 AND CountL > 5 thenCountL = 1;

If Condition3 AND Condition4 AND CountS > 5 thenCountS = 1;

Long & Short Entries

If the CountL variable is less than or equal to 5, a buy stop order is generated at the high of the setup bar plus 1 point. If the CountS variable is less than or equal to 5, a sell stop order is generated at the low of the setup bar minus 1 point.

If CountL <= 5 then Buy Next Bar at High[CountL] + 1 Point Stop;

If CountS <= 5 then Sellshort Next Bar at Low[CountS] — 1 Point Stop;

Long & Short Exits

A trailing stop for long positions will be placed at the lowest low of the last four bars. Conversely, we will place a trailing stop to cover our short positions at the highest high of the last four bars.

Sell Next Bar at Lowest(Low, 4) Stop;

Buytocover Next Bar at Highest(High, 4) Stop;

Additionally, the system will generate a long exit on the close of the current bar if the HPI value falls below zero. A short exit on the close of the current bar will be generated if the HPI value rises above zero.

If HPIVal < 0 then Sell this bar on Close;

If HPIVal > 0 then Buytocover this bar on Close;

Testing & Improving

Below I will show you the performance on some underlyings, of course the parameters have been optimized but they are not finished strategies, you will find the whole strategy on my Telegram channel so you can download it for free!

Now it’s your turn! I’ll leave you the complete strategy, let me know what you can do!


Buy my 👉 Trading Systems

Join the 👉 Telegram group

Follow me on 👉 LinkedIn

If you want discounts for the platform I use contact me privately or buy via this 👉 MultiCharts

Categories
Uncategorized

How to choose the parameters to optimize an automatic trading system

If you are also a trader and you develop automatic trading strategies, you absolutely have to ask yourself this question: What parameters do I choose during an optimization?

This question is by no means obvious and if you don’t answer it right it will have catastrophic effects on your systems and especially on your personal account.

In this article we will see how to optimize a trading system with one variable and with two variables.

In this article I use Tradestation, for those unfamiliar with it it is a trading platform that allows you to do automatic trading in a simple and safe way, the same goes for those who use Multicharts, I remind you that the concepts I explain are the same for whatever platform you are using.

Let’s start right away…

OPTIMIZATION WITH 1 PARAMETER

Suppose we have a system with tm Daily that enters long on the S&P 500 when the price exceeds a moving average of variable length and we exit the market after 6 bars (6 days), here is the system in its entirety:

Now we don’t know what length of the moving average to use for better performance, so we’re going to optimize the length of the average.

Well after a good optimization we find this system:

With a net profit of $139,000, an average trade of $335 and a drawdown of $37,000, you’ll say perfect, I’ve created a system, I’ll add a filter to lower the drawdown and that’s it!

Unfortunately this is not the case, let’s take a better look at what our optimization has done…

I optimized my moving average from 5 to 200 bars with steps of 5 and the Tradestation automatically chose the best result that I showed you above, but let’s see all the results:

Let’s zoom in on the part chosen by the optimization and with better parameters:

What you notice? I’m telling you this is called OVERFITTING, meaning too much adapting your system and metrics based on the past!

Do you know what happens if a system is OVERFITTED? YOU WILL LOSE YOUR MONEY

How to understand it? Well the answer is simple when you optimize just 1 parameter: LOOK AROUND

We see that in our case moving 10 bars in length from the selected result something very interesting: The net profit drops drastically and the drawdown increases!

Do you think it is a sign of stability? Well I would say NO!

But let’s see in more detail…

This is a simple chart showing NetProfit in relation to the length of the bars..

Notice the difference in just 10 bars? Moving the indicator 10 bars would have resulted in a $30,000 lower NetProfit and an almost doubled drawdown!

So guys be careful what parameters you select and always look at the surroundings!

OPTIMIZATION WITH 2 PARAMETERS

Let’s continue with the previous system, this time I don’t want to optimize only the length of the moving average but also the duration of the trade (i.e. the exit after tot bars), and therefore I put a new element in input: lenBar, I will optimize it to understand which parameter is the best.

So this time I proceed to optimize the length of the moving average from 5 to 200 with steps of 5 and the length of bars for the exit from 0 to 6 with steps of 1 (I don’t want to stay on the market for more than 6 days)

Let’s see the results and we notice that Tradestation offers us the same inputs I had before, therefore average length 80 and output after 6 bars!

Fine, but now that we have one more input how do we figure out which one is the best and the most stable? If optimizing 1 parameter we used a 2D graph, we just have to use a 3D graph to show 3 parameters! In this case we will have the optimized inputs in X and Y and in Z we will have the NetProfit, unfortunately Tradestation unlike Multicharts does not give us the possibility to do this, so we should do it ourselves.

For a while I used excel, but it was a tedious and graphically unappealing operation, so in the end I decided to write a small python tool and share it with all of you!

Well, by saving the report you can upload it to my site and the tool will do everything automatically.

Let’s see the results of my optimization:

What do you think? I’ll tell you, this system is not stable, the returns of the strategy after a few inputs vary considerably, this means that the system will not withstand long market variations or adverse conditions that arise after its creation, in this case if we choose the values we like the most like these:

But we will have an OVERFITTED system that at the first signs of change or even without signs of change the system will no longer perform and you WILL LOSE MONEY.

SO HOW TO AVOID BUILDING AN OVERFITTED SYSTEM?

The explanation with 1 and 2 parameters is very simple, look at the surroundings, they must be stable and above all the Net Profit must not fluctuate much. Of course there is one thing to say, optimizing a moving average on a daily tm is different from optimizing it on a 5-minute tm, so choose also and above all the optimization steps with criteria, as a too narrow step does not allow it will give a complete but too fragmented vision, while a large step will give us an overall vision but not detailed enough, the secret lies in the middle.

I hope this article has been useful and can help you in building your systems, if you have any questions do not hesitate to write me, I leave you the link to my site again to upload your 2 parameter reports

See you soon!


Join the 👉 Telegram group

Follow me on 👉 LinkedIn

If you want discounts for the platform I use contact me privately or buy via this 👉 MultiCharts

Categories
Uncategorized

FEBRUARY -409$: Monthly portfolio performance of my trading systems

Want to know what my systems do month by month? I will show you the profits and losses that my systems generated in the month just ended!

Before analyzing what happened this month, I’ll explain how this format is structured:

  1. part: My Portfolio — How I build my portfolio and how I select systems;
  2. part: Portfolio Specification — The specifics of each system and some metrics I use;
  3. part: Portfolio Past Performance — Past performance of the portfolio and systems;
  4. part: Systems Monthly Performance — The performances of the individual live systems in the month that has just ended;
  5. part: Portfolio Monthly Performance — The overall performance of the portfolio in the month just ended;
  6. part: Complications during the month — Complications and problems that arose during the month;
  7. part: Conclusions…

Before starting, I’ll link you to my 2 tools that I use to look at the performance of my systems and select the best ones

MY PORTFOLIO

My portfolio consists of different trading systems that I choose every month based on their past performance.

In this article you will find which systems I have used in the last month and how I have selected them. At the end of the article you will find the performances I recorded at the end of the month and the necessary links if you want to purchase my systems that I currently use.

The software in question can be found at this link, it’s free and you can all use it.

And now a succession of images, these are the results of the analyzes with my tool, each image includes a different underlying with the metrics for each strategy..

WHAT IS IT COMPOSED OF?

My portfolio differs in types of strategies, time frames, markets and correlations between strategies.

To select the systems to be used for the next month, I use my own software that reads the past performance of all the systems I have, and through some filters I can identify the systems that have achieved the best performance.

To select the best systems I use these filters:

  1. Net Profit
  2. Average trades
  3. Percent Win Trade
  4. Profit Factor
  5. Last two months must be positive
  6. Low Drawdown

PORTFOLIO SPECIFICATIONS

In this section we look at the types of systems I use and all the values needed to keep the portfolio going. With these values, I evaluate the portfolio’s riskiness and show me in Drawdown phases whether the portfolio is reacting as in the past or it is time to make changes.

Let’s take a closer look at the portfolio:

  • Market column: are the markets chosen for each system
  • Margin required column: are the margins required by the broker to open a position
  • System name column: the selected strategy name
  • Stop loss system: the monetary stop loss for each single system
  • A — Max Margin required: the sum of all the margins required for each strategy
  • B — Max DD Portfolio: the maximum drawdown recorded by the portfolio
  • C — Tot Capital: minimum capital required for the portfolio
  • D — Security Capital: security capital for the portfolio
  • E — % of Drawdown: The maximum historical Drawdown of the portfolio (must not exceed 25%)
  • Once all the data taken from the strategies and the portfolio have been entered, we obtain that in order to use this portfolio we need a minimum capital (see point C) and a capital to be more relaxed (see point D).

PORTFOLIO PAST PERFORMANCE

Here we will analyze the performance of the portfolio that I have extracted based on the criteria and tools listed above.

For the month just ended I chose this portfolio with 5 systems .

These are the performances of the two months preceding the month just ended..

This portfolio in the last 2 months before the end month would bring me a profit of $24,091 (with mini contracts it would be $2,400).

While here you see the performance if you had used this portfolio for 12 years:

As you can see, this system’s wallet made $783,000 in 12 years!

SYSTEMS MONTHLY PERFORMANCE

In this section we see the real performance of the systems in the month that has just ended..

Crude Oil
Soybeans
Nasdaq
Gold

PORTFOLIO MONTHLY PERFORMANCE

In this section you will find the monetary performances for the month ended.

As you can see I have recorded a loss of $ 409 in this month!

COMPLICATIONS DURING THE MONTH

In this section I show you a log taken directly from my worksheet in which I write down day by day if there have been problems or operations to be done that have required my attention.

CONCLUSION

The month of February was quite disappointing, it started underperforming and then recovered in the middle of the month, the last two operations of the system on the Nasdaq brought a drawdown that made me close the month in negative, it could have been worse but even better! 🤟


Buy my 👉 Trading Systems

Join the 👉 Telegram group

Follow me on 👉 LinkedIn

If you want discounts for the platform I use contact me privately or buy via this 👉 MultiCharts

Categories
Uncategorized

Systems performance evaluation: my method to evaluate my trading systems and always choose the best one

If you have written many systems like me you have found yourself in the same situation as me.

I have written about 200 trading systems on different underlyings and every month I find myself having to choose which system to use for the month that has just begun. But how to evaluate the performance of your systems? Which one to choose the best, those that are doing better in the last period and make the most of them?

I started working on it some time ago, initially I used these analyzes only for myself but now I’ve decided to make them public and formalize the birth of my new free and accessible online tool for everyone!

This tool not only allows you to evaluate the performance of your systems but also to give them a general and more parsimonious look, if like me you use Tradestation or Multicharts you will find it fantastic. On the tool page you will find a small guide that will explain you step by step how to use it.

Here’s where you can find it

Let’s get to the point…

1. EQUITY ANALYSIS

First of all, once your system/s have been loaded (you can load as many as you want) the tool will start automatically. The first thing you will find in front of you is the equity line of the system itself, the equity (in green) and you will also have the drawdown as a percentage superimposed.

It is an interactive graph so you can zoom in on parts of it to see every moment of the system in detail

2. PERFORMANCE SUMMARY

Scrolling down you will find in the first column called “METRICS” the general performance of your entire system

Now let’s move on to the highlight…

3. PERFORMANCE METRICS

There are two methods I use to evaluate the performance of a system: the first is to compare the general metrics of the system with the latest metrics recorded by the system, in this case the last 5% of the trades, the second method is to compare the general metrics with metrics from the last two months. In this tool I wanted to include both to have a greater comparison and better choice. Let’s see them together:

I chose these 4 metrics as an evaluation method because in my opinion they are the best for evaluating a system and therefore comparing them over time to evaluate its effectiveness.

From the photo it is clear how to evaluate your system, I personally use the performance of the last two months but I always like to compare it with the last 5% of the system. If, as in this case, the system performs better than in the past, it means that in the last period it has been reacting well to the market and is outperforming its own general parameters. The specific metrics I use are:

1 Metric: Average Trades

2 Metric: Percent Profitable

3 Metric: Profit Factor

4 Metric: Positive last two months

Below the columns I’ve added a points system that gives you the score of the system based on its own column and the above metrics.

This score ranges from –100 to +100, in which case you see that the system in question outperformed the overall system metrics in both cases.

Last but not least you will find a summary in tabular format of the profits / losses month by month for each recorded year.

I hope this tool will help you and if you encounter problems, bugs or have suggestions to tell me let me know!

Thanks for reading.

Categories
Uncategorized

Using the Linear Regression Indicator and Momentum to Identify Trends and Counter-trends

The Linear Regression Indicator plots a line through the prices of a stock or commodity in an attempt to minimize the distance between the line and each individual point. The method used to accomplish this is called the “least squares” method. The indicator is based on the theory that prices are pulled back to the regression line after they stray above it or below it.

The Linear Regression Indicator can also be used to monitor the current trend. If it’s rising the trend is up, and if it’s falling the trend is down. For our Linear Regression and Momentum System, we’ll smooth the linear regression line with an exponential moving average so that the indicator does not switch back and forth between uptrends and downtrends too often.

Momentum, the second indicator in this system, compares the current bar’s closing price with the closing price a specified number of bars in the past. To calculate a 5-bar momentum line, for example, subtract the close of 5 bars ago from the current bar’s close. When the 5-bar Momentum Indicator is above its zero line and rising, the 5-bar price changes are positive and increasing — that is, the trend is bullish and accelerating. If the momentum line turns flat, it implies that the 5-bar price changes are about equal during the Momentum Indicator’s period of sideways movement. When the Momentum Indicator begins to decline from above zero, the market’s gains during the past 5 bars are less than the corresponding gains in the preceding bars — that is, the uptrend is decelerating.

When the 5-bar Momentum Indicator falls below its zero line, the current close is below the close 5 bars ago. As the downtrend gains bearish velocity, momentum accelerates downward from the zero line. An upturn of the indicator in negative territory means that the magnitude of 5-bar price declines is decreasing — that is, the downtrend is decelerating. Momentum is a leading indicator — it levels off while prices are still rising in an uptrend or falling in a downtrend, and it reverses its direction when the trend begins to slow. In this system, we’ll use momentum to identify countertrend declines in an uptrend and countertrend rallies in a downtrend. As mentioned previously, the trend will be determined by the direction of a smoothed linear regression line (i.e., an exponential moving average of linear regression).

To download the whole system just join my Telegram channel

For a buy setup, we’ll require the smoothed linear regression line to be rising and for momentum to be below zero but rising. For a sell setup, we’ll require the smoothed linear regression line to be falling and for momentum to be above zero but falling.

After a buy setup, we’ll calculate the distance between the high of the setup bar and the smoothed linear regression line. Then we’ll add 50% of that distance to the high of the setup bar to determine our long entry price.

After a sell setup, we’ll calculate the distance between the low of the setup bar and the smoothed linear regression line. Then we’ll subtract 50% of that distance from the low of the setup bar to determine our short entry price.

Once we’ve entered a long position, we’ll set our initial protective stop at the low of the setup bar minus 50% of the 10-bar average true range; once we’ve entered a short position, we’ll set our initial protective stop at the high of the setup bar plus 50% of the 10-bar average true range. As the market moves in our favor, we’ll trail a % risk trailing stop.

To exit when we’re in a long position, we’ll watch for the smoothed linear regression line to turn down. Then we’ll place our sell stop at the lowest low of the last 4 bars. When we’re in a short position, we’ll watch for the smoothed linear regression line to turn up. Then we’ll place our buy stop at the highest high of the last 4 bars.

Defining your Trading Rules

In this system, we defined both long entries and short entries as well as exit orders. We also did some setup work to calculate the linear regression line, its smoothed average and momentum. The setup, entries and exits are described next:

Setup

  • Calculate the linear regression line (using the closing prices and a length of 20) and its exponential average (using a length of 15).
  • Calculate the momentum (using the closing prices and a length of 10).

Long Entries

  • For a buy setup, we’ll require the smoothed linear regression line to be rising. In other words, its value on the current bar must be greater than its value on the previous bar. Also, momentum must be below zero but rising (greater on this bar than on the previous bar).
  • After a buy setup, we’ll calculate the distance between the high of the setup bar and the smoothed linear regression line. Then we’ll add 50% of that distance to the high of the setup bar; this is our long entry price. The order remains active for 4 bars.

Short Entries

  • For a sell setup, we’ll require the smoothed linear regression line to be falling. In other words, its value on the current bar must be less than its value on the previous bar. Also, momentum must be greater than zero but falling (less on this bar than on the previous bar).
  • After a sell setup, we’ll calculate the distance between the low of the setup bar and the smoothed linear regression line. Then we’ll subtract 50% of that distance from the low of the setup bar; this is our short entry price. The order remains active for 4 bars.

Exit Orders

  • Once we’ve entered a long position, we’ll set our initial protective stop at the low of the setup bar minus 50% of the 10-bar average true range.
  • Once we’ve entered a short position, we’ll set our initial protective stop at the high of the setup bar plus 50% of the 10-bar average true range.
  • To exit when we’re in a long position, we’ll watch for the smoothed linear regression line to turn down (the value on the current bar is less than it was on the previous bar). Then we’ll place a stop order at the lowest low of the last 4 bars.
  • When we’re in a short position, we’ll watch for the smoothed linear regression line to turn up (the value on the current bar is greater than it was on the previous bar). Then we’ll place a stop order at the highest high of the last 4 bars.

Designing & Formatting

This section presents the EasyLanguage instructions and formatting for the system, with the EasyLanguage instructions broken down and explained line by line.

Input

Following is the list of all the inputs we used in this system:

Setup

First, we calculate the exponential moving average of the linear regression. We use the LinearRegValue function to calculate the linear regression and then use the resulting value as an input for the XAverage function in order to determine the exponential average of the linear regression. We store the resulting value in the XLinReg variable.

We also calculate the momentum using the Momentum function and store the resulting value in the Mom variable.

We use two counters, CountL and CountS. We increment these with each bar and reset them each time a buy setup or sell setup occurs, respectively. This way, we can keep a count and use them to keep buy and sell orders active for 4 bars Next, we make the comparisons between the exponential moving averages and the momentum values. The results of these comparisons are used throughout the system. We compare the exponential moving average of the linear regression line to the same value one bar ago. We also compare the value of the momentum calculation to zero and to the same value one bar ago.

First, we check to see if the current value of the exponential average is greater than the value one bar ago. If it is, the variable Condition1 is set to True. Next, we check to see if the momentum value is less than zero and greater than the same value one bar ago. If it is, Condition2 is set to True. After that, we check to see if the exponential average is less than it was one bar ago. If it is, Condition3 is set to True. And finally, we check to see if the momentum value is greater than zero and less than the same value one bar ago. If it is, Condition4 is set to True.

Long Entries

Next, we check to see if Condition1 and Condition2 are true. If they are, and they became true either on the previous bar or more than 4 bars ago, then the high price is stored in the variable SetBarL and the CountL variable, which accumulates the number of bars since the setup, is set to 1.

If the number of bars since Condition1 and Condition2 became true is less than 4, then we place a buy order at a certain percentage above the value stored in SetBarL. We calculate the percentage by subtracting the value of the exponential moving average from the value in SetBarL and multiplying that by the specified percentage (default of .5). We add this to the value in SetBarL and that is our entry price. Notice that we specified a certain number of shares to buy using the NumUnits function. This function is described in detail in the section at the end of this chapter, titled, “Investing a Fixed Dollar Amount.”

Short Entries

Next, we check to see if Condition3 and Condition4 are true. If they are, and they became true either on the previous bar or more than 4 bars ago, then the low price is stored in the variable SetBarS and the CountS variable, which accumulates the number of bars since the setup, is set to 1.

If the number of bars since Condition3 and Condition4 became true is less than 4, then we place a sell order at a certain percentage below the value stored in SetBarS. We calculate the percentage by subtracting the value of the exponential moving average from the value in SetBarS and multiplying that by the specified percentage (default of .5). We subtract this from the value in SetBarS and that is our entry price. 

Long & Short Exits

We will exit any long position at or below the value that results when you subtract a percentage (as specified by the input Pcnt) of the 10-bar average of the true range from the low of the buy setup bar.

Conversely, we will exit the short position at or above the value that results when you add a percentage (as specified by the input Pcnt) of the 10-bar average of the true range to the high of the sell setup bar.

Finally, we will place a trailing stop for long positions at the lowest low of the last four bars. Conversely, we will place a trailing stop to cover our short positions at the highest high of the last four bars.

General System Format

When we apply a system to a chart, we normally use the options in the Format dialog box to format costs, stops, and properties. However, in this system we did not enter an amount for slippage and commission although those costs must certainly be taken into account before a system is traded.

Note: Remember that Commissions are calculated on a per contract/share basis. When you are trading stocks, you would enter the average commission you are charged divided by the number of shares the system is buying and selling.

Testing & Improving

I want to be honest, I haven’t tested this system properly, I used some underlyings with different timeframes, I remind you that you can download the entire system from my Telegram channel, here are the results:


Categories
Uncategorized

17 Trading System with just one move!

Many of you will think it’s a joke or something, but what can come from a simple thought? Well in this case from a simple thought I managed to write 17 systems starting from a simple and stupid idea, this idea made me write systems on a multitude of underlyings. Do you know how long it took me? 2 months!

2 months may seem like a long time but if you write 17 systems plus you work on other projects, work and do algorithmic trading it’s not bad at all!

THE IDEA

The idea was very simple: if you follow my articles you will know that I don’t write strategies starting from indicators but rather from the instrument I am going to trade, as you well know there are two different macro-categories: Mean Reverting and Breakout/Trend Follow and so I thought “How do I spot a movie without breakout or mean reverting?”

The answer came to me as usual in the shower, and it was very simple: “USE THE CROSSING OF TWO MOVING AVERAGES” it seems a very trivial thing but from what you will see you will change your mind!

DEVELOPMENT

Developing this idea was very simple, especially if you program in Easylenguage or PowerLenguage, for the Breakout/Trend Follow part here is the very simple code:

While the Mean Reverting part:

As for the long and short side of the Trend Follow / Breakout part, it is simple if the fast average crosses the slow fast average from bottom to top then we will have a bullish signal, for the short instead our fast average must cross from ‘up to down the slow average, in this case we will have a bearish signal.

For the Mean Reverting conditions we will have the exact opposite: we will go long if the fast average crosses the slow average from bottom to top, we will go short if the fast average crosses the slow average from top to bottom.

And then a simple condition that checks me if I’m not in the market and that I haven’t made 0 trades:

Then I put it all together to enter the market:

As for the output, for this kind of project I prefer an output after a certain number of bars, this allows me to measure the intensity and strength of each instrument in a different way:

THE SUBSTANCE

Our system is finished, but is it really a system? Well not really particularly because I haven’t added a Stop Loss (remember that if you don’t add stop losses to your systems you will end up in the abyss very soon), actually these types of systems I call them “ ENGINES “ this type of system allows me to check if my idea can be used and above all that it is profitable on the market.

And So?

So I use these engines to test each underlying I use, I’ll give you an example: if I know that crude oil has a purely Breakout/Trend Follow nature I won’t go to use the Mean Reverting conditions but rather I will do the opposite!

From the study of this engine I will get some data and if I evaluate them profitable well I will create the real system based on my engine!

Thanks to this simple engine I created 17 systems, I finished writing them all in 2 months as you can see in this screen:

PERFORMANCE

As I said I created these systems between 10/22 and 11/22, they have now been Out Of Sample for almost 4 months, let’s see how they performed!

Due to time and space problems, I will only show you the equity, if you want more information, don’t hesitate to contact me, you have all the links at the end of the article.

CONCLUSIONS

I tried to put as many different tools, as you can see the systems in the last 4 months have held up very well and some have even had new highs. This makes us understand a very important thing: “It is not the indicator that makes the system but the instrument that I want to trade that does it”

I hope this article has been useful to you and I remind you that if you want to buy my systems just contact me!

To the next article. 🤘


Categories
Uncategorized

JANUARY +894$: Monthly portfolio performance of my trading systems

Want to know what my systems do month by month? I will show you the profits and losses that my systems generated in the month just ended!

If you missed last month’s article, here is the link 

Before analyzing what happened this month, I’ll explain how this format is structured:

1 part: My Portfolio — How I build my portfolio and how I select systems;

2 part: Portfolio Specification — Which systems have I selected for the month that has just ended;

3 part: Portfolio Past Performance — Past performance of the portfolio and systems;

4 part: Systems Monthly Performance — The performances of the individual live systems in the month that has just ended;

5 part: Portfolio Monthly Performance — The overall performance of the portfolio in the month just ended;

6 part: Complications during the month — Complications and problems that arose during the month;

7 part: Conclusions…

1. MY PORTFOLIO

My portfolio is made up of different trading systems that I choose each month based on their past performance.

In this article you will find which systems I have used in the last month and how I have selected them. At the end of the article you will find the performances I recorded at the end of the month and the necessary links if you want to buy my systems that I currently use.

WHAT IS IT COMPOSED OF?

My portfolio differs in strategies, timeframes and markets.

I use different strategies on different markets to better diversify portfolio performance, I don’t use more than two systems on a market and I balance the weights of each strategy, to find out more, do not hesitate to write to me.

To select the systems to use for the next month, I use a software that reads the past performance of all the systems I have, and through some filters it selects the systems that have performed best.

To select the best systems I use these filters:

  1. Best performance of the last 2 months
  2. Only one system per market eg: 1 for energy sectors, 1 for indices and 1 for metals
  3. Less wallet withdrawal
  4. Stability and returns

2. PORTFOLIO SPECIFICATIONS

In this section, we analyze the types of systems I use, and all the values needed to keep the portfolio standing.

Let’s take a closer look at the portfolio:

Market column: are the markets chosen for each system

Margin required column: are the margins required by the broker to open a position

System name column: the selected strategy name

Stop loss system: the monetary stop loss for each single system

A — Max Margin required: the sum of all the margins required for each strategy

B — Max DD Portfolio: the maximum drawdown recorded by the portfolio

C — Tot Capital: minimum capital required for the portfolio

D — Security Capital: security capital for the portfolio

E — % of Drawdown: The maximum historical drawdown of the portfolio (must not exceed 25%)

Once all the data taken from the strategies and the portfolio have been entered, we obtain that in order to use this portfolio we need a minimum capital (see point C) and a capital to be more relaxed (see point D).

3. PORTFOLIO PAST PERFORMANCE

Here we are going to analyze the performance of the best portfolio I have extracted based on the criteria listed above

Here is the portfolio I chose based on the last two months before 

For January I chose the selected portfolio with 5 trading systems.

The portfolio performance of the two months prior to January is as follows:

I have selected this type of portfolio because in the last 2 months it has brought me a profit of $ 25,000 (with mini contracts it would be $ 2,500).

While here you see the performance if I had used this portfolio for 12 years:

As you can see, this system’s portfolio has earned $ 778,000 in 12 years!

4. SYSTEMS MONTHLY PERFORMANCE

In this section we see the real performance of the systems in the month that has just ended..

Crude Oil
Soybeans
Gold
Nasdaq
Euro

5. PORTFOLIO MONTHLY PERFORMANCE

In this section you will find the monetary performances for the month ended.

As you can see I have recorded a win of $ 894 in this month!

6. COMPLICATIONS DURING THE MONTH

In this section I show you a log taken directly from my worksheet in which I write down day by day if there have been problems or operations to be done that have required my attention.

7. CONCLUSION

This month went very well, systems performed very well, misalignments mostly due to strategy/platform errors, I am correcting them right now. 🤟

Categories
Uncategorized

The best markets to trade

Where and how to start? It may seem like a trivial question, but I can assure you that especially beginners may have several doubts before starting this trading activity.

In this article we will try to clarify things a bit.

Let’s see the first question that many ask themselves.

Often the first question is about the platform, not so much intended as which platform to use, but rather whether to trade via a simulated platform or a real platform.

Starting from a simulated platform we have the possibility of trading with fake money. So basically we have no risk and we can approach this first step with greater peace of mind.

On the other hand, of course, there is certainly a certain imprecision in the orders executed. Because a simulated platform can’t actually know if that order you are going to place would have been delivered and filled by the market.

Moreover, even with regard to slippage we will have completely unrealistic values. Often then these platforms have bugs in the functioning. They are not updated as frequently as the real platforms so there may be some technical problems that in reality you would not encounter.

And above all, the simulated trading experience is very different from a live experience, especially from an emotional point of view. By not really risking capital, the whole psychological aspect, therefore fear, greed, insecurity, are missing and therefore we inevitably speak of an experience that is different.

And this is why I believe that choosing a real platform is the optimal choice to start systematic trading, because it gives us the most realistic picture possible.

So a single problem arises: how to minimize the economic risk, because at the time of departure, the ideal would be to start live but risk little.

This allows us to approach systematic trading as truly as possible, while putting a small amount of capital at risk.

How can this result be achieved? Choosing the right markets.

Let’s see together what are the characteristics that these markets must have that make them particularly attractive to start systematic trading.

1) Surely they must have good liquidity. This is a general requirement, starting trading in an illiquid market is highly inadvisable.

2) The other feature is that they have low entry barriers, so they must actually allow you to trade with modest capital. And this can basically be achieved in two ways: through financial leverage or through a high granularity of the market itself.

  • Through financial leverage, it is possible to trade on instruments with a capital lower than the notional that would be necessary to invest the sum covered by the contract.
  • High granularity, on the other hand, allows us to go to tools that actually have a low cost, such as an action for example. A share can typically cost from $5 to $500, so we’re talking about capital within everyone’s reach.

What are these markets? Let’s see them together..

As I said, shares, CFDs which are basically derivatives that are contracted directly with the reference broker.

Micro futures, which are the new ones, which allow you to replicate operations on a larger contract, such as the Mini S&P for example, but with 1/10 of the notional.

So effectively this barrier to entry has been lowered which allows many traders to start with low capital.

Definitely Forex, which has very high liquidity and high granularity.

And then the cryptocurrency market, which from a certain point of view is very similar to Forex.

So let’s analyze the characteristics of these different markets in more detail, with a focus on liquidity and their financial leverage.

Let’s start with the shares, in the graph we see that the shares can be considered a definitely liquid instrument (remaining within the main lists such as the Nasdaq and S&P). We will have highly liquid underlyings, but which typically offer low leverage but which however have a low cost and therefore allow trading with low capital.

CFD

Then there are CFDs, Contracts for difference, they can differ from broker to broker. They generally have good leverage, so you can move much more than your capital.

But on the cash scale you placed them at a much lower value than stocks. This is also not true in general. There are brokers like Interactive Brokers who also offer good liquidity on these instruments.

But the negative aspect is that often some brokers who are a bit crafty in phases of high volatility and tend to widen the spreads.

MicroFuture

Moving on to the next tool, we have microfutures, which we can place between these two different asset classes, let’s say. We certainly have good liquidity. Some microfutures are highly liquid like the Micro on the Mini S&P 500. Others a little less like the one on gold. So, averaging the liquidity of these instruments we can say that they still have good liquidity and offer good leverage.

As a negative aspect, the commission aspect can be highlighted, because obviously the commission impact on these instruments is certainly greater than in trading on larger futures.

Forex

Finally we have Forex. From the graph, Forex would certainly seem like the ideal market from which to start. Because? Because it has very high liquidity. It is one of the most liquid markets in the world.

However, I would like to remind everyone that it is not a market with official quotations, so also in this case the broker you are using is absolutely important.

The choice of broker is absolutely important because even in this case, as with CFDs, there may be less reliable minor brokers who do not represent you true prices or who keep excessively wide spreads.

At the same time, in addition to having very good liquidity, it also has a high financial leverage and therefore this allows you to trade with little capital.

It also has very high granularity, so from that point of view it would be the ideal market.

If I had to choose two markets to recommend for starting and systematic trading, I would choose the cryptocurrency market or I would switch to microfutures. Both of these markets, in my opinion, are optimal for starting systematic trading by risking low capital.

Categories
Uncategorized

ChatGPT and Algorithmic Trading


The images, codes and conversations made with this artificial intelligence created by OpenAI have caused a sensation in recent times, I don’t want to go into the details of this company but let’s get straight to the point, a few days ago I thought to myself hey I could get him to write a strategy in EasyLanguage from scratch? Let’s see what happened..

First I asked him if he knew this programming language, here is the answer

Then I asked him if he could actually code me a strategy and he immediately started throwing me this strategy…

So I decided to copy this beautiful code in the Tradestation editor and put this strategy to the test, however there was a small error in the code in the construction of the moving averages, and above all the short entry was wrong as sell is not used but Sellshort, so I asked him to correct these two mistakes, judge for yourself the answer…

I was blown away by this response! The AI understood what I said, understood where the mistakes were and corrected them flawlessly! I couldn’t believe my eyes and when she did I was truly amazed!

Beyond those two errors, the AI wrote the code in an impeccable and above all comprehensive manner, without using strange variables and giving random names to the moving averages, these are a sign of great efficiency and good training.

The strategy he proposed to me is based on a simple crossing of exponential moving averages and the market entry signal is given precisely by this crossing, a very simple and effective strategy, however one thing is missing and also important: the exit

By now amazed by this thing, I asked him to insert a Stop Loss and Take Profit

From what you’ve seen, I don’t quite understand what he did or why he used this incorrect syntax, but that’s it! I told him that he was wrong and how he should fix the code..

I’d say it was flawless, don’t you think?

Well this gentlemen is a trading strategy codified with an AI, I would never put it online as it is but the goal has been achieved! I must say that I did not expect such a thing and above all that he was able to keep the “thread of speech” so well and interpret my correction messages.

In my opinion this is a new way of approaching the world and the difficulties it entails, these days I have used ChatGPT not only to test codes in EasyLenguage but it has helped me a lot with Python codes, some problems on my spreadsheet and setting up a VPS, I honestly didn’t expect it to be so powerful.

Naturally as far as I’m concerned and for my field it can be very useful on some occasions, it can help a novice person to approach the world of systematic trading as it explains well every step it takes and does it clearly, I tried a few things in Python and I have to say it’s even more formidable there.

However, I want to remind you that strategy is not everything, the choice of parameters, exits, position management, performance control parameters, data analysis, the type of underlying chosen, the choice of systems, the choice of wallets, the complexity of a system itself are quite another thing that go far beyond knowing how to write code.

So?

It’s early days but this is a good start!

What if I didn’t write all this?