Author: Copyright � 2005-2006, David W. Thomas
EWO
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
EWO
//+------------------------------------------------------------------+
//|                                                          EWO.mq4 |
//|                                Copyright © 2005-2006, David W. Thomas |
//|                                           http://www.davidwt.com |
//+------------------------------------------------------------------+
// Elliott Wave Oscillator
#property copyright "Copyright © 2005-2006, David W. Thomas"
#property link      "http://www.davidwt.com"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Sienna

//---- buffers
double EWOBuffer[];

//---- variables
int indexbegin = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
	SetIndexStyle(0, DRAW_LINE);
	SetIndexBuffer(0, EWOBuffer);
	SetIndexLabel(0, "EWO");
//----
   IndicatorShortName("EWO");

	indexbegin = Bars - 35;
	if (indexbegin < 0)
		indexbegin = 0;

	return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
	return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int i;
	int counted_bars = IndicatorCounted();

	//---- check for possible errors
	if (counted_bars < 0) counted_bars = 0;
	//---- last counted bar will be recounted
	if (counted_bars > 0) counted_bars--;
	if (counted_bars > indexbegin) counted_bars = indexbegin;

	for (i = 0; i < indexbegin-counted_bars; i++)
	{
		//! compute EWO for the current bar.  If EWO is > 0, then the 5SMA is above
		//! the 35SMA.  If EWO < 0, then the 5SMA is below the 35SMA.
		EWOBuffer[i] = iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, i) - iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, i);
	}
	
	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 ---