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

 
Igor Makanu:

why not replace several if( condition_1 ) if( condition_2 )

to if( condition_1 && condition_2)

it's easier to look for closing parentheses, the code is faster to read, in general, more convenient, imho.

This seems to make it even harder. The code in python first generates a python tree calculation function from tree structure, then I modify it into a C-like function.

 
Maxim Dmitrievsky:

it looks like it will be even more complicated. The python code first generates a python tree calculation function from the tree structure, then I rework it into a C-like one.

generate intermediate code...stack machines a la Forth, are born capable of micro-optimization

 
Maxim Dmitrievsky:

it looks like it will be even more complicated. The python code first generates a python tree calculation function from the tree structure, then I redo it in C-like.

couldn't find yesterday's graph in the thread

there, i think you need to rotate it to -90 degrees and parsing along the lines

it doesn't matter what to put in if() or &&

 
Igor Makanu:

I couldn't find yesterday's graph in the topic

there, i think it needs to be rotated by -90 degrees and then parsed along the lines

and what to put in if() or && when parsing makes no difference

Initially it looks like this

|--- 55 1 <= 0.00047
|   |--- 45 1 <= -0.00029
|   |   |--- 50 1 <= -0.00062
|   |   |   |--- class: 1
|   |   |--- 50 1 >  -0.00062
|   |   |   |--- 25 1 <= -0.00034
|   |   |   |   |--- 35 1 <= -0.00070
|   |   |   |   |   |--- class: 1
|   |   |   |   |--- 35 1 >  -0.00070
|   |   |   |   |   |--- class: 0
|   |   |   |--- 25 1 >  -0.00034
|   |   |   |   |--- 35 1 <= -0.00053
|   |   |   |   |   |--- class: 0
|   |   |   |   |--- 35 1 >  -0.00053
|   |   |   |   |   |--- 55 1 <= -0.00014
|   |   |   |   |   |   |--- 25 1 <= -0.00021
|   |   |   |   |   |   |   |--- 50 1 <= -0.00037
|   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |--- 50 1 >  -0.00037
|   |   |   |   |   |   |   |   |--- class: 1
|   |   |   |   |   |   |--- 25 1 >  -0.00021
|   |   |   |   |   |   |   |--- class: 1
|   |   |   |   |   |--- 55 1 >  -0.00014
|   |   |   |   |   |   |--- class: 0
|   |--- 45 1 >  -0.00029
|   |   |--- 10 1 <= 0.00031
|   |   |   |--- 5 1 <= -0.00020
|   |   |   |   |--- 20 1 <= 0.00010
|   |   |   |   |   |--- 30 1 <= 0.00014
|   |   |   |   |   |   |--- 45 1 <= 0.00004
|   |   |   |   |   |   |   |--- class: 1
|   |   |   |   |   |   |--- 45 1 >  0.00004
|   |   |   |   |   |   |   |--- class: 2
|   |   |   |   |   |--- 30 1 >  0.00014
|   |   |   |   |   |   |--- class: 1
|   |   |   |   |--- 20 1 >  0.00010
|   |   |   |   |   |--- class: 0
|   |   |   |--- 5 1 >  -0.00020
|   |   |   |   |--- 15 1 <= 0.00062
|   |   |   |   |   |--- 55 1 <= 0.00035
|   |   |   |   |   |   |--- 40 1 <= -0.00008
|   |   |   |   |   |   |   |--- 10 1 <= 0.00019
|   |   |   |   |   |   |   |   |--- 30 1 <= -0.00000
|   |   |   |   |   |   |   |   |   |--- 25 1 <= -0.00019
|   |   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |   |   |--- 25 1 >  -0.00019
|   |   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |   |--- 30 1 >  -0.00000
|   |   |   |   |   |   |   |   |   |--- 10 1 <= 0.00005
|   |   |   |   |   |   |   |   |   |   |--- class: 1
|   |   |   |   |   |   |   |   |   |--- 10 1 >  0.00005
|   |   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |--- 10 1 >  0.00019
|   |   |   |   |   |   |   |   |--- class: 1
|   |   |   |   |   |   |--- 40 1 >  -0.00008
|   |   |   |   |   |   |   |--- 10 1 <= -0.00012
|   |   |   |   |   |   |   |   |--- 20 1 <= 0.00004
|   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |   |--- 20 1 >  0.00004
|   |   |   |   |   |   |   |   |   |--- 45 1 <= 0.00013
|   |   |   |   |   |   |   |   |   |   |--- class: 1
|   |   |   |   |   |   |   |   |   |--- 45 1 >  0.00013
|   |   |   |   |   |   |   |   |   |   |--- class: 2
|   |   |   |   |   |   |   |--- 10 1 >  -0.00012
|   |   |   |   |   |   |   |   |--- 55 1 <= -0.00003
|   |   |   |   |   |   |   |   |   |--- 55 1 <= -0.00004
|   |   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |   |   |--- 55 1 >  -0.00004
|   |   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |   |--- 55 1 >  -0.00003
|   |   |   |   |   |   |   |   |   |--- 50 1 <= 0.00026
|   |   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |   |   |--- 50 1 >  0.00026
|   |   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |--- 55 1 >  0.00035
|   |   |   |   |   |   |--- 40 1 <= 0.00021
|   |   |   |   |   |   |   |--- 20 1 <= -0.00001
|   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |--- 20 1 >  -0.00001
|   |   |   |   |   |   |   |   |--- class: 2
|   |   |   |   |   |   |--- 40 1 >  0.00021
|   |   |   |   |   |   |   |--- 50 1 <= 0.00029
|   |   |   |   |   |   |   |   |--- 40 1 <= 0.00025
|   |   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |   |   |   |   |--- 40 1 >  0.00025
|   |   |   |   |   |   |   |   |   |--- class: 2
|   |   |   |   |   |   |   |--- 50 1 >  0.00029
|   |   |   |   |   |   |   |   |--- class: 0
|   |   |   |   |--- 15 1 >  0.00062
|   |   |   |   |   |--- class: 2
|   |   |--- 10 1 >  0.00031
|   |   |   |--- 45 1 <= 0.00012
|   |   |   |   |--- class: 1
|   |   |   |--- 45 1 >  0.00012
|   |   |   |   |--- class: 2
|--- 55 1 >  0.00047
|   |--- 30 1 <= 0.00044
|   |   |--- class: 2
|   |--- 30 1 >  0.00044
|   |   |--- 25 1 <= 0.00047
|   |   |   |--- 5 1 <= 0.00012
|   |   |   |   |--- class: 0
|   |   |   |--- 5 1 >  0.00012
|   |   |   |   |--- class: 2
|   |   |--- 25 1 >  0.00047
|   |   |   |--- class: 2
 
