Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
SimpleScalp_MTF
//+------------------------------------------------------------------+
//| SimpleScalp_MTF.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.mql4.com/ru/users/kontra |
//-------------------------------------------------------------------+
//-------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightCyan
#property indicator_color2 OrangeRed
#property indicator_width1 2
#property indicator_width2 2
//-------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| DO NOT MODIFY ANYTHING BELOW THIS LINE!!! |
//+------------------------------------------------------------------+
//-------------------------------------------------------------------+
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double bar1;
double bar2;
double bar3;
double bar4;
int bar2_period;
int bar3_period;
int bar4_period;
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(2);
SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,241);
SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,242);
return(0);
}
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
int start()
{
//+------------------------------------------------------------------+
//| Calculating Periods |
//+------------------------------------------------------------------+
if (Period() == PERIOD_M1)
{
bar2_period=PERIOD_M5;
bar3_period=PERIOD_M15;
bar4_period=PERIOD_M30;
}
if (Period() == PERIOD_M5)
{
bar2_period=PERIOD_M15;
bar3_period=PERIOD_M30;
bar4_period=PERIOD_H1;
}
if (Period() == PERIOD_M15)
{
bar2_period=PERIOD_M30;
bar3_period=PERIOD_H1;
bar4_period=PERIOD_H4;
}
if (Period() == PERIOD_M30)
{
bar2_period=PERIOD_H1;
bar3_period=PERIOD_H4;
bar4_period=PERIOD_D1;
}
if (Period() == PERIOD_H1)
{
bar2_period=PERIOD_H4;
bar3_period=PERIOD_D1;
bar4_period=PERIOD_W1;
}
if (Period() == PERIOD_H4)
{
bar2_period=PERIOD_D1;
bar3_period=PERIOD_W1;
bar4_period=PERIOD_MN1;
}
//+------------------------------------------------------------------+
int counted_bars=IndicatorCounted();
int limit;
//-----
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=MathMin(Bars-counted_bars,Bars-1);
//-----
for(int i=limit; i>=0; i--)
{
bar1 = iClose(NULL,0,i+1)-iOpen(NULL,0,i+1);
bar2 = iClose(NULL,bar2_period,i+1)-iOpen(NULL,bar2_period,i+1);
bar3 = iClose(NULL,bar3_period,i+1)-iOpen(NULL,bar3_period,i+1);
bar4 = iClose(NULL,bar4_period,i+1)-iOpen(NULL,bar4_period,i+1);
if(bar1 > 0 && bar2>0 && bar3>0 && bar4>0) ExtMapBuffer1[i] = Open[i];
if(bar1 < 0 && bar2<0 && bar3<0 && bar4<0) ExtMapBuffer2[i] = Open[i];
}
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
---