//+------------------------------------------------------------------+
//|                                                       iTrend.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#property indicator_chart_window

#define SIGNAL_NONE 0
#define SIGNAL_BUY   1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4
//---- input parameters
extern string Lbl = "Choose color of text";
extern color lblcolor= White;
extern string Loc = "Choose corner placement";
extern string Loc2 = "0-TopLeft, 1-TopRight";
extern string Loc3 = "2-BottomLeft, 3-BottomRight";
extern int location = 1;
extern string ind1 = "stochastics h1";
extern int k_h = 8;
extern int sl_h = 3;
extern int d_h = 3;
extern string ind2 = "stochastics day";
extern int k_d = 8;
extern int sl_d = 3;
extern int d_d = 3;
extern string ind3 = "rsi";
extern int rsih = 13;
extern int rsid = 13;
extern string ind4 = "ma";
extern int ma1h = 5;
extern int ma2h = 8;
extern int ma1d = 5;
extern int ma2d = 8;
bool TickCheck = False;
extern bool EachTickMode = true;
//---- internal global 
int bar = 0;
int bard = 0;
int BarCount;
int Current;
string daily_direction;
string hour_direction;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
 {
   BarCount = Bars;

   if (EachTickMode) Current = 0; else Current = 1;

   return(0);
}
//+------------------------------------------------------------------+
//| Trend                                                         |
//+------------------------------------------------------------------+
int start() {
daily_direction=" ";
int yd=0;
string longl="LONG";
string shortl="SHORT";
string ntl="NO TRADE";
hour_direction=" ";
string sym[6]={"EURJPY","GBPUSD","GBPJPY","AUDJPY","EURCAD","GBPCHF"};
int s;
for(s=0; s<6; s++){
double bma1d = iMA(sym[s], 1440, ma1d, 0, 1, 0, Current + 1);
double bma2d = iMA(sym[s], 1440, ma2d, 0, 1, 1, Current + 1);
double sma1d = iMA(sym[s], 1440, ma1d, 0, 1, 0, Current + 1);
double sma2d = iMA(sym[s], 1440, ma2d, 0, 1, 1, Current + 1);
double bma1h = iMA(sym[s], 60, ma1h, 0, 1, 0, Current + 0);
double bma2h = iMA(sym[s], 60, ma2h, 0, 1, 1, Current + 0);
double sma1h = iMA(sym[s], 60, ma1h, 0, 1, 0, Current + 0);
double sma2h = iMA(sym[s], 60, ma2h, 0, 1, 1, Current + 0);


double bst1h = iStochastic(sym[s], 60, k_h, sl_h, d_h, MODE_SMA, 0, 0, Current + 0);
double bst2h = iStochastic(sym[s], 60, k_h, sl_h, d_h, MODE_SMA, 0, 1, Current + 0);
double bst1d = iStochastic(sym[s], 1440, k_d, sl_d, d_d, MODE_SMA, 0, 0, Current + 1);
double bst2d = iStochastic(sym[s], 1440, k_d, sl_d, d_d, MODE_SMA, 0, 1, Current + 1);

double sst1h = iStochastic(sym[s], 60, k_h, sl_h, d_h, MODE_SMA, 0, 0, Current + 0);
double sst2h = iStochastic(sym[s], 60, k_h, sl_h, d_h, MODE_SMA, 0, 1, Current + 0);
double sst1d = iStochastic(sym[s], 1440, k_d, sl_d, d_d, MODE_SMA, 0, 0, Current + 1);
double sst2d = iStochastic(sym[s], 1440, k_d, sl_d, d_d, MODE_SMA, 0, 1, Current + 1);

double bst1h2 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 0, Current + 3);
double bst2h2 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 1, Current + 3);
double bst1d2 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 0, Current + 3);
double bst2d2 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 1, Current + 3);

double sst1h2 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 0, Current + 3);
double sst2h2 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 1, Current + 3);
double sst1d2 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 0, Current + 3);
double sst2d2 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 1, Current + 3);

double bst1h21 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 0, Current + 2);
double bst2h21 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 1, Current + 2);
double bst1d21 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 0, Current + 2);
double bst2d21 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 1, Current + 2);

double sst1h21 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 0, Current + 2);
double sst2h21 = iStochastic(sym[s], 60, 8, 3, 3, MODE_SMA, 0, 1, Current + 2);
double sst1d21 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 0, Current + 2);
double sst2d21 = iStochastic(sym[s], 1440, 8, 3, 3, MODE_SMA, 0, 1, Current + 2);

double brsid = iRSI(sym[s], 1440, rsid, 0, Current + 1);
double brsild = 50;
double brsih = iRSI(sym[s], 60, rsih, 0, Current + 0);
double brsilh = 50;
double srsid = iRSI(sym[s], 1440, rsid, 0, Current + 1);
double srsild = 50;
double srsih = iRSI(sym[s], 60, rsih, 0, Current + 0);
double srsilh = 50;

