VR Donchian Lite

Author: Copyright 2018, Trading-go Project.
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
VR Donchian Lite
ÿþ//************************************************************************************************/

//*                                    VR Donchian Lite.mq4                                      */

//*                            Copyright 2018, Trading-go Project.                               */

//*           Author: Voldemar, Version: 12.09.2018, Site https://trading-go.ru                  */

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

//| Full version MetaTrader 4  https://www.mql5.com/ru/market/product/31831 

//| Lite version MetaTrader 4  https://www.mql5.com/ru/code/21150 

//| Full version MetaTrader 5  https://www.mql5.com/ru/market/product/31832 

//| Lite version MetaTrader 5  https://www.mql5.com/ru/code/22383

//************************************************************************************************/

//| All products of the Author https://www.mql5.com/ru/users/voldemar/seller

//************************************************************************************************/

#property copyright   "Copyright 2018, Trading-go Project."

#property link        "http://trading-go.ru"

#property version     "18.100"

#property description "A simple standard Donchian indicator"

#property strict

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

#property indicator_chart_window

#property indicator_buffers 3

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

input int          Period_      = 24;         // Period Donchian

input color        UpperLine    = clrBlue;    // Color Upper Line

input color        LowerLine    = clrRed;     // Color Lower Line

input color        AverageLine  = clrGreen;   // Color Average Line 

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

double upper_line[],lower_line[],awera_line[];

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

int OnInit()

  {

   Comment("");

   

   IndicatorSetString(INDICATOR_SHORTNAME,"VR Donchian Lite("+(string)Period_+")");

   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);



   SetIndexBuffer(0,upper_line,INDICATOR_DATA);

   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,UpperLine);

   SetIndexLabel(0,"Upper Line");



   SetIndexBuffer(1,awera_line,INDICATOR_DATA);

   SetIndexStyle(1,DRAW_LINE,STYLE_DOT,1,AverageLine);

   SetIndexLabel(1,"Average Line");



   SetIndexBuffer(2,lower_line,INDICATOR_DATA);

   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2,LowerLine);

   SetIndexLabel(2,"Lower Line");

   

   return(INIT_SUCCEEDED);

  }

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

int OnCalculate (const int rates_total,      // the size of the input timeseries 

                 const int prev_calculated,  // bars processed at the previous call 

                 const datetime& time[],     // Time 

                 const double& open[],       // Open 

                 const double& high[],       // High 

                 const double& low[],        // Low 

                 const double& close[],      // Close 

                 const long& tick_volume[],  // Tick Volume 

                 const long& volume[],       // Real Volume 

                 const int& spread[]         // Spread 

                 )

  {

   if(rates_total<=Period_ || Period_<=0)

      return(0);



   int limit=rates_total-prev_calculated-1;

   if(limit<0) limit=0;

   

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

     {

      upper_line[i]=iHigh(_Symbol,0,iHighest(NULL,0,MODE_HIGH,Period_,i));

      lower_line[i]=iLow(_Symbol,0,iLowest(NULL,0,MODE_LOW,Period_,i));

      awera_line[i]=(upper_line[i]+lower_line[i])/2;

     }



   return(rates_total);

  }

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

void OnDeinit(const int reason)

  {



  }

//************************************************************************************************/

//*                                                                                              */

//************************************************************************************************/

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