Скачать MetaTrader 5

ПОМОГИТЕ !!!! переделать индиктор с MT4 под MT5.(бесплатно) - страница 9

Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий
Victor Ziborov
2876
Victor Ziborov  
o_o:

код запускается в МТ4/5

Pay It Forward

Olexiy Polyakov:

Люди помогите плизз переделать индикатор уровней круглых чисел с МТ4 под MT5. 

К сожалению оплатить работу не в состоянии. Если найдется добрый человек то буду сердечно благодарен. 

 


Этот индикатор:  Key_Levels.mq5   -  я его попробовал. Работает и в mq4 и в mq5. Очень удобно, нужно только менять расширение файлов. Только, при удалении этого индикатора с графика он не удаляет все нарисованные им горизонтальные линии. Пришлось добавить в mq4 такой код:

void OnDeinit(const int reason){ Comment(""); ObjectsDeleteAll(0,"Round"); }
dkd1193
30
dkd1193  

Всем привет. Помогите пожалуйста переделать индикатор, мой мозг слишком глуп для такой задачи (индикатор показывает название валютной пары и тайм фрейм на заднем фоне графика.)

p.s. шрифт текста "импакт"

спасибо заранее :)

//+------------------------------------------------------------------+
//|                                                    Watermark.mq4 |
//|                                          Copyright © M00SE  2011 |
//|                                                                  |
//|                      W A T E R M A R K                           |
//|                                                                  |
//| This indicator will display a symbol watermark on the chart      |
//| background, showing the timeframe and symbol name in large font. |
//|                                                                  |
//| Version 1 - 16 Jun 2011                                          |
//|                                                                  |
//|                                                                  |
//| Instructions                                                     |
//|                                                                  |
//| Choose the symbol you're interested in and display it in a chart |
//| window at the appropriate timeframe. Load the Watermark          |
//| indicator and optionally choose font, size, colour, position etc.|
//| Additionally you may choose to add some custom text of your own, |
//| eg. web link, email address etc. in a tag field.                 |
//|                                                                  |
//| That's it!                                                       |
//| Hope you like it, MOOSE.                                         |
//|                                                                  |
//+------------------------------------------------------------------+

#property copyright "Copyright © M00SE  2011"

#property indicator_chart_window

//---- input parameters
extern int sidFontSize = 140;
extern string sidFontName = "Ariel";
extern string NoteRedGreenBlue = "Red/Green/Blue each 0..255";
extern int sidRed = 30;
extern int sidGreen = 30;
extern int sidBlue = 30;
extern int sidXPos = 30;
extern int sidYPos = 150;

extern bool tagDisplayText = true;
extern string tagText = "[Your Name Here]";
extern int tagFontSize = 20;
extern string tagFontName = "Tahoma";
extern int tagRed = 60;
extern int tagGreen = 30;
extern int tagBlue = 60;
extern int tagXPos = 600;
extern int tagYPos = 550;

//---- data
string SID = "Symbol";
int sidRGB = 0;
string TAG = "Tag";
int tagRGB = 0;
string tf;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----

   switch(Period())
     {  
      case PERIOD_D1:
         tf="d1";
         break;
      case PERIOD_H1:
         tf="h1";
         break;
      case PERIOD_H4:
         tf="h4";
         break;
      case PERIOD_M1:
         tf="m1";
         break;
      case PERIOD_M15:
         tf="m15";
         break;
      case PERIOD_M30:
         tf="m30";
         break;
      case PERIOD_M5:
         tf="m5";
         break;
      case PERIOD_MN1:
         tf="mn1";
         break;
      case PERIOD_W1:
         tf="w1";
         break;
      default:
         tf="Unknown";
         break;
     }

     if(tagRed > 255 || tagGreen > 255  || tagBlue > 255 || sidRed > 255 || sidGreen > 255 || sidBlue > 255)
     {
       Alert("Watermark Red/Green/Blue components must each be in range 0..255");
     }   

     tagRGB = (tagBlue << 16); 
     tagRGB |= (tagGreen << 8);
     tagRGB |= tagRed;

     sidRGB = (sidBlue << 16); 
     sidRGB |= (sidGreen << 8);
     sidRGB |= sidRed;
      
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----

   ObjectDelete(SID);
   ObjectDelete(TAG);
   
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
   double chartHi, chartLo;
   double range;
   static double prevRange;
   
   chartHi = WindowPriceMax(0);
   chartLo = WindowPriceMin(0);
   range = chartHi - chartLo;

   // need only draw the watermark if the chart range has changed
   if(prevRange != range)
   {
      deinit();
      prevRange = range;
   
      watermark(SID, tf + Symbol(), sidFontSize, sidFontName, sidRGB, sidXPos, sidYPos);
      if(tagDisplayText && StringLen(tagText) > 0)
      {
         watermark(TAG, tagText, tagFontSize, tagFontName, tagRGB, tagXPos, tagYPos); 
      }
   }   
   return(0);
}

