Analytical methods using trend lines
summary
Trendlines are a simple analytical technique for understanding market direction in the stock and currency markets. Trendlines are lines connecting market lows and highs that help us visually understand uptrends (rising prices) and downtrends (falling prices).
The use of trendlines allows one to understand the direction of the market and to make appropriate decisions on investment timing. Trendlines can also be used as a reference for determining stop-loss and profit-taking points.
problem
Subjective judgment
When trend lines are drawn manually, personal subjectivity is inevitable. Different investors may have different angles and positions of the line, as well as which points should be connected. As a result, the trend may be judged differently even for the same stock or time period.
This is greatly affected by the experience and skill of the investor. A beginner may not always be able to draw trend lines with the same accuracy as an experienced investor.
effort
Each time market conditions change, trendlines must be re-established or adjusted. This can increase the burden on the investor.
As the number of stocks to be analyzed increases, the effort increases dramatically, and it becomes difficult to continuously maintain and perform analysis based on the same criteria.
Dealing with Problems
Tool utilization is the best option for structuring and automating.
An indicator has been developed to automatically draw and continuously update trend lines.
Indicator developed
impression
Feature
The following trend lines are automatically generated
- Resistance line (long term)
- Resistance Line (Short-term)
- Support Line (Long-term)
- Support Line (Short-term)
These lines are automatically recalculated and redrawn when the bar is updated and the waveform changes.
Since the latest lines are always drawn based on certain criteria, there is no room for subjectivity, and since the lines are automatically updated, there is no need for time-consuming operations.
Calculation Method
The general idea is to find the intercept and slope of the linear regression line using the rate information of the mountains and valleys (combination of multiple vertices), and then to calculate the error between the line and the vertices as coefficient of determination (R-squared) The coefficient of determination (R-squared) is then used to calculate the error between the line and the vertex,
By devising additional filter conditions, the lines that are considered to work best as resistance and support lines are drawn as final candidates.
environment
- MT5 (Indicator)
How to use
Trend Following Strategy
The strategy is to use trend lines to detect strong market trends and position according to those trends. When an uptrend line is formed, a buy position (long) is taken; when a downtrend line is formed, a sell position (short) is taken.
breakout strategy
The strategy is based on the assumption that when a trend line is broken, a new trend begins. Once a breakout of a trendline is confirmed, a position is taken according to the direction of the breakout.
Support and Resistance Strategies
Trend lines are used as support (lower support) and resistance (upper resistance) lines. We buy when price approaches the support line and sell when price approaches the resistance line. If the price breaks through the support/resistance line, we take a position in the direction of the breakout as in the breakout strategy.
Integration into EA
Lines are drawn on the chart, but the core of the process is the automatic calculation of the line's intercept and slope.
Based on the results of this calculation, the above investment strategy could be added to one of the automated trading rules.
digression
I want to use ALGLIB but can't.
In the search for an efficient way to implement linear regression analysis and coefficient of determination calculations in the MQL5 language, the first standard library to incorporate ALGLIB which is built in as a standard library, but we finally abandoned its use.
I started to use it without examining the background carefully, and the implementation itself was easy, but when I finished the development and was checking various things, I found the following notation in the source code...
//| This file is free software; you can redistribute it and/or |
//| modify it under the terms of the GNU General Public License as |
//| published by the Free Software Foundation (www.fsf.org); either |
//| version 2 of the License, or (at your option) any later version. |
//| |
//| This program is distributed in the hope that it will be useful, |
//| but WITHOUT ANY WARRANTY; without even the implied warranty of |
//| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
//| GNU General Public License for more details. |
//+------------------------------------------------------------------+
The MQL5 version of
ALGLIB has been found to need to be treated as a GPL v2 license.
Since it is built in as if it were a standard library (this library is included in the initial installation), I did not check it beforehand, but I was naive...
What is GPL(v2)?
GPL V2 (GNU General Public License version 2) is an open source software license for free use, modification, and redistribution of programs. The license gives others the right to share, modify, and redistribute the software while retaining the author's copyright. the main feature of GPL V2 is a condition called "copyleft," which requires modified versions that are redistributed to also be released under the GPL V2 license. This ensures that modified software is always open source. Translated with http://www.DeepL.com/Translator (free version)
Programs developed under the GPL license must also disclose all source code of copyrighted works as they benefit from open source.
Since the leakage of source code can also lead to the leakage of intellectual property, we would like to avoid source code disclosure as much as possible, so if you distribute the application as your own commercial application, please use the following
Use of GPL-licensed libraries must be avoided.
What is Copyleft?
Copyright ensures that the author has exclusive rights to the work, while copyleft is a strategy to ensure that the work can be freely used, modified, and redistributed using copyright law.
Right" originally means "right," but the synonym "copyleft" is intuitive and easy to understand.
ALGLIB also has a commercial license, but the MQL5 version is GPL v2 only
In practice ALGLIB.net to inquire whether it is possible to purchase a commercial license and avoid copyleft in this case.
To summarize...
- There are two versions of ALGLIB: a copyleft version and a commercial license version.
- ALGLIB manages licenses for each development language
- ALGLIB (MQL5) is provided under GPL v2 only.
- This is due to the fact that, although they discussed the terms of providing the library to MQL5, they could not reach an agreement on the application of a commercial license.
- Only the copyleft version is still available in MQL5.
- This is due to the fact that, although they discussed the terms of providing the library to MQL5, they could not reach an agreement on the application of a commercial license.
- Only the copyleft version is still available in MQL5.
- Since the MQL5 version of ALGLIB was written by MQL5 developers, ALGLIB.net is not in a position to make changes to these license terms and conditions
- If you want to use ALGLIB commercially, you have to buy the C++ version of the commercial linecess and make your own wrapper for MQL5
He said.
There was a complicated background... Since I did not have the strength or skills to create my own from MQL5 wrappers, I decided to seek another means.
Utilize MQL5 functions for matrix calculations
MQL5 provides functions to perform matrix calculations.
Internally it seems to be just an array of type double, numpy and therefore, users who are familiar with python will find it much easier to use.
Since there was a wealth of knowledge on how to use numpy to derive the intercept and slope of a linear regression line, we decided to implement a linear regression analysis on MQL5 based on this.
Matrix functions are provided only in MQL5
Official Documentation I read in the official documentation that it can be used only with MQL5 (= not with MQL4). (If you know more details, please comment)
I think this is another advantage of using MQL5 (=MT5) (complex data processing can be easily implemented = easy to develop quality tools).
summary
This indicator is available free of charge for those who use the automated trading tool Helios in their real accounts.
We hope you will find this information useful in judging the market environment. Once you are contacted by the service desk, we will provide you with a set of indicators, support documents, etc.
*If you wish to use only the indicator, please contact us individually.
Structuring and automation are essential for smart and efficient investment.
We will continue to compile ideas that may be useful in analyzing the market environment and deliver them to you as tools that you can use immediately.
【Notice】New EA Selene has been released!
See the following article for an overview of HF copying and how to use it. Free EAs are available for HFM (Premium account) or XM (Standard account). Please click the link below to open an account. *Depending on conditions, low spread accounts may be available. The following screen will open. Please fill in the required information and contact us. After you click the "Submit" button, you will receive the following auto-reply e-mail to the e-mail address you entered. If you already have a VPS environment, you can use it as is. Domestic brokerage firms are at risk of additional fees, and MT5 is not available at most brokerage firms. Only foreign brokerage firms are subject to the zero-cut system, which allows you to take no more risk than the amount of your deposit.This will be the case. and many other benefits. When using MT5, please consider opening an account at an overseas brokerage firm at the same time. As a benefit to those who use the EA in their real accounts, we offer the use of our originally developed indicator free of charge. With automated trading tools, the trading itself can be done continuously by the program according to the rules, but it is the role of humans to determine which EAs to start/stop and when to stop them. Since analysis of the market environment is sometimes necessary, we encourage you to use these free indicators to help you realize solid investments.EA is available free of charge!
Usage 1: Trade without the need for a VPS using HF Copy
Usage Method 2: Prepare a VPS and deploy EA
Step 1. Create an MT5 account
Please contact us for details. Step 2. Application to use automated trading tools
If you do not receive it, there is a possibility that you typed the address incorrectly or it was sent to your spam mail.
If you have checked your spam mail and still have not received it, please reconfirm your e-mail address and contact us again. 
Step 3. Sign up for a VPS
There are several ways to create a new VPS environment, but if you are not comfortable with building your own VPS (it seems difficult or you do not know how to manage it), we recommend that you use a VPS service. If you want to use MT5, I recommend an overseas brokerage firm!
However, this does not mean that any brokerage firm will do.
by choosing a major international brokerage firm, Special offers available for EA users only!





HFM is running an event where you can win great prizes if you reach a target trading volume set according to your trading volume!
The event is open until 30/08/2024! Enter as soon as possible!