Maxim Kuznetsov:

generate intermediate code...stack machines, a la Forte, are born with the ability to micro-optimize

How many books do you have to read? ) because of one parenthesis

You just need a logical solution. Count the number of indents before (if), for example
 
Maxim Dmitrievsky:

(How many books do you have to read? ) because of one bracket

You just need a logical solution. Count the number of indents before (if), for example

i.e. the whole task is to parse what is generated in the post above ?

SZY. and of course the question, why they indent instead of a couple of tags (brackets), but it is clear only to pythonists :-) it would not be a problem

 
Maxim Kuznetsov:

that is, the whole task is to parse what is generated in the post above ?

ZS. and of course the question, why you need to indent instead of a couple of tags (brackets), but only pythonists know that :-) there would be no problem

yes

because it's python, that's why it's spelled that way ) it's easy to spar with a python function, there are no parentheses

the library returns the tree in this format

 
Maxim Dmitrievsky:

Initially it looks like this

you can't rotate

here by the position (the iconic place)|---

You'll have to make something up.

SZZH Perhaps in Excel it will be easier to do

 
Igor Makanu:

you can't rotate it.

there's a position here...

You'll have to make something up.

It may be easier to do something in Excel

I want it in python

i want to copy the ready TS to mql.

I'll think of something... maybe someone has faced

 
Maxim Dmitrievsky:

yes

because it's python, that's why it's spelled that way ) it's easy to spar to a python f-function, there are no brackets

the library returns the tree in this format

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

---

adderror handling and loop exit to taste