Trendline 30M,2HR,8HR,Daily and Weekly Time intervals

MQL4 Indicadores

Termos de Referência

I need someone to add on some more time intervals to the Trendlines indicator. Currently its for the 5M,15M,1HR,4HR.

I need the 30M,2HR,8HR,Daily and Weekly added. Now i know on MT4 you don't actually have the 2HR and 8HR time interval but i have a time converter indicator. Nonethless thats the code below and i simply again just need the 30Min,2HR,8HR,Daily and Weekly added. Thanks a bunch.



//+------------------------------------------------------------------+
//|                                                   Trendlines.mq4 |
//|                                      Copyright © 2006, John Hitt |
//|                                           jhitt@kanji.dyndns.org |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, John Hitt"
#property link      "jhitt@kanji.dyndns.org"

#property indicator_chart_window

extern color H4_R=RoyalBlue;
extern color H4_S=FireBrick;
extern color H1_R=RoyalBlue;
extern color H1_S=FireBrick;
extern color M15_R=RoyalBlue;
extern color M15_S=FireBrick;

#define RESISTANCE 1
#define SUPPORT 2

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("H4_R");
   ObjectDelete("H4_S");
   ObjectDelete("H1_R");
   ObjectDelete("H1_S");
   ObjectDelete("M15_R");
   ObjectDelete("M15_S");
   ObjectDelete("M5_R");
   ObjectDelete("M5_S");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime currentbar = 0;
  
   if (currentbar != Time[0])
   {
      switch (Period())
      {
         case PERIOD_H4:
            Draw_H4_Trends();
            break;
         case PERIOD_H1:
            Draw_H4_Trends();
            Draw_H1_Trends();
            break;
         case PERIOD_M15:
            Draw_H1_Trends();
            Draw_M15_Trends();
            break;
         case PERIOD_M5:
            Draw_M15_Trends();
            break;
       }
   }  

   return(0);
  }


void Draw_M15_Trends()
{
   int sbar=0;
   int ebar=0;
   int i;
   double rate_array[][6];
  
   ArrayCopyRates(rate_array, Symbol(), PERIOD_M15);
  
   for (i=2; i < Bars; i++)
   {
      if (HigherHigh(i, 1, rate_array) == true)
      {
        //Print("HiherHigh: ", i);
        if (ebar == 0)
          ebar = i;
        else if (sbar == 0 && rate_array[i][3] > rate_array[ebar][3]) // use 3 for high
          sbar = i;
      }
      if (sbar !=0 && ebar !=0)
         break;
   }
   DrawTrendline ("M15_R", ebar, sbar, PERIOD_M15, RESISTANCE, rate_array);
 
   ebar = 0;
   sbar = 0;
  
   for (i=2; i < Bars; i++)
   {
      if (LowerLow(i, 1, rate_array) == true)
      {
        if (ebar == 0)
          ebar = i;
        else if (sbar == 0 && rate_array[i][2] < rate_array[ebar][2]) // use 2 for low
          sbar = i;
      }
      if (sbar !=0 && ebar !=0)
         break;
   }
   DrawTrendline ("M15_S", ebar, sbar, PERIOD_M15, SUPPORT, rate_array);

}

void Draw_H1_Trends()
{
   int sbar=0;
   int ebar=0;
   int i;
   double rate_array[][6];
  
   ArrayCopyRates(rate_array, Symbol(), PERIOD_H1);
  
   for (i=2; i < Bars; i++)
   {
      if (HigherHigh(i, 1, rate_array) == true)
      {
        //Print("HiherHigh: ", i);
        if (ebar == 0)
          ebar = i;
        else if (sbar == 0 && rate_array[i][3] > rate_array[ebar][3]) // use 3 for high
          sbar = i;
      }
      if (sbar !=0 && ebar !=0)
         break;
   }
   DrawTrendline ("H1_R", ebar, sbar, PERIOD_H1, RESISTANCE, rate_array);
 
   ebar = 0;
   sbar = 0;
  
   for (i=2; i < Bars; i++)
   {
      if (LowerLow(i, 1, rate_array) == true)
      {
        if (ebar == 0)
          ebar = i;
        else if (sbar == 0 && rate_array[i][2] < rate_array[ebar][2]) // use 2 for low
          sbar = i;
      }
      if (sbar !=0 && ebar !=0)
         break;
   }
   DrawTrendline ("H1_S", ebar, sbar, PERIOD_H1, SUPPORT, rate_array);

}

