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

MQL4 Göstergeler

İş Gereklilikleri

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);
 }

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(468)
Projeler
703
56%
Arabuluculuk
45
29% / 31%
Süresi dolmuş
115
16%
Çalışıyor
2
Geliştirici 2
Derecelendirme
(807)
Projeler
1382
72%
Arabuluculuk
113
29% / 48%
Süresi dolmuş
343
25%
Yüklendi
3
Geliştirici 3
Derecelendirme
(90)
Projeler
159
61%
Arabuluculuk
40
18% / 63%
Süresi dolmuş
70
44%
Serbest
4
Geliştirici 4
Derecelendirme
(118)
Projeler
201
42%
Arabuluculuk
44
9% / 68%
Süresi dolmuş
47
23%
Serbest
5
Geliştirici 5
Derecelendirme
(339)
Projeler
809
73%
Arabuluculuk
30
33% / 37%
Süresi dolmuş
194
24%
Serbest
6
Geliştirici 6
Derecelendirme
(169)
Projeler
218
50%
Arabuluculuk
6
17% / 67%
Süresi dolmuş
11
5%
Serbest
7
Geliştirici 7
Derecelendirme
(47)
Projeler
140
49%
Arabuluculuk
9
56% / 0%
Süresi dolmuş
27
19%
Serbest
8
Geliştirici 8
Derecelendirme
(273)
Projeler
395
63%
Arabuluculuk
70
53% / 26%
Süresi dolmuş
198
50%
Serbest
9
Geliştirici 9
Derecelendirme
(62)
Projeler
140
46%
Arabuluculuk
19
42% / 16%
Süresi dolmuş
32
23%
Serbest
10
Geliştirici 10
Derecelendirme
(7)
Projeler
15
47%
Arabuluculuk
6
33% / 17%
Süresi dolmuş
4
27%
Serbest
11
Geliştirici 11
Derecelendirme
(13)
Projeler
20
30%
Arabuluculuk
5
20% / 80%
Süresi dolmuş
5
25%
Serbest
12
Geliştirici 12
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
13
Geliştirici 13
Derecelendirme
Projeler
5
40%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Benzer siparişler
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

Proje bilgisi

Bütçe
10 - 15 USD
Geliştirici için
9 - 13.5 USD
Son teslim tarihi
from 1 to 3 gün