Tutte le domande dei nuovi arrivati su MQL4 e MQL5, aiuto e discussione su algoritmi e codici - pagina 1628

 
Taras Slobodyanik #:

er, non hai chiesto dell'errore di modifica e della sua criticità?
...e la sua spiegazione

Taras chiese

Per favore ditemi se ho ordini con TakeProfit e li sto modificando per calcolare un nuovo TakeProfit.

&& tp!=OrderTakeProfit()

Se posso dire "e il takeprofit non è uguale al takeprofit dell'ordine selezionato".

Allora dovremmo scrivere una nuova funzione per modificare gli ordini che sono già stati presi, ma una delle condizioni di controllo dovrebbe essere

if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() == otype && tp!=OrderTakeProfit() )

Puoi darmi un suggerimento?

 
EVGENII SHELIPOV #:

Taras chiese

Se ho un ordine con un takeprofit e lo sto modificando per calcolare un nuovo takeprofit, come devo aggiungerlo?

Se posso dire "e il takeprofit non è uguale al takeprofit dell'ordine selezionato".

Allora dovremmo scrivere una nuova funzione per modificare gli ordini che sono già stati presi, ma una delle condizioni di controllo dovrebbe essere

Per favore, ditemi da che parte sto pensando.

Giusto - da quella parte.


Non ho errori nel mio tester. Dimmi su quale coppia quale data?

 
EVGENII SHELIPOV #:

Dimmi se sto pensando nella giusta direzione.

Non proprio così... Di regola, il TP viene cambiato se il nuovo TP porta più profitto di quello vecchio. E questa condizione

tp!=OrderTakeProfit()

può essere realizzato sia verso l'alto che verso il basso...

Quindi dobbiamo condizionarlo > o < a seconda del tipo di ordine.

 
Roman Kutemov #:
Non c'è

Tutti hanno


 
MakarFX #:

Giusto - da quella parte.


Non ho un solo errore nel mio tester. Dimmi su quale coppia quale data?

Sterlina/Dollaro ma non è questo il punto, probabilmente è meglio caricare questo file set e appena un paio di ordini sono chiusi guardare il log

File:
1111.set  3 kb
 
EVGENII SHELIPOV #:

Taras chiese

Ho degli ordini con TakeProfit e li sto modificando per calcolare un nuovo TakeProfit, come faccio ad allegare questo

L'ho già aggiunto alla tua linea di codice (nel messaggio precedente).

La spiegazione è la stessa: l'errore si verifica se si modifica un ordine che ha già lo stesso TP.
Quando si modifica un ordine, almeno un parametro (TP, SL, Prezzo) deve essere diverso.

In altre parole, "tp!=OrderTakeProfit()" significa che non è necessario modificare l'ordine se ha già lo stesso TP.

 
MakarFX #:

Tutti hanno


Il mio non è sull'unità C per qualche motivo, ma l'ho trovato attraverso Open Data Directory nel terminale.
 
Roman Kutemov #:
Il mio disco non è sull'unità C per qualche motivo, ma l'ho trovato tramite Open data directory nel terminale.
Naturalmente nella directory dei dati, ho solo la directory sull'unità C
 
EVGENII SHELIPOV # :

Sterlina / dollaro ma non è questo il punto, probabilmente è meglio scaricare questo file di set e non appena un paio di ordini vengono chiusi, guarda il log

Molti errori sono dovuti alla disattenzione

ora non ci sono errori

 2021.09 . 26 20 : 21 : 37.087 2021.08 . 30 08 : 06 : 05    111 GBPUSD,M5: Максимальный и минимальный ордера на покупку успешно закрыты!
