In our new 3 XAvg Crossover System, we’ll call the fastest moving average Avg1, the second fastest moving average Avg2, and the third fastest moving average Avg3. The rules are as follows: 1. Buy when Avg1 crosses over Avg2 AND when Avg2 is greater than Avg3. 2. Sell when Avg1 crosses under Avg2 and Avg2 is less than Avg3. We’ll exit our long positions on the open of the next bar when Avg1 is less than Avg2. Likewise, we’ll exit our short positions on the open of the next bar when Avg1 is greater than Avg2. We’ll also place a trailing stop for the first bar, exiting our long position at the low price minus the 4-bar average of the range. On subsequent bars, the stop price will be the initial stop price plus the value that results from subtracting the stop price from the low and dividing by 4. For the short side, on the first bar, we’ll exit our position at the high price plus the 4-bar average of the range. On subsequent bars, the stop price will be the initial stop price minus the value that results from subtracting the high from the initial stop price and dividing by 4.
Defining your Trading Rules
In this system, we defined both long and short entries as well as exit orders. The long and short entries reverse your position, whereas the exits close out your existing position and exit you from the market. We also performed some setup work, which involved identifying the Inside Day and subsequent breakouts. The setup, entry and exits are described next.
Setup
a) Calculate the three exponential moving averages.
Long Entries
a) When Avg1 crosses over Avg2 and when Avg2 is greater than Avg3, buy on the next bar at the open.
Short Entries
a) When Avg1 crosses under Avg2 and Avg2 is less than Avg3, sell on the next bar at the open.
Exits
a) Exit all long positions on the next bar at the open when Avg1 is less than Avg2.
b) Exit all short positions on the next bar at the open when Avg1 is greater than Avg2.
c) On the first bar of a long position, place a trailing stop that exits at the low minus the 4-bar average of the range. On the first bar of a short position, place a trailing stop that exits at the high plust the 4-bar average of the range.
d) On subsequent bars, place a trailing stop to exit long positions at the original stop price plus the value that results from subtracting the stop price from the low and dividing by 4. We’ll place a trailing stop to exit short positions at the initial stop price minus the value that results from subtracting the high from the initial stop price and dividing by 4.
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the EasyLanguage instructions broken down and explained line by line.//Three Exponential Moving Average Crossover System
Inputs:
Price(Close),
AvgLen1(6),
AvgLen2(12),
AvgLen3(28);
Vars:
Avg1(0),
Avg2(0),
Avg3(0),
MP(0),
StopPrice(0);
Avg1 = XAverage(Price, AvgLen1);
Avg2 = XAverage(Price, AvgLen2);
Avg3 = XAverage(Price, AvgLen3);
MP = MarketPosition;
// ENTRY
If Avg1 Crosses Over Avg2 AND Avg2 > Avg3 then
Buy next bar at Open;
If Avg1 Crosses Under Avg2 AND Avg2 < Avg3 then
Sellshort next bar at Open;
// EXITS
If Avg1 < Avg2 then SELL next bar at Open;
If Avg1 > Avg2 then Buytocover next bar at Open;
If MP = 1 and MP[1] <> 1 then StopPrice = Low - Average(Range,4);
If MP = 1 then Begin
sell ("ExitTradeLong") next bar at StopPrice Stop;
StopPrice = StopPrice + (Low - StopPrice)/4;
End;
If MP = -1 and MP[1] <> -1 then StopPrice = High + Average(Range, 4);
If MP = -1 then Begin
Buytocover ("ExitTradeShort") next bar at StopPrice Stop;
StopPrice = StopPrice - (StopPrice - High)/3;
End;
SetUp
The exponential moving average values are calculated and assigned to variables. This allows for easy reference later, without recalculation of the XAverage function.
Avg1 = XAverage(Price, AvgLen1);
Avg2 = XAverage(Price, AvgLen2);
Avg3 = XAverage(Price, AvgLen3);
Long Entries
A buy order will be triggered on the open of the next bar if Avg1 (fast average) crosses above Avg2 (medium average) and Avg2 is greater than Avg3 (slow average).
Short Entries
A sell order will be triggered on the open of the next bar if Avg1 crosses below Avg2 and Avg2 is less than Avg3.
Exit Orders
If Avg1 is greater than Avg2, nearly the opposite of the first part of the Buy Entry criteria, a long exit will be triggered on the open of the next bar.
If Avg1 is less than Avg2, nearly the opposite of the first part of the sell entry criteria, a short exit will be triggered on the open of the next bar.
The value of the MarketPosition function is assigned to the variable MP so that we can reference previous market position values.
If the current market position is long (1) and the market position on the previous bar was short or flat (-1 or 0), a stop price is calculated by subtracting the average range of four bars from the low. Thus, the stop price is calculated each time the market position becomes long.
If the current market position is long (1) an long exit order is generated on the stop price (StopPrice) calculated above. In addition, this trailing stop is moved up by ¼ of the StopPrice value.
If the current market position is short (-1) and the market position on the previous bar was long or flat (1 or 0), a stop price is calculated by adding the average range of four bars to the high. Thus, the stop price is calculated each time the market position becomes short.
If the current market position is short (-1) an long exit order is generated on the stop price (StopPrice) calculated above. In addition, this trailing stop is moved up by ¼ of the StopPrice value.
The most negative feature of this system’s performance was its dependence on the largest winning trade for the good results. This, of course, is not unusual in a trend-following system, as the whole purpose of this type of system is to capture large profits in a big trend and to minimize losses in periods of choppy market activity. Although having the largest winning trade represent a major portion of the system’s profits is a potential problem (what if the market doesn’t provide an exceptional trend again before our money or patience runs out?), the solution is clearly not to reduce the size of the largest winning trade. The most practical solution is found in portfolio management. Since no one really knows for sure when and where the next explosive trend will occur, most successful trend-followers diversify their portfolios to increase their chances of participation in an exceptional trend. Trading a carefully selected “basket” of stocks and/or commodities rather than limiting your efforts to only one market has the potential to smooth your equity curve and increase your profits.
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:
My Portfolio — How I build my portfolio and how I select systems;
Portfolio Specification — The specifics of each system and some metrics I use;
Portfolio Past Performance — Past performance of the portfolio and systems;
Systems Monthly Performance — The performances of the individual systems;
Portfolio Monthly Performance — The overall performance of the portfolio;
Complications during the month — Complications and problems;
Conclusions…
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.
How do I compose the portfolio?
My portfolio differs in types of strategies, timing, markets and correlations between strategies.
To select which systems to use for the next month, I use tools of my own writing (available free online) to analyze the past performance of all the trading algorithms I own.
To select the best systems I use these filters:
Net Profit
Average trades
Percent Win Trade
Profit Factor
Last two months must be positive
Low Drawdown
Return on Account
If you are interested in my tools or in buying my strategies you can visit the following links:
And now the results of my analyses, I analyze instrument by instrument, finding the best system among them
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: are the markets chosen for each system
Margin required: margins required by the broker to open a position
System name: the selected strategy name
Stop loss system: the monetary stop loss for each single system
A — Max Margin required: 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
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 .
Below are the screens of the past performance of the entire portfolio:
SYSTEMS MONTHLY PERFORMANCE
In this section we see the real performance of the systems in the month that has just ended..
Crude OilSoybeansS&P 500GoldEuro
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 $ 140 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
Month with a slight loss, the systems did not go off the rails.. 🤟
Volatility in the timber market has been a major concern in recent years. Houses in the United States in particular are primarily built using wood as the primary material, making the construction industry extremely sensitive to fluctuations in lumber prices.
To mitigate this volatility and provide support to industry players, the Chicago Mercantile Exchange (CME) has introduced a new lumber futures contract. This new contract is smaller than the previous one, in order to address the excessive volatility that has characterized the market in recent years.
This initiative by the CME has been welcomed by small and medium-sized traders, who have found themselves facing unprecedented instability in the timber market. Introducing a smaller contract gives them the ability to better manage risk and adjust to price fluctuations more efficiently.
However, some concern still remains regarding the measures taken to regulate the timber market. The size of units of measurement used for timber, such as trucks or trains, appear to fall short of common metrics used in other industries. A more conventional approach, using tons or kilograms as the standard unit of measure, could make the market more transparent and understandable for all operators.
Despite these uncertainties, the introduction of the new timber futures contract by the CME represents a major step forward in an effort to stabilize the market and provide greater security for its participants. This tool is expected to provide significant support to traders like us at Grassi alike, who hope to benefit from greater stability and predictability in timber-related trading.
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:
part: My Portfolio — How I build my portfolio and how I select systems;
part: Portfolio Specification — The specifics of each system and some metrics I use;
part: Portfolio Past Performance — Past performance of the portfolio and systems;
part: Systems Monthly Performance — The performances of the individual live systems in the month that has just ended;
part: Portfolio Monthly Performance — The overall performance of the portfolio in the month just ended;
part: Complications during the month — Complications and problems that arose during the month;
part: Conclusions…
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.
How do I compose the portfolio?
My portfolio differs in types of strategies, timing, markets and correlations between strategies.
To select which systems to use for the next month, I use tools of my own writing (available free online) to analyze the past performance of all the trading algorithms I own.
To select the best systems I use these filters:
Net Profit
Average trades
Percent Win Trade
Profit Factor
Last two months must be positive
Low Drawdown
Return on Account
If you are interested in my tools or in buying my strategies you can visit the following links:
And now the results of my analyses, I analyze instrument by instrument, finding the best system among them
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 6 systems .
Below are the screens of the past performance of the entire portfolio:
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
Euro
Australian Dollar
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 $ 1,300 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
As you have seen, this month I suffered a big loss, also thanks to the numerous problems with the platform but above all having overweighted the energy and currency departments, completely excluding the indices, this exposed me a lot in sectors that have not done much this month well while I could have balanced with the climb of the indices. See you next month! 🤟
This process is very important for every trader and should be done by everyone for every underlying that we are going to trade because it allows us to really know what we are dealing with and how to manage it.
The instrument we are going to analyze today is APPLE
VOLUME ANALYSIS
I first analyze the daily volumes via TradingView and Tradestation. I use a 200-period average on the volumes to calculate them. With more analysis we might find some interesting bias with the volume analysis.
Daily volumes..
Intraday volumes..
the volumes are very high, with intraday trading you will have no problems..
PRICE ANALYSIS
The history available starts from 1980
We will notice various trends in the averages that can be exploited to our advantage
RETURNS ANALYSIS
Apple has had an incredible % return in 40 years!
These graph that you will find below are very useful in finding market bias..
SEASONALITY ANALYSIS
Seasonality is a very important part of everything. In this case I used a rolling window seasonality of 90 periods. As you can see through the averages the seasonality also found in the price analysis is reconfirmed
VOLATILITY ANALYSIS
Historical
Let’s see how over the years the general volatility of apple has decreased, with the exception of peaks during the various crises
Returns
Volatility in the middle of the week appears to reach high peaks
Seasonality
We see how volatility alternates between periods of high and low volatility throughout the year
Finished analysis! In the future, I intend to add more information and graphs to my analysis to provide you with further insights and advice. I hope it helps you to better develop your strategies!
Hello everyone and welcome to this short little announcement, I have recently implemented the new shop of my strategies, you can find it at this link
If you don’t know what I’m talking about, I’ll explain it briefly..
I am an algorithmic trader and I develop trading strategies on futures and stocks, I use Tradestation and Multicharts for coding these strategies.
I created the shop to give everyone the opportunity to use my strategies. They are open source so once purchased you can do what you want with them.
Brief guide to the shop
The systems are automatically updated every first day of the month so as to always have and be able to compare new statistics.
This is the first part you will find
In this section you will also find a link where you can download reports of all my strategies and then manually insert them into my analysis tools like Systems Selecor or Portfolio Composer
After that you can select my strategies from this nice drop down menu
Selected the strategy you will see its equity and the drawdown in percentage
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.
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:
Net Profit
Average trades
Percent Win Trade
Profit Factor
Last two months must be positive
Low Drawdown
Return on Account
Once you have selected the best strategies through the software that I mentioned before, I use another software created by me to sift through system by system in more detail, this one of my properties is also free and accessible to everyone.
Both of the software that I have mentioned in this section do a very simple thing, they find or filter the systems that have been performing best in the last period, if you have more than 200 strategies to select like me you cannot do without them! If you are interested here are the links:
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 .
Below are the screens of the past performance of the entire portfolio:
This portfolio in the last 2 months before the end month would bring me a profit of $4.280
As you can see, this system’s wallet made $ 90.000 in 13 years!
SYSTEMS MONTHLY PERFORMANCE
In this section we see the real performance of the systems in the month that has just ended..
Crude OilSoybeansEuroS&P 500Gold
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 + 2,58 % 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
This month I decided to trade 5 systems, on Euro I used 2 contracts to better balance the portfolio, as you have seen I had a lot of misalignments and problems in general this month, the performances would have been even better if I hadn’t made some “discretionary” mistakes “ 🤟
This tool was born from my need to analyze in detail the tools I’m going to trade in the real market in order to find new trading opportunities. Let’s start now..
As soon as it opens, on the left you will find an input where you can enter the tickers of your shares or other instruments that you prefer, the data is taken from yahoo finance, so rely on it
afterwards you will have a slider, the tool automatically downloads all the history available, but you can still select the years as you like
after which you can choose between four sections:
Let’s see them in detail…
PRICE SECTION
It is the first section that appears as soon as you open the tool, the first graph shows the value of the selected underlying
The second chart will show a series of price averages over time, you can choose between two types of normalization:
The last chart will show you each year separately
RETURN SECTION
This part is dedicated to returns, interesting trends and price biases can be found. The first row of the two columns will show you these 2 graphs:
Annual returns and monthly returns, no simple and effective explanation the second line shows us the returns by day of the week and day of the month:
the third line shows the normal distribution, qq plot and box plot with brief explanations
last line KS Test:
SEASONALITY SECTION
This section analyzes the selected underlying and shows you some very useful information about its seasons and cycles. In the left column you can select the type of data normalization and the rolling period
First graph divided in turn into 4 sub-graphs:
price
trend
cyclic
residuals
2 graph the average of seasonality
last chart separate years:
VOLATILITY SECTION
This section is entirely dedicated to volatility, the first graph presented to us is historical volatility:
2 graph the average volatility:
3 annual volatility chart
4, 5, 6, 7 graphs: annual, monthly, weekly and day of the month volatility
8 charts: volatility distribution
9 chart: cycles and trends
10th chart: seasonality of volatility
11th and last chart: separate years
I hope this tool will be useful in your analyses, if you encounter problems do not hesitate to contact me, if you have any questions, doubts or perplexities I am at your disposal just contact me in the links below! Ciao
The first step in applying the Momentum-Retracement System is to determine the trend. We use a moving-average channel and the MACD Indicator to accomplish this task.
The moving-average channel includes exponential moving averages of 15 highs, 15 lows, and 5 closes. The trend is up when the 5-bar exponential average of the closes is above 15-bar exponential average of the highs, or when the 5-bar exponential moving average of the closes is above the 15-bar exponential moving average of the highs more recently than it was below the 15-bar exponential moving average of the lows.
Conversely, the trend is down when 5-bar exponential average of the closes is below the 15-bar exponential average of the lows or when the 5-bar exponential average of the closes was below 15-bar exponential average of the lows more recently than it was above 15-bar exponential average of the highs.
The MACD Indicator must confirm the trend identified by the moving-average channel. We use a 3–10–15 MACD. This means that the MACD line represents the difference between a 3-bar and a 10-bar exponential moving average, and that the signal line of the indicator is a 15-bar exponential moving average of the MACD line. When the signal line is above zero, the trend is up, and when the signal line is below zero, the trend is down.
The second step is to evaluate the market’s momentum. In this system, we use the Relative Strength Index (RSI). RSI compares the relative strength of price gains on bars that close above the previous bar’s close to price losses on bars that close below the previous bar’s close. A
5-bar RSI rising to 70 or higher signifies strong bullish momentum, and the RSI falling to 30 or lower indicates strong bearish momentum.
The third step is to measure the market’s directional movement. In this system, we use the Directional Movement Index (DMI). DMI consists of two lines — the DMIPlus line and the DMIMinus line. These two lines represent the amount of consistent bullish “trendiness” and consistent bearish “trendiness” respectively. We construct an indicator called the DMI Spread by subtracting the DMIMinus line from the DMIPlus line. A DMI spread of +15 or higher indicates a persistent uptrend, and a DMI spread of -15 or lower indicates a persistent downtrend.
The fourth step is to identify a retracement. A retracement refers to a countertrend decline in an uptrend or a countertrend rally in a downtrend. In this system, we specify three conditions that must be met for a qualifying retracement. In an uptrend, the three conditions are: 1) Prices decline into the moving-average channel (in other words, the low of a price bar crosses below the exponential moving average of 15 highs), 2) MACD crosses below the signal line, and 3) RSI declines from above 70 to below 50 or declines by at least 30 RSI points.
In a downtrend, the three conditions are: 1) Prices rally into the moving-average channel (i.e., the high of a price bar crosses above the exponential moving average of 15 lows), 2) MACD crosses above the signal line, and 3) RSI rises from below 30 to above 50 or rises by at least 30 RSI points.
These three conditions for retracements do not have to occur on the same bar. The requirement is that all three conditions occur within 10 bars of the highest high (in an uptrend) or within 10 bars of the lowest low (in a downtrend).
The fifth step is to determine the entry price. After a qualified retracement in an uptrend, we enter a long position when prices rally one third of the way back up between the low of the retracement and the high of the uptrend. For example, if the high of the uptrend is 124, and the low of the retracement is 112, we will set our buy stop at 116 (one third of the way back up).
After a qualified retracement in a downtrend, we enter a short position when prices fall one third of the way back down between the high of the retracement and the low of the downtrend. For example, if the low of the downtrend is 112, and the high of the retracement is 124, we will set our sell stop at 120 (one third of the way back down).
The setup for a buy entry is canceled if the exponential moving average of 5 closes crosses below the exponential moving average of 15 lows or if the signal line of the MACD crosses below zero. The setup to sell short is canceled if exponential moving average of 5 closes crosses above the exponential moving average of 15 highs or if the signal line of the MACD crosses above zero.
The sixth step is to determine our initial protective stop, our breakeven stop, and our trailing stop. For a long position, the initial protective stop is set one 10-bar average true range below our entry price; for a short position, the initial stop is set a 10-bar average true range above our entry price.
We move our stop to breakeven after a closing price that gives us an open profit equal to or greater than the initial risk on the trade. For example, if we bought a stock at $80 and set our initial stop at $77, we would raise our stop to $80 (breakeven) after a close of $83 or higher.
We’ll also place a profit-protect trailing stop. For a long position, we watch two trailing stops and place our profit-protect order at the higher of the two stops. The first stop is swing support to the power of two, which is defined as a price low that has at least two higher lows immediately before it and at least two higher lows immediately after it. The second stop is the exponential moving averages of 15 lows. Remember that we will place our stop at the higher of the two possibilities.
For a short position, we also watch two trailing stops and place our profit-protect order at the lower of the two stops. The first stop is swing resistance to the power of two, which can be defined as a price high that has at least two lower highs immediately before it and after it. The second stop is the exponential moving averages of 15 highs. We will place our stop at the lower of the two alternatives.
The seventh step is the exit. We exit from a long position on the next open when both the signal line of the MACD and the DMI spread fall below zero; we exit from a short position on the next open when both the MACD signal line and the DMI spread rally 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 substantial setup work to calculate the moving average channel, momentum, and DMI. The setup, entries and exits are described next:
Setup
Calculate the 15-bar exponential moving averages of the highs and the lows and the 5-bar exponential moving average of the closing prices.
Calculate a 15-bar exponential average of the MACD (based on 3 and 10 bars).
Calculate the difference between the exponential average of the MACD calculated in b) and the underlying MACD.
Calculate the DMI spread by subtracting the DMI Minus from the DMI Plus, based on a length of 15 bars.
Long Entries
Determine the trend by comparing the exponential moving averages. The trend is up when: the 5-bar exponential average of the closes is above 15-bar exponential average of the highs, or when the 5-bar exponential moving average of the closes is above the 15-bar exponential moving average of the highs more recently than it was below the 15-bar exponential moving average of the lows.
Confirm the trend using the MACD. When the signal line is above zero, the trend is up.
Evaluate the momentum of the market using the RSI Indicator. A 5-bar RSI rising to 70 or higher signifies strong bullish momentum.
Determine the persistence of the trend using the DMI Indicator. We construct an indicator called the DMI Spread by subtracting the DMIMinus line from the DMIPlus line. A DMI spread of +15 or higher indicates a persistent uptrend.
Check for a retracement. In an uptrend, the three conditions are:
Prices decline into the moving-average channel (in other words, the low of a price bar crosses below the exponential moving average of 15 highs),
MACD crosses below the signal line, and
RSI declines from above 70 to below 50 or declines by at least 30 RSI points.
These three conditions for retracements do not have to occur on the same bar. The requirement is that all three conditions occur within 10 bars of the highest high.
Short Entries
Determine the trend by comparing the exponential moving averages. The trend is down when: the 5-bar exponential average of the closes is below the 15-bar exponential average of the lows or when the 5-bar exponential average of the closes was below 15-bar exponential average of the lows more recently than it was above 15-bar exponential average of the highs.
Confirm the trend using the MACD. When the signal line is below zero, the trend is down.
Evaluate the momentum of the market using the RSI Indicator. A 5-bar RSI falling to 30 or lower indicates strong bearish momentum.
Determine the persistence of the trend using the DMI Indicator. We construct an indicator called the DMI Spread by subtracting the DMIMinus line from the DMIPlus line. A DMI spread of -15 or lower indicates a persistent downtrend.
Check for a retracement. In a downtrend, the three conditions are: 1) Prices rally into the moving-average channel (i.e., the high of a price bar crosses above the exponential moving average of 15 lows), 2) MACD crosses above the signal line, and 3) RSI rises from below 30 to above 50 or rises by at least 30 RSI points.
These three conditions for retracements do not have to occur on the same bar. The requirement is that all three conditions occur within 10 bars of thelowest low.
Exit Orders
Place protective stops. For a long position, we’ll set the initial protective stop at our entry price minus the 10-bar average true range; for a short position, we’ll set the initial stop at our entry price plus a 10-bar average true range.
We’ll also place a profit-protect trailing stop:
For a long position, we’ll watch two trailing stops and place our profit-protect order at the higher of the two stops. The first stop is swing support to the power of two, which is defined as a price low that has at least two higher lows immediately before it and at least two higher lows immediately after it. The second stop is one point below the exponential moving averages of 15 lows. We will place our stop at the higher of the two possibilities.
For a short position, the first stop is swing resistance to the power of two, which can be defined as a price high that has at least two lower highs immediately before it and after it. The second stop is one point above the exponential moving averages of 15 highs. We will place our stop at the lower of the two alternatives.
We exit from a long position on the next open when both the signal line of the MACD and the DMI spread fall below zero; we exit from a short position on the next open when both the MACD signal line and the DMI spread rally 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.
Inputs
Following is the list of all the inputs we used in this system:
In addition to these inputs, we define the following variables:
Setup
We begin by calculating the exponential averages. We use the function XAverage to calculate the three averages we will be using.
Then, we calculate the 15-bar expoential average of the MACD line and store the resulting value in the variable MACDSigLine (we’ll refer to this as the MACD signal line). We also subtract this average from the MACD line itself and store this value in MACDDiff (we’ll refer to this differential as the MACD differential. It represents the nearness of the MACD line to its smoothed average). Finally, we calculate the DMI spread and store this in the variable DMISpread.
Once we have the values we need, we can begin our comparisons. As described, we want to check for trend, momentum, directional movement and retracement. First, we look for a trend. We check to make sure that the 5-bar average of the closing prices is greater than the 15-bar average of the high prices and that the MACD signal line is greater than zero. We store the resulting true or false value in the variable TrendUp.
Then, we check the RSI to evaluate momentum. We use the RSI function to check whether or not the RSI (using the closing prices and 5 bars) is greater than or equal to 70, and then make sure the DMI spread is greater than 15. We store the resulting value, true or false, in the variable Momentum.
Long Entries
Once we have performed the comparisons, we check their values. If the trend is up and there is strong bullish movement (RSI >= 70), then we do three things: First, if Fase1 is False, then we set our variables HighestHigh and HighestRSI to zero. This will make sure we capture the current bar’s high and RSI values in these variables. Second, we set the variable Fase1 to True and the variable Fase2 to False. And three, we compare the high of the current bar to the value in HighestHigh. If the high is greater, we store it in HighestHigh. Likewise, we compare the value of the RSI to the value stored in HighestRSI and store the greater value in HighestRSI.
We use the variables Fase1 and Fase2 essentially to keep track of what we consider two distinct phases. The first phase is the up trend and the second phase is the retracement. As soon as we begin the second phase, we consider the first phase over and set Fase1 to False and set Fase2 to True, and vice versa.
Then, we check for a retracement. Four conditions must be true. First, Fase1 must be true, which means the trend is up and there is strong bullish movement, the 5-bar average of closing prices must be less then the 15-bar average of the high prices, the MACD differential must be less than zero, and one of the following must be true: the RSI is at or under 50 or the RSI is less than the HighestRSI minus 30. If they are, then the variable Retracement is set to True.
If there is a retracement then we do three things. First, if Fase2 is False then we set the LowestLow variable to 999999 (this ensures that we will capture the low of the current bar in the variable LowestLow in the next set of instructions). Second, we set the variable Fase2 to True and set the variable Fase1 to False. Third, we set the variable BuySwitch to False.
If Fase2 is True, meaning that there was first an up trend and bullish market momentum and a subsequent retracement, then we perform two actions: first, we check to make sure that the current low is less than the LowestLow. If it is, then we’ll store it in the variable LowestLow. And second, we set the variable BuySwitch to True.
Finally, if BuySwitch is True, which means there was a retracement, and we are currently not in a long position, then we place a buy stop order at the value stored in the variable LowestLow plus a third of the difference between the HighestHigh and LowestLow. This ensures that prices have to rally a third of the way back up between the low of the retracement and the high of the uptrend.
Once we are in a long position, or if 5-bar average of the closing prices is less than the 15-bar average of the low prices or the MACD signal line is less than zero, we will re-set our variables, BuySwitch, Fase1 and Fase2 to False.
The next set of instructions places exit orders. First, we check to see if we are in a long position. If we are not, then we place the exit order at the low of the current bar minus the 10-bar average of the true range. If we are, we place the exit order at the entry price minus the 10-bar average of the true range.
Consider this set of instructions. When we are not in a long position, we place an order to exit a long position. This statement enables us to place an exit for the bar of entry. As soon as we are in a long position, this exit order takes effect.
We also wanted to place a profit-protecting trailing stop. We consider two prices, the low of the swing resistance and the exponential moving averages of the low prices. First we determine when a swing low has occurred and we are in a long position, we use the functions SwingLow and MarketPosition, respectively, to do this. When these two conditions are true, we store the low of the swing bar in the variable ExitPrc. We then use the MinList function to determine which value is lower, the 15-bar exponential moving average of the low prices (LowXMA) or the value stored in ExitPrc. Whichever is lower is stored in the variable ExitPrc. Then, we place a stop order to exit our long position at the price stored in the variable ExitPrc.
Testing & Improving
For simplicity, tests were carried out on various underlyings with the Daily timeframe, nothing prevents you from trying other timeframes and other underlyings, the strategy is complete and at your disposal
Let’s see the results..
Suggestions for Improvement
This system was tested without any optimization. The results could almost certainly be improved by proper optimization. Inputs that could be optimized include the values for the EMA of highs, EMA of lows, EMA of closes, MACD, RSI, and DMI spread. We could also optimize the levels of the RSI and DMI spread (currently 70–30 for RSI and +15, -15 for the DMI spread). The percent of the countertrend move that must be “taken back” by a resumption of the major trend is another candidate for optimization (the percent is currently fixed at 33%).
The system’s stops could also be optimized. The initial protective stop (currently set at one average true range from our entry point) could be optimized for the best value in a range of 1/2 of an ATR to 3 ATRs.
The breakeven stop for this system has a floor equal to or greater than the initial risk. For example, if the risk on a trade was $500, we would move our stop to breakeven when our open profits were equal to (or greater than) $500. The breakeven stop could be optimized for values between 75% of the initial risk and two times the initial risk.
I became interested in trading at the young age of 20. I saw advertisements for a broker that offered €20 if you opened an account with them. At that time, I was proficient with computers and was taking a course on “Analyst Programmer” organized by the local government. Although it turned out to be a disappointment, those months spent in the course improved my computer skills and programming knowledge.
Naturally, I had no idea what trading was or the tools needed to do it, so I started blindly and emotionally (the worst approach). Surprisingly, I made some profit within a couple of weeks, turning €20 into €76, a 380% increase. How did I do it? Honestly, I don’t know! My technique involved following news that I found interesting and using sophisticated fundamental and geopolitical analysis in my head to place orders!
I remember making many trades in the Forex market, and since I didn’t yet understand lot sizes, I guessed my way through. I also traded Italian stocks based on news that came out during those days, but they didn’t satisfy me enough, so I continued with Forex.
EUR/USD and GBP/USD were my last two trades. At that time, I didn’t know what correlation was, so I opened two long positions on both pairs. I don’t remember the news, but there was a piece of bad news that hit the markets and naturally affected the currencies.
I didn’t know what a stop-loss was, so I couldn’t even sell the positions due to the extremely high volatility.
Needless to say, I watched those €76 plummet to €0 within a few minutes, and my positions were immediately closed by the broker. Two weeks went up in smoke!
At the time, I wasn’t employed, so I didn’t have the means to replenish my account (fortunately). I decided to abandon trading until better times and promised myself to understand what I was doing.
Some time passed, but my interest in trading didn’t wane. I frequently researched stocks and companies, followed many YouTube channels that discussed trading (mostly technical analysis), and investments. However, what really ignited my passion was the Covid pandemic.
It’s not a pleasant thing to say, but during that period of isolation and pandemic, I spent a lot of time at home and started reading many books, especially on finance and investments. This completely changed my life and the way I thought.
I began to seriously engage with trading and investments, so I bought my first course from a person who made YouTube videos on technical analysis. At the time, I didn’t realize how useless it was, but I immersed myself in the course and learned the basics of trading, such as platforms, trading tools, and operating methods. The course included various strategies for Forex, stocks, options, and automated trading. Initially, I became passionate about Forex, so I opened a demo account and started applying the strategies taught in the course. It went well for about 3–4 months, so I decided to switch to real trading. Needless to say, it was a disaster.
Emotions dominate in trading, especially discretionary trading, and I hadn’t taken my emotions into account during the demo because it wasn’t real money, so I didn’t care. In real trading, things went poorly, but I managed to get out in time and minimize the losses. I then spent more time studying, bought trading books, and started following other pillars on YouTube until I found what suited me best: systematic trading, also known as automated trading. The course I attended used MetaTrader, a complex platform with a difficult programming language, so I started looking for simpler platforms or programming languages, and that’s when I came across the holy grail of EasyLanguage.