void Draw_H4_Trends()
{
   int sbar=0;
   int ebar=0;
   int i;
   double rate_array[][6];
  
   ArrayCopyRates(rate_array, Symbol(), PERIOD_H4);
  
   for (i=2; i < Bars; i++)
   {
      if (HigherHigh(i, 1, rate_array) == true)
      {
        //Print("HiherHigh: ", i);
        if (ebar == 0)
          ebar = i;
        else if (sbar == 0 && rate_array[i][3] > rate_array[ebar][3]) // use 3 for high
          sbar = i;
      }
      if (sbar !=0 && ebar !=0)
         break;
   }
   DrawTrendline ("H4_R", ebar, sbar, PERIOD_H4, RESISTANCE, rate_array);
 
   ebar = 0;
   sbar = 0;
  
   for (i=2; i < Bars; i++)
   {
      if (LowerLow(i, 1, rate_array) == true)
      {
        if (ebar == 0)
          ebar = i;
        else if (sbar == 0 && rate_array[i][2] < rate_array[ebar][2]) // use 2 for low
          sbar = i;
      }
      if (sbar !=0 && ebar !=0)
         break;
   }
   DrawTrendline ("H4_S", ebar, sbar, PERIOD_H4, SUPPORT, rate_array);
}

 bool HigherHigh (int point, int shift, double array[][6])
  {
    if (shift == 0)
     return (true);

    if (array[point][3] >= array[point+shift][3] && array[point][3] >= array[point-shift][3])
    {
      if (array[point][3] == array[point+shift][3] || array[point][3] == array[point-shift][3])
      {
        if ((point - shift - 1) == 0)
          return (false);
        if (array[point][3] > array[point+shift+1][3] && array[point][3] > array[point-shift-1][3])
          return (HigherHigh (point, shift-1, array));
        else
          return (false);
      } else {
        return (HigherHigh (point, shift-1, array));
      }
    }   
    else
      return (false);
  }
 
  bool LowerLow (int point, int shift, double array[][6])
  {
    if (shift == 0)
     return (true);
    
    if (array[point][2] <= array[point+shift][2] && array[point][2] <= array[point-shift][2])
    {
      if (array[point][2] == array[point+shift][2] || array[point][2] == array[point-shift][2])
      {
        if ((point-shift-1) == 0)
         return (false);
        if (array[point][2] < array[point+shift+1][2] && array[point][2] < array[point-shift-1][2])
          return(LowerLow (point, shift-1, array));
        else
          return (false);
      } else {
        return(LowerLow (point, shift-1, array));
      }
    }
    else
      return (false);
  }
 
 int GetRealPosition(int p1, double array[][6], int which, datetime value, double peak)
 {
   int i;
 
   for (i=0; i < Bars; i++)
   {
     if (array[i][0] == value || array[i][0] < value)
     {
        if (which == RESISTANCE)
        {
          if (array[i][3] == peak) return (i);
          if (array[i-1][3] == peak) return (i-1);
          if (array[i-2][3] == peak) return (i-2);
          if (array[i-3][3] == peak) return (i-3);
         } else {
          if (array[i][2] == peak) return (i);
          if (array[i-1][2] == peak) return (i-1);
          if (array[i-2][2] == peak) return (i-2);
          if (array[i-3][2] == peak) return (i-3);
         }
         if (array[i][0] < value) return (i);
     }
   }
   return (-1);
}
 
 int DrawTrendline (string name, int p1, int p2, int timeframe, int which, double r_array[][6])
 {
   color hue;
   int thickness = 1;
   int style = STYLE_DASH;
   double array[][6];
 
   ArrayCopyRates(array, Symbol(), Period());
   
   if (which == RESISTANCE)
   {
     hue = RoyalBlue;
     if (Period() != timeframe)
     {
       p1 = GetRealPosition(p1, array, which, r_array[p1][0], r_array[p1][3]);
       p2 = GetRealPosition(p2, array, which, r_array[p2][0], r_array[p2][3]);
     }
   }
   else
   {
     hue = FireBrick;
     if (Period() != timeframe)
     {
       p1 = GetRealPosition(p1, array, which, r_array[p1][0], r_array[p1][2]);
       p2 = GetRealPosition(p2, array, which, r_array[p2][0], r_array[p2][2]);
     }
   }
     
   switch(timeframe)
   {
      case PERIOD_H4:
         thickness = 2;
         style = STYLE_SOLID;
         if (which == RESISTANCE)
           hue = H4_R;
         else
           hue = H4_S;
         break;
      case PERIOD_H1:
         style = STYLE_SOLID;
         thickness = 1;
         if (which == RESISTANCE)
           hue = H1_R;
         else
           hue = H1_S;
         break;
      case PERIOD_M15:
         style = STYLE_DASHDOTDOT;
         thickness = 1;
         if (which == RESISTANCE)
           hue = M15_R;
         else
           hue = M15_S;
         break;
   }
  
   if (ObjectFind(name) < 0)
   {
     if (which == SUPPORT)
       ObjectCreate(name, OBJ_TREND, 0, array[p2][0], array[p2][2], array[p1][0], array[p1][2]);
     else
       ObjectCreate(name, OBJ_TREND, 0, array[p2][2], array[p2][3], array[p1][0], array[p1][3]);
      
     ObjectSet(name, OBJPROP_COLOR, hue);
     ObjectSet(name, OBJPROP_RAY, true);
     ObjectSet(name, OBJPROP_BACK, true);
     ObjectSet(name, OBJPROP_WIDTH, thickness);
     ObjectSet(name, OBJPROP_STYLE, style);
   }
  
   if (which == SUPPORT)
   { // Lows (0 == Time)
     ObjectMove (name, 0, array[p2][0], array[p2][2]);
     ObjectMove (name, 1, array[p1][0], array[p1][2]); 
   }
   else
   { // Highs
     ObjectMove (name, 0, array[p2][0], array[p2][3]);
     ObjectMove (name, 1, array[p1][0], array[p1][3]);  
   }
  
   ObjectsRedraw();
   return(0);
 }