void watermark(string obj, string text, int fontSize, string fontName, color colour, int xPos, int yPos)
{
      ObjectCreate(obj, OBJ_LABEL, 0, 0, 0); 
      ObjectSetText(obj, text, fontSize, fontName, colour);
      ObjectSet(obj, OBJPROP_CORNER, 0); 
      ObjectSet(obj, OBJPROP_XDISTANCE, xPos); 
      ObjectSet(obj, OBJPROP_YDISTANCE, yPos);
      ObjectSet(obj, OBJPROP_BACK, true);
}
kostya96
7
kostya96  

ребят помогите переделать индикатор на мт5 пожалуйста сколько раз пробовал никак, был бы благодарен всю жизнь)

Aleksey Kremnev
11
Aleksey Kremnev  

Помогите переделать индикатор MTF Fractal MQL4 в MQL 5 


//+------------------------------------------------------------------+
//|                                                  MTF Fractal.mq4 |
//|                                         Copyright © 2014, TrueTL |
//|                                            http://www.truetl.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2014, TrueTL"
#property link      "http://www.truetl.com"
#property version "1.40"
#property indicator_chart_window
#property indicator_buffers 2

extern string  Version_140                      = "www.truetl.com";
extern int     Fractal_Timeframe                = 0;
extern int     Maxbar                           = 2000;
extern color   Up_Fractal_Color                 = Red;
extern int     Up_Fractal_Symbol                = 108;
extern color   Down_Fractal_Color               = Blue;
extern int     Down_Fractal_Symbol              = 108;
extern bool    Extend_Line                      = true;
extern bool    Extend_Line_to_Background        = true;
extern bool    Show_Validation_Candle           = true;
extern color   Up_Fractal_Extend_Line_Color     = Red;
extern int     Up_Fractal_Extend_Width          = 0;
extern int     Up_Fractal_Extend_Style          = 2;
extern color   Down_Fractal_Extend_Line_Color   = Blue;
extern int     Down_Fractal_Extend_Width        = 0;
extern int     Down_Fractal_Extend_Style        = 2;

double UpBuffer[], DoBuffer[], refchk, tempref, level;
int barc;

//+------------------------------------------------------------------+
//|                                                             INIT |
//+------------------------------------------------------------------+

int init() {

   SetIndexBuffer(0,UpBuffer);
   SetIndexStyle(0,DRAW_ARROW, DRAW_ARROW, 0, Up_Fractal_Color);
   SetIndexArrow(0,Up_Fractal_Symbol);
   SetIndexBuffer(1,DoBuffer);
   SetIndexStyle(1,DRAW_ARROW, DRAW_ARROW, 0, Down_Fractal_Color);
   SetIndexArrow(1,Down_Fractal_Symbol);
   
   return(0);
}

//+------------------------------------------------------------------+
//|                                                           DEINIT |
//+------------------------------------------------------------------+

int deinit() {
   for (int i = ObjectsTotal(); i >= 0; i--) {
      if (StringSubstr(ObjectName(i),0,12) == "MTF_Fractal_") {
         ObjectDelete(ObjectName(i));
      }
   }
   
   return(0);
}

