dex_SolarWind

Author: Copyright � 2006, akadex
dex_SolarWind
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
dex_SolarWind
//+------------------------------------------------------------------+
//|                                                dex_SolarWind.mq4 |
//|                                        Copyright © 2006, akadex. |
//|                                                           tohell |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, akadex"
#property link      "tohell"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Gray
#property indicator_color2 Aqua
#property indicator_color3 Red
#property indicator_level1 0

extern int period=12;
extern int price=6; 
extern int smoothperiod=3; 
extern int TypeMA=3;

double buffer[],MA1buffer[],MA2buffer[],Value[],Fish[];
double MaxH,MinL,Price;
int i;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(4);
  SetIndexStyle(0,DRAW_HISTOGRAM,0,2);
  SetIndexLabel(0,"Trend");
  SetIndexBuffer(0,buffer);
  SetIndexStyle(1,DRAW_NONE);
  SetIndexBuffer(1,MA1buffer);
  SetIndexStyle(2,DRAW_LINE,0,1);
  SetIndexLabel(2,"Exit "+smoothperiod);
  SetIndexBuffer(2,MA2buffer);
  SetIndexBuffer(3,Value);

   
   string short_name="dex_SolarWind";
   IndicatorShortName(short_name);
   return(0);
}
int deinit()
{
   return(0);
}

int start()
{
	int    limit;
	int    counted_bars = IndicatorCounted();
	if (counted_bars>0)
		counted_bars--;
	else
	counted_bars = 1;
	limit = Bars - counted_bars;
	
	for (i=limit; i>=0; i--)
	{
   switch (price)
     {
     case 1: Price = Open[i]; break;
     case 2: Price = Close[i]; break;
     case 3: Price = High[i]; break;
     case 4: Price = Low[i]; break;
     case 5: Price = (High[i]+Low[i]+Close[i])/3; break;
     case 6: Price = (Open[i]+High[i]+Low[i]+Close[i])/4; break;
     case 7: Price = (Open[i]+Close[i])/2; break;
    default: Price = (High[i]+Low[i])/2; break;
     }
   // Îïðåäåëÿåì ìèíèìóì è ìàêñèìóì çà èññëåäóåìûé ïåðèîä
   MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)];
   MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)];
   
   // Âû÷èñëÿåì çíà÷åíèÿ
   Value[i] = 0.33*2*((Price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value[i+1];     
   buffer[i] = 0.5*MathLog((1+Value[i])/(1-Value[i]))+0.5*Fish[i+1];
   }
	for (i=limit; i>=0; i--)
	{
   MA1buffer[i]=iMAOnArray(buffer,0,smoothperiod,0,TypeMA,i);
	}
	for (i=limit; i>=0; i--)
	{
   MA2buffer[i]=iMAOnArray(MA1buffer,0,smoothperiod,0,TypeMA,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 ---