Respondido

1
Desenvolvedor 1
Classificação
(468)
Projetos
703
56%
Arbitragem
45
29% / 31%
Expirado
115
16%
Trabalhando
2
Desenvolvedor 2
Classificação
(807)
Projetos
1382
72%
Arbitragem
113
29% / 48%
Expirado
343
25%
Carregado
3
Desenvolvedor 3
Classificação
(90)
Projetos
159
61%
Arbitragem
40
18% / 63%
Expirado
70
44%
Livre
4
Desenvolvedor 4
Classificação
(118)
Projetos
201
42%
Arbitragem
44
9% / 68%
Expirado
47
23%
Livre
5
Desenvolvedor 5
Classificação
(339)
Projetos
809
73%
Arbitragem
30
33% / 37%
Expirado
194
24%
Livre
6
Desenvolvedor 6
Classificação
(169)
Projetos
218
50%
Arbitragem
6
17% / 67%
Expirado
11
5%
Livre
7
Desenvolvedor 7
Classificação
(47)
Projetos
140
49%
Arbitragem
9
56% / 0%
Expirado
27
19%
Livre
8
Desenvolvedor 8
Classificação
(273)
Projetos
395
63%
Arbitragem
70
53% / 26%
Expirado
198
50%
Livre
9
Desenvolvedor 9
Classificação
(62)
Projetos
140
46%
Arbitragem
19
42% / 16%
Expirado
32
23%
Livre
10
Desenvolvedor 10
Classificação
(7)
Projetos
15
47%
Arbitragem
6
33% / 17%
Expirado
4
27%
Livre
11
Desenvolvedor 11
Classificação
(13)
Projetos
20
30%
Arbitragem
5
20% / 80%
Expirado
5
25%
Livre
12
Desenvolvedor 12
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
13
Desenvolvedor 13
Classificação
Projetos
5
40%
Arbitragem
0
Expirado
0
Livre
Pedidos semelhantes
Hello, I have a protected Ninja trader Order Flow indicator and I was wondering if you can reverse engineer it to replicate the functionality. H ere are the specifications and indicator: https://docs.google.com/document/d/1KyYwQ7iTL2KWGhnZzxS1gObccu9LPMrGuMc9Mdk_3KY/edit?usp=sharing
I have an EA that need some changes including integrating the indicator code directly into the Expert Advisor. I will give the detailed doc once we settle on the candidate for the job . Please bid if you can work with the stated amount. Thanks
Hello, Need to convert Tradingview Indicator to MQL4 indicator. or if you have this one converted already, let me buy a copy please. If we're good, then will definitely buy it and ask to convert into EA on new order. Supertrend by KivancOzbilgic
Fix bug or modify an existing Trading view indicator to display correct. The indicator is working but not displaying/plotting all the information i want. So i want it adjusted to plot all the info
Here's a brief requirement you can use: **Description:** I am seeking an experienced MQL5 developer to create a (EA). The EA should include features for placing pending orders (Buy Stop and Sell Stop) based on market spread, managing trades effectively at the opening of new candlesticks, and implementing take profit and stop loss strategies. Additionally, I would like the option to adjust parameters based on market
I have an EA which i need to do below modifications. Variable Inputs to be added Order Type : Market , Pending Trade Type : Buy, Sell , Buy & Sell Pending Pips Step : ( Pips Value can be negative or positive to decide on what type of Pending Order ) // If trade type Buy is selected Close Type : Close All ( Bulk Close Option in MT5 ) , Close Individually Close Option : %of Equity , %of Balance , Amount $ , %of No
Add multiplier to grid recovery system. For example: Grid Trade 2-3 Spacing; 1.0 Multiplier Grid Trade 4-6 Spacing; 2.0 Multiplier Grid Trade 7+ Spacing; 1.6 Multiplier Need quick turn around. Need it done ASAP
Objects reader PIN 70 - 100 USD
Hi I have an indicator that create objects in the chart and using those following some rules the new indicator will create external global variables with value = 0 ( NONE ), = 1 ( BUY ) or = 2 ( SELL ). The global variable will use PIN external integer number . PINS are by now global variables (GV) whose name indicates the pair name and the PIN belonging and their value indicates it direction/action. PINS GV names
I want an indicator and its source code that returns the value of: - two moving averages in different selectable timeframes, with method Exponential and price calculation price_open; - Opening, closing, maximum and minimum of the candle in different timeframes And that returns the values ​​regardless in a chart of one minute. The input parameters: * select timeframe media1 = {1,2,3,4,5,...} * select timeframe media2
Hello, I want offline Renko chart based on pips and time. Trading View Renko chart is a perfect example of what I require, it prints renko bricks at close of time frame chosen which is more cleaner. The Trading View Renko chart wait until end of desired timeframe candle to close before final renko bricks are drawn. Best is to look at Trading View renko charts to see exactly how this works. I currently have an

Informações sobre o projeto

Orçamento
10 - 15 USD
Desenvolvedor
9 - 13.5 USD
Prazo
de 1 para 3 dias