Month_CAMARRILLA

Author: Copyright � 2010, ������� ������
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
2 Views
0 Downloads
0 Favorites
Month_CAMARRILLA
//+------------------------------------------------------------------+
//|                                             Month CAMARRILLA.mq4 |
//|                                 Copyright © 2010, Êóùåíêî Íèêèòà |
//|                                              www.tradestrateg.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Êóùåíêî Íèêèòà"
#property link      "www.tradestrateg.ru"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Silver
#property indicator_color2 Silver
#property indicator_color3 Red
#property indicator_color4 Lime
#property indicator_color5 BlueViolet
#property indicator_color6 BlueViolet

//---- buffers
double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[];
double P5Buffer[];
double P6Buffer[];
//----
int myPeriod = PERIOD_MN1;
//----
double H1, L1, H2, L2, H4, L4, Q;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexBuffer(0, P1Buffer);
   SetIndexBuffer(1, P2Buffer);
   SetIndexBuffer(2, P3Buffer);
   SetIndexBuffer(3, P4Buffer);
   SetIndexBuffer(4, P5Buffer);
   SetIndexBuffer(5, P6Buffer);
//----
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 0);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 0);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 4);
   SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 4);
   SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 4);
   SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 4);
//----
   Comment("Month CAMARRILLA");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectDelete("MonthH1");
   ObjectDelete("MonthH2");
   ObjectDelete("MonthH4");

   ObjectDelete("MonthL1");
   ObjectDelete("MonthL2");
   ObjectDelete("MonthL4");

   ObjectDelete("txtMonthH1");
   ObjectDelete("txtMonthH2");
   ObjectDelete("txtMonthH4");

   ObjectDelete("txtMonthL1");
   ObjectDelete("txtMonthL2");
   ObjectDelete("txtMonthL4");
   Comment("");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i, dayi, counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--;  
   int limit = Bars - counted_bars;
//----   
   for(i = limit - 1; i >= 0; i--)
     {
       dayi = iBarShift(Symbol(), myPeriod, Time[i], false);
       Q = (iHigh(Symbol(), myPeriod,dayi+1) - iLow(Symbol(), myPeriod, 
            dayi + 1));
       //----
       H1 = iClose(Symbol(), myPeriod,dayi+1) + (Q * 0.09);
       L1 = iClose(Symbol(), myPeriod,dayi+1) - (Q * 0.09);
       //----
       H2 = iClose(Symbol(), myPeriod,dayi+1) + (Q * 0.18);
       L2 = iClose(Symbol(), myPeriod,dayi+1) - (Q * 0.18);
       //----
       H4 = iClose(Symbol(), myPeriod,dayi+1) + (Q * 0.55);
       L4 = iClose(Symbol(), myPeriod,dayi+1) - (Q * 0.55);
       //----
       P1Buffer[i] = H1;
       SetPrice("MonthH1", Time[i], H1, Red);
       SetText("txtMonthH1", "H1", Time[i], H1, Red);
       //----
       P2Buffer[i] = L1;
       SetPrice("MonthL1", Time[i], L1, Lime);
       SetText("txtMonthL1", "L1", Time[i], L1, Lime);
       //----
       P3Buffer[i] = H2;
       SetPrice("MonthH2", Time[i], H2, Red);
       SetText("txtMonthH2", "H2", Time[i], H2, Red);
       //----
       P4Buffer[i] = L2;
       SetPrice("MonthL2",Time[i],L2,Lime);
       SetText("txtMonthL2","L2",Time[i],L2,Lime);
       //----
       P5Buffer[i] = H4;
       SetPrice("MonthH4", Time[i], H4, BlueViolet);
       SetText("txtMonthH4", "H4", Time[i], H4, BlueViolet);
       //----
       P6Buffer[i] = L4;
       SetPrice("MonthL4", Time[i], L4, BlueViolet);
       SetText("txtMonthL4", "L4", Time[i], L4, BlueViolet);

    }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SetPrice(string name, datetime Tm, double Prc, color clr)
  {
   if(ObjectFind(name) == -1)
     {
       ObjectCreate(name, OBJ_ARROW, 0, Tm, Prc);
       ObjectSet(name, OBJPROP_COLOR, clr);
       ObjectSet(name, OBJPROP_WIDTH, 2);
       ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
     }
   else
     {
       ObjectSet(name, OBJPROP_TIME1, Tm);
       ObjectSet(name, OBJPROP_PRICE1, Prc);
       ObjectSet(name, OBJPROP_COLOR, clr);
       ObjectSet(name, OBJPROP_WIDTH, 2);
       ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
     } 
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SetText(string name, string txt, datetime Tm, double Prc, color clr)
  {
   if(ObjectFind(name) == -1)
     {
       ObjectCreate(name, OBJ_TEXT, 0, Tm, Prc);
       ObjectSetText(name, txt, 9, "Times New Roman", clr);
     }
   else
     {
       ObjectSet(name, OBJPROP_TIME1, Tm);
       ObjectSet(name, OBJPROP_PRICE1, Prc);
       ObjectSetText(name, txt, 9, "Times New Roman", clr);
     } 
  }
//+------------------------------------------------------------------+

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