/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "zx815@126.com"
#property link      "zx815@126.com"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 1.0
#property indicator_buffers 8
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Aqua
#property indicator_color4 Gold
#property indicator_color5 Aqua
#property indicator_color6 Gold
#property indicator_color7 Aqua
#property indicator_color8 Gold

extern int FasterMA = 5;
extern int SlowerMA = 15;
extern int MA1_Type = 1;
extern int MA2_Type = 1;
extern int MACD_Fast = 8;
extern int MACD_Slow = 17;
extern int MACD_Signal = 9;
extern int RSI = 14;
extern int Momentum = 14;
extern int DeMarker = 14;
extern int ADX = 14;
extern int ForceIndex = 14;
double g_ibuf_124[];
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[];

int init() {
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexArrow(0, 120);
   SetIndexBuffer(0, g_ibuf_124);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 120);
   SetIndexBuffer(1, g_ibuf_128);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, SYMBOL_STOPSIGN);
   SetIndexBuffer(2, g_ibuf_132);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, SYMBOL_STOPSIGN);
   SetIndexBuffer(3, g_ibuf_136);
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexArrow(4, 110);
   SetIndexBuffer(4, g_ibuf_140);
   SetIndexStyle(5, DRAW_ARROW);
   SetIndexArrow(5, 110);
   SetIndexBuffer(5, g_ibuf_144);
   SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexArrow(6, SYMBOL_ARROWUP);
   SetIndexBuffer(6, g_ibuf_148);
   SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexArrow(7, SYMBOL_ARROWDOWN);
   SetIndexBuffer(7, g_ibuf_152);
   IndicatorShortName("Golden Varitey");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double l_ima_0;
   double l_ima_8;
   double l_ima_16;
   double l_ima_24;
   double l_ima_32;
   double l_ima_40;
   double l_imacd_48;
   double l_imacd_56;
   double l_iadx_64;
   double l_iadx_72;
   double l_irsi_80;
   double l_idemarker_88;
   double l_imomentum_96;
   double l_iforce_104;
   int li_112 = IndicatorCounted();
   if (li_112 < 0) return (-1);
   if (li_112 > 0) li_112--;
   int li_116 = Bars - li_112;
   for (int li_120 = li_116 - 1; li_120 >= 0; li_120--) {
      l_ima_0 = iMA(NULL, 0, FasterMA, 0, MA1_Type, PRICE_CLOSE, li_120);
      l_ima_8 = iMA(NULL, 0, FasterMA, 0, MA1_Type, PRICE_CLOSE, li_120 + 1);
      l_ima_16 = iMA(NULL, 0, FasterMA, 0, MA1_Type, PRICE_CLOSE, li_120 - 1);
      l_ima_24 = iMA(NULL, 0, SlowerMA, 0, MA2_Type, PRICE_CLOSE, li_120);
      l_ima_32 = iMA(NULL, 0, SlowerMA, 0, MA2_Type, PRICE_CLOSE, li_120 + 1);
      l_ima_40 = iMA(NULL, 0, SlowerMA, 0, MA2_Type, PRICE_CLOSE, li_120 - 1);
      l_imacd_48 = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Signal, PRICE_CLOSE, MODE_MAIN, li_120);
      l_imacd_56 = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Signal, PRICE_CLOSE, MODE_SIGNAL, li_120);
      l_iadx_64 = iADX(NULL, 0, ADX, PRICE_CLOSE, MODE_PLUSDI, li_120);
      l_iadx_72 = iADX(NULL, 0, ADX, PRICE_CLOSE, MODE_MINUSDI, li_120);
      l_irsi_80 = iRSI(NULL, 0, RSI, PRICE_CLOSE, li_120);
      l_idemarker_88 = iDeMarker(NULL, 0, DeMarker, li_120);
      l_imomentum_96 = iMomentum(NULL, 0, Momentum, PRICE_CLOSE, li_120);
      l_iforce_104 = iForce(NULL, 0, ForceIndex, MODE_EMA, PRICE_CLOSE, li_120);
      if (l_imomentum_96 > 100.0) g_ibuf_124[li_120] = 0.05;
      if (l_imomentum_96 <= 100.0) g_ibuf_128[li_120] = 0.05;
      if (l_idemarker_88 > 0.5 && l_iforce_104 > 0.0) g_ibuf_140[li_120] = 0.22;
      if (l_idemarker_88 < 0.5 < 50 && l_iforce_104 < 0.0) g_ibuf_144[li_120] = 0.22;
      if (l_irsi_80 > 50.0 && l_imacd_48 > l_imacd_56 && l_iadx_64 > l_iadx_72) g_ibuf_132[li_120] = 0.47;
      if (l_irsi_80 < 50.0 && l_imacd_48 < l_imacd_56 && l_iadx_64 < l_iadx_72) g_ibuf_136[li_120] = 0.47;
      if (l_ima_0 > l_ima_24 && l_ima_8 < l_ima_32 && l_ima_16 > l_ima_40) g_ibuf_148[li_120] = 0.8;
      if (l_ima_0 < l_ima_24 && l_ima_8 > l_ima_32 && l_ima_16 < l_ima_40) g_ibuf_152[li_120] = 0.8;
   }
   return (0);
}
