Author: Copyright 2015, WASD
Price Data Components
Series array that contains the lowest prices of each barSeries array that contains the highest prices of each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
WASD_FR1
//+------------------------------------------------------------------+
//|                                                      WASD_FR.mq4 |
//|                                             Copyright 2015, WASD |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, WASD"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
//--- input parameters
#property indicator_color1 clrMidnightBlue
#property indicator_color2 clrMidnightBlue
#property indicator_buffers 2

double arr_fr_dwn[];
double arr_fr_up[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   IndicatorDigits(Digits);
//--- indicator buffers mapping
   SetIndexBuffer(0,arr_fr_dwn);
   SetIndexStyle(0,DRAW_ARROW,0,1);
   SetIndexArrow(0,218);
   SetIndexLabel(0,"Fractal Down");

   SetIndexBuffer(1,arr_fr_up);
   SetIndexStyle(1,DRAW_ARROW,0,1);
   SetIndexArrow(1,217);
   SetIndexLabel(1,"Fractal Up");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {

   int idx_right_bar=Bars-IndicatorCounted();

   for(int i=idx_right_bar;i>0; i--)
     {
      if(IsStopped())
         break;

      if((iLow(NULL,0,i+1)<iLow(NULL,0,i)) && (iLow(NULL,0,i+1)<iLow(NULL,0,i+2)))
        {
         arr_fr_dwn[i+1]=iLow(NULL,0,i+1);
        }

      if((iHigh(NULL,0,i+1)>iHigh(NULL,0,i)) && (iHigh(NULL,0,i+1)>iHigh(NULL,0,i+2)))
        {
         arr_fr_up[i+1]=iHigh(NULL,0,i+1);
        }
     }

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