Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
2_river_indicator
//+------------------------------------------------------------------+
//| 2_river indicator.mq4 |
//| Êàïàíèí Àëåêñàíäð aka Frog0612 |
//| Frog0612@yandex.ru |
//| Èíäèêàòîð ê ÒÑ "Äâå ðåêè v.1.0" |
//| |
//+------------------------------------------------------------------+
#property copyright "MetaQuotes"
#property link "http://forum.alpari-idc.ru/viewtopic.php?t=48186"
//#property show_inputs
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 DeepSkyBlue
#property indicator_color4 Orange
extern int Period_MA=20;
extern int Method_MA=3;
//datetime Today=0;
//int Signal_1;
//string SignalGV = "GV_Signal"; // èìÿ GV ïåðåìåííîé
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
Print("Âûïîëíÿåòñÿ init()");
SetIndexStyle(0,DRAW_ARROW,0,3);
SetIndexArrow(0,241);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW,0,3);
SetIndexArrow(1,242);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_ARROW,0,3);
SetIndexArrow(2,241);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_ARROW,0,3);
SetIndexArrow(3,242);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexEmptyValue(3,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
Print("Âûïîëíÿåòñÿ deinit()");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit; // îãðàíè÷èòåëü ðàñ÷åòîâ
double MA_Hi,MA_Lo;
// îáúÿâèì ñëóæåáíûå ïåðåìåííûå, â êîòîðûõ áóäåì õðàíèòü öåíîâûå êîîðäèíàòû ñòðåëîê
double value1,value2,value3,value4;
if (counted_bars==0) limit=Bars-1;
if (counted_bars>0) limit=Bars-counted_bars-1;
Comment("Bars=",Bars," limit=",limit," counted_bars=",counted_bars);
// Print ("Bars=",Bars," limit=",limit," counted_bars=",counted_bars);
for(int i=limit;i>=0;i--)
{
value1=0.0;
value2=0.0;
value3=0.0;
value4=0.0;
MA_Hi=iMA(NULL,0,Period_MA,0,Method_MA,PRICE_HIGH,i);
MA_Lo=iMA(NULL,0,Period_MA,0,Method_MA,PRICE_LOW,i);
//Åñëè åñòü ñèãíàë ê ïîêóïêå(Ñâå÷à ïåðåñåêëà ïîëíîñòüþ) - ïîñòàâèì ñèíþþ ñòðåëêó ââåðõ
if ((Open[i]<=MA_Lo) && (Close[i]>MA_Hi) && (Close[i]>Open[i]))
{
value1=High[i];//çàïîìíèì öåíó ñèíåé ñòðåëêè
Comment("H=",High[i],"L=",Low[i]);
}
if ((Open[i]>MA_Lo)&&(Open[i]<=MA_Hi)&&(Close[i]>MA_Hi)&&(Close[i]>Open[i]))
{
value3=High[i];
Comment("H=",High[i],"L=",Low[i]);
}
//Åñëè åñòü ñèãíàë ê ïðîäàæå - ïîñòàâèì êðàñíóþ ñòðåëêó âíèç
if ((Open[i]>=MA_Hi)&&(Close[i]<MA_Lo)&&(Close[i]<Open[i]))
{
value2=Low[i];//çàïîìíèì öåíó êðàñíîé ñòðåëêè
Comment("H=",High[i],"L=",Low[i]);
}
if ((Open[i]<MA_Hi)&&(Open[i]>=MA_Lo)&&(Close[i]<MA_Lo)&&(Close[i]<Open[i]))
{
value4=Low[i];
Comment("H=",High[i],"L=",Low[i]);
}
ExtMapBuffer1[i]=value1;
ExtMapBuffer2[i]=value2;
ExtMapBuffer3[i]=value3;
ExtMapBuffer4[i]=value4;
}
return(0);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---