Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Epsilon
//+------------------------------------------------------------------+
//| Epsilon.mq4 |
//| Copyright © 2008, Commercial Credit & Commerce Inc. |
//| http://www.creditbanc.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Commercial Credit & Commerce Inc."
#property link "http://www.creditbanc.net"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 White
#property indicator_color2 Red
#property indicator_color3 Red
//---- input parameters
extern string Start_Time = "00:00";//Time to adjust moving average (1time per day)
extern int Ema_Period=10;// Length of moving average in days
extern double Cycle1_Var=1;// percent above and below moving average
//---- internal Global Variables
double ema;
double cycle1_high;
double cycle1_low;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
int pos, i;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if (Bars <= Ema_Period) return(0);
if (counted_bars < 0) return (-1);
if (counted_bars > 0) counted_bars--;
pos = Bars - counted_bars - Ema_Period;
//----
for (i=pos; i>=0; i--)
{
if(TimeToStr(iTime(NULL,0,i), TIME_MINUTES) == Start_Time) // only perform ema calculation at 00:01
{
Sleep(60000);
ema = iMA(NULL, 0, Ema_Period, 0, MODE_EMA, PRICE_CLOSE, i); // calculate 10 day ema
cycle1_high = (ema + (ema * (Cycle1_Var / 100))); //Add percent to ema
cycle1_low =(ema - (ema * (Cycle1_Var / 100))); // subtract percent from ema
}
ExtMapBuffer1[i] = ema; // draw ema
ExtMapBuffer2[i] = cycle1_high; // draw cycle1 high (ema + percent)
ExtMapBuffer3[i] = cycle1_low; // draw cycle1 low (ema - percent)
}
//----
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
---