//+------------------------------------------------------------------+
//|                                                            START |
//+------------------------------------------------------------------+

int start() {
   int i, c, dif;
   tempref =   iHigh(Symbol(), Fractal_Timeframe, 1) + 
               iHigh(Symbol(), Fractal_Timeframe, 51) + 
               iHigh(Symbol(), Fractal_Timeframe, 101);
   
   if (barc != Bars || IndicatorCounted() < 0 || tempref != refchk) {
      barc = Bars;
      refchk = tempref;
   } else
      return(0);
   
   deinit();
   
   if (Fractal_Timeframe <= Period()) Fractal_Timeframe = Period();
   
   dif = Fractal_Timeframe/Period();
   
   if (Maxbar > Bars) Maxbar = Bars-10;
   
   for(i = 0; i < Maxbar; i++) {
      if (iBarShift(NULL,Fractal_Timeframe,Time[i]) < 3) {
         UpBuffer[i] = 0;
         DoBuffer[i] = 0;
         continue;
      }
      UpBuffer[i] = iFractals(NULL,Fractal_Timeframe,1,iBarShift(NULL,Fractal_Timeframe,Time[i]));
      DoBuffer[i] = iFractals(NULL,Fractal_Timeframe,2,iBarShift(NULL,Fractal_Timeframe,Time[i]));
   }
   
   if (Extend_Line) {
      for(i = 0; i < Maxbar; i++) {
         if (UpBuffer[i] > 0) {
            level = UpBuffer[i];
            for (c = i; c > 0; c--) {
               if ((Open[c] < level && Close[c] > level) || (Open[c] > level && Close[c] < level)) 
                  break;
               if (Open[c] <= level && Close[c] <= level && Open[c-1] >= level && Close[c-1] >= level) 
                  break;
               if (Open[c] >= level && Close[c] >= level && Open[c-1] <= level && Close[c-1] <= level) 
                  break;
            }
            DrawLine ("H", i, c, level, Extend_Line_to_Background, Up_Fractal_Extend_Line_Color, Up_Fractal_Extend_Width, Up_Fractal_Extend_Style);
            if (Show_Validation_Candle) UpBuffer[i-2*dif] = level;
            i += dif;         
         }
      }
      
      for(i = 0; i < Maxbar; i++) {
         if (DoBuffer[i] > 0) {
            level = DoBuffer[i];
            for (c = i; c > 0; c--) {
               if ((Open[c] < level && Close[c] > level) || (Open[c] > level && Close[c] < level)) 
                  break;
               if (Open[c] <= level && Close[c] <= level && Open[c-1] >= level && Close[c-1] >= level) 
                  break;
               if (Open[c] >= level && Close[c] >= level && Open[c-1] <= level && Close[c-1] <= level) 
                  break;
            }
            DrawLine ("L", i, c, level, Extend_Line_to_Background, Down_Fractal_Extend_Line_Color, Down_Fractal_Extend_Width, Down_Fractal_Extend_Style);
            if (Show_Validation_Candle) DoBuffer[i-2*dif] = level;
            i += dif;
         }
      }
   }
   
   return(0);
}
//+------------------------------------------------------------------+
//|                                                        DRAW LINE |
//+------------------------------------------------------------------+

void DrawLine (string dir, int i, int c, double lev, bool back, color col, int width, int style) {
   ObjectCreate("MTF_Fractal_"+dir+i,OBJ_TREND,0,0,0,0,0);
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME1,iTime(Symbol(),Period(),i));
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE1,lev);
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME2,iTime(Symbol(),Period(),c));
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE2,lev);
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_RAY,0);
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_BACK,back);
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_COLOR,col);
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_WIDTH,width);
   ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_STYLE,style);
}
About TrueTL Indicators
  • TrueTL
  • www.truetl.com
Leader trading indicators for MT4 that draw trendlines, support/resistance levels and divergences automatically. Originally we made a trendline tracer script for ourselves in 2010. We've experienced wide interest, so we decided to create the True Trendline Indicator with some additional free and paid indicators for technical analysis. We keep...
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий