How to apply good indicators to ea

Part I: Indicators

In order to make money instead of losing money, both professional dealers and individuals are studying and summarizing various laws and making indicators. We often find that some indicator graphs look perfect, so we think of trading according to the changes of indicators.
But will it make money?
Whether we can make money depends on whether these indicators cheat. That is to determine whether the indicator has the calculation of future function, that is, whether the indicator will be changed according to the current K line, and then the indicator will be marked on the historical K line for change. For example, the original tip to sell was changed to buy. (horrible). (of course, there are also some special links of ea that will affect the profitability, so I won't talk about it here.)
There are two ways to determine whether there is a future function:
1. White box verification (i.e. check the source code)
Looking directly at the loop part of the source code, if you have the behavior of modifying the historical curve array, you can immediately determine that there is a future function.
2. Black box observation
When there is no source code, the indicator can be loaded onto the 1-minute graph line to continuously observe the change of its mark, especially the change of the historical K-line mark closest to the current K-line status. If there is a change in the history of the current function, it can also change

Things to be confirmed before EA indicators
If an index contains a future function, the index is meaningless. That is to say, before we change the indicator to EA, we must confirm that this indicator does not contain future functions, so that the indicator EA is meaningful.

The second part is ea index

The next step is to EA indicators
In EA, the current K line output value of this indicator is read through the function icustom, and the current status is obtained to decide whether to enter or close and reverse admission.

Specific usage of icustom:
Indicators are generally either curves or arrows. It's easy to understand that both curves and arrows are arrays.
For indicators, each curve or arrow is written in the array corresponding to each k line, that is, a curve corresponds to an array, and an arrow in a direction corresponds to an array (the array value with arrow is the current price, and the array value without arrow is "empty")
The help of icustom MT4 says, "calculate the specified customer indicator and return its value", that is, this function allows you to obtain the calculated value on the K line corresponding to the array of specified indicators.
The details are as follows:
double iCustom(string symbol, int timeframe, string name, ..., int mode, int shift)
Calculates the specified customer metric and returns its value. Must be in terminal_ Write customer indicators in the directory / experts / indicators directory.
Symbol - the name of the currency pair on the calculation indicator data. Null indicates the current currency pair
Timeframe - time period. Any value can be enumerated by time period. 0 represents the time period of the current chart

Ame - the program name of the complete customer index
... - parameter settings (if required). The parameters passed and their order must correspond to the description command and the type of external variable of the customer metric.
Mode - index row. Setindexbuffer function from 0 to 7 and must correspond to one of the indexes used

Shift - the index of the value taken from the display buffer (before transferring a specific number of periods relative to the current column)
Double Val = icustom (null, 0, "example ind", 13,1,0);

Double va2 = icustom (null, 0, "example ind", 13,0,1);

For example, if two curves are drawn for an indicator, the value of the first curve corresponding to this indicator on the 4th K line can be obtained by using icustom.

Now we can get the state value of any k line of a given indicator according to our own ideas. So the next step is to start the concept of EA.
Because EA only controls the actions under the current price status. Therefore, in general, we take the calculated value of the specified index under the current K line for the condition judgment of EA.
If you think that the current K-line is not over and its value is always changing, and there may be signals and no signals, then you can take the indicator value of the previous K line as the basis. (if the current K-line index value is used as the condition, there will be uncertain results, but if the previous K-line value is used as the condition, there will be the problem of "missing the best entrance point". It's a matter for programmers to weigh.)
Another problem is how to judge whether the output value of the indicator is consistent with the signal we see with the naked eye.
If the reference indicator is a color change line, it must be a color and an array of ways to display. When we take the values, we only need to look at the values of arrays of different colors and compare them to know which color the results are, and act as the condition of EA.
If it is an arrow, it is the same way to get its value. The value corresponding to the indicator on the K line without arrow is "empty", and the value corresponding to the array where there is an arrow is definitely not empty. Use this to determine if there is a signal.
For example, for a two-color line, two arrays must display different colors. When the indicator thinks that one of the colors should be displayed, the value of the array corresponding to this color in the current K line is set as the current price. Otherwise, it is set to "empty". After this cycle, what you see with your naked eye is the color line
Now we can easily get the current signal status of the indicator!
The next step is to combine into EA, which is to take the array values in the indicators

The third part is ea programming logic
EA is a cyclical process. Run every price.
EA is a computer. You don't know your current position and indicators. You don't know anything except calculation. Everything is given by the programmer. Therefore, the programmer's mind must establish a comprehensive state concept.
At the beginning of EA, we must check the position condition first. The general logic is as follows:
1. Find out the position and the direction of the warehouse receipt.
2. Then get the value of the index.
3. Judge and operate
Position status: according to the direction of the warehouse receipt to determine whether the reverse signal occurs. If it happens, close the position and reverse the entrance. If it doesn't happen, return directly and wait for the next price.
Empty: then the signals in both directions will be judged, and the direction will be used to enter.
4. Other details
Whether entering or leaving the stage, we should judge whether the judgment is correctly carried out immediately after sending out the action. If the execution is not successful, you must immediately abandon the later operation and return directly. Wait for the next price to come and send the same action here.
In addition, the data is automatically updated.

    Was this article helpful?

    0 out of 0 found this helpful