I made one of these things once ... - page 2

 
Have you tried this approximation https://ru.wikipedia.org/wiki/Кубический_сплайн? It's a built-in function in Matcad. Sometimes it turns out very nice. I haven't even tried to program it in MQL (I know how slow-witted I am). If you do it, it would be interesting and if necessary I may help you compare matcad calculations to MQL code.
 
Prival:
Have you ever tried this approximation https://ru.wikipedia.org/wiki/Кубический_сплайн? It's a built-in function in Matkadec. Sometimes it turns out very nice. I haven't even tried to program it in MQL, since I'm not very handy. If you do it, it would be interesting and if necessary I may help you compare matcad calculations with those in MQL.

The point is that the approximation itself does not interest me too much, I am interested in the possibility of extrapolation. And it is desirable to see some physical meaning behind it. And splines don't seem to be designed for it. What physical sense can be behind splines?

By the way, we were on a first-name basis, weren't we?

 
Prival:
I haven't even tried to program it in MQL. Seeing your codes, I understand that you are good at it. If you suddenly do it, it would be interesting, and if you need help comparing matcad calculations and MQL code

Programming crankiness is simply not knowing a few simple rules for writing programs carefully. As soon as one understands them, the sloppiness disappears at once. By the way, this code suffers from sloppiness too - the body of the main called function must not contain computational code, for example loops and everything must be rolled up into functions.

 
Andrei01:

By the way, this code suffers from some crankiness too - the body of the main called function should not contain any computational code, e.g. loops and everything should be collapsed into a function.


Generally speaking, avoiding some of the rules that are correct for large projects can sometimes speed up a program. This is especially true for MQL, considering the specifics of the application. I can confess that I sometimes use more or less structured code for debugging and then change it back to linear code :). Although it's probably an extremism :).

But in this case I intended a quick "what-if" look, so it's linear code in its purest form.

 
Andrei01:

Programming crankiness is simply not knowing a few simple rules for writing programs carefully.

Bollocks.

As soon as one understands them, the sloppiness immediately disappears.

Bollocks.

The body of the main function to be called must not contain computational code

Why is that?

Candid:

One day I suddenly realised a simple thing: least-squares approximation essentially boils down to minimising a linear combination of vectors. That is, you can make some kind of universal approximator function. Said and done, here is the header of the function:

Where were you before? Just yesterday I finished writing the same thing, though in C++. Thanks, it'll come in handy too.

 
Candid:

Generally speaking, not using some of the rules that are correct for large projects can sometimes speed up a programme considerably. This is especially true for MQL, given the specifics of the application. I can confess that I sometimes use more or less structured code for debugging and then change it back to linear code :). That's probably an extremism though :).

In this case I intended a quick "what-if" look, so it's linear code in its purest form.

I agree that at the stage of debugging it is convenient to keep some fragments temporarily open... And in the final version you can unroll the whole code making it unreadable and insignificantly improve performance, but in practice code readability is always more important especially for further modification and search of bugs.

Besides, it's not the fact that collapsing into function will slow down the program noticeably - it's much better to optimize a calculation algorithm where many operations may be meaningless.

 
TheXpert:

1. Rubbish.

1. Bollocks.

2. Why is that?

1. Why is that bullshit? What is the basis for that conclusion?

2. The structure of a normally written program (of any degree of complexity) must be fully visible and readable in the main function.

If a programmer is clumsy and sloppy, he/she is unable to do that, which makes the program badly readable, including for the clumsy programmer himself/herself, which leads to further multiplication of clumsiness at any modernization and code modification.

 
Andrei01:

1 Why is this nonsense? What is the basis for that conclusion?

2. The structure of a normally written program (of any degree of complexity) must be fully visible and readable in the main function.

If a programmer is clumsy and sloppy, he is not able to do it, which makes the program badly readable, including for the clumsy programmer himself, which leads to further multiplication of clumsiness at any modernization and change of code.


Maybe you could do a master class instead of blaspheming others.

Usually, having said "A" you should also say "B".

 
Vinin:


Maybe you can show a master class instead of blaspheming others.

Usually you have to say "A" and you have to say "B".

What exactly are you interested in, could you specify? How to minimize code into a function so that the main function doesn't have calculation code scattered here and there?

 
TheXpert:
Gg :) what if you don't have this most important function? Anyway, no comment :)
Do you do without the main callable function start()? Haven't you heard anything about this function? :)
Reason: