m- candle umprogrammieren

 

Hallo MQL Team,

Kann mir irgendjemand helfen bei der umprogrammierung des M- Candle Indikators?

Im Code steht: 60 für Stunde - 43200 für Monat. Wenn ich 129600 für 3 Monatskerzen ( Quartal) eingebe zeigt er nichts an. Das gleich gilt für das Jahr.

Kann mir jemand einen Tipp geben was ich da falch mache?

Danke im voraus.

 
MAG298:

Hallo MQL Team,

Kann mir irgendjemand helfen bei der umprogrammierung des M- Candle Indikators?

Im Code steht: 60 für Stunde - 43200 für Monat. Wenn ich 129600 für 3 Monatskerzen ( Quartal) eingebe zeigt er nichts an. Das gleich gilt für das Jahr.

Kann mir jemand einen Tipp geben was ich da falch mache?

Danke im voraus.

der Baum vor meinem Büro hat keine Blätter mehr, daher kann ich den Code so schwer lesen

 

//+------------------------------------------------------------------+
//|                                                    M-Candles.mq4 |
//|         оригинальная идея для H1 и выше - Ким Игорь В. aka KimIV |
//|                                              http://www.kimiv.ru |
//|            Переписал для стандартных таймфреймов - Михаил Житнев |
//|                                                    ICQ 138092006 |
//|         2008.09.05  На любом графике показывает свечи старших ТФ |
//+------------------------------------------------------------------+
#property copyright "Житнев Михаил aka MikeZTN"
#property link      "ICQ 138092006"

#property indicator_chart_window

//------- Внешние параметры ------------------------------------------
extern int TFBar       = 240;           // Период старших свечек
extern int NumberOfBar = 100;           // Количество старших свечек
extern color ColorUp   = 0x003300;      // Цвет восходящей свечи
extern color ColorDown = 0x000033;      // Цвет нисходящей свечи

//------- Глобальные переменные --------------------------------------

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() {
  int i;

  for (i=0; i<NumberOfBar; i++) {
    ObjectDelete("BodyTF"+TFBar+"Bar"+i);
    ObjectDelete("ShadowTF"+TFBar+"Bar" + i);
  }
  for (i=0; i<NumberOfBar; i++) {
    ObjectCreate("BodyTF"+TFBar+"Bar"+i, OBJ_RECTANGLE, 0, 0,0, 0,0);
    ObjectCreate("ShadowTF"+TFBar+"Bar"+i, OBJ_TREND, 0, 0,0, 0,0);
  }
  Comment("");
}

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() {
  // Удаление объектов
  for (int i=0; i<NumberOfBar; i++) {
    ObjectDelete("BodyTF"+TFBar+"Bar"+i);
    ObjectDelete("ShadowTF"+TFBar+"Bar" + i);
  }
  Comment("");
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  int shb=0, sh1=1, d;
  double   po, pc;       // Цены открытия и закрытия старших свечек
  double   ph=0, pl=500; // Цены хай и лоу старших свечек
  datetime to, tc, ts;   // Время открытия, закрытия и теней старших свечек

  
  bool OK_Period=false;  
  switch (TFBar)
  {    
    case 1:OK_Period=true;break;
    case 5:OK_Period=true;break;
    case 15:OK_Period=true;break;
    case 30:OK_Period=true;break;
    case 60:OK_Period=true;break;
    case 240:OK_Period=true;break;
    case 1440:OK_Period=true;break;
    case 10080:OK_Period=true;break;
    case 43200:OK_Period=true;break;
  }
  if (OK_Period==false)
     {
       Comment("Вы ввели нестандартную цифру таймфрейма TFBar! Необходимо ввести одну из следующих: 1,5,15,30,60,240,1440 и т.д.");  
       return(0);
     }
  if (Period()>TFBar)
  {
    Comment("Задаваемый стандартный период должен быть больше текущего! (Текущий равен " + Period() + ")");
    return(0);
  }
    
    shb=0;
    // Бежим по старшим свечкам  
    while (shb<NumberOfBar)
    {
      to = iTime(Symbol(), TFBar, shb);
      tc = iTime(Symbol(), TFBar, shb) + TFBar*60;
      po = iOpen(Symbol(), TFBar, shb);
      pc = iClose(Symbol(), TFBar, shb);
      ph = iHigh(Symbol(), TFBar, shb);
      pl = iLow(Symbol(), TFBar, shb);
      //устанавливаем  ректангелы
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_TIME1, to);  //время открытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_PRICE1, po); //цена открытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_TIME2, tc);  //время закрытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_PRICE2, pc); //цена закрытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_BACK, True);
      //устанавливаем тени
      ts = to + MathRound((TFBar*60)/2);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_TIME1, ts);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_PRICE1, ph);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_TIME2, ts);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_PRICE2, pl);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_WIDTH, 3);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_BACK, True);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_RAY, False);            
      //устанавливаем цвета для всех объектов
      if (po<pc) {
          ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorUp);
          ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorUp);
        } else {
          ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorDown);
          ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorDown);
        }
      shb++;
     }      
      
  
  return(0);
}
//+------------------------------------------------------------------+
 
amando:

der Baum vor meinem Büro hat keine Blätter mehr, daher kann ich den Code so schwer lesen



//+------------------------------------------------------------------+
//|                                                    M-Candles.mq4 |
//|         оригинальная идея для H1 и выше - Ким Игорь В. aka KimIV |
//|                                              http://www.kimiv.ru |
//|            Переписал для стандартных таймфреймов - Михаил Житнев |
//|                                                    ICQ 138092006 |
//|         2008.09.05  На любом графике показывает свечи старших ТФ |
//+------------------------------------------------------------------+
#property copyright "Житнев Михаил aka MikeZTN"
#property link      "ICQ 138092006"

#property indicator_chart_window

//------- Внешние параметры ------------------------------------------
extern int TFBar       = 240;           // Период старших свечек
extern int NumberOfBar = 100;           // Количество старших свечек
extern color ColorUp   = 0x003300;      // Цвет восходящей свечи
extern color ColorDown = 0x000033;      // Цвет нисходящей свечи

//------- Глобальные переменные --------------------------------------

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() {
  int i;

  for (i=0; i<NumberOfBar; i++) {
    ObjectDelete("BodyTF"+TFBar+"Bar"+i);
    ObjectDelete("ShadowTF"+TFBar+"Bar" + i);
  }
  for (i=0; i<NumberOfBar; i++) {
    ObjectCreate("BodyTF"+TFBar+"Bar"+i, OBJ_RECTANGLE, 0, 0,0, 0,0);
    ObjectCreate("ShadowTF"+TFBar+"Bar"+i, OBJ_TREND, 0, 0,0, 0,0);
  }
  Comment("");
}

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() {
  // Удаление объектов
  for (int i=0; i<NumberOfBar; i++) {
    ObjectDelete("BodyTF"+TFBar+"Bar"+i);
    ObjectDelete("ShadowTF"+TFBar+"Bar" + i);
  }
  Comment("");
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  int shb=0, sh1=1, d;
  double   po, pc;       // Цены открытия и закрытия старших свечек
  double   ph=0, pl=500; // Цены хай и лоу старших свечек
  datetime to, tc, ts;   // Время открытия, закрытия и теней старших свечек

  
  bool OK_Period=false;  
  switch (TFBar)
  {    
    case 1:OK_Period=true;break;
    case 5:OK_Period=true;break;
    case 15:OK_Period=true;break;
    case 30:OK_Period=true;break;
    case 60:OK_Period=true;break;
    case 240:OK_Period=true;break;
    case 1440:OK_Period=true;break;
    case 10080:OK_Period=true;break;
    case 43200:OK_Period=true;break;
  }
  if (OK_Period==false)
     {
       Comment("Вы ввели нестандартную цифру таймфрейма TFBar! Необходимо ввести одну из следующих: 1,5,15,30,60,240,1440 и т.д.");  
       return(0);
     }
  if (Period()>TFBar)
  {
    Comment("Задаваемый стандартный период должен быть больше текущего! (Текущий равен " + Period() + ")");
    return(0);
  }
    
    shb=0;
    // Бежим по старшим свечкам  
    while (shb<NumberOfBar)
    {
      to = iTime(Symbol(), TFBar, shb);
      tc = iTime(Symbol(), TFBar, shb) + TFBar*60;
      po = iOpen(Symbol(), TFBar, shb);
      pc = iClose(Symbol(), TFBar, shb);
      ph = iHigh(Symbol(), TFBar, shb);
      pl = iLow(Symbol(), TFBar, shb);
      //устанавливаем  ректангелы
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_TIME1, to);  //время открытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_PRICE1, po); //цена открытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_TIME2, tc);  //время закрытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_PRICE2, pc); //цена закрытия
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_BACK, True);
      //устанавливаем тени
      ts = to + MathRound((TFBar*60)/2);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_TIME1, ts);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_PRICE1, ph);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_TIME2, ts);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_PRICE2, pl);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_WIDTH, 3);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_BACK, True);
      ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_RAY, False);            
      //устанавливаем цвета для всех объектов
      if (po<pc) {
          ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorUp);
          ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorUp);
        } else {
          ObjectSet("BodyTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorDown);
          ObjectSet("ShadowTF"+TFBar+"Bar"+shb, OBJPROP_COLOR, ColorDown);
        }
      shb++;
     }      
      
  
  return(0);
}
//+------------------------------------------------------------------+
 
Kann nichts passieren, da gehts nur um die umrechnung. 43xxx ist der monatschart, mehr als monatschart gibts im mt4 nicht
 
amando:
Kann nichts passieren, da gehts nur um die umrechnung. 43xxx ist der monatschart, mehr als monatschart gibts im mt4 nicht
Danke, schade das es nicht funktioniert. Obwohl es geheißen hat man muss es nur umprogrammieren. Ich hab auch einen Jahresindikator gefunden. Leider kann ich den auch nicht auf das Quartal umstellen. Da steht bei Timewick 7*60*43200. Wie man da auf 1ne Jahreskerze kommt? Keine Ahnung. Andere Werte eingeben hat auch keinen Sinn. Es ändert sich nur Docht und Lunte.
 
