//+------------------------------------------------------------------+
//                                           Genesis Set Candles.mq4 |
//                                                      derived from |
// S Sentiment
// E Emotion
// T Trend  (despite the name, this indicator is not used here ) 
//                                   Symphonie Set Candles V3.0.mq4 |
// Remap of indicators only 2012 08 11 Cody_R
//+------------------------------------------------------------------+
#property indicator_chart_window
//+------------------------------------------------------------------+
#property indicator_buffers 8
#property indicator_color1 C'0,90,255'
#property indicator_color2 Red
#property indicator_color3 C'0,90,255'
#property indicator_color4 Red
#property indicator_color5 Yellow
#property indicator_color6 Yellow
#property indicator_color7 Yellow
#property indicator_color8 Yellow
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 3
#property indicator_width4 3
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 3
#property indicator_width8 3
//+------------------------------------------------------------------+
double UpBody[];
double DownBody[];
double UpWick[];
double DownWick[];
double FlatOpen[];
double FlatClose[];
double FlatLow[];
double FlatHigh[];
//+------------------------------------------------------------------+
extern string    GannHiLo.Settings = "GHL Settings —————————————";
extern int       GannHiLo.Period   = 10;

extern string    T3_8.Settings     = " T3MA Settings ———————————";
extern int       T3_8.Period       = 8;
extern double    T3.b              = 0.618;
//+------------------------------------------------------------------+
int init()
   {
   IndicatorBuffers(8);
   //----
   SetIndexBuffer(0,UpWick);
   SetIndexBuffer(1,DownWick);
   SetIndexBuffer(2,UpBody);
   SetIndexBuffer(3,DownBody);
   SetIndexBuffer(4,FlatLow);
   SetIndexBuffer(5,FlatHigh);
   SetIndexBuffer(6,FlatOpen);
   SetIndexBuffer(7,FlatClose);
   //----
   for(int i = 7; i >= 0; i--) {SetIndexStyle(i, DRAW_HISTOGRAM); SetIndexDrawBegin(i, T3_8.Period);}
   //----
   IndicatorDigits(Digits);
   //----
   return(0);
   }
//+------------------------------------------------------------------+
int start()
   {
   if(Bars <= T3_8.Period) return(0);
   int CountedBars = IndicatorCounted();
   if (CountedBars < 0) return(-1);
   if (CountedBars > 0) CountedBars--;
   int i = MathMax(Bars - CountedBars - 1, T3_8.Period);
   //----
   while(i >= 0)
      {
      double SentimentValueUp = iCustom(NULL,0,"GannHiLo-Histo",GannHiLo.Period,0,i);
      double SentimentValueDn = iCustom(NULL,0,"GannHiLo-Histo",GannHiLo.Period,1,i);
      double EmotionValue0 = iCustom(NULL,0,"T3MA", T3_8.Period, T3.b, 0, i); 
      double EmotionValue1 = iCustom(NULL,0,"T3MA", T3_8.Period, T3.b, 0, i+1);
      
      //----
      UpBody[i]      = EMPTY_VALUE;
      DownBody[i]    = EMPTY_VALUE;
      UpWick[i]      = EMPTY_VALUE;
      DownWick[i]    = EMPTY_VALUE;
      FlatOpen[i]    = EMPTY_VALUE;
      FlatClose[i]   = EMPTY_VALUE;
      FlatHigh[i]    = EMPTY_VALUE;
      FlatLow[i]     = EMPTY_VALUE;
      //----
      if ((SentimentValueUp == 1.0) && (EmotionValue0 > EmotionValue1))
         {
         UpBody[i] = MathMax(Open[i], Close[i]);
         DownBody[i] = MathMin(Open[i], Close[i]);
         UpWick[i] = High[i];
         DownWick[i] = Low[i];
         if (UpBody[i] == DownBody[i]) UpBody[i] += Point;
         }
      else if ((SentimentValueDn == 1.0) && (EmotionValue0 < EmotionValue1))
         {
         UpBody[i] = MathMin(Open[i], Close[i]);
         DownBody[i] = MathMax(Open[i], Close[i]);
         UpWick[i] = Low[i];
         DownWick[i] = High[i];
         if (UpBody[i] == DownBody[i]) DownBody[i] += Point;
         }
      else
         {
         FlatOpen[i] = Open[i];
         FlatClose[i] = Close[i];
         FlatLow[i] = Low[i];
         FlatHigh[i] = High[i];
         if (FlatOpen[i] == FlatClose[i]) FlatOpen[i] += Point;
         }
      //----
      i--;
      }
      //----
      return(0);
   }
//+------------------------------------------------------------------+