#4X TrendLine 8B

#4X TrendLine 8B
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
#4X TrendLine 8B
//+------------------------------------------------------------------+ 
// #4X TrendLine 8B           \¦/
// Knowledge of the ancients (ò ó)
//______________________o0o___(_)___o0o_____
//___¦Xard777¦_____¦_____¦_____¦_____¦_2009_¦
//+------------------------------------------------------------------+
#property indicator_chart_window
//+------------------------------------------------------------------+
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_width1 4
#property indicator_width2 4

double buf0[], buf1[], buf2[];
extern int PeriodX = 8;

int init() {
   IndicatorBuffers(3);
   SetIndexBuffer(0, buf0);
   SetIndexBuffer(1, buf1);
   SetIndexBuffer(2, buf2);
   SetIndexStyle(0, DRAW_LINE,0,4);
   SetIndexStyle(1, DRAW_LINE,0,4);
   return (0);
}

int start() {
   for (int X4 = Bars - 10; X4 >= 0; X4--) buf2[X4] = iMA(NULL, 0, PeriodX, 0, MODE_LWMA, PRICE_MEDIAN, X4);
   for (int X8 = Bars - 10; X8 >= 0; X8--) {
      buf0[X8] = buf2[X8]; buf1[X8] = buf2[X8];
      if (buf2[X8] > buf2[X8 + 1]) {
         buf0[X8] = EMPTY_VALUE; buf1[X8 + 1] = buf2[X8 + 1];
      } else {
         if (buf2[X8] < buf2[X8 + 1]) {
            buf1[X8] = EMPTY_VALUE; buf0[X8 + 1] = buf2[X8 + 1];
         }
      }
   }
   return (0);
}
//--------------------------------------------Xard@hotmail.co.uk-----+

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