Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Sem BearsBulls
//+------------------------------------------------------------------+
//| Áîëüøàÿ Êîëëåêöèÿ Ñåìàôîðîâ.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ñåðãååâ Àëåêñåé (ñ) 2007"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_buffers 4
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 1
#property indicator_width4 1
#property indicator_color1 Crimson
#property indicator_color2 LimeGreen
#property indicator_color3 Crimson
#property indicator_color4 LimeGreen
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
#property indicator_style3 STYLE_SOLID
#property indicator_style4 STYLE_SOLID
//---- input parameters
extern int Minutes=0;
extern int MA=20;
extern int MB=13;
extern int Mode=MODE_EMA;//0-sma, 1-ema, 2-smma, 3-lwma
extern int Price=PRICE_CLOSE;//0-close, 1-open, 2-high, 3-low, 4-median, 5-typic, 6-wieight
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexBuffer(3,ExtMapBuffer4);
string Name = "Bears vs. Bulls ("+MA+","+MB+")";
IndicatorShortName(Name);
return(0);
}
int deinit() { return(0); }
int start()
{
double maPre, maCur, bearPre, bearCur, bullPre, bullCur;
//----
for (int i = Bars; i >= 0; i--)
{
ExtMapBuffer1[i]=0;
ExtMapBuffer2[i]=0;
ExtMapBuffer3[i]=0;
ExtMapBuffer4[i]=0;
maCur=iMA(NULL, Minutes, MA, 0, Mode, Price, i); maPre=iMA(NULL, Minutes, MA, 0, Mode, Price, i+1);
bearCur=iBearsPower(NULL, Minutes, MB, Price, i); bearPre=iBearsPower(NULL, Minutes, MB, Price, i+1);
bullCur=iBullsPower(NULL, Minutes, MB, Price, i); bullPre=iBullsPower(NULL, Minutes, MB, Price, i+1);
if (maCur<maPre && bullCur<bullPre ){ ExtMapBuffer1[i] = 1; }//ïðîäàåì
if (maCur>maPre && bearCur>bearPre ){ ExtMapBuffer2[i] = 1; }//ïîêóïàåì
if (ExtMapBuffer1[i]==0 && ExtMapBuffer2[i] == 0)
{ ExtMapBuffer3[i]=ExtMapBuffer1[i+1]; ExtMapBuffer4[i] = ExtMapBuffer2[i+1]; }
if (ExtMapBuffer3[i]==0 && ExtMapBuffer4[i] == 0 && ExtMapBuffer1[i]==0 && ExtMapBuffer2[i] == 0)
{ ExtMapBuffer3[i]=ExtMapBuffer3[i+1]; ExtMapBuffer4[i] = ExtMapBuffer4[i+1]; }
}
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
---