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

 
Hi all, does anyone have an .exe file for metatrader 4? Exactly from the developers, not linked to any dc
 
a.lxrn:
Hi all, does anybody have an .exe file for metatrader 4? Exactly from the developers, not tied to any dc

the file is not bound, take metatrader.exe and metaeditorium.exe from any dtz and run it from a separate folder and set up the account. There is no 4ka installer on the website. But what is it for?

 
Igor Makanu:

Drop a fractal indicator and a test Expert Advisor with this function on the chart

and reprinter the found values passing them to my functionMODE_UPPER and MODE_LOWER

You need to remember the time of the bar, at the appearance of a new bar the numbering will change, and the open time of the bar is always constant

I.e., when you run my code, remember the time of the bar where the fractal was detected, then run it again, find the bar and compare the time of the bar with the remembered one - the time is different, it means a new fractal

I did it like this:

if((Hour()>=9 && Minute()==15) && Hour()<23)
   {
    Fun_New_Bar();
    if(New_Bar)      
     {
     barfrup_1 = GetLastFractals(1,MODE_UPPER);Alert("barfrup_1 = ",barfrup_1);
     barfrup_2 = GetLastFractals(barfrup_1+1,MODE_UPPER);Alert("barfrup_2 = ",barfrup_2);
     if(barfrup_1==3)
     {
      secondtime1=iTime(NULL,0,barfrup_1);;Alert("secondtime1 = ",secondtime1);
      secondprice1=iHigh(NULL,0,barfrup_1);Alert("secondprice1 = ",secondprice1);
      firsttime1=iTime(NULL,0,barfrup_2);Alert("firsttime1 = ",firsttime1);
      firstprice1=iHigh(NULL,0,barfrup_2);Alert("firstprice1 = ",firstprice1);
      //рисуем трендовую линию High
      ObjectCreate("HighLine",OBJ_TREND,0,firsttime1,firstprice1,secondtime1,secondprice1);
     }}}

Draws one line. If I add:

if(barfrup_1>3)  ObjectsDeleteAll();

It erases this line and that's it. What is wrong?

 
novichok2018:

I did it like this:

Draws one line. If I add:

it erases that line and that's it. What's wrong?

In one of your previous posts, you complained that you were not answered. Please remember how many times you were told to read the documentation and elementary questions will go away by themselves. This question is again from the series of "smoke the documentation", smoke carefully without missing a word or even a sentence.

Do you think you have a full namesake? So complete that your year and birthday match, not to mention your surname, first name and patronymic.

ObjectCreate - Графические объекты - Справочник MQL4
ObjectCreate - Графические объекты - Справочник MQL4
  • docs.mql4.com
[in]  Индекс окна, в которое будет добавлен объект. Окно должно существовать (индекс окна должен быть большим или равным 0 и меньшим, чем WindowsTotal()), иначе функция возвратит false. При использовании функции на собственном графике осуществляется прямой доступ к графику (как это всегда было в MQL4) и возврат true означает успешное создание...
 
novichok2018:

I did it like this:

Draws one line. If I add:

it erases that line and that's it. What's wrong?

read my first post, who will give the line a different name? or move the line

sketched out, quickly, it draws something, I do not understand, try to use this code to do your job

