gMTF_BullsBears_5periodos_largos

Author:
Indicators Used
Bears Power indicatorBulls Power indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
gMTF_BullsBears_5periodos_largos
//+------------------------------------------------------------------+
//|                                      MTF_BullsBears_5periodos_largos.mq4 |
//|                                      forexjarp74 JUAN ALEJANDRO RUIZ PALACIO 2010 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
//#property indicator_chart_window
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_level1 0
#property indicator_level2 0.0088
#property indicator_level3 -0.0088

//---- input parameters
/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30 
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
PRICE_CLOSE    0 Close price. 
PRICE_OPEN     1 Open price. 
PRICE_HIGH     2 High price. 
PRICE_LOW      3 Low price. 
PRICE_MEDIAN   4 Median price, (high+low)/2. 
PRICE_TYPICAL  5 Typical price, (high+low+close)/3. 
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4. 
You must use the numeric value of the Applied Price that you want to use
when you set the 'applied_price' value with the indicator inputs.
**************************************************************************/
extern int TimeFrame=0;
//extern int CCIperiod=14;
extern int applied_price=5;
extern string Moneda= "EURUSD";
extern int periodo1 = 10;
extern int periodo2 = 11;
extern int periodo3 = 12;
extern int periodo4 = 13;
extern int periodo5 = 14;

double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label
   switch(TimeFrame)
     {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
     }
   IndicatorShortName("BullsBears_5periodos_largos ("+TimeFrameStr+")");
   return(0);
  }
//----

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,y=0;
   double doce,once,diez,nueve,ocho;

// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);

   int counted_bars=IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit--;

   for(i=0,y=0;i<limit;i++)
     {
      if(Time[i]<TimeArray[y]) y++;

      doce = iBullsPower(Moneda,TimeFrame,periodo5,PRICE_CLOSE,y)+iBearsPower(Moneda,TimeFrame,periodo5,PRICE_CLOSE,y);
      once = iBullsPower(Moneda,TimeFrame,periodo4,PRICE_CLOSE,y)+iBearsPower(Moneda,TimeFrame,periodo4,PRICE_CLOSE,y);
      diez = iBullsPower(Moneda,TimeFrame,periodo3,PRICE_CLOSE,y)+iBearsPower(Moneda,TimeFrame,periodo3,PRICE_CLOSE,y);
      nueve=iBullsPower(Moneda,TimeFrame,periodo2,PRICE_CLOSE,y)+iBearsPower(Moneda,TimeFrame,periodo2,PRICE_CLOSE,y);
      ocho = iBullsPower(Moneda,TimeFrame,periodo1,PRICE_CLOSE,y)+iBearsPower(Moneda,TimeFrame,periodo1,PRICE_CLOSE,y);
      ExtMapBuffer1[i]=doce+once+diez+nueve+ocho;
     }
   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 ---