iMoningStar

Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
iMoningStar
//+------------------------------------------------------------------+
//|                                                  iMoningStar.mq4 |
//|                                                                * |
//|                                                                * |
//+------------------------------------------------------------------+
#property copyright "http://dmffx.com"
#property link      "http://dmffx.com"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Red

#property indicator_width1 1
#property indicator_width2 1

extern int     PreBarMaxSize   =  10;     // Ìaêñèìàëüíûé ðàçìåð ïðåäøåñòâóþùåãî áàðà â ïóíêòàõ
extern int     PreBarMinSize   =  0;      // Ìèíèìàëüíûé ðàçìåð ïðåäøåñòâóþùåãî áàðà â ïóíêòàõ
extern double  StarSize        =  0.2;    // Ðàçìåð òåëà çâåçäû (ïî îòíîøåíèþ ê òåëó ïðåäøåñòâóþùåãî áàðà) 
extern double  GapSize         =  0.05;   // Ðàçìåðà ãýïà (ïî îòíîøåíèþ ê òåëó ïðåäøåñòâóþùåãî áàðà) 


double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,172);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,172);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=2;

   for(int i=limit-1;i>=0;i--)
     {
      ExtMapBuffer1[i]=0;
      ExtMapBuffer2[i]=0;
      if(MathAbs(Close[i+1]-Open[i+1])<=Point*PreBarMaxSize)
        {
         if(MathAbs(Close[i+1]-Open[i+1])>=Point*PreBarMinSize)
           {
            if(MathAbs(Close[i]-Open[i])<StarSize*MathAbs(Close[i+1]-Open[i+1]))
              {
               if(MathMax(Close[i],Open[i])<MathMin(Close[i+1],Open[i+1])-GapSize*MathAbs(Close[i+1]-Open[i+1]))
                 {
                  ExtMapBuffer1[i]=Low[i]-Point*5;
                 }
               if(MathMin(Close[i],Open[i])>MathMax(Close[i+1],Open[i+1])+GapSize*MathAbs(Close[i+1]-Open[i+1]))
                 {
                  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 ---