//+------------------------------------------------------------------+
//|                                                 FractalTrend.mq4 |
//|                                                            IgorM |
//|                              https://www.mql5.com/ru/users/igorm |
//+------------------------------------------------------------------+
#property copyright "IgorM"
#property link      "https://www.mql5.com/ru/users/igorm"
#property version   "1.00"
#property strict
#include <ChartObjects\ChartObjectsLines.mqh>
CChartObjectTrend *UPLine, *DNLine;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   delete UPLine;
   delete DNLine;
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   static datetime bar1 = 0;
   if(bar1 != Time[1])
   {
      delete UPLine;
      delete DNLine;
      int last_fractal = GetLastFractals(0, MODE_UPPER);
      int prev_fractal = GetLastFractals(last_fractal + 1, MODE_UPPER);
      UPLine = DrawTrendLine(MODE_UPPER, "UPLineFractal", prev_fractal, last_fractal, clrRed);
  
      last_fractal = GetLastFractals(0, MODE_LOWER);
      prev_fractal = GetLastFractals(last_fractal + 1, MODE_LOWER);
      DNLine = DrawTrendLine(MODE_LOWER, "DNLineFractal", prev_fractal, last_fractal, clrYellowGreen);
      bar1 = Time[1];
   }

}
//_______________________________________________________________________
CChartObjectTrend* DrawTrendLine(const int MODE, const string obj_name, const int bar2, const int bar1, const color clr)
{
   CChartObjectTrend *obj = new CChartObjectTrend;
   obj.Create(0, obj_name, 0, Time[bar2], MODE == MODE_UPPER ? High[bar2] : Low[bar2], Time[bar1], MODE == MODE_UPPER ? High[bar1] : Low[bar1]);
   obj.Color(clr);
   return obj;
}
//_______________________________________________________________________
int GetLastFractals(int bar, int mode) // bar - с какого бара начинать поиск, mode = MODE_UPPER или MODE_LOWER , результат № бара где найден фрактал
{
   int i = bar;
   while(i < Bars && iFractals(NULL, 0, mode, i) < _Point) i++;
   return(i);
}
//_______________________________________________________________________
 
Alexey Viktorov:

In one of your previous posts you complained about not getting an answer. Please remember how many times you were sent to read documentation and elementary questions will disappear by themselves. This question is again from the series of "smoke the documentation", smoke carefully without skipping words and even more so without skipping sentences.

Do you think you have a full namesake? So full that your year and birthday are the same, not to mention your surname, first name and patronymic.

Yes, I have long understood from your first "advice" to my questions that you are the toughest guy here, and to stoop to explaining what seems elementary to you is "out of place" for you. But you just can't help fluffing up your tail. Where else but in the newcomer's thread!

 
Igor Makanu:

read my first post, who will give the line a different name? or move the line

sketched, hastily, something draws, did not understand, try this code to do for your task

Thank you! I will keep digging.

 
novichok2018:

From your first "advice" to my questions, I have long understood that you are the toughest guy here, and it is "out of place" for you to stoop to explaining what seems elementary to you. But you just can't help fluffing up your tail. Where else but in a thread for newcomers!

Look, you can't be so ignorant that even these words

Unique object name.

in the documentation can't see or understand. That's exactly what I've been trying to tell you. But, apparently, to no avail. Next time I will try my best to say all what I think about you in a whisper. Some newbies stay newbies forever. That must be your fate. Saw, Shura, saw...

 

Gentlemen comrades@novichok2018 and@Alexey Viktorov, don't get too emotional! They are detrimental to constructive dialogue! ....

)))))))))))

 
Igor Makanu:

read my first post, who will give the line a different name? or move the line

sketched out, quickly, something draws, did not understand, try this code to do your task

Did so:

Fun_New_Bar();
    if(New_Bar)      
     {
     barfrup_1 = GetLastFractals(1,MODE_UPPER);Alert("barfrup_1 = ",barfrup_1);
     barfrup_2 = GetLastFractals(barfrup_1+1,MODE_UPPER);Alert("barfrup_2 = ",barfrup_2);
     if(barfrup_1==3)
     {
      secondtime1=iTime(NULL,0,barfrup_1);
      secondprice1=iHigh(NULL,0,barfrup_1);
      firsttime1=iTime(NULL,0,barfrup_2);
      firstprice1=iHigh(NULL,0,barfrup_2);
      //рисуем трендовую линию High
      ObjectCreate("HighLine",OBJ_TREND,0,firsttime1,firstprice1,secondtime1,secondprice1);
     }
      if(barfrup_1>3)  ObjectsDeleteAll();
      if(TimeCurrent()>secondtime1)
      {
      datetime Nsecondtime1=iTime(NULL,0,barfrup_1);
      double  Nsecondprice1=iHigh(NULL,0,barfrup_1);
      datetime Nfirsttime1=iTime(NULL,0,barfrup_2);
      double  Nfirstprice1=iHigh(NULL,0,barfrup_2);
      //рисуем новую трендовую линию High
      ObjectCreate("HighLine",OBJ_TREND,0,Nfirsttime1,Nfirstprice1,Nsecondtime1,Nsecondprice1);
      }
      }
 

In my opinion, it's simpler. It works fine on the history. I will check online on the demo, I think it will work too. Will it work for real since your experience?