This is a question raised by a friend in the EA BANG forum.
In fact, this function does not need to be made into an indicator, because the existing EA can realize it.
There are two ways to achieve this.
What is the slope of the k-line?
It is a line formed by connecting N consecutive K lines and the closing ends of the two K lines at the head and tail. As shown in the figure:
So can the angle value of this slash be calculated?
When the slope is greater than a value, a long order is placed at a fixed point below the current price. When the price goes down to the position of the pending order, the long order will be filled.
Whether its trading strategy works well, let’s not talk about it first, let’s talk about how to achieve the slope of the k-line?
In the automatic panel – conditional opening and closing – moving average, there is a moving average angle to open a position, you may ask, we are talking about the K line angle, how to use the moving average angle?
In fact, the moving average with a K-line is the K-line. As shown in the figure below, a simple moving average with a call period of 1 is applied to the closing price. It can be seen that the closing price of the moving average and the K-line coincide.
When the mouse is placed at the intersection of the moving average and a certain K line, it can be found that the value of the moving average is the closing value of the K line. Therefore, we only need to set the K line as a moving average to calculate the angle of the moving average.
1.As shown in the figure below, you can open positions at the K-line angle.
How is the value of the angle defined? The default is to calculate the angle from the closing price of the previous 6th K-line to the current price.
2.But the strategy mentioned by this friend may also be another way. It is a K-line that fluctuates up or down by one point, and then places the order. So how to use HedgingEA to achieve it?
Here we will use the automatic panel – conditional opening and closing, the yin and yang inside.
The above picture shows: 8 of the previous 10 K lines are positive lines, and the number of points between the high and low points is greater than the number of points (you can set it yourself in the above picture), and then go to the pending order.
It can be done in two ways.
Finally, let’s talk about the precautions. Angle trading is related to the resolution of our chart and display. If the density of my chart is smaller, its angle may become larger. If the density is larger, its angle will be Possibly smaller.
Load the output time under Experts Advisors to the trading window, we can find that the current symbol has been outputting time, that is to say, every time the price fluctuates, the time is output once.
Of course, the EA can also output the time every second or every interval.
We can understand that EA is continuous execution.
The following figure is a demonstration of the output time of executing the script. Double-click the output time script under Scripts once, we can find that the current symbol has only one time output record, that is to say, the script is executed only once.
So when should we use EA/script?
Under normal circumstances, fully automatic transactions need to run uninterruptedly, which can only be achieved with EA. When the opening conditions are met, the positions are automatically opened, and when the closing conditions are met, the positions are automatically closed. Then the EA has to run all the time, and every time you quote, you can’t miss the opportunity to open or close a position. Scripts generally perform manual one-time functions, such as a one-click full-flat script, which can be fully flattened by double-clicking.
In fact, many EAs include script functions, such as the one-click full closing function in the HedgingEA closing panel, all closing long orders, all closing short orders, and one-click locking.
Many programmers often use script output when debugging code, because it only outputs once, unlike EA’s output all the time.
This is a requirement raised by a friend in the EA State forum before. He has been using our programmatic EA to trade frequently, and the trading strategy is of the order brushing type.
We all know that the transaction speed has a great influence on the strategy of frequent transactions. He usually uses VPS (a server that never shuts down) in Hong Kong and New York. In order to improve the transaction speed, I asked if there is any way to obtain the platform server address. In this case, you can rent a VPS in a city near the platform server. The transaction speed is relatively fast, and you can use this strategy with confidence.
How to get the ip address of the platform provider’s server?
First of all, our trading platform mt4/mt5 can only open one, press Ctrl+Shift+Esc, select Task Manager.
Select Performance and open Resource Monitor;
Find terminal.exe in the network options, this is the mt4 running on our computer.
The address of the server can be found in the TCP connection, as shown in the figure below, the address in the blue box.
Ask Du Niang for a website that can query IP location.
When the specific address of the platform server is queried, you can rent each vps in or around this city.
In the process of using programmatic trading, have you encountered such a situation? The opening position of aEA is better, and the closing position of bEA is better. It would be perfect if these two EAs could be combined together!
Generally, we use 1 EA to open and close positions. If I want to handle opening and closing positions separately, that is to say, one EA program is used for opening positions, another EA program is used for closing positions, and both EAs manage orders.
We use DKX_EA_v2.1 and Hdging _EA_v3.8.8 as examples.
First, load DKX_EA_v2.1 and Hdging _EA_v3.8.8 on two EURUSD windows respectively.
Use DKX EA to open positions, most EA members like to use this EA to open positions, and it is usually quite accurate.
When the white line crosses the yellow line (gold cross), enter a long order, and when the white line crosses the yellow line (silicon cross), enter a short order. As shown in the figure:
As shown in the figure below, when the white line crosses the yellow line (gold cross), enter a long order.
Let’s open the HedgingEA loading window again, click “Profit and Loss Information” in “Information Display”, we can find that the orders placed by DKX EA are not managed by HedgingEA.
Find the configuration file of Hedging EA, open it with WordPad or Notepad, select and paste its magic code, that is, change Hedging’s magic code to be the same as DKX. During this process, make sure that HedgingEA stops running.
Go back to the window for loading HedgingEA again, open the information display and the profit and loss information in it, you can find that the orders placed by DKX EA are managed by HedgingEA.
Now we can make the corresponding closing settings in the Hedging EA.
Summary: By modifying the parameters of the configuration file, the parameters of the two EAs are the same, so that the two EAs can manage each other’s orders.
A user has been using Bang EA’s Hedging EA for multi-variety trading. The functions of EA software are constantly enriched. As time goes by, there are hundreds of EA functions, so just use the conditions of the automatic panel to open and close positions. For example, there are many conditions for the trend category and the shock category. Each condition has a sub-panel with specific settings. There are many functions. For the introduction of specific functions, please visit:https://bangea.com/category/ea-help/
After there are too many functions, there will be a very real problem. Every time a new version of EA is launched, after loading the new version of EA, the parameters have to be re-entered one by one, which is very troublesome, and it is easy to enter the process. Make a mistake, because there are many setting items for a complete strategy, including opening, closing, adding, take profit, stop loss, open position calculation, risk control and so on. Therefore, some friends put forward such a suggestion, whether to increase the parameter function of saving and loading Ea.
Friends who have questions about EA installation can visit the following links:
After a period of research and development, Mr. Tang added this function to the global settings, and the function will be introduced in detail below.
Save and load settings
(1) .Load the Hedging EA on the XAUUSD chart window. After setting the corresponding parameters on the panel, click Global Settings / Save Settings / Settings 1-5. After the parameters are saved, the corresponding button will turn orange. Click the delete button to delete the corresponding configuration file.
(2).If you want to call the same parameters on other symbols, click Global Settings/Load Settings/Settings 1.
2.Configuration file save directory
If you need to use this configuration file in other clients, other symbols, then you can find this file in the following file.
File save location: file/open data folder/mql4/files in the upper left corner of MT4, as shown below, Heding_EA_v3.8.8con1.csv.
3.Another configuration file
Let’s talk about a configuration file saving method, which is different from the above method.
Sometimes the configuration files downloaded in the website forum are of the type shown below.
This configuration file is actually the configuration file currently used by EA. This configuration file can be used after copying it directly to the files folder, and does not need to be loaded separately.
A few more words about this configuration file. After loading the EA, the system will automatically generate a configuration file with the current variety name. If you click the lower panel, the current parameter configuration will be saved without any action. It will be automatically saved once every tens of minutes, as shown in the figure below, Heding_EA_v3.8.8XAUUSD.csv, this is the configuration file currently used by version 3.8.8 of gold.
Therefore, after the configuration file downloaded in the EA State Forum is copied to the files directory, there will be two types. One is to click on the EA panel to load the settings. This file contains con1-5, and the other is the settings that are currently being used by the breed. The file is like the one shown above.
con general type: Copy this file to the file below, and you can find this parameter configuration file in the loading settings of Hedging EA global settings.
Only with the name of the trading symbol: before calling this configuration file, close the mt4 or mt5 software, and then copy the file to the Files, if the file name is repeated, please overwrite it, open the mt4, 5 software, when the EA is reloaded , the EA will automatically call the configuration file we just copied. This is an automatic call. You do not need to click the load settings on the panel. Remember, you must turn off the trading software before copying the file.
How to call the configuration file during backtesting
When backtesting with MT5, you can only use the con-universal configuration file. In the newly generated backtest window, click File/Open Data Folder/MQL5/Files in the upper left corner, and copy the configuration file to this directory.
When using mt4 for backtesting, the configuration file of con-generic type and symbol name needs to be copied to tester/files. As shown below.
5.Restore default settings
When clicking on the “Restore” function, the configuration file with the symbol name is automatically deleted and the current EA is uninstalled.
When loading the EA again, all settings are cleared, just like loading the EA for the first time.
6.The same EA of the same symbol can control the orders separately
This requirement is also related to configuration files, so I think it is necessary to talk about it in this article.
Suppose it is such a demand, the same mt4 client, Hedging3.8.8 version EA, I want to load two European and American varieties, and the cycle is the same, but I want EA to manage the orders on these two European and American varieties respectively.
Normally, I directly load two EAs of version 3.8.8 to the same European and American varieties. At this time, these two EAs will manage the European and American orders, no matter which EA opened the order.
Find Heding_EA_v3.8.8.ex4 in MQL4/Experts, copy and paste it into this directory, that is, there are two identical EAs in the directory, the difference is that the file names are different.
Load these two EAs in two different EURUSD icon windows.
Click the current price short order on the opening panel to place 2 sell orders of 0.01;
Click the current price short order on the opening panel, and place 2 buy orders of 0.01;
As shown in the figure above, click the profit and loss information in the global settings, and you can see that each EA manages its own orders.
During the previous 10 years of simulated trading, a constant trading strategy made steady losses, and in the process, it was strictly executed according to its set trading strategy.
In the future market, the probability of loss is definitely very high, and it may also be a loss.
If we follow the trading strategy in reverse, can we make money by trading?
That is to say, this strategy opens buy orders and closes sell orders, I will open sell orders and close buy orders; if the strategy opens sell orders and close buy orders, I will open buy orders and close sell orders; if this strategy takes profit, I will stop damage.
If you do this in reverse, it is sometimes feasible, but you must pay attention to the following points in the process:
1,The strategy of small take profit and large stop loss is not feasible;
For example, there is such a strategy: I predict that the next EURUSD will have a bullish trend, enter a long order of 0.1 lot at the current price, and increase the position equidistantly by 100 points, the increase multiple is 1, and the order in one direction is 200 points. Take profit , 500 points stop loss;
Use Hedging EA to set the parameters, let’s randomly choose a period of time to test and verify: test time 2012.1.1-2012.1.31
The test results are as follows:
Reverse this strategy: enter the current price with two long and short orders of 0.01 lots each. Both against the trend and the trend are equidistant to increase the position by 100 points.
From the above test results, it can be seen that the forward loss is close to about 1500$, and the reverse copy order earns about 400$. The profit and loss are not proportional, so it is not desirable;
2,The impact of transaction costs, the reverse copy order will lose 2 times the spread. If you don’t understand it, you can understand it by drawing two lines at the top and bottom.
Anyone who has done a transaction should know the transaction cost, that is to say, when a buy order enters the market at the current price, the transaction price is the bid price (the price above), and the current price closes the sell order, and the transaction price is the bid price. The point is to enter a buy or sell order at the current price and close the order immediately, then you will lose a transaction cost.
For example, enter a long order of 1 standard lot at the current price, and the profit will be 200 points.
Reverse copying a sell order, when the buy order is closed with a profit of 200 points, the number of points lost in the sell order = 200 points + 2 times the transaction cost;
It can be seen from the above results that if it is a strategy of frequent trading and reverse copying, the handling fee will defeat you.
Note: This article is transferred from www.eabang.com.
This article is a video recorded by Mr. Tang. For those who don’t like watching videos, you can read the article.
How to automatically take screenshots when EA opens and closes orders?
This function is a request from an EA member. He usually uses programmatic transactions. He has two MT4 accounts on different platforms, and the same EA is hung on the VPS (VPS is a computer that never shuts down). Set After the parameters are good, I don’t care. I log in to the VPS every once in a while to check the situation, but sometimes I find that the transaction price of multiple orders on one platform is not ideal, and the transaction price on the other platform is basically no problem. When negotiating with the platform, I asked why the transaction price was very different from what I set. The platform said it was the problem of EA, because all orders were placed by EA, and the EA provider should be found.
Everyone understands that after the EA is set up, the opening and closing of positions will be executed in strict accordance with the set parameters, which is obviously not the problem of the EA.、
So the member found us and suggested that we add the automatic screenshot function of EA opening and closing orders.
This feature is really a good feature, so we added the “Open and close screenshots” function in the global settings of Hedging EA.
After the EA is downloaded and loaded successfully, you can watch the video I recorded before about EA download and loading, click “Open and close screenshots” in the global settings, a confirmation box will pop up, select “Yes” and the button will turn orange (on ), the default is gray (off).
The picture storage directory of opening and closing positions: Click the file in the upper left corner of the trading software/open data folder/MQL5/Files/under the corresponding trading variety of this EA name directory, the picture includes the opening and closing time, opening and closing price, order position, order number, etc.
Note: No screenshots will be taken when backtesting historical data.
The difference mainly comes from the bar shape in different fixe d periods.
As shown in the figure below, such as the 1-minute chart and the daily chart, many K-lines in the 1-minute chart may have only a small number of TICKs. During the inactive time period of some unpopular varieties, the 1-minute K-line fluctuates several times, while the daily chart The daily fluctuations are not too different.
That is to say, the distribution of ticks in the small-period K-line chart is very uneven.
The above two charts are K-line charts of the same time period.
The upper one is a 1-minute K-line chart, and the lower one is a chart that generates a K-line every 50 ticks.
Sometimes the K-lines of the upper and lower charts are similar, but in the inactive time period, the number of K-lines in the tick chart below is less, and the market is clearer.
If you are trading with an indicator, the indicator will behave differently on the upper and lower charts.
The following two pictures are the enlarged part of the box above, the same rsi indicator, the same time period, the difference is still obvious.
1.Click on the “Buy Open” or the “Sell Open” in the Opening Panel to check whether there is an order filled.If no new order,Please check whether mt4 and mt5 are logged in, and whether “Algo Trading” and “Allow DLL imports” are turned on.EA installation
2.If there is a new order,the not closed orders not managed,Place the mouse on the order to check whether the ID of the executed order is the same as the ID of the order that has not been closed;
3.Check the conditions of the automatic panel ,the settings of the closing panel ,and “ALL conditions close” to see if the closing conditions are established;
This function is used for multiple symbols. After the Overall T/P in the closing panel is triggered, the amount of its profit hedges the loss managed by this EA for the most one order, and how much can be closed;
Pofit>0:The profit of the two hedged orders is greater than 0;