Author: � 2007 RickD
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
i-AMMA

#property copyright "© 2007 RickD"
#property link      "www.e2e-fx.net"

#define major   1
#define minor   0


#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1  Gold

extern int MA.Period = 25;


double MABuf[];

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void init()
{       
  SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1);
  SetIndexDrawBegin(0, MA.Period);
  SetIndexBuffer(0, MABuf);
  
  IndicatorShortName("AMMA ("+MA.Period+")");
}

void deinit() {
}  

void start() 
{
  int counted = IndicatorCounted();
  if (counted < 0) return (-1);
  
  if (counted > 0) counted--;
  int limit = Bars-counted;
   
  for (int i=limit-1; i >= 0; i--)
  {
    if (i == Bars-1)
      MABuf[i] = Close[i];
    else
      MABuf[i] = ((MA.Period-1)*MABuf[i+1] + Close[i])/MA.Period;
  }
}

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 ---