amando:
Kann nichts passieren, da gehts nur um die umrechnung. 43xxx ist der monatschart, mehr als monatschart gibts im mt4 nicht
//+------------------------------------------------------------------+
//|                                                  Heiken Ashi.mq4 |
//|                      Copyright c 2004, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//|                        INDONESIA RAYA                            |
//| For Heiken Ashi we recommend next chart settings ( press F8 or   |
//| select on menu 'Charts'->'Properties...'):                       |
//|  - On 'Color' Tab select 'Black' for 'Line Graph'                |
//|  - On 'Common' Tab disable 'Chart on Foreground' checkbox and    |
//|    select 'Line Chart' radiobutton                               |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
//----
int ExtCountedBars=0;


extern color  colorUp = SteelBlue;
extern color  colorDown = Red;

int data = 1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|
int init()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   ObjectsDeleteAll(0,"Yearly");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   if(data != 1) return(0);
   double haOpen, haHigh, haLow, haClose;
   if(Bars<=10) return(0);
   ExtCountedBars=IndicatorCounted();
//---- check for possible errors
   if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
   if (ExtCountedBars>0) ExtCountedBars--;
   int pos=Bars-ExtCountedBars-1;
   int i;
  
   datetime startmonth = Time[pos];
   datetime endmonth;
   datetime timewick;

   int firstyear = TimeYear(Time[pos]);
   int thisyear  = TimeYear(TimeCurrent());
   int year      = thisyear - firstyear;
   int yeardummy = year;
  
   int theyear;
   int yeartemp;
  
  
  
   for(i=thisyear; i>= firstyear; i--)
      {
       ObjectCreate("Yearly Body"+i,      OBJ_RECTANGLE, 0, 0,0, 0,0);
       ObjectCreate("Yearly Shadow Up"+i, OBJ_TREND, 0, 0,0, 0,0);
       ObjectCreate("Yearly Shadow Dn"+i, OBJ_TREND, 0, 0,0, 0,0);
      }

   while(pos>=0)
        {
         theyear    = TimeYear(Time[pos]);
         haOpen     = Open[pos];
         haClose    = haOpen;
         haHigh     = haOpen;
         haLow      = haOpen;
         startmonth = Time[pos];
         timewick   = Time[pos] + 7 * 60 * 43200;

         while(theyear == TimeYear(Time[pos]))
              {
               haHigh   = MathMax(haHigh, High[pos]);
               haLow    = MathMin(haLow,  Low[pos]) ;
               haClose  = Close[pos];
               yeartemp = theyear;
               endmonth = Time[pos];
               pos--;
              }       
         
      ObjectSet("Yearly Body"+yeartemp, OBJPROP_TIME1,  startmonth);
      ObjectSet("Yearly Body"+yeartemp, OBJPROP_PRICE1, haOpen);
      ObjectSet("Yearly Body"+yeartemp, OBJPROP_TIME2,  endmonth);
      ObjectSet("Yearly Body"+yeartemp, OBJPROP_PRICE2, haClose);
      ObjectSet("Yearly Body"+yeartemp, OBJPROP_STYLE,  STYLE_SOLID);
      ObjectSet("Yearly Body"+yeartemp, OBJPROP_WIDTH,  2);
     
      ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_TIME1,  timewick);
      ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_PRICE1, haHigh);
      ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_TIME2,  timewick);
      ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_PRICE2, MathMax(haOpen,haClose));
      ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_STYLE,  STYLE_SOLID);
      ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_WIDTH,  4);
      ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_RAY,    False);           
 
      ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_TIME1,  timewick);
      ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_PRICE1, MathMin(haOpen,haClose));
      ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_TIME2,  timewick);
      ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_PRICE2, haLow);
      ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_STYLE,  STYLE_SOLID);
      ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_WIDTH,  4);
      ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_RAY,    False);           


      if(haOpen < haClose)
        {
         ObjectSet("Yearly Body"     +yeartemp, OBJPROP_COLOR, colorUp);
         ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_COLOR, colorUp);
         ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_COLOR, colorUp);
        }
      else
        {
          ObjectSet("Yearly Body"     +yeartemp, OBJPROP_COLOR, colorDown);
          ObjectSet("Yearly Shadow Up"+yeartemp, OBJPROP_COLOR, colorDown);
          ObjectSet("Yearly Shadow Dn"+yeartemp, OBJPROP_COLOR, colorDown);
        }

           yeardummy--;
        }
//----
   data = 2;
   return(0);
  }
//+------------------------------------------------------------------+
MetaQuotes Software Corp.
MetaQuotes Software Corp.
  • www.metaquotes.net
Millions of traders and hundreds of brokers cannot be wrong — they have chosen MetaTrader 5 for trading Forex and financial markets! Learn more
 
Hatt den wirklich niemand einen Tipp was mann da ändern könnte?
Grund der Beschwerde: