Indicators Used
Miscellaneous
1
Views
0
Downloads
0
Favorites
ytg_MA_Open_V0_v1
//+------------------------------------------------------------------+
//| MA_Open_V0.mq4 |
//| Yuriy Tokman |
//| yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link "yuriytokman@gmail.com"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
extern string __íàñòðîéêè_íèäèêàòîðà__ = "Çäåñü èçìåíÿåì";
extern int PeriodMA = 33;
extern int ma_method = 1;//0-3
extern int applied_price = 6;//0-6
extern int âåðõíèé_ïîðîã = 250;
extern int íèæíèé_ïîðîã = 250;
double ExtMapBuffer0[];
double ExtMapBuffer1[];
datetime LastTime=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,3);
SetIndexBuffer(0,ExtMapBuffer0);
SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,3);
SetIndexBuffer(1,ExtMapBuffer1);
IndicatorShortName("MA_Open ("+PeriodMA+")");
SetIndexLabel(0," ISQ#481971287 ");
SetIndexLabel(1," yuriytokman@gmail.com ");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
int limit = Bars - counted_bars;
if(counted_bars==0) limit--;
for(int i=limit; i>=0; i--)
{
double MA_0 = iMA( NULL,0,PeriodMA,0,ma_method,applied_price,i);
double MA_H = MA_0 + âåðõíèé_ïîðîã*Point;
double MA_L = MA_0 - íèæíèé_ïîðîã*Point;
if(Open[i]>MA_H&&Low[i]>MA_0&&Low[i]<MA_H)
{
if(Time[0]!= LastTime)
{
Alert("îòêàò äëÿ áàé "," Ñèìâîë ",Symbol()," Ïåðèîä ",GetNameTF());
LastTime = Time[0];
}
ExtMapBuffer0[i]=1;
}
else ExtMapBuffer0[i]=0;
if(Open[i]<MA_L&&High[i]<MA_0&&High[i]>MA_L)
{
if(Time[0]!= LastTime)
{
Alert("îòêàò äëÿ ñåëë "," Ñèìâîë ",Symbol()," Ïåðèîä ",GetNameTF());
LastTime = Time[0];
}
ExtMapBuffer1[i]=-1;
}
else ExtMapBuffer1[i]=0;
}
//----
return(0);
}
//+------------------------------------------------------------------+
string GetNameTF(int TimeFrame=0) {
if (TimeFrame==0) TimeFrame=Period();
switch (TimeFrame) {
case PERIOD_M1: return("M1");
case PERIOD_M5: return("M5");
case PERIOD_M15: return("M15");
case PERIOD_M30: return("M30");
case PERIOD_H1: return("H1");
case PERIOD_H4: return("H4");
case PERIOD_D1: return("Daily");
case PERIOD_W1: return("Weekly");
case PERIOD_MN1: return("Monthly");
default: return("UnknownPeriod");
}
}
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
---