Candles_last4barsEli__mtf_

Author: Copyright � 2006, Eli Hayun
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 open prices of each barSeries array that contains close prices for each bar
0 Views
0 Downloads
0 Favorites
Candles_last4barsEli__mtf_
//+------------------------------------------------------------------+
//|                                                 #MTF Candles.mq4 |
//|                                      Copyright © 2006, Eli Hayun |
//|                                          http://www.elihayun.com |
//+------------------------------------------------------------------+
//mod2008fxtsd   ki
#property copyright "Copyright © 2006, Eli Hayun"
#property link      "http://www.elihayun.com"
//----
#property indicator_chart_window
//---- input parameters

extern int       CandlesTF=240;
extern color     UpCandleColorHL   = DeepSkyBlue;
extern color     UpCandleColorOC   = DodgerBlue;
extern color     DownCandleColorHL = OrangeRed;
extern color     DownCandleColorOC = Red;
extern int       withHL = 2;
extern int       withOC = 4;
extern bool      HigherTF.0  = false;
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-currentTF";

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() 
  {
  DeleteObjects();
  }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() 
 {
  DeleteObjects();

  return(0);
 }


void DeleteObjects() 
   {

   double dif=MathAbs(Time[1] - Time[2]);
   int ix=0;
   datetime dtStart=dif * 8 + Time[0];
   for(int ii=0; ii<8; ii+=2)
     {
      ObjectDelete("rect"+ii); 
      ObjectDelete("OTrnd"+ii); 
      ObjectDelete("CTrnd"+ii);

     }     
 return(0); 
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   double dif=MathAbs(Time[1] - Time[2]);
   int ix=0;
   datetime dtStart=dif * 8 + Time[0];
   for(int ii=0; ii<8; ii+=2)
     {
      ObjectDelete("rect"+ii); ObjectDelete("OTrnd"+ii); ObjectDelete("CTrnd"+ii);
      
      ObjectCreate("rect"+ii,OBJ_TREND, 0, dtStart, iLow(NULL, CandlesTF,ix), dtStart, iHigh(NULL,CandlesTF,ix));
      color clr1=DownCandleColorHL; color clr2=DownCandleColorOC;
      if (iOpen(NULL, CandlesTF,ix) < iClose(NULL, CandlesTF,ix)) {clr1=UpCandleColorHL; clr2=UpCandleColorOC;}
      ObjectSet("rect"+ii, OBJPROP_COLOR, clr1);
      ObjectSet("rect"+ii, OBJPROP_WIDTH, withHL);
      ObjectSet("rect"+ii, OBJPROP_RAY, False);
      ObjectSet("rect"+ii, OBJPROP_BACK, true);
  
      
      ObjectCreate("OTrnd"+ii, OBJ_TREND, 0, dtStart, iOpen(NULL, CandlesTF,ix), dtStart, iClose(NULL,CandlesTF,ix));
      ObjectSet("OTrnd"+ii, OBJPROP_COLOR, clr2);
      ObjectSet("OTrnd"+ii, OBJPROP_WIDTH, withOC);
      ObjectSet("OTrnd"+ii, OBJPROP_RAY, False);   
      
      dtStart-=dif * 2;
      ix++;

   if (HigherTF.0) {if (CandlesTF <Period()) CandlesTF =Period();}

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