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

 
Artyom Trishkin:

It is not very nice and correct to give libraries as a training material for MQL5 - they give you zero knowledge. The libraries are necessary for those who already understand what's what.

What do you mean beautiful? Why do you apply this to the word library? there is a SB, I use it is not beautiful?

knowledge? I can write and write drivers under DOS, seems like a good knowledge, but under Windows I do not even know how to write drivers, but I use ready-made from WinAPI - I have no knowledge?

the man has programming experience, at least the questions are meaningful, I showed the code sections that look logical

;)

 

HistorySelect

Queriesthe history of trades and orders for the specified period of server time.

HistorySelect(
datetimefrom_date,// from date
datetimeto_date//to date
);

Parameters

from_date

[Initial date of the request.

to_date

[in] Request end date.

Returned value

Returns true if successful, otherwise false.


I've got such a trading function, it doesn't react in any way, it always returns false.

if(HistorySelect(0,TimeCurrent())

return(true);

 
Igor Makanu:

I asked this question too, unfortunately only a few people on the forum know the answer, here is the beginninghttps://www.mql5.com/ru/forum/6343/page1096#comment_12518595

here is the solutionhttps://www.mql5.com/ru/forum/6343/page1098#comment_12519819

this is the universal solution:https://www.mql5.com/ru/code/16006

Thanks, I'll have a look tomorrow...

 
Igor Makanu:

What do you mean beautiful? Why do you apply this to the word library? there is a SB, I use it is not beautiful?

knowledge? I can write and write drivers under DOS, seems like a good knowledge, but under Windows I do not even know how to write drivers, but I use ready-made from WinAPI - I have no knowledge?

the man has programming experience, at least the questions are meaningful, I showed the code sections that look logical

;)

Everything is relative, and everything looks "on the spot".

In this context, when a person asks a question on how to learn (discover!) this or that, we do not give him an explanation, but just a library - say, use it, and do not ask silly questions :)

Although, to be fair, there was a link to an example from fxsaber. That would have been enough.

And when we followed the example (rod) gives a huge cauldron with ready-made fish, smelling deliciously, and with a smoke, the result may be what? That's right - "why do I need to understand something, if I can connect it and not bother".

An SB is good to use. But if you know how to use it and don't know how to do anything else, it's bad. But we're not like that, are we? We first chew up all the knowledge we can, and with this weight on our shoulders we can afford to use the SB, while clearly understanding how it works, or if we want to - open it, look and understand everything.

Basic knowledge rules in general. That's what I meant.

 
//+------------------------------------------------------------------+
double LowPrice()
{
   double lowest = 1000000;
   
   for(int i=1; i<= BarCount;i++)
   {
      price = iLow(Symbol(),0,i);
      if(price <= lowest)
      lowest = price;
   }
   return(lowest);
}
//+------------------------------------------------------------------+
double HiPrice()
{
   double highest = 0;
   
   for(int i=1; i<= BarCount;i++)
   {
      price = iHigh(Symbol(),0,i);
      if(price >= highest)
      highest = price;
   }
   return(highest);
}
//+------------------------------------------------------------------+
double Zerro()
{  
   
}
//+------------------------------------------------------------------+

Good afternoon! can you please tell me how to write an average price function? Zerro. from maximum to minimum find the middle... I've written two functions but I'm having trouble finding the middle ... I need to somehow subtract this average from the minimum and add it to the maximum ... I mean not like this - (LowPrice() +HiPrice()) /2... but to pull out the value like this - (HiPrice() - LowPrice()) /2 = AAA... and then this variable could also be used further... --- LowPrice() - AAA, HiPrice + AAA....

 
Alex Pirate:

Good afternoon! can you please tell me how to write an average price function? Zerro. from maximum to minimum find the middle... I've written two functions but I'm having trouble finding the middle ... I need to somehow subtract this average from the minimum and add it to the maximum ... I mean not like this - (LowPrice() +HiPrice()) /2... but to pull out the value like this - ( HiPrice() - LowPrice()) /2 = AAA... and then this variable could also be used further... --- LowPrice() - AAA, HiPrice + AAA....

Everything is exactly as you wrote, except that the AAA variable should be assigned a value, not the other way around.

double ААА = (HiPrice() - LowPrice()) /2;

And then use that variable.

And why would you write your own function instead of using the regular one?

int  iHighest( 
   const string        symbol,              // символ 
   ENUM_TIMEFRAMES     timeframe,           // период 
   ENUM_SERIESMODE     type,                // идентификатор таймсерии 
   int                 count=WHOLE_ARRAY,   // число элементов 
   int                 start=0              // индекс 
  );
int  iLowest( 
   const string        symbol,              // символ 
   ENUM_TIMEFRAMES     timeframe,           // период 
   ENUM_SERIESMODE     type,                // идентификатор таймсерии 
   int                 count=WHOLE_ARRAY,   // число элементов 
   int                 start=0              // индекс 
  );
 
Alexey Viktorov:

Everything is exactly as you wrote, except that the AAA variable should be assigned a value, not the other way round.

And then use that variable.

And why would you write your own function instead of using the regular one

Thanks a lot!!! I wanted to do something similar as PivotPoint... so that it would determine the highs at the beginning of the day and already move something from the middle... but the distance is exactly what the average value is... Sometimes it goes twice as far if it hits a high or low...... interesting pattern...

 
Alex Pirate:

Thanks a lot!!! wanted to do something like PivotPoint... so that it would identify the highs at the beginning of the day and move something from the middle... but the distance is exactly what the average value is... Sometimes it goes twice as far if it hits a high or low...... interesting pattern...

Can you translate the highlighted into Russian?

 
Alexey Viktorov:

Can you translate the highlighted in Russian?

the price moves from the daily mean, in either direction exactly at this distance (AAA-MAX or AAA-MIN) (from the middle to the maximum. For example 50 points) or vice versa (from the middle to the minimum) ... and if the maximum or minimum is broken, then the same distance (50 points) falls or rises ... maybe even for these two values ... at (100 points), the screen is clearly visible ... So for this reason and tried to calculate this value. to determine exactly where to take profit

 
Alex Pirate:

The price moves from the daily average, in either direction exactly at this distance (AAA-MAX or AAA-MIN) (from the middle to the maximum. For example 50 points) or vice versa (from the middle to the minimum) ... and if the maximum or minimum is broken, then the same distance (50 points) is falling or rising ... maybe even for these two values ... at (100 points), the screen is clearly visible ... Just to try and calculate this value. To determine exactly where to take profit

If that's the case, what's the point of these self-written functions?

double minPrice = iLow(Symbol(),PERIOD_D1,1);
double maxPrice = iHigh(Symbol(),PERIOD_D1,1);

You've got the maximum and minimum prices of yesterday and define the middle point from these values.