/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Oops"
#property link      "http://www.Golden-Traders.com"

#property indicator_separate_window
#property indicator_minimum -100.0
#property indicator_maximum 100.0
#property indicator_levelcolor Red
#property indicator_width1 2
#property indicator_level1 80.0
#property indicator_level2 -80.0

extern string ModeTravail = "Buy at -100% and Sell at 100%";
extern string TradeMode = "Choose Trading Method : ";
extern bool Scalping = TRUE;
extern string IndColor = "Choose Indicator color : ";
extern color Couleur = Blue;
extern bool SoundON = TRUE;
double Indicator_Buffer[];
double High_Level[];
double Low_Level[];
double gd_120;
double gd_128;
double gd_136;
static double Time_Bar_0;
int gi_144 = 5;
int gi_148;
int index;
int g_period_156;
int Bars_Counted;
int Rest_Bars;

int init() {
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_LINE, EMPTY, 2, Couleur);
   SetIndexBuffer(0, Indicator_Buffer);
   SetIndexBuffer(1, Low_Level);
   SetIndexBuffer(2, High_Level);
   IndicatorShortName("Vostro     ");
   Time_Bar_0 = Time[0];
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   if (Scalping == TRUE) g_period_156 = 100;
   else g_period_156 = 300;
   
   Bars_Counted = IndicatorCounted();
   if (Bars_Counted < 0) return (-1);
   if (Bars_Counted > 0) Bars_Counted--;
   int Rest_Bars = Bars + 1 - Bars_Counted;
   
   for (index = 0; index < Rest_Bars; index++) {
      gd_120 = 0;
      for (gi_148 = index; gi_148 < gi_144 + index; gi_148++) gd_120 += (High[gi_148] + Low[gi_148]) / 2.0;
      gd_128 = gd_120 / gi_144;
      gd_120 = 0;
      for (gi_148 = index; gi_148 < gi_144 + index; gi_148++) gd_120 += High[gi_148] - Low[gi_148];
      gd_136 = 0.2 * (gd_120 / gi_144);
      Low_Level[index] = (Low[index] - gd_128) / gd_136;
      High_Level[index] = (High[index] - gd_128) / gd_136;
      if (High_Level[index] > 8.0 && High[index] > iMA(NULL, 0, g_period_156, 0, MODE_LWMA, PRICE_MEDIAN, index)) {
	      Indicator_Buffer[index] = 90.0;
      }
      else {
         if (Low_Level[index] < -8.0 && Low[index] < iMA(NULL, 0, g_period_156, 0, MODE_LWMA, PRICE_MEDIAN, index)) {
	         Indicator_Buffer[index] = -90.0;
        }
         else Indicator_Buffer[index] = 0.0;
      }
      if (High_Level[index] > 8.0 && High_Level[index - 1] > 8.0) {
	      Indicator_Buffer[index] = 0;
	      if (SoundON == TRUE && Time_Bar_0 != Time[0]) {
          	Alert("Vostro: Buy!", Symbol(), Period());
            Time_Bar_0 = Time[0];
         }

      }
      if (High_Level[index] > 8.0 && High_Level[index - 1] > 8.0 && High_Level[index - 2] > 8.0) {
	      Indicator_Buffer[index] = 0;
 	      if (SoundON == TRUE && Time_Bar_0 != Time[0]) {
          	Alert("Vostro: Buy!", Symbol(), Period());
            Time_Bar_0 = Time[0];
         }
     }
      if (Low_Level[index] < -8.0 && Low_Level[index - 1] < -8.0) {
	      Indicator_Buffer[index] = 0;
 	      if (SoundON == TRUE && Time_Bar_0 != Time[0]) {
          	Alert("Vostro: Sell!", Symbol(), Period());
            Time_Bar_0 = Time[0];
         }
      }
      if (Low_Level[index] < -8.0 && Low_Level[index - 1] < -8.0 && Low_Level[index - 2] < -8.0) {
	      Indicator_Buffer[index] = 0;
 	      if (SoundON == TRUE && Time_Bar_0 != Time[0]) {
          	Alert("Vostro: Sell!", Symbol(), Period());
            Time_Bar_0 = Time[0];
         }
      }
   }
   return (0);
}