Machine learning in trading: theory, models, practice and algo-trading - page 1861

 
Maxim Kuznetsov:

initially the counter (in the stack) equals 1

for each line in the file :

you count the number of "|" sticks at the beginning of the line, ignoring spaces (and decorators "-") and up to the first letter/digit

if more than the counter, it's { and the counter is incremented

if less then } and decreased

---

add error handling and loop exit to taste

something like this, but there may be nested if-es (a few pieces), then it will not work

P.S. You'll need to shake things up a bit.

If the indentation of the next line is less than preexisting one by some value, then add a parenthesis. If it's less then by some more value, then add some more.

Машинное обучение в трейдинге: теория, практика, торговля и не только
Машинное обучение в трейдинге: теория, практика, торговля и не только
  • 2020.07.08
  • www.mql5.com
Добрый день всем, Знаю, что есть на форуме энтузиасты machine learning и статистики...
 
Maxim Dmitrievsky:

something like this, but there may be nested if-es (a few pieces), then it won't work

P.S. You need to shake things up a bit

If the indentation of the next line is less than preexisting one by some value, then add a parenthesis. If it is less than on the greater value, add some

How many lines) maybe by compiler errors it is easier to add if there are few appendices)
 
Maxim Dmitrievsky:

something like this, but there may be nested ifs (a few pieces), then it won't work

Z.I. You need to shake things up a bit

If the indentation of the next line is less than preexisting one by some value, then add a parenthesis. If less by a larger value, then add some

this is exactly the reason why C users don't like Python :-)

in algorithm with "sticks" - when subtracting, look how many sticks were in count (in stack) and put as many closing parentheses.

PS/ why all this hassle? You own the generating code... make it convenient at once

 
Maxim Dmitrievsky:

I want it in python

I pressed a button and it spit out almost ready TS, which I can copy to mql

I'll think of... maybe someone has just come across

it's a binary tree traversal problem (or AVL trees, i don't know, i googled it)

I have never worked with binary trees, I have my own interest, I still can't figure it out.

 
Maxim Dmitrievsky:

something like this, but there may be nested if-i's (a few pieces), then it won't work

Ask your question on stackowerlow but go to English instead of Russian...

Or google your question in English and add two more keywords " stackowerlow " and "python".

It is unlikely anyone will help you here, but if you do it right they will answer very quickly and accurately, or give you a negative answer))

 
Valeriy Yastremskiy:
And how many lines) it may be easier to add by compiler errors if there are few additions)

The compiler does not want to correctly count parentheses))) Only parse by condition. The indentation apparently.

 
mytarmailS:

Ask your question on stackowerlow, but go to English instead of Russian...

Or google your question in English and add two more keywords " stackowerlow " and "python".

It is unlikely anyone will help you here, but if you do it right it will be very quickly and accurately answered, or zamnusuyut))

Even if they wrote on the subject without referring anywhere ... like I was dumb and did not google.) It is clear already, I thought there were other options. No time yet.
 
Maxim Dmitrievsky:

something like this, but there may be nested if-es (a few pieces), then it won't work

P.S. You need to shake things up a bit

If the indentation of the next line is less than preexisting one by some value, then add a parenthesis. If it's less by some more value, then add some more.

If on the line before if there are the same number of gaps and on the line before if there are fewer gaps, then on the line above at the end of the line there is a parenthesis, and if before the next (probably loop) there are fewer gaps than before the previous one, then on the line above at the end there is a parenthesis, if there are more gaps leave the loop and look for the same.

Put an extra one at the end.
 
Valeriy Yastremskiy:

If in line before if gaps are the same and in line before if gaps are less then on the line above at the end of the line brackets and if further (probably the loop) before the next if gaps are less than before the previous one then on the line above at the end brackets, if gaps are more exit the loop and look the same.

Put an extra one at the end.
Yeah. Today I finally got free, I need to finish
 
Maxim Dmitrievsky:

Let's say I did, but there are not enough closing parentheses, highlighted in red what I need to add. What's the best way to calculate where the brackets are missing and add? Purely logically

Settings -> General -> Insert () and closing }])' "
Maybe that would help?

Or compile.
Thenon the Errors tab, double click on the first error.
Cursor will go where there is no closing bracket.
And so for each parenthesis, double clickon the error, put the parenthesis, compile.

Reason: