L'apprendimento automatico nel trading: teoria, modelli, pratica e algo-trading - pagina 1862

 
Romano:

Impostazioni -> Generale -> Inserire () e chiudere }])' "
Forse questo aiuterà?

O compilare.
Poinella scheda Error, fai doppio clic sul primo errore.
Il cursore andrà dove non c'è una parentesi di chiusura.
E così per ogni parentesi, fare doppio clicsu errore, mettere la parentesi, compilare.

il compito è quello di generare un codice mql funzionante in python, quindi perché armeggiare con esso?

quasi fatto

 
Romano:

Impostazioni -> Generale -> Inserimento () e chiusura }])' "
Forse questo potrebbe aiutare?

O compilare.
Poinella scheda Error, fate doppio clic sul primo errore.
Il cursore andrà dove non c'è una parentesi di chiusura.
E così per ogni parentesi, fai doppio clic suun errore, metti la parentesi, compila.

Credo di aver capito che non si può fare off-line....

il portafoglio è davvero qualcosa....

 

voilà

sarebbe un dolore nel debugger :D

non è l'albero più grande che puoi avere

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; }
 

Controllare che l'albero funzioni allo stesso modo.

Su 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:

Credo di aver capito che non si può fare off-line....

la valigetta è un vero pezzo da novanta....

Funziona bene off-line, l'ho testato.

Mi metto una pelliccia in testa.

È stato un errore stupido.

Roman, cerca il tuo bug, dovrebbe funzionare bene sulla storia

;)

vaporoso, 7 anni fa

trovato, trovato il difetto della strategia!!!

pre-test fino a 10 volte al giorno

cosa c'è in arrivo........

 
@Maxim Dmitrievsky è ancora necessario il parser?
File:
parser.zip  2 kb
 
Renat Akhtyamov:

Off-line vive bene, l'ho testato.

È un po' eccitante.

C'è stato uno stupido errore.

Roman, cerca un errore in te stesso, dovrebbe funzionare bene sulla storia

;)

vaporoso, 7 anni fa

trovato, trovato il difetto della strategia!!!

pre-test fino a 10 volte al giorno

cosa c'è in arrivo........

Quindi non ho detto nulla sul fatto che non funziona sulla storia :)))
Ho detto che non l'ho finito per la storia, quindi ho rimandato lo sviluppo per ora.
E così, preparare i dati storici è uno dei passi importanti.
E tutti i modelli sono costruiti e testati tenendo conto della storia.
Questa è la statistica ))
Buon per te che tutto sta funzionando.

 
Nanix:
@Maxim Dmitrievsky è ancora necessario il parser?

Grazie, le parentesi mancano ancora, per esempio qui

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; } }

rosso - come dovrebbe essere.

Il mio fa tutto. Altrimenti, le condizioni non funzioneranno correttamente e l'albero conterà il numero sbagliato

 
Maxim Dmitrievsky:

grazie, le parentesi mancano ancora, per esempio qui

quelli rossi sono come dovrebbero essere.

il mio fa tutto. Altrimenti, le condizioni funzioneranno in modo errato e l'albero conterà in modo sbagliato

Dai vostri codici ho cominciato a capire approssimativamente come funzionano gli alberi. Algoritmo debole rispetto al polinomio, penso così....
 
Mihail Marchukajtes:
Dai tuoi codici ho iniziato a capire approssimativamente come funzionano gli alberi. Algoritmo debole rispetto al polinomio, così sembra a me....

non dire stronzate.