2021.09 . 26 20 : 21 : 37.087 2021.08 . 30 08 : 06 : 05    111 GBPUSD,M5: close # 16 buy 0.14 GBPUSD at 1.37709 tp: 1.37720 at price 1.37712
2021.09 . 26 20 : 21 : 37.087 2021.08 . 30 08 : 06 : 05    111 GBPUSD,M5: close # 15 buy 0.12 GBPUSD at 1.37730 tp: 1.37720 at price 1.37712
2021.09 . 26 20 : 21 : 37.087 2021.08 . 30 08 : 06 : 05    111 GBPUSD,M5: Максимальный и минимальный ордера на покупку успешно закрыты!
2021.09 . 26 20 : 21 : 37.087 2021.08 . 30 08 : 06 : 05    111 GBPUSD,M5: close # 17 buy 0.17 GBPUSD at 1.37689 tp: 1.37720 at price 1.37712
2021.09 . 26 20 : 21 : 37.087 2021.08 . 30 08 : 06 : 05    111 GBPUSD,M5: close # 14 buy 0.10 GBPUSD at 1.37751 tp: 1.37720 at price 1.37712
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: modify # 14 buy 0.10 GBPUSD at 1.37751 sl: 0.00000 tp: 1.37720 ok
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: modify # 15 buy 0.12 GBPUSD at 1.37730 sl: 0.00000 tp: 1.37720 ok
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: modify # 16 buy 0.14 GBPUSD at 1.37709 sl: 0.00000 tp: 1.37720 ok
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: modify # 17 buy 0.17 GBPUSD at 1.37689 sl: 0.00000 tp: 1.37720 ok
2021.09 . 26 20 : 21 : 17.837 2021.08 . 30 07 : 04 : 30    111 GBPUSD,M5: open # 17 buy 0.17 GBPUSD at 1.37689 ok
2021.09 . 26 20 : 21 : 16.247 2021.08 . 30 07 : 00 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 16.247 2021.08 . 30 07 : 00 : 30    111 GBPUSD,M5: modify # 14 buy 0.10 GBPUSD at 1.37751 sl: 0.00000 tp: 1.37733 ok
2021.09 . 26 20 : 21 : 16.247 2021.08 . 30 07 : 00 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 16.247 2021.08 . 30 07 : 00 : 30    111 GBPUSD,M5: modify # 15 buy 0.12 GBPUSD at 1.37730 sl: 0.00000 tp: 1.37733 ok
2021.09 . 26 20 : 21 : 16.247 2021.08 . 30 07 : 00 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 16.247 2021.08 . 30 07 : 00 : 30    111 GBPUSD,M5: modify # 16 buy 0.14 GBPUSD at 1.37709 sl: 0.00000 tp: 1.37733 ok
2021.09 . 26 20 : 21 : 16.247 2021.08 . 30 07 : 00 : 30    111 GBPUSD,M5: open # 16 buy 0.14 GBPUSD at 1.37709 ok
2021.09 . 26 20 : 21 : 14.015 2021.08 . 30 06 : 53 : 36    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 14.015 2021.08 . 30 06 : 53 : 36    111 GBPUSD,M5: modify # 14 buy 0.10 GBPUSD at 1.37751 sl: 0.00000 tp: 1.37745 ok
2021.09 . 26 20 : 21 : 14.015 2021.08 . 30 06 : 53 : 36    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 21 : 14.015 2021.08 . 30 06 : 53 : 36    111 GBPUSD,M5: modify # 15 buy 0.12 GBPUSD at 1.37730 sl: 0.00000 tp: 1.37745 ok
2021.09 . 26 20 : 21 : 14.015 2021.08 . 30 06 : 53 : 36    111 GBPUSD,M5: open # 15 buy 0.12 GBPUSD at 1.37730 ok
2021.09 . 26 20 : 21 : 00.130 2021.08 . 30 06 : 16 : 10    111 GBPUSD,M5: open # 14 buy 0.10 GBPUSD at 1.37751 tp: 1.37771 ok
2021.09 . 26 20 : 21 : 00.130 2021.08 . 30 06 : 16 : 10   Tester: take profit # 13 at 1.37715 ( 1.37715 / 1.37751 )
2021.09 . 26 20 : 21 : 00.130 2021.08 . 30 06 : 16 : 10   Tester: take profit # 12 at 1.37715 ( 1.37715 / 1.37751 )
2021.09 . 26 20 : 20 : 54.618 2021.08 . 30 06 : 00 : 36    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 54.618 2021.08 . 30 06 : 00 : 36    111 GBPUSD,M5: modify # 12 buy 0.10 GBPUSD at 1.37726 sl: 0.00000 tp: 1.37715 ok
2021.09 . 26 20 : 20 : 54.618 2021.08 . 30 06 : 00 : 36    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 54.618 2021.08 . 30 06 : 00 : 36    111 GBPUSD,M5: modify # 13 buy 0.12 GBPUSD at 1.37696 sl: 0.00000 tp: 1.37715 ok
2021.09 . 26 20 : 20 : 54.618 2021.08 . 30 06 : 00 : 36    111 GBPUSD,M5: open # 13 buy 0.12 GBPUSD at 1.37696 ok
2021.09 . 26 20 : 20 : 39.209 2021.08 . 30 05 : 18 : 18    111 GBPUSD,M5: open # 12 buy 0.10 GBPUSD at 1.37726 tp: 1.37746 ok
2021.09 . 26 20 : 20 : 39.209 2021.08 . 30 05 : 18 : 18   Tester: take profit # 11 at 1.37690 ( 1.37690 / 1.37726 )
2021.09 . 26 20 : 20 : 39.209 2021.08 . 30 05 : 18 : 18   Tester: take profit # 10 at 1.37690 ( 1.37690 / 1.37726 )
2021.09 . 26 20 : 20 : 39.209 2021.08 . 30 05 : 18 : 18   Tester: take profit # 9 at 1.37690 ( 1.37690 / 1.37726 )
2021.09 . 26 20 : 20 : 24.724 2021.08 . 30 04 : 40 : 49    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 24.724 2021.08 . 30 04 : 40 : 49    111 GBPUSD,M5: modify # 9 buy 0.10 GBPUSD at 1.37730 sl: 0.00000 tp: 1.37690 ok
2021.09 . 26 20 : 20 : 24.724 2021.08 . 30 04 : 40 : 49    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 24.724 2021.08 . 30 04 : 40 : 49    111 GBPUSD,M5: modify # 10 buy 0.12 GBPUSD at 1.37685 sl: 0.00000 tp: 1.37690 ok
2021.09 . 26 20 : 20 : 24.724 2021.08 . 30 04 : 40 : 49    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 24.724 2021.08 . 30 04 : 40 : 49    111 GBPUSD,M5: modify # 11 buy 0.14 GBPUSD at 1.37652 sl: 0.00000 tp: 1.37690 ok
2021.09 . 26 20 : 20 : 24.724 2021.08 . 30 04 : 40 : 49    111 GBPUSD,M5: open # 11 buy 0.14 GBPUSD at 1.37652 ok
2021.09 . 26 20 : 20 : 24.257 2021.08 . 30 04 : 39 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 24.257 2021.08 . 30 04 : 39 : 30    111 GBPUSD,M5: modify # 9 buy 0.10 GBPUSD at 1.37730 sl: 0.00000 tp: 1.37710 ok
2021.09 . 26 20 : 20 : 24.257 2021.08 . 30 04 : 39 : 30    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 24.257 2021.08 . 30 04 : 39 : 30    111 GBPUSD,M5: modify # 10 buy 0.12 GBPUSD at 1.37685 sl: 0.00000 tp: 1.37710 ok
2021.09 . 26 20 : 20 : 24.257 2021.08 . 30 04 : 39 : 30    111 GBPUSD,M5: open # 10 buy 0.12 GBPUSD at 1.37685 ok
2021.09 . 26 20 : 20 : 22.388 2021.08 . 30 04 : 35 : 00    111 GBPUSD,M5: open # 9 buy 0.10 GBPUSD at 1.37730 tp: 1.37750 ok
2021.09 . 26 20 : 20 : 20.331 2021.08 . 30 04 : 30 : 51   Tester: take profit # 8 at 1.37696 ( 1.37696 / 1.37732 )
2021.09 . 26 20 : 20 : 15.093 2021.08 . 30 04 : 17 : 40    111 GBPUSD,M5: open # 8 buy 0.09 GBPUSD at 1.37676 tp: 1.37696 ok
2021.09 . 26 20 : 20 : 15.093 2021.08 . 30 04 : 17 : 40   Tester: take profit # 7 at 1.37640 ( 1.37640 / 1.37676 )
2021.09 . 26 20 : 20 : 15.093 2021.08 . 30 04 : 17 : 40   Tester: take profit # 6 at 1.37640 ( 1.37640 / 1.37676 )
2021.09 . 26 20 : 20 : 15.093 2021.08 . 30 04 : 17 : 40   Tester: take profit # 5 at 1.37640 ( 1.37640 / 1.37676 )
2021.09 . 26 20 : 20 : 10.273 2021.08 . 30 04 : 06 : 15    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 10.273 2021.08 . 30 04 : 06 : 15    111 GBPUSD,M5: modify # 5 buy 0.09 GBPUSD at 1.37666 sl: 0.00000 tp: 1.37640 ok
2021.09 . 26 20 : 20 : 10.273 2021.08 . 30 04 : 06 : 15    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 10.273 2021.08 . 30 04 : 06 : 15    111 GBPUSD,M5: modify # 6 buy 0.11 GBPUSD at 1.37639 sl: 0.00000 tp: 1.37640 ok
2021.09 . 26 20 : 20 : 10.273 2021.08 . 30 04 : 06 : 15    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 10.273 2021.08 . 30 04 : 06 : 15    111 GBPUSD,M5: modify # 7 buy 0.13 GBPUSD at 1.37611 sl: 0.00000 tp: 1.37640 ok
2021.09 . 26 20 : 20 : 10.273 2021.08 . 30 04 : 06 : 15    111 GBPUSD,M5: open # 7 buy 0.13 GBPUSD at 1.37611 ok
2021.09 . 26 20 : 20 : 09.103 2021.08 . 30 04 : 03 : 18    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 09.103 2021.08 . 30 04 : 03 : 18    111 GBPUSD,M5: modify # 5 buy 0.09 GBPUSD at 1.37666 sl: 0.00000 tp: 1.37656 ok
2021.09 . 26 20 : 20 : 09.103 2021.08 . 30 04 : 03 : 18    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 20 : 09.103 2021.08 . 30 04 : 03 : 18    111 GBPUSD,M5: modify # 6 buy 0.11 GBPUSD at 1.37639 sl: 0.00000 tp: 1.37656 ok
2021.09 . 26 20 : 20 : 09.103 2021.08 . 30 04 : 03 : 18    111 GBPUSD,M5: open # 6 buy 0.11 GBPUSD at 1.37639 ok
2021.09 . 26 20 : 20 : 00.895 2021.08 . 30 03 : 45 : 18    111 GBPUSD,M5: open # 5 buy 0.09 GBPUSD at 1.37666 tp: 1.37686 ok
2021.09 . 26 20 : 19 : 53.991 2021.08 . 30 03 : 25 : 10    111 GBPUSD,M5: Максимальный и минимальный ордера на покупку успешно закрыты!
2021.09 . 26 20 : 19 : 53.991 2021.08 . 30 03 : 25 : 10    111 GBPUSD,M5: close # 3 buy 0.14 GBPUSD at 1.37624 tp: 1.37637 at price 1.37628
2021.09 . 26 20 : 19 : 53.991 2021.08 . 30 03 : 25 : 10    111 GBPUSD,M5: close # 2 buy 0.12 GBPUSD at 1.37650 tp: 1.37637 at price 1.37628
2021.09 . 26 20 : 19 : 53.991 2021.08 . 30 03 : 25 : 10    111 GBPUSD,M5: Максимальный и минимальный ордера на покупку успешно закрыты!
2021.09 . 26 20 : 19 : 53.991 2021.08 . 30 03 : 25 : 10    111 GBPUSD,M5: close # 4 buy 0.17 GBPUSD at 1.37602 tp: 1.37637 at price 1.37628
2021.09 . 26 20 : 19 : 53.991 2021.08 . 30 03 : 25 : 10    111 GBPUSD,M5: close # 1 buy 0.10 GBPUSD at 1.37672 tp: 1.37637 at price 1.37628
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: modify # 1 buy 0.10 GBPUSD at 1.37672 sl: 0.00000 tp: 1.37637 ok
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: modify # 2 buy 0.12 GBPUSD at 1.37650 sl: 0.00000 tp: 1.37637 ok
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: modify # 3 buy 0.14 GBPUSD at 1.37624 sl: 0.00000 tp: 1.37637 ok
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: modify # 4 buy 0.17 GBPUSD at 1.37602 sl: 0.00000 tp: 1.37637 ok
2021.09 . 26 20 : 19 : 46.828 2021.08 . 30 03 : 08 : 51    111 GBPUSD,M5: open # 4 buy 0.17 GBPUSD at 1.37602 ok
2021.09 . 26 20 : 19 : 44.589 2021.08 . 30 03 : 04 : 00    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 44.589 2021.08 . 30 03 : 04 : 00    111 GBPUSD,M5: modify # 1 buy 0.10 GBPUSD at 1.37672 sl: 0.00000 tp: 1.37651 ok
2021.09 . 26 20 : 19 : 44.589 2021.08 . 30 03 : 04 : 00    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 44.589 2021.08 . 30 03 : 04 : 00    111 GBPUSD,M5: modify # 2 buy 0.12 GBPUSD at 1.37650 sl: 0.00000 tp: 1.37651 ok
2021.09 . 26 20 : 19 : 44.589 2021.08 . 30 03 : 04 : 00    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 44.589 2021.08 . 30 03 : 04 : 00    111 GBPUSD,M5: modify # 3 buy 0.14 GBPUSD at 1.37624 sl: 0.00000 tp: 1.37651 ok
2021.09 . 26 20 : 19 : 44.589 2021.08 . 30 03 : 04 : 00    111 GBPUSD,M5: open # 3 buy 0.14 GBPUSD at 1.37624 ok
2021.09 . 26 20 : 19 : 38.679 2021.08 . 30 02 : 48 : 40    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 38.679 2021.08 . 30 02 : 48 : 40    111 GBPUSD,M5: modify # 1 buy 0.10 GBPUSD at 1.37672 sl: 0.00000 tp: 1.37665 ok
2021.09 . 26 20 : 19 : 38.679 2021.08 . 30 02 : 48 : 40    111 GBPUSD,M5: Ордера успешно модифицированы!
2021.09 . 26 20 : 19 : 38.679 2021.08 . 30 02 : 48 : 40    111 GBPUSD,M5: modify # 2 buy 0.12 GBPUSD at 1.37650 sl: 0.00000 tp: 1.37665 ok
2021.09 . 26 20 : 19 : 38.679 2021.08 . 30 02 : 48 : 40    111 GBPUSD,M5: open # 2 buy 0.12 GBPUSD at 1.37650 ok
2021.09 . 26 20 : 19 : 21.319 2021.08 . 30 02 : 00 : 00    111 GBPUSD,M5: open # 1 buy 0.10 GBPUSD at 1.37672 tp: 1.37692 ok
File:
111.mq4  47 kb
 

Non conta iATR e iVolumi

Print("iATR=", iATR(Symbol(),PERIOD_M5,1), " iVolumes=", iVolumes(Symbol(),PERIOD_M5,1));

Dà sempre 10 e 10. Per favore, ditemi cosa fare.