Indicator Emissions
Indicator Emissions
Introduction
Certainly, many traders and developers of trading strategies are interested in these questions:
Finding the answers for these questions led me to creation of a new approach to the market research: construction and
analysis of indicator emissions. To make it clearer, take a look at the following figures:
It shows the emission from different indicators, but the principle of their construction is the same. More and more points with
different color and shape appear after the each tick. They form numerous clusters in the forms of nebulae, clouds, tracks,
lines, arcs, etc. These shapes can help to detect the invisible springs and forces that affect the movement of market prices.
The research and analysis of these emissions are something like chiromancy.
Emission and its Properties
The emission is a set of points, located at the intersection points of specific lines of the indicator.
The properties of emissions haven't been still clear yet, they are still waiting for the researchers. Here is a list of known
properties:
We need an Expert Advisor to create emission points. It's better to use the MQL5 Wizard to create an Expert Advisor template.
Fig. 4. Creating an Expert Advisor template using MQL5 Wizard.
//+------------------------------------------------------------------+
//| Emission of Bands && MA.mq5 |
//| Copyright DC2008 |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "DC2008"
#property link "http://www.mql5.com"
#property version "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return ( 0 );
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit( const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
First, we need some auxiliary plottings. We need to continue indicator lines using rays (Fig. 5.). It will allow to control the
correctness of calculation and visualization of emission points. Later, we will remove these lines from the chart.
Fig. 5. Auxiliary plottings. Continuation of the indicator's lines using rays.
Thus, let's add the graphic objects (horizontal and trend lines) to the code of our Expert Advisor.
Since the emission continues to the past and to the future, the trend line properties should be following:
As a result, the chart with additional lines will look as presented in Fig. 6.
The preparatory phase is completed, now let's proceed to the emission. We are going to create the first series of points at the
intersection of the following lines:
between the "MA" (iMA) line and "BH" line (iBands = UPPER_BAND);
between the "MA" (iMA) line and "BL" line (iBands = LOWER_BAND);
between the "MA" (iMA) line and "BM" line (iBands = BASE_BAND).
Fig. 6. Auxiliary plottings. Continuation of the indicator's lines using straight lines.
Now it's time to calculate the coordinates of intersection and to draw the points of the emission. Let's create the function:
void Draw_Point(
string P_name, // Object name (OBJ_ARROW)
double P_y1, // Y-coordinate of the 1st line at the [1] bar
double P_y0, // Y-coordinate of the 1st line at the [0] bar
double P_yy1, // Y-coordinate of the 2nd line at the [1] bar
double P_yy0, // Y-coordinate of the 2nd line at the [0] bar
char P_code1, // Char at the right side of the [0] bar
char P_code2, // Char at the left side of the [0] bar
color P_color1, // Color of point at the right side of the [0] bar
color P_color2 // color of point at the left side of the [0] bar
)
{
double P,X;
datetime P_time;
if ( MathAbs ((P_yy0-P_yy1)-(P_y0-P_y1))> 0 )
{
P=P_y1+(P_y0-P_y1)*(P_y1-P_yy1)/((P_yy0-P_yy1)-(P_y0-P_y1));
X=(P_y1-P_yy1)/((P_yy0-P_yy1)-(P_y0-P_y1));
if (X>draw_period)
{
P_time=T[ 0 ]+( int )(X* PeriodSeconds ());
ObjectCreate ( 0 ,P_name, OBJ_ARROW, 0 , 0 , 0 );
ObjectSetDouble ( 0 ,P_name, OBJPROP_PRICE ,P);
ObjectSetInteger ( 0 ,P_name, OBJPROP_TIME ,P_time);
ObjectSetInteger ( 0 ,P_name, OBJPROP_WIDTH , 0 );
ObjectSetInteger ( 0 ,P_name, OBJPROP_ARROWCODE ,P_code1);
ObjectSetInteger ( 0 ,P_name, OBJPROP_COLOR ,P_color1);
if (X< 0 )
{
ObjectSetInteger ( 0 ,P_name, OBJPROP_ARROWCODE ,P_code2);
ObjectSetInteger ( 0 ,P_name, OBJPROP_COLOR ,P_color2);
}
}
}
}
//+------------------------------------------------------------------+
int GTC= GetTickCount ();
//+------------------------------------------------------------------+
name= "H" +( string )GTC;
Draw_Point(name,BBH[ 1 ],BBH[ 0 ],MA[ 1 ],MA[ 0 ], 170 , 178 , Red , Red );
name= "L" +( string )GTC;
Draw_Point(name,BBL[ 1 ],BBL[ 0 ],MA[ 1 ],MA[ 0 ], 170 , 178 , Blue, Blue);
name= "M" +( string )GTC;
Draw_Point(name,BBM[ 1 ],BBM[ 0 ],MA[ 1 ],MA[ 0 ], 170 , 178 , Green , Green );
//---
ChartRedraw ( 0 );
Now let's run the Expert Advisor and look at the result (Fig. 7.).
It's good, but there are some other intersection cases, that we haven't considered. For example, the iBands indicator has three
lines that intersect each other and can complement the overall picture.
Now, let's try to add another one series of point to the calculated emission, the intersection between the following lines:
between the line "BH" (iBands = UPPER_BAND) and line "BL" (iBands = LOWER_BAND);
between the line "BH" (iBands = UPPER_BAND) and line "BM" (iBands = BASE_BAND);
between the line "BL" (iBands = LOWER_BAND) and line "BM" (iBands = BASE_BAND).
Due to these intersections, we would get 3 points, but all they will have the same coordinates. Therefore, it's sufficient to use
an only one intersection, between the line "BH" and line "BL".
Let's add these lines of code to our Expert Advisor, and take a look at the result (Fig. 8.).
So, we have got the emission, but there is a feeling that we have missed something important. Nevertheless, what we have
missed?
Why we have used just such input parameters? What we will get if we change them? And anyway, what is their role in the
emissions?
All right, the emission we've got corresponds to a single frequency, resulted from the input parameters of the indicator. To
calculate the full multi-frequency spectrum, it's necessary to perform the same calculations for other frequencies. As an
example, here is my version of the possible emission spectrum:
To consider all possible combinations, let's add the following code to the Expert Advisor:
//+------------------------------------------------------------------+
CopyTime ( NULL, 0 , 0 , 10 ,T);
ArraySetAsSeries (T,true);
int GTC= GetTickCount ();
//+------------------------------------------------------------------+
int iMax= ArraySize(BBHandle)- 1 ;
int jMax= ArraySize(MAHandle)- 1 ;
for ( int i= 0 ; i<iMax; i++)
{
for ( int j= 0 ; j<jMax; j++)
{
//--- filling the arrays with current values
CopyBuffer (MAHandle[j], 0 , 0 , 2 ,MA);
ArraySetAsSeries (MA,true);
CopyBuffer (BBHandle[i], 0 , 0 , 2 ,BBM);
ArraySetAsSeries (BBM,true);
CopyBuffer (BBHandle[i], 1 , 0 , 2 ,BBH);
ArraySetAsSeries (BBH,true);
CopyBuffer (BBHandle[i], 2 , 0 , 2 ,BBL);
ArraySetAsSeries (BBL,true);
name= "H" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBH[ 1 ],BBH[ 0 ],MA[ 1 ],MA[ 0 ], 250 , 158 , Aqua, Aqua);
name= "L" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBL[ 1 ],BBL[ 0 ],MA[ 1 ],MA[ 0 ], 250 , 158 , Blue, Blue);
name= "M" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBM[ 1 ],BBM[ 0 ],MA[ 1 ],MA[ 0 ], 250 , 158 , Green , Green );
name= "B" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBH[ 1 ],BBH[ 0 ],BBL[ 1 ],BBL[ 0 ], 250 , 158 , Magenta , Magenta );
}
}
//---
ChartRedraw ( 0 );
The more frequencies is involved in the emission spectrum, the better picture will be on chart, but you should not abuse it - it's
a simplest way to exhaust the computer resources, and to get the chaos on the chart. The number of frequencies can be
determined experimentally. For the better perception of graphics, we must pay special attention to the drawing style.
1. Each person has his own perception of graphic images, so you'll need some time to customize the emissions.
2. The "chaos" in Fig.9. doesn't allow to recognize any regularities or patterns in images. It's an example of bad drawing.
3. Try to use the neighbor colors in the rainbow spectrum.
4. The character codes for the past (from the left side of [0] bar) and for the future (from the right side of [0] bar) should
differ.
5. The successful combination of colors and shapes of points is able to turn the emission into the masterpieces, which will
not only help in the trade, but will also pleasure your eyes.
As an example, here is my version of drawing style for the emission (see Figures 10-17):
name= "H" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBH[ 1 ],BBH[ 0 ],MA[ 1 ],MA[ 0 ], 250 , 158 , Aqua, Aqua);
name= "L" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBL[ 1 ],BBL[ 0 ],MA[ 1 ],MA[ 0 ], 250 , 158 , Blue, Blue);
name= "M" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBM[ 1 ],BBM[ 0 ],MA[ 1 ],MA[ 0 ], 250 , 158 , Magenta , Magenta );
name= "B" +( string )GTC+( string )i+( string )j;
Draw_Point(name,BBH[ 1 ],BBH[ 0 ],BBL[ 1 ],BBL[ 0 ], 250 , 158 , DarkOrchid , DarkOrchid );
Fig. 10.
Fig. 11
Fig. 12.
Fig. 13.
Fig. 14.
Fig. 15.
Fig. 16.
Fig. 17.
Emission Analysis
The analysis of emissions is a separate task. The most useful thing is to look at its dynamics in a real time, it's the best way to
understand many effects and patterns.
Pay attention to the price corrections - it seems that the emission "knows" the target price. In addition, you can see the
support, resistance and equilibrium price levels.
Conclusion
1. The emissions of the indicators might be interesting to traders and trade systems developers, who are looking for new
approaches in market research and analysis.
2. As an introductory article, it doesn't contain the ready solutions. However, the presented technology for emission
calculation can be applied in other indicators or their combinations.
3. Preparing this article, I have collected more questions than answers. Here are some of them: how to optimize the
algorithm of emission drawing; what is the role of the emission spectrum characteristics in the structure of emission;
how to use the emissions in automated trading?
Attached files
emission_bands_and_ma_en.mq5 (8.62 KB)
emission_bands_and_ma_spectrum_en.mq5 (5.63 KB)