Sem MACross

Author: ������� ������� (�) 2007
Sem MACross
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Sem MACross
//+------------------------------------------------------------------+
//|                                  Áîëüøàÿ Êîëëåêöèÿ Ñåìàôîðîâ.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ñåðãååâ Àëåêñåé (ñ) 2007"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_buffers 2
#property indicator_width1 2
#property indicator_width2 2
#property indicator_color1 Crimson
#property indicator_color2 LimeGreen
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID

extern int       SlowMA=7;
extern int       FastMA=5;
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[];

int init()
{
	SetIndexStyle(0,DRAW_HISTOGRAM);	SetIndexBuffer(0,ExtMapBuffer1);
	SetIndexStyle(1,DRAW_HISTOGRAM);	SetIndexBuffer(1,ExtMapBuffer2);
	IndicatorShortName("Cross MA ("+SlowMA+","+FastMA+")");
	return(0);
}
int deinit()  { return(0); }

int start()
{
	double s, f;

	for (int i = 0; i < Bars; i++)
	{
		ExtMapBuffer1[i]=0; ExtMapBuffer2[i]=0;
		s=iMA(NULL, 0, SlowMA, 0, Mode, Price, i);
		f=iMA(NULL, 0, FastMA, 0, Mode, Price, i);
		if (f<s) ExtMapBuffer1[i] = 1; //ïðîäàåì
		if (f>s) ExtMapBuffer2[i] = 1; //ïîêóïàåì
	}
	return(0);
}
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---