Indicators Used
0
Views
0
Downloads
0
Favorites
QuickMA
//+------------------------------------------------------------------+
//| QuickMA.mq4 |
//| mladen |
//| |
//| original (tradestation version) by John McCormick, 2008 |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link "mladenfx@gmail.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//
//
//
//
//
extern int Length = 14;
extern int Shift = 0;
extern int Price = PRICE_CLOSE;
//
//
//
//
//
double buffer1[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
SetIndexBuffer(0,buffer1); SetIndexShift(0,Shift);
return(0);
}
int deinit() { return(0); }
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit = Bars-counted_bars;
//
//
//
//
//
for(i=limit; i>=0; i--)
{
double sum = 0;
double divisor = 0;
double peak = Length/3.0;
//
//
//
//
//
for(int k=1; k<=(Length+1); k++)
{
double val;
if(k <= peak)
val = k/peak;
else val = (Length+1-k)/(Length+1-peak);
sum += iMA(NULL,0,1,0,MODE_SMA,Price,i+k-1)*val;
divisor += val;
}
if (divisor!=0)
buffer1[i] = sum/divisor;
else buffer1[i] = 0;
}
//
//
//
//
//
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
---