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

 
Roman:

Settings -> General -> Inserting () and closing }]') "
Maybe this will help?

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

The task - to generate in python a working mql code, why tinker with it?

almost done

 
Roman:

Settings -> General -> Inserting () and closing }]') "
Maybe this will help?

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

I think I've figured out that you can't do it off-line....

the portfolio is really something....

 

voila

would have been exhausted in debugger :D

that's not the biggest tree you can get

double decision_tree(double &features[]) { 
    if ( features[11] <= 0.000385 )  {
        if ( features[9] <= -0.000275 )  {
            if ( features[9] <= -0.000465 )  {
                if ( features[5] <= 0.00034 )  {
                    if ( features[10] <= -0.00034 )  {
                        return 2; }
                    if ( features[10] > -0.00034 )  {
                        if ( features[11] <= -0.00031 )  {
                            return 1; }
                        if ( features[11] > -0.00031 )  {
                            return 2; } } }
                if ( features[5] > 0.00034 )  {
                    return 1; } }
            if ( features[9] > -0.000465 )  {
                if ( features[4] <= -0.000465 )  {
                    return 1; }
                if ( features[4] > -0.000465 )  {
                    if ( features[9] <= -0.000425 )  {
                        if ( features[5] <= -0.00015 )  {
                            return 1; }
                        if ( features[5] > -0.00015 )  {
                            return 2; } }
                    if ( features[9] > -0.000425 )  {
                        if ( features[8] <= -0.000165 )  {
                            if ( features[4] <= -0.000395 )  {
                                if ( features[5] <= -0.00033 )  {
                                    return 1; }
                                if ( features[5] > -0.00033 )  {
                                    return 2; } }
                            if ( features[4] > -0.000395 )  {
                                return 2; } }
                        if ( features[8] > -0.000165 )  {
                            if ( features[8] <= -4.5 e-05 )  {
                                return 1; }
                            if ( features[8] > -4.5 e-05 )  {
                                return 2; } } } } } }
        if ( features[9] > -0.000275 )  {
            if ( features[3] <= 0.000605 )  {
                if ( features[1] <= -0.00036 )  {
                    return 2; }
                if ( features[1] > -0.00036 )  {
                    if ( features[9] <= -0.000115 )  {
                        if ( features[2] <= 0.000165 )  {
                            if ( features[4] <= -0.000125 )  {
                                if ( features[7] <= -0.00014 )  {
                                    if ( features[6] <= -0.000265 )  {
                                        if ( features[8] <= -0.0003 )  {
                                            return 1; }
                                        if ( features[8] > -0.0003 )  {
                                            return 2; } }
                                    if ( features[6] > -0.000265 )  {
                                        return 1; } }
                                if ( features[7] > -0.00014 )  {
                                    if ( features[10] <= -0.00015 )  {
                                        return 1; }
                                    if ( features[10] > -0.00015 )  {
                                        return 2; } } }
                            if ( features[4] > -0.000125 )  {
                                return 1; } }
                        if ( features[2] > 0.000165 )  {
                            return 2; } }
                    if ( features[9] > -0.000115 )  {
                        if ( features[1] <= -0.000175 )  {
                            if ( features[8] <= 0.000145 )  {
                                return 1; }
                            if ( features[8] > 0.000145 )  {
                                if ( features[2] <= -9.5 e-05 )  {
                                    return 0; }
                                if ( features[2] > -9.5 e-05 )  {
                                    return 2; } } }
                        if ( features[1] > -0.000175 )  {
                            if ( features[11] <= 0.000195 )  {
                                if ( features[11] <= -5.5 e-05 )  {
                                    if ( features[5] <= 9.5 e-05 )  {
                                        return 1; }
                                    if ( features[5] > 9.5 e-05 )  {
                                        if ( features[2] <= -2.5 e-05 )  {
                                            return 0; }
                                        if ( features[2] > -2.5 e-05 )  {
                                            return 1; } } }
                                if ( features[11] > -5.5 e-05 )  {
                                    if ( features[8] <= -8.5 e-05 )  {
                                        if ( features[2] <= 2.5 e-05 )  {
                                            return 1; }
                                        if ( features[2] > 2.5 e-05 )  {
                                            return 2; } }
                                    if ( features[8] > -8.5 e-05 )  {
                                        return 1; } } }
                            if ( features[11] > 0.000195 )  {
                                if ( features[4] <= -0.00024 )  {
                                    return 0; }
                                if ( features[4] > -0.00024 )  {
                                    if ( features[2] <= 0.00021 )  {
                                        if ( features[1] <= 1.5 e-05 )  {
                                            return 1; }
                                        if ( features[1] > 1.5 e-05 )  {
                                            return 1; } }
                                    if ( features[2] > 0.00021 )  {
                                        if ( features[5] <= 0.00024 )  {
                                            return 0; }
                                        if ( features[5] > 0.00024 )  {
                                            return 1; } } } } } } } }
            if ( features[3] > 0.000605 )  {
                if ( features[11] <= 0.000195 )  {
                    return 2; }
                if ( features[11] > 0.000195 )  {
                    return 0; } } } }
    if ( features[11] > 0.000385 )  {
        if ( features[11] <= 0.00049 )  {
            if ( features[3] <= 0.000155 )  {
                if ( features[8] <= 0.00036 )  {
                    return 0; }
                if ( features[8] > 0.00036 )  {
                    return 1; } }
            if ( features[3] > 0.000155 )  {
                if ( features[11] <= 0.00041 )  {
                    if ( features[5] <= 0.00047 )  {
                        return 0; }
                    if ( features[5] > 0.00047 )  {
                        return 1; } }
                if ( features[11] > 0.00041 )  {
                    return 1; } } }
        if ( features[11] > 0.00049 )  {
            if ( features[4] <= -0.00022 )  {
                return 1; }
            if ( features[4] > -0.00022 )  {
                if ( features[2] <= 0.000345 )  {
                    return 0; }
                if ( features[2] > 0.000345 )  {
                    if ( features[7] <= 0.00061 )  {
                        return 1; }
                    if ( features[7] > 0.00061 )  {
                        return 0; } } } } }


 return 3; }
 

