Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 752

 
Gentlemen, can you tell me where to find useful articles on working with buttons in Metatrader 4.
 
BillionerClub:
Gentlemen, can you tell me where to find useful articles on working with buttons in Metatrader 4.
Here.
OBJ_BUTTON - Типы объектов - Константы объектов - Константы, перечисления и структуры - Справочник MQL4
OBJ_BUTTON - Типы объектов - Константы объектов - Константы, перечисления и структуры - Справочник MQL4
  • docs.mql4.com
Следующий скрипт создает и перемещает на графике объект "Кнопка". Для создания и изменения свойств графического объекта написаны специальные функции, которые вы можете использовать "как есть" в своих собственных программах. //| Создает кнопку                                                   |               chart_ID=0,               ...
 
Alexey Viktorov:
Here.

Good afternoon programmers gurus, help fix the autofib.

1. I want to change the stretching of Fibo, not from 0, but from 100, i.e. the stretching has to start from the last HI to LOW and from LOW to HI and start stretching from 100 level to the bar behind the price, like in autofibo, but vice versa. If the fibo has stretched HI or LOW, the fibo is reversed and coloured, if it is difficult to colour, let it stay that way.
2. switch the price channel on and off.
3. The possibility to add and modify levels in the code and at each level the price should be indicated, we need the level 23.6 and other levels.
4. At the moment of placing an order in the Fibo grid, Fibo stops stretching; after the order is processed, Fibo is removed. After the order has been processed, fibo is deleted.New fibo starts stretching; it is turned in the opposite direction and colored in another colour.

I would like to ask you to mark in the code what you have changed.

File attached....


Thanks in advance.

#property link      "___"

#property  indicator_chart_window

#property indicator_buffers  2

#property  indicator_color1  LightSkyBlue

#property  indicator_color2  Plum

 
extern int       Band_Period   = 10;

extern int       price_type    = 0; // 0 = High/Low | 1 = Open/Close

 
//---- buffers

double WWBuffer1[];

double WWBuffer2[];

double WWBuffer3[];

double ATR;

int init() {

   IndicatorBuffers(2);


   SetIndexStyle(0,DRAW_LINE,1);

   SetIndexStyle(1,DRAW_LINE,1);
   

   SetIndexLabel(0, "High");

   SetIndexLabel(1, "Low");
   

   SetIndexBuffer(0, WWBuffer1);

   SetIndexBuffer(1, WWBuffer2);
   

   IndicatorDigits(Digits+2);

   
   IndicatorShortName("Automatic Fibonacci");

   
   ObjectCreate("AutoFibo", OBJ_FIBO, 0, Time[0],High[0],Time[0],Low[0]);
   

   return(0);

}

int deinit() {

   ObjectDelete("AutoFibo");

}

int start() {

   int    counted_bars=IndicatorCounted();

   int    limit,i;

   

   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;
   

   for(i=limit-1; i>=0; i--) {
 

      WWBuffer1[i] = getPeriodHigh(Band_Period,i);

      WWBuffer2[i] = getPeriodLow(Band_Period,i);
      

      ObjectSet("AutoFibo", OBJPROP_TIME1, Time[Band_Period]);

      ObjectSet("AutoFibo", OBJPROP_TIME2, Time[0]);

      if (Open[Band_Period] < Open[0]) { // Up

         ObjectSet("AutoFibo", OBJPROP_PRICE1, getPeriodHigh(Band_Period,i));

         ObjectSet("AutoFibo", OBJPROP_PRICE2, getPeriodLow(Band_Period,i));

      } else {

         ObjectSet("AutoFibo", OBJPROP_PRICE1, getPeriodLow(Band_Period,i));

         ObjectSet("AutoFibo", OBJPROP_PRICE2, getPeriodHigh(Band_Period,i));

      }


   }

   return(0);

}

 

double getPeriodHigh(int period, int pos) {

   int i;

   double buffer = 0;

   for (i=pos;i<=pos+period;i++) {

      if (price_type == 0) {

         if (High[i] > buffer) {

            buffer = High[i];

         }

      } else {

         if (Open[i] > Close[i]) { // Down

            if (Open[i] > buffer) {

               buffer = Open[i];

            }

         } else {

            if (Close[i] > buffer) {

               buffer = Close[i];

            }

         }

      }

   }

   return (buffer);

}

double getPeriodLow(int period, int pos) {

   int i;

   double buffer = 100000;

   for (i=pos;i<=pos+period;i++) {

      if (price_type == 0) {

         if (Low[i] < buffer) {

            buffer = Low[i];

         }

      } else {

         if (Open[i] > Close[i]) { // Down

            if (Close[i] < buffer) {

               buffer = Close[i];

            }

         } else {

            if (Open[i] < buffer) {

               buffer = Open[i];

            }

         }

      }

   }

   return (buffer);

}

Files:
AutoFibo.mq4  6 kb
 
Hello to all forum members.

Guys, please help me who is just starting to learn
programming basics in MQL4.MT4

I am interested in SendMail.

How to correctly write the code
When an EA reaches a specified percentage of the deposit drawdown,
The Expert Advisor will send one email.
Please help me, I really need it!

Thanks so much in advance.
 
Ruslan:
Hello to all forum members.

Guys, please help me who is just starting to learn
programming basics in MQL4.MT4

I am interested in SendMail.

How to correctly write the code
When an EA reaches a specified percentage of the deposit drawdown,
The Expert Advisor will send one email.
Please help me, I really need it!

Thanks so much in advance.
As soon as the deposit drawdown reaches the specified percentage, send a message to email.
 
Ruslan:
Hello to all forum members.

Guys, please help beginners to learn
programming basics in MQL4.MT4

I am interested in SendMail.

How to correctly write the code
When an EA reaches a specified percentage of the deposit drawdown,
The Expert Advisor will send one email.
Please help me, I really need it!

Thanks so much in advance.

Is your forum search not working?

Изменить скрипт
Изменить скрипт
  • 2018.02.20
  • www.mql5.com
Здравствуйте. Поскольку сам mql не знаю, кому не сложно, помогите пожалуйста чуть изменить скрипт...
 
Artyom Trishkin:
As soon as the deposit drawdown reaches the specified percentage, you send a message to email.
Artem could you write at least some example code, how it should look like?
 
Ruslan:
Artyom, maybe you could write at least some example code, how it should look like?
I could, but I won't. It's very simple. Read the help - it's very interesting.
 
Artyom Trishkin:
I could, but I won't. It's very simple. Read the help - it's very interesting.
When one is just starting to learn MQL, everything is not so easy for him, at least for me.
But thank you for such an answer.
 
Ruslan:
When one is just starting to learn MQL it's not so easy for them, at least for me.
But thank you for such an answer.
Everyone is a beginner. I have given advice for myself.
Reason: