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

 
Aleksey Vyazmikin:

I am trying to reproduce the method suggested by you - where am I wrong?



We must understand that real trading has its pitfalls. From the point of view of mathematics and simple human logic, everything is beautiful.

But all will be enough just a glitch in the form of the appearance of one candle (which may then be erased) option not working ...

 
Darirunu:

You have to understand that real trading has its pitfalls. From the point of view of mathematics and simple human logic, everything is beautiful of course .

But all it will take is a glitch in the form of one candle (which may be wiped up later) and it's not working.


Just do not see the expected beauty ...

As for the glitches - everything cannot be foreseen - with the appearance of unplanned situations, an additional solution is sought - for the future.

 
Aleksey Vyazmikin:

I am trying to reproduce the method you suggested - where am I wrong?

1 Week2 Week3 Week4 Week5 Week1 Week2 Week3 Week4 Week5 Week
1 8 15 22 29 0 1 2 3 4
2 9 16 23 30 0 1 2 3 4
3 10 17 24 31 0 1 2 3 4
4 11 18 25 1 2 3 4
5 12 19 26 1 2 3 4
6 13 20 27 1 2 3 4
7 14 21 28 1 2 3 4

I did not understand the second half of the table.

The first half, as I understand it, assumes that the month started on Monday. Accordingly, all days from 1 to 7 inclusive are the first week, then everything makes sense. But we do not consider what week the specified number, but what Monday or Thursday in the month, the first or second or third. Suppose the 7th day is Wednesday, before that was another Wednesday in this month? No, so it is the first Wednesday of the month.

 
Darirunu:

Then add that it's not a bad idea to know trigonometry and drafting.

For the construction of any figures that are used in trading, it is desirable to know a thing or two about drafting, geometry, perhaps. Well, at least a little. But other than that... I made a reservation that one must be good at mathematics, but not necessarily at advanced mathematics. And philosophy might not be a bad thing either, to understand the strategy.

You can disagree with me and know nothing, but then you'll have to ask for help for every sneeze. And the willingness to help will dwindle with each such response to a hint. One less willing to help.

 
Alexey Viktorov:

I did not understand the second half of the table.

The first half, as I understand it, assumes that the month started on Monday. Accordingly all days from 1 to 7 inclusive the first week, then everything is logical. But we do not consider what week the specified number, but what Monday or Thursday in the month, the first or second or third. Suppose the 7th is Wednesday, before that was another Wednesday in this month? No, so it is the first Wednesday of the month.


Earlier you suggested dividing the date of the month by 7 and rounding, which is done in the second table.

I don't understand your algorithm.

Now here is what I am thinking:

1. Determine the day of the week of the first day of the month.

2. Find out how many days left to the end of the week (was Wednesday (3) to Monday 7-3 = 4).

3. The 5th day - the beginning of the second week

4. then in the loop, we are looking for a week, if the number falls within the range of 5 + 7 * x to 5 + 7 * (x +1), where x - number of week minus one, then we have found the week

But it's a bit complicated, maybe there's an easier way?

 
Darirunu:

This isn't a maths class, is it, or am I writing in the wrong place?

It's about programming and logic, not about handing out ready-made solutions.
 
Artyom Trishkin:
This is about programming and logic, not about handing out ready-made solutions.

I don't think anyone asked you to do anything... We are discussing a topic...

 

here is the answer https://www.mql5.com/ru/forum/110372

Как определить номер недели в месяце?
Как определить номер недели в месяце?
  • 2008.08.12
  • www.mql5.com
Собственно сабж. Просто че-то запарился уже придумывать алгоритм определения...
 
Darirunu:

I don't think anybody asked you to do anything. We're discussing a topic.

Are you absolutely sure I haven't already given you an answer?
And please don't be rude in my thread.
 
Darirunu:

I don't think anybody asked you to do anything. We're discussing a topic.

Artyom Trishkin:
You are absolutely sure that I have not given you the answer already?
And please, no need to be rude in my thread.

Artyom, ban him for a week and you'll be right.

Reason: