Come codificare? - pagina 193

 

Bisogno di aiuto per un avviso

ciao,

Prima di tutto: scusate per il mio inglese, sono veramente scarso in inglese.

quindi, ma la mia domanda è: come posso programmare un segnale di allarme se tenkan e senkou si incrociano? lungo e corto.

qualcuno può aiutarmi, per favore!!!

grazie mille,

ciao Benjamin

File:
ichimoku.mq4  5 kb
 

Piccolo problema...

Qualcuno può aiutarmi a fare la funzione per agire a cascata.

Ho: A=0

Quando l'indicatore colpisce un certo punto nr1: A=1.

E quando l'indicatore ha lasciato questo punto: A=1 (A mantiene ancora il suo valore).

Quando l'indicatore colpisce un certo punto nr2: A=0.

Qualsiasi idea è benvenuta!

Grazie.

 
ohir:
Qualcuno può aiutarmi a creare una funzione che agisca in modo da far cadere il prezzo.

Ho: A=0

Quando l'indicatore colpisce un certo punto nr1: A=1.

E quando l'indicatore ha lasciato questo certo punto: A=1 (A mantiene ancora il suo valore).

Quando l'indicatore colpisce un certo punto nr2: A=0.

Qualsiasi idea è benvenuta!

Grazie.

È difficile sapere esattamente cosa vuoi con così poco da fare.

Che ne dici di

A=0;

if (Bid >= nr1 && Bid < nr2) A=1;

se (Bid >= nr2) A=0;

Sostituisci Bid con O,H,L,C o qualsiasi altra variabile tu voglia.

Ma devi anche pensare a cosa succede se il prezzo colpisce nr1 e poi scende invece di andare a nr2.

Ricorda che sto solo ipotizzando quello che vuoi.

Spero che sia stato di aiuto

 

Come posso accedere ad un file sul mio disco fisso che non si trova nella cartella /experts/files?

btw, è possibile eseguire comandi di windows (es. copia) in mql4? magari con un file dll?

Grazie in anticipo :-)

 

Re swgman1

Grazie, swgman1!

... ma è ancora un problema per me.

Quello che sto cercando di dire -

Inizio

Il valore dell'indicatore1 è 0

Il valore dell'indicatore2 è 0

A=0

Passo1

Il valore dell'indicatore1 è 1

Il valore dell'indicatore2 è 0

A=1

Passo2

Il valore dell'indicatore1 è 0

Il valore dell'indicatore2 è 0

A=1

Passo3

Il valore dell'indicatore1 è 0

Il valore dell'indicatore2 è 1

A=0

Spero che sia più chiaro

Grazie.

 

Strano loop...

Ho fatto un ciclo strano nel mio programma di prova:

int A=1

for(A=0, A=1; A==(condizione di acquisto); A++)

Compra se(A=1)

Chiudi se(Bid>0)

Tratta dopo la scomparsa della contition... MA, non chiude le operazioni subito dopo l'apertura (come dovrebbe - Bid>0). Ora il mio pogramma chiude tutti i trade solo se appare la condizione di acquisto.

Cosa fa in realtà questo ciclo?

 
ohir:
Ho fatto qualche strano ciclo nel mio programma di prova:

int A=1

for(A=0, A=1; A==(condizione di acquisto); A++)

Compra se(A=1)

Chiudi se(Bid>0)

Tratta dopo la scomparsa della contition... MA, non chiude le operazioni subito dopo l'apertura (come dovrebbe - Bid>0). Ora il mio pogramma chiude tutte le operazioni solo se appare la condizione di acquisto.

Cosa fa questo ciclo in realtà?

Ciao ohir,

Non mi sono mai occupato della scrittura di EA, ho fatto solo indicatori, quindi non sono la persona migliore a cui chiedere.

Comunque con un ciclo for dichiari il punto di partenza (numero di barra), poi la tua condizione per mantenere il ciclo in esecuzione, quindi incrementi il tuo punto di partenza per il prossimo ciclo.

for (x=bars-1;x>0;x--) questo ciclo si estende a tutte le barre del grafico dalla prima all'ultima.

for (x=0;x<bars-1;x++) fa il loop al contrario

x è solo il contatore del ciclo

Il tuo inizia dalla barra 0 o 1 (non sono sicuro di come funziona con la virgola) poi mentre il tuo contatore è uguale alla condizione di acquisto (impossibile, secondo me) continua il ciclo, poi incrementa il contatore.

Prova qualcosa come

for (x=0;x<=bars-1;x++)

{

if (A[x]==1) OrderSend(bla,bla,bla)

se (Bid[x]>0) OrderClose(blah,.....)

}

Non so se tutto questo aiuta, ma è il meglio che posso fare. Forse qualcuno con più conoscenza può essere in grado di aiutare di più.

Buona Fortuna

Swagman

 

Aiuto per favore

Ok, l'ho preso - cancella questo post

File:
trenddetect.mq4  14 kb
 

Metatrader e numeri negativi

Qualcuno conosce un modo migliore per codificare questo ???? Non riesco a far leggere a Metatrader i numeri esatti, alcuni sono positivi e altri sono numeri negativi.

if (Use_Entry_Delay == true) {

//if (trendis == 0 || trendis == -0) {

//EntryAllowed= True;

//Stampa ("Ingresso consentito");

//}

if (trendis == 0.0010){ EntryAllowed= true; Stampa ("Entrata consentita"); }

if (trendis == 0.0011){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0012){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0013){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0014){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0015){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0016){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0017){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0018){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0019){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0020){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0021){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0022){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0023){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0024){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0025){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0026){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0010){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0011){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0012){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0013){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0014){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0015){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0016){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0017){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0018){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0019){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0020){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0021){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0022){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0023){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0024){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0025){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0026){ EntryAllowed= true; Print ("Entry Allowed"); }

}else{

EntryAllowed= false;

Print ("Entrata non consentita");

}

}

-----------------------------------------

quindi fondamentalmente se è -0.0010 o inferiore non farlo

se è superiore a 0.0026 o superiore a -0.0026 non farlo.

Provato molte cose non riesce a farlo.

Qualsiasi AIUTO per favore per favore per favore.

 
niteuser:
Qualcuno conosce un modo migliore per codificare questo ???? Non riesco a far leggere a Metatrader i numeri esatti, alcuni sono positivi e altri sono numeri negativi.

if (Use_Entry_Delay == true) {

//if (trendis == 0 || trendis == -0) {

//EntryAllowed= True;

//Stampa ("Ingresso consentito");

//}

if (trendis == 0.0010){ EntryAllowed= true; Stampa ("Entrata consentita"); }

if (trendis == 0.0011){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0012){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0013){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0014){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0015){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0016){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0017){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0018){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0019){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0020){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0021){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0022){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0023){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0024){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0025){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == 0.0026){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0010){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0011){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0012){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0013){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0014){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0015){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0016){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0017){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0018){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0019){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0020){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0021){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0022){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0023){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0024){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0025){ EntryAllowed= true; Print ("Entry Allowed"); }

if (trendis == -0.0026){ EntryAllowed= true; Print ("Entry Allowed"); }

}else{

EntryAllowed= false;

Stampa ("Entrata non consentita");

}

}

-----------------------------------------

quindi fondamentalmente se è -0.0010 o inferiore non farlo

se è superiore a 0.0026 o superiore a -0.0026 non farlo.

Ho provato molte cose e non riesco a farlo.

Qualsiasi AIUTO per favore, per favore.
if ((trendis = 0.0026)) { EntryAllowed= true; Print ("Entry Allowed"); }