Checking that the tree works the same way.

On mql:

2020.07.11 23:17:15.120 code check (EURUSD,M5)  Result 2.0
2020.07.11 23:17:15.121 code check (EURUSD,M5)   0.00000  0.00030  0.00031  0.00019  0.00005 -0.00009 -0.00014 -0.00014 -0.00008 -0.00025 -0.00014 -0.00038

In python:

lll = [0.00000,  0.00030,  0.00031,  0.00019,  0.00005, -0.00009, -0.00014, -0.00014, -0.00008, -0.00025, -0.00014, -0.00038]
lll = np.array(lll).reshape(1,-1)
clf.predict(lll)

>>> clf.predict(lll)
array([2])
 
Renat Akhtyamov:

I think I figured out that you can't do it off-line....

the briefcase is a real piece of work....

It's doing great off-line. I've tested it.

It makes my fur coat turn.

There was an error.

Roman, look for an error in yourself, it should work fine on the story

;)

steamy, 7 years ago

i found it, i found the flaw in the strategy!!!

Pre-testing up to 10x per day

what happens now........

 
@Maxim Dmitrievsky Is the parser still needed?
Files:
parser.zip  2 kb
 
Renat Akhtyamov:

off-line lives just fine, I tested it

It makes my fur coat curl.

There was a stupid error.

Roman, look for an error in yourself, it should work fine on the story

;)

steamy, 7 years ago

i found it, i found the flaw in the strategy!!!

Pre-testing up to 10x per day

what's going to happen now........

So I did not say that it does not work on history :)))
I said that I have not finished for history, and postponed the development.
And so, the preparation of historical data, this is one of the important stages.
And all models are built, tested, taking into account history.
That's statistics ))
Good for you that everything is working out.

 
Nanix:
@Maxim Dmitrievsky do you still need a parser?

Thanks, brackets are still missing, for example here

if(L_55_1  >  0.00047) {
    if(L_30_1  <= 0.00044)
        { return 2;}
    if(L_30_1  >  0.00044) {
        if(L_25_1  <= 0.00047) {
            if(L_5_1  <= 0.00012)
                { return 0;}
            if(L_5_1  >  0.00012)
                { return 2;} }
        if(L_25_1  >  0.00047) return 2; } }

the red ones are as they should be.

Mine does it all. Otherwise, the conditions will not work correctly and the tree will count the wrong

 
Maxim Dmitrievsky:

Thank you, brackets are still missing, for example, here

the red ones are as they should be.

mine does it all. Otherwise, the conditions will not work correctly and the tree will count the wrong

From your codes I roughly began to understand how trees work. Weak algorithm compared to polynomial, in my opinion so....
 
Mihail Marchukajtes:
Your codes have given me a rough idea of how trees work. Weak algorithm compared to polynomial, in my opinion so....

Don't talk nonsense.