iKarakatica_v1

iKarakatica_v1
Indicators Used
Movement directional index
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
iKarakatica_v1
//+------------------------------------------------------------------+
//|                        Karacatica                                |
//|                        Äìèòðèé                                   |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//----
extern int       iPeriod=70;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  int init()
  {
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,241);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,242);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();  // îïðåäåëèì êîëè÷åñòâî ïðîñ÷èòàíûõ áàðîâ ó èíäèêàòîðà
   limit=Bars-counted_bars;              // îïðåäåëÿåì ãðàíèöó äî êîòîðîé ðàññ÷èòûâàåì çíà÷åíèÿ èíäèêàòîðà
   if(limit >Bars-2)limit=Bars-2;
   static int ltr;
     for(int i=limit-1;i>=0;i--)
     {
      if(ExtMapBuffer1[i+1]!=0 && ExtMapBuffer1[i+1]!=EMPTY_VALUE)ltr=1;
      if(ExtMapBuffer2[i+1]!=0 && ExtMapBuffer2[i+1]!=EMPTY_VALUE)ltr=2;
      double pdi=iADX(NULL,0,iPeriod,0,MODE_PLUSDI,i);
      double mdi=iADX(NULL,0,iPeriod,0,MODE_MINUSDI,i);
      ExtMapBuffer1[i]=EMPTY_VALUE;
      ExtMapBuffer2[i]=EMPTY_VALUE;
      if(Close[i]>Close[i+iPeriod] && pdi>mdi && ltr!=1)ExtMapBuffer1[i]=Low[i]-Point*5;
      if(Close[i]<Close[i+iPeriod] && pdi<mdi && ltr!=2)ExtMapBuffer2[i]=High[i]+Point*5;
     }
     //-----
   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 ---