Door Pointer

Author: Yuriy Tokman (YTG)
Miscellaneous
Implements a curve of type %1
2 Views
0 Downloads
0 Favorites
Door Pointer
ÿþ//+------------------------------------------------------------------+

//|                                                 Door Pointer.mq4 |

//|                                               Yuriy Tokman (YTG) |

//|                       https://www.mql5.com/ru/users/satop/seller |

//+------------------------------------------------------------------+

#property copyright "Yuriy Tokman (YTG)"

#property link      "https://www.mql5.com/ru/users/satop/seller"

#property version   "1.00"

#property strict

#property indicator_chart_window



#property indicator_buffers 2

#property indicator_color1 clrRed

#property indicator_color2 clrLime

#property indicator_width1 1

#property indicator_width2 1



input int bar_limit = 0;



//--- buffers

double R[];

double L[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit()

  {

//--- indicator buffers mapping

   IndicatorShortName("DOOR Pointer");

   IndicatorDigits(Digits);

//--- indicator lines

   SetIndexStyle(0,DRAW_ARROW);

   SetIndexBuffer(0,R);

   SetIndexArrow(0,234);

   SetIndexStyle(1,DRAW_ARROW);

   SetIndexBuffer(1,L);

   SetIndexArrow(1,233);   

//---

   SetIndexLabel(0,"R");

   SetIndexLabel(1,"L");



   SetIndexDrawBegin(0,10);

   SetIndexDrawBegin(1,10);   

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function                       |

//+------------------------------------------------------------------+

int deinit()

  {

//----



//----

   return(0);

  }

//+------------------------------------------------------------------+

//| Custom indicator iteration function                              |

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime &time[],

                const double &open[],

                const double &high[],

                const double &low[],

                const double &close[],

                const long &tick_volume[],

                const long &volume[],

                const int &spread[])

  {

//---

   int limit = 0;

   int counted_bars=IndicatorCounted();   

   if(counted_bars<0) return(-1);

   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars-2;

   if(bar_limit>0 && bar_limit<limit)limit=bar_limit-1; 

   

   for(int i=limit; i>=0; i--)

    {

     if(Open[i+1]>Close[i+1] && NormalizeDouble(MathAbs(Open[i+1]-High[i+1]),Digits)<0.1*Point)R[i]=High[i+1]+50*Point;

     if(Open[i+1]<Close[i+1] && NormalizeDouble(MathAbs(Open[i+1]-Low[i+1]),Digits)<0.1*Point)L[i]=Low[i+1]-50*Point;

    }  

//--- return value of prev_calculated for next call

   return(rates_total);

  }

//+------------------------------------------------------------------+

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