Candle_Shadow

Author: Copyright © 2017, Vladimir Karputov
Price Data Components
0 Views
0 Downloads
0 Favorites
Candle_Shadow
ÿþ//+------------------------------------------------------------------+

//|                                                Candle Shadow.mq5 |

//|                              Copyright © 2017, Vladimir Karputov |

//|                                           http://wmua.ru/slesar/ |

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

#property copyright "Copyright © 2017, Vladimir Karputov"

#property link      "http://wmua.ru/slesar/"

#property version   "1.000"



#property description "=48:0B>@ ?>8A:0 A25G59 157 B5=59" 

#property description "0945==K5 A25G8 >B<5G0NBAO A8<2>;0<8 87 =01>@0 Wingdings" 



#property indicator_chart_window 

#property indicator_buffers 2 

#property indicator_plots   2 

//--- plot Arrows 

#property indicator_label1  "High" 

#property indicator_type1   DRAW_ARROW 

#property indicator_color1  clrBlue 

#property indicator_width1  1 

#property indicator_label2  "Low" 

#property indicator_type2   DRAW_ARROW 

#property indicator_color2  clrRed

#property indicator_width2  1 

//--- input ?0@0<5B@K

sinput string  __1__             = "";          // 0@0<5B@K 25@E0 A25G8

input bool     IsTopShadow       = true;        // true -> >B>1@060BL A25G8 157 25@E=59 B5=8  

input ushort   top_shadow_code   = 226;         // >4 A8<2>;0 25@E0 A25G8 (32-255)

sinput string  __2__             = "";          // 0@0<5B@ B5;0 A25G8

input ushort   min_size_candel   = 15;          // 8=8<0;L=K9 @07<5@ B5;0 A25G8 ()

sinput string  __3__             = "";          // 0@0<5B@K =870 A25G8

input bool     IsLowerShadow     = true;        // true -> >B>1@060BL A25G8 157 =86=59 B5=8  

input ushort   lower_shadow_code = 225;         // >4 A8<2>;0 25@E0 A25G8 (32-255)

sinput string  __4__             = "";          // 0@0<5B@ A<5I5=8O

input uchar    vertical_shift    = 15;          // !<5I5=85 AB@5;>: ?> 25@B8:0;8 (0-255)

//--- 8=48:0B>@=K5 1CD5@0 4;O ?>AB@>5=8O  

double         BufferTop[];

double         BufferLower[];

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

//| Custom indicator initialization function                         |

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

int OnInit()

  {

//--- ?@>25@:0 :>@@5:B=>AB8 ?0@0<5B@>2

   if(!IsTopShadow && !IsLowerShadow)

     {

      Print("10 ?0@0<5B@0 \">B>1@060BL A25G8 157 25@E=59/=86=59 B5=8\" @02=K false");

      return(INIT_PARAMETERS_INCORRECT);

     }

//--- indicator buffers mapping 

   SetIndexBuffer(0,BufferTop,INDICATOR_DATA);

   SetIndexBuffer(1,BufferLower,INDICATOR_DATA);

//--- 704048< :>4 A8<2>;0 4;O >B@8A>2:8 2 PLOT_ARROW 

   PlotIndexSetInteger(0,PLOT_ARROW,top_shadow_code);

   PlotIndexSetInteger(1,PLOT_ARROW,lower_shadow_code);

//--- 704048< c<5I5=85 AB@5;>: ?> 25@B8:0;8 2 ?8:A5;OE  

   PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,-(int)vertical_shift);

   PlotIndexSetInteger(1,PLOT_ARROW_SHIFT,(int)vertical_shift);

//--- CAB0=>28< 2 :0G5AB25 ?CAB>3> 7=0G5=8O 0 

   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0);

   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0);

//--- 

   return(INIT_SUCCEEDED);

  }

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

//| 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[])

  {

   static datetime prev_time=0;

//--- @01>B05< B>;L:> 2 <><5=B @>645=8O =>2>3> 10@0, 2=CB@8 10@0 =5 @01>B05<

   if(prev_time==time[rates_total-1])

      return(rates_total);

//--- =0 =>2>< 10@5 70?><8=05B 2@5<O 53> @>645=8O

   prev_time=time[rates_total-1];

//--- 1;>: @0AG5B0 7=0G5=89 8=48:0B>@0 

   int start=1;

   if(prev_calculated>0)

      start=prev_calculated;

//--- F8:; @0AG5B0 

   for(int i=start;i<rates_total;i++)

     {

      //--- 5A;8 ?@54K4CI0O A25G0 8<55B B5;> 1>;LH5 <8=8<0;L=>3>

      if(MathAbs(open[i-1]-close[i-1])/Point()>min_size_candel)

        {

         if(IsTopShadow)

            if(high[i-1]==open[i-1] || high[i-1]==close[i-1])

               BufferTop[i-1]=high[i-1];

         if(IsLowerShadow)

            if(low[i-1]==open[i-1] || low[i-1]==close[i-1])

               BufferLower[i-1]=low[i-1];

        }

     }

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