/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_minimum -1.0
#property indicator_maximum 1.0
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 Blue
#property indicator_color4 Red

extern int Minutes = 0;
extern int QQE_SF = 10;
extern int QQE_RSI_Period = 10;
extern double QQE_DARFACTOR = 3;
extern int QQE_Width = 1;
extern double QQE_Position = 0.5;
double g_ibuf_108[];
double g_ibuf_112[];
double g_ibuf_116[];
double g_ibuf_120[];
string gs_unused_124;

int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(0, g_ibuf_108);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(1, g_ibuf_112);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(2, g_ibuf_116);
   SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(3, g_ibuf_120);
   switch (Minutes) {
   case 1:
      gs_unused_124 = "Period_M1";
      break;
   case 5:
      gs_unused_124 = "Period_M5";
      break;
   case 15:
      gs_unused_124 = "Period_M15";
      break;
   case 30:
      gs_unused_124 = "Period_M30";
      break;
   case 60:
      gs_unused_124 = "Period_H1";
      break;
   case 240:
      gs_unused_124 = "Period_H4";
      break;
   case 1440:
      gs_unused_124 = "Period_D1";
      break;
   case 10080:
      gs_unused_124 = "Period_W1";
      break;
   case 43200:
      gs_unused_124 = "Period_MN1";
      break;
   default:
      gs_unused_124 = "Current Timeframe";
      Minutes = FALSE;
   }
   IndicatorShortName("QQE Adv Bars");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double l_icustom_4;
   double l_icustom_12;
   double l_icustom_20;
   double l_icustom_28;
   double l_icustom_36;
   double l_icustom_44;
   int l_ind_counted_0 = IndicatorCounted();
   for (int l_index_52 = 0; l_index_52 < 5000; l_index_52++) {
      g_ibuf_108[l_index_52] = 0;
      g_ibuf_112[l_index_52] = 0;
      g_ibuf_116[l_index_52] = 0;
      g_ibuf_120[l_index_52] = 0;
      l_icustom_4 = iCustom(NULL, 0, "QQEA", QQE_SF, QQE_RSI_Period, QQE_DARFACTOR, 0, l_index_52);
      l_icustom_20 = iCustom(NULL, 0, "QQEA", QQE_SF, QQE_RSI_Period, QQE_DARFACTOR, 0, l_index_52 + 1);
      l_icustom_36 = iCustom(NULL, 0, "QQEA", QQE_SF, QQE_RSI_Period, QQE_DARFACTOR, 0, l_index_52 - 1);
      l_icustom_12 = iCustom(NULL, 0, "QQEA", QQE_SF, QQE_RSI_Period, QQE_DARFACTOR, 1, l_index_52);
      l_icustom_28 = iCustom(NULL, 0, "QQEA", QQE_SF, QQE_RSI_Period, QQE_DARFACTOR, 1, l_index_52 + 1);
      l_icustom_44 = iCustom(NULL, 0, "QQEA", QQE_SF, QQE_RSI_Period, QQE_DARFACTOR, 1, l_index_52 - 1);
      if (l_icustom_4 > l_icustom_12) g_ibuf_108[l_index_52] = 1;
      if (l_icustom_4 < l_icustom_12) g_ibuf_112[l_index_52] = -1;
      if (l_icustom_4 > l_icustom_12) g_ibuf_116[l_index_52] = 1;
      if (l_icustom_4 < l_icustom_12) g_ibuf_120[l_index_52] = -1;
   }
   return (0);
}