double brsid2 = iRSI(sym[s], 1440, rsid, 0, Current + 1);
double brsild2 = 50;
double brsih2 = iRSI(sym[s], 60, rsih, 0, Current + 0);
double brsilh2 = 50;
double srsid2 = iRSI(sym[s], 1440, rsid, 0, Current + 1);
double srsild2 = 50;
double srsih2 = iRSI(sym[s], 60, rsih, 0, Current + 0);
double srsilh2 = 50;

double brsid21 = iRSI(sym[s], 1440, rsid, 0, Current + 1);
double brsild21 = 50;
double brsih21 = iRSI(sym[s], 60, rsih, 0, Current + 0);
double brsilh21 = 50;
double srsid21 = iRSI(sym[s], 1440, rsid, 0, Current + 1);
double srsild21 = 50;
double srsih21 = iRSI(sym[s], 60, rsih, 0, Current + 0);
double srsilh21 = 50;
   
if (bma1d > bma2d&&brsid > brsild&&bst1d > bst2d){
   daily_direction =longl;
   
     {

     }
   }
   if (bma1d < bma2d&&brsid > brsild&&bst1d > bst2d){
   daily_direction =ntl;
   
     {

     }
   }
      if (bma1d > bma2d&&brsid < brsild&&bst1d > bst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (bma1d > bma2d&&brsid > brsild&&bst1d < bst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (bma1d < bma2d&&brsid < brsild&&bst1d > bst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (bma1d < bma2d&&brsid > brsild&&bst1d < bst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (bma1d > bma2d&&brsid < brsild&&bst1d < bst2d){
   daily_direction =ntl;
   
     {

     }
   }
   if (sma1d < sma2d&&srsid < srsild&&sst1d < sst2d){
   daily_direction =shortl;
   
     {

     }
   }
      if (sma1d > sma2d&&srsid < srsild&&sst1d < sst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (sma1d < sma2d&&srsid > srsild&&sst1d < sst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (sma1d < sma2d&&srsid < srsild&&sst1d > sst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (sma1d > sma2d&&srsid > srsild&&sst1d < sst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (sma1d < sma2d&&srsid > srsild&&sst1d > sst2d){
   daily_direction =ntl;
   
     {

     }
   }
         if (sma1d > sma2d&&srsid < srsild&&sst1d > sst2d){
   daily_direction =ntl;
   
     {

     }
   }
   
   if (bma1h > bma2h&&brsih > brsilh&&bst1h > bst2h){
   hour_direction =longl;
  
     {

     }
   }
      if (bma1h < bma2h&&brsih > brsilh&&bst1h > bst2h){
   hour_direction =ntl;
  
     {

     }
   }
         if (bma1h > bma2h&&brsih < brsilh&&bst1h > bst2h){
   hour_direction =ntl;
  
     {

     }
   }
         if (bma1h > bma2h&&brsih > brsilh&&bst1h < bst2h){
   hour_direction =ntl;
  
     {

     }
   }
         if (bma1h < bma2h&&brsih < brsilh&&bst1h > bst2h){
   hour_direction =ntl;
  
     {

     }
   }
         if (bma1h > bma2h&&brsih < brsilh&&bst1h < bst2h){
   hour_direction =ntl;
  
     {

     }
   }
         if (bma1h < bma2h&&brsih > brsilh&&bst1h < bst2h){
   hour_direction =ntl;
  
     {

     }
   }
   if (sma1h < sma2h&&srsih < srsilh&&sst1h < sst2h){
   hour_direction =shortl;
   
     {

     }
   }
      if (sma1h > sma2h&&srsih < srsilh&&sst1h < sst2h){
   hour_direction =ntl;
   
     {

     }
   }
         if (sma1h < sma2h&&srsih > srsilh&&sst1h < sst2h){
   hour_direction =ntl;
   
     {

     }
   }
         if (sma1h < sma2h&&srsih < srsilh&&sst1h > sst2h){
   hour_direction =ntl;
   
     {

     }
   }
         if (sma1h > sma2h&&srsih > srsilh&&sst1h < sst2h){
   hour_direction =ntl;
   
     {

     }
   }
         if (sma1h < sma2h&&srsih > srsilh&&sst1h > sst2h){
   hour_direction =ntl;
   
     {

     }
   }
         if (sma1h > sma2h&&srsih < srsilh&&sst1h > sst2h){
   hour_direction =ntl;
   
     {

     }
   }
   yd=yd+20;
DrawObjects(sym[s],daily_direction,hour_direction,yd);


}
   return(0);
  }
//+------------------------------------------------------------------+

void DrawObjects(string symb, string daily_direction, string hour_direction,int yd){
string trdlbl="symb"+symb;
ObjectCreate(trdlbl,OBJ_LABEL,0,0,0,0);
ObjectSet(trdlbl,OBJPROP_CORNER,location);
ObjectSet(trdlbl,OBJPROP_YDISTANCE,yd);
ObjectSet(trdlbl,OBJPROP_XDISTANCE,10);
string objdesc= StringConcatenate(symb," daily = ",daily_direction," hourly = ",hour_direction);
ObjectSetText(trdlbl,objdesc,10,"Times New Roman",lblcolor);

yd=yd+20;
}