Price_Range_hhll

Author: Grigori Minassian
Price_Range_hhll
Price Data Components
Series array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Price_Range_hhll
//+------------------------------------------------------------------+
//|                                                  Price Range.mq4 |
//|                                                Grigori Minassian |
//+------------------------------------------------------------------+
#property copyright "Grigori Minassian"


#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  Blue
#property  indicator_color2  Green
#property  indicator_color3  Red
#property  indicator_width1  1
#property  indicator_width3  1


double ChangeHigh[];
double ChangeClose[];
double ChangeLow[];


extern int PR_Period = 60;


int init()
{

   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexBuffer(0, ChangeHigh);
   SetIndexBuffer(1, ChangeClose);
   SetIndexBuffer(2, ChangeLow);
   
   IndicatorDigits(Digits + 1);

   IndicatorShortName("Price Range(" + PR_Period + ")");
   SetIndexLabel(0, "High");
   SetIndexLabel(1, "Close");
   SetIndexLabel(2, "Low");
   return(0);
}



double price_change_high = 0;
double price_change_low = 0;
double price_change_close = 0;

void ComputePriceRange(int period, int shift)
{
   int high_shift = iHighest(Symbol(), 0, MODE_CLOSE, period, shift);
   int low_shift  = iLowest(Symbol(), 0, MODE_CLOSE, period, shift);

   double price_open  = iClose(Symbol(), 0, period + shift);
   double price_high  = iClose(Symbol(), 0, high_shift);
   double price_low   = iClose(Symbol(), 0, low_shift);
   double price_close = iClose(Symbol(), 0, shift);
   
   price_change_high = (price_high - price_open) / Point;
   price_change_low = (price_low - price_open) / Point;
   price_change_close = (price_close - price_open) / Point;
}



int start()
{
   int i, limit;
   int counted_bars=IndicatorCounted();


   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;


   for(i = 0; i < limit; i++)
   {
      ComputePriceRange(PR_Period, i);
      ChangeHigh[i] = price_change_high;
      ChangeClose[i] = price_change_close;
      ChangeLow[i] = price_change_low;
   }
   
   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 ---