/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_color3 Gold

extern int Bands_Mode_0_2 = 0;
extern int Power_Price_0_6 = 0;
extern int Price_Type_0_3 = 0;
extern int Bands_Period = 20;
extern int Bands_Deviation = 2;
extern int Power_Period = 13;
extern int CountBars = 20000;
double g_ibuf_104[];
double g_ibuf_108[];
double diff[];
int l_applied_price_8;
double ld_16;
   
int init() {
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(0, g_ibuf_104);
   SetIndexBuffer(1, g_ibuf_108);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexBuffer(2, diff);
   if (Bands_Mode_0_2 == 1) l_applied_price_8 = 1;
   if (Bands_Mode_0_2 == 2) l_applied_price_8 = 2;
   if (Bands_Mode_0_2 == 0) l_applied_price_8 = 0;
   if (Power_Price_0_6 == 1) ld_16 = 1;
   if (Power_Price_0_6 == 2) ld_16 = 2;
   if (Power_Price_0_6 == 3) ld_16 = 3;
   if (Power_Price_0_6 == 4) ld_16 = 4;
   if (Power_Price_0_6 == 5) ld_16 = 5;
   if (Power_Price_0_6 == 6) ld_16 = 6;
   if (Power_Price_0_6 == 6) ld_16 = 0;
   return (0);
}

int start() {
   double ld_24;
   SetIndexDrawBegin(0, Bars - CountBars + Bands_Period + 1);
   SetIndexDrawBegin(1, Bars - CountBars + Bands_Period + 1);
   int l_ind_counted_12 = IndicatorCounted();
   if (Bars <= Bands_Period) return (0);
   if (l_ind_counted_12 < Bands_Period) {
      for (int l_shift_0 = 1; l_shift_0 <= Bands_Period; l_shift_0++) g_ibuf_104[Bars - l_shift_0] = 0.0;
      for (l_shift_0 = 1; l_shift_0 <= Bands_Period; l_shift_0++) g_ibuf_108[Bars - l_shift_0] = 0.0;
   }
   l_shift_0 = CountBars - Bands_Period - 1;
   for (l_shift_0 = CountBars - 1; l_shift_0 >= 0; l_shift_0--) {
      if (Price_Type_0_3 == 1) ld_24 = Open[l_shift_0];
      if (Price_Type_0_3 == 2) ld_24 = High[l_shift_0];
      if (Price_Type_0_3 == 3) ld_24 = Low[l_shift_0];
      if (Price_Type_0_3 == 0) ld_24 = Close[l_shift_0];
      g_ibuf_104[l_shift_0] = ld_24 - iBands(NULL, 0, Bands_Period, Bands_Deviation, 0, l_applied_price_8, ld_16, l_shift_0);
      g_ibuf_108[l_shift_0] = -(iBearsPower(NULL, 0, Power_Period, ld_16, l_shift_0) + iBullsPower(NULL, 0, Power_Period, ld_16, l_shift_0));
      diff[l_shift_0] = g_ibuf_104[l_shift_0] + g_ibuf_108[l_shift_0];
   }
   return (0);
}