/*
   Generated by EX4-TO-MQ4 decompiler ONE FILE V4.0.218.3
   EX4 ID : 04E20A41724C2645BAEB3FDF008C44EC
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2007, Excalbur"
#property link      "Excalibur"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 1.0
#property indicator_buffers 8
#property indicator_color1 LightGreen
#property indicator_color2 OrangeRed
#property indicator_color3 SpringGreen
#property indicator_color4 DarkGray
#property indicator_color5 SpringGreen
#property indicator_color6 DarkGray
#property indicator_color7 LawnGreen
#property indicator_color8 DeepPink

int g_period_76 = 5;
int g_period_80 = 15;
int g_ma_method_84 = MODE_EMA;
int g_ma_method_88 = MODE_EMA;
int g_period_92 = 8;
int g_period_96 = 17;
int g_period_100 = 9;
int g_period_104 = 21;
int g_period_108 = 14;
int g_period_112 = 14;
int g_period_116 = 14;
int g_period_120 = 14;
bool gi_124 = FALSE;
double g_ibuf_128[];
double g_ibuf_132[];
double g_ibuf_136[];
double g_ibuf_140[];
double g_ibuf_144[];
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];

int init() {
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 120);
   SetIndexBuffer(0, g_ibuf_128);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 120);
   SetIndexBuffer(1, g_ibuf_132);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, SYMBOL_STOPSIGN);
   SetIndexBuffer(2, g_ibuf_136);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, SYMBOL_STOPSIGN);
   SetIndexBuffer(3, g_ibuf_140);
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexArrow(4, 110);
   SetIndexBuffer(4, g_ibuf_144);
   SetIndexStyle(5, DRAW_ARROW);
   SetIndexArrow(5, 110);
   SetIndexBuffer(5, g_ibuf_148);
   SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexArrow(6, SYMBOL_ARROWUP);
   SetIndexBuffer(6, g_ibuf_152);
   SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexArrow(7, SYMBOL_ARROWDOWN);
   SetIndexBuffer(7, g_ibuf_156);
   IndicatorShortName("Excalibur-9");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double l_ima_12;
   double l_ima_20;
   double l_ima_28;
   double l_ima_36;
   double l_ima_44;
   double l_ima_52;
   double l_imacd_60;
   double l_imacd_68;
   double l_iadx_76;
   double l_iadx_84;
   double l_irsi_92;
   double l_idemarker_100;
   double l_imomentum_108;
   double l_iforce_116;
   int li_0 = IndicatorCounted();
   if (li_0 < 0) return (-1);
   if (li_0 > 0) li_0--;
   int li_8 = Bars - li_0;
   for (int li_4 = li_8 - 1; li_4 >= 0; li_4--) {
      l_ima_12 = iMA(NULL, 0, g_period_76, 0, g_ma_method_84, PRICE_CLOSE, li_4);
      l_ima_20 = iMA(NULL, 0, g_period_76, 0, g_ma_method_84, PRICE_CLOSE, li_4 + 1);
      l_ima_28 = iMA(NULL, 0, g_period_76, 0, g_ma_method_84, PRICE_CLOSE, li_4 - 1);
      l_ima_36 = iMA(NULL, 0, g_period_80, 0, g_ma_method_88, PRICE_CLOSE, li_4);
      l_ima_44 = iMA(NULL, 0, g_period_80, 0, g_ma_method_88, PRICE_CLOSE, li_4 + 1);
      l_ima_52 = iMA(NULL, 0, g_period_80, 0, g_ma_method_88, PRICE_CLOSE, li_4 - 1);
      l_imacd_60 = iMACD(Symbol(), Period(), g_period_92, g_period_96, g_period_100, PRICE_CLOSE, MODE_MAIN, li_4);
      l_imacd_68 = iMACD(Symbol(), Period(), g_period_92, g_period_96, g_period_100, PRICE_CLOSE, MODE_SIGNAL, li_4);
      l_iadx_76 = iADX(NULL, 0, g_period_116, PRICE_CLOSE, MODE_PLUSDI, li_4);
      l_iadx_84 = iADX(NULL, 0, g_period_116, PRICE_CLOSE, MODE_MINUSDI, li_4);
      l_irsi_92 = iRSI(NULL, 0, g_period_104, PRICE_CLOSE, li_4);
      l_idemarker_100 = iDeMarker(NULL, 0, g_period_112, li_4);
      l_imomentum_108 = iMomentum(NULL, 0, g_period_108, PRICE_CLOSE, li_4);
      l_iforce_116 = iForce(NULL, 0, g_period_120, MODE_EMA, PRICE_CLOSE, li_4);
      if (l_imomentum_108 > 100.0) g_ibuf_128[li_4] = 0.05;
      if (l_imomentum_108 <= 100.0) g_ibuf_132[li_4] = 0.05;
      if (l_idemarker_100 > 0.5 && l_iforce_116 > 0.0) g_ibuf_144[li_4] = 0.22;
      if (l_idemarker_100 < 0.5 < 50 && l_iforce_116 < 0.0) g_ibuf_148[li_4] = 0.22;
      if (l_irsi_92 > 50.0 && l_imacd_60 > l_imacd_68 && l_iadx_76 > l_iadx_84) g_ibuf_136[li_4] = 0.47;
      if (l_irsi_92 < 50.0 && l_imacd_60 < l_imacd_68 && l_iadx_76 < l_iadx_84) g_ibuf_140[li_4] = 0.47;
      if (l_ima_12 > l_ima_36 && l_ima_20 < l_ima_44 && l_ima_28 > l_ima_52) {
         g_ibuf_152[li_4] = 0.8;
         if (gi_124 == TRUE) Alert("Excalibur Up " + Symbol() + " on the " + Period() + " minute chart.");
      }
      if (l_ima_12 < l_ima_36 && l_ima_20 > l_ima_44 && l_ima_28 < l_ima_52) {
         g_ibuf_156[li_4] = 0.8;
         if (gi_124 == TRUE) Alert("Excalibur DWN " + Symbol() + " on the " + Period() + " minute chart.");
      }
   }
   return (0);
}
