[Qualsiasi domanda da principiante, per non ingombrare il forum. Professionisti, non passate oltre. Non potrei andare da nessuna parte senza di te - 2. - pagina 229

 
Sh.ProTrader:

Ciao a tutti!

Potete per favore aiutarmi con questa domanda?

Sto cercando di ottenere il valore esatto di apertura(Open[i]) o di chiusura(Close[i]) della coppia di valute EURUSD con un valore di cinque cifre dopo lo zero, ma in risposta ottengo sempre un valore arrotondato!


utilizzare la funzione DoubleToStr(value, Digits) quando si visualizza il valore;
 

Salve.

Ho una domanda da principiante:

come ottenere dati in MQL4 sul "Profitto" corrente per posizioni aperte e totale; come ottenere dati sul saldo corrente.

 

La documentazione ha una voce di informazioni sull'account. se non c'è una funzione per qualsiasi informazione sull'ordine, devi passare attraverso tutti gli ordini e ottenere le informazioni giuste per quelli giusti.

 

Potete dirmi come determinare se una candela ha chiuso sotto o sopra un certo livello di Fibonacci?

Close[i] è chiaro, ma come faccio a sapere dove si trova il livello rispetto al prezzo?

 
alsu:
utilizzare DoubleToStr(value, Digits) quando si visualizza il valore;

Grazie mille!

L'ho già capito, ho cercato in tutto il forum, su questo argomento, ma nessuno ha risposto chiaramente, in realtà è abbastanza semplice.

Risulta che il valore è arrotondato a 4 cifre solo quando si cerca di stamparlo usando Alert(), Comment() o Print() senza DoubleToStr(value, Digits).

E per calcolare il programma usa i valori senza arrotondamento al 4° segno, se volete arrotondare dovete usare il

NormalizeDouble( valore, Dijist).

Quindi dovresti semplicemente leggere l'aiuto con più attenzione e tutto andrà bene ;)

 
fury2006:

Potete dirmi come determinare se una candela ha chiuso sotto o sopra un certo livello di Fibonacci Fan?

Close[i] è chiaro, ma come faccio a sapere dove si trova il livello rispetto al prezzo?


Il prezzo di livello deve essere richiesto programmaticamente. A tal fine, è necessario aver precedentemente posizionato e configurato (tutto programmaticamente) l'oggetto "Fibo" sul grafico. Questo non è così facile come può sembrare a prima vista. Tuttavia, gli dei non bruciano le stoviglie. Una volta ho dovuto giocare con i livelli di Fibo. E ora sto lavorando con l'elaborazione di questi livelli. In generale, se vuoi puoi capirlo.

Ecco un esempio di codice per creare un Fibo su un grafico.

if(Ind1>Ind2 && Ind2!=0){//индикатор прорисовался вверх, рисуем фибо вверх
      IndUp=true;IndDown=false;
      fff=ObjectFind("FiboLewels");
      if(fff==-1){
        if(!ObjectCreate("FiboLewels",OBJ_FIBO,0,Time[Maximum(Ind1)],Ind1,Time[Minimum(Ind2)],Ind2)){
          GeneralError();
        }
        if(!ObjectSet("FiboLewels",OBJPROP_COLOR,Red)||!ObjectSet("FiboLewels",OBJPROP_LEVELCOLOR,Blue)){
          GeneralError();
        }
        // ------ Устанавливаем количество уровней фибо ----------
                                if(!ObjectSet("FiboLewels",OBJPROP_FIBOLEVELS,22)){
                                        GeneralError();
                                }
                                // ------- Устанавливаем свойства фибоуровней ------------
                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+0,0)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 0,"0.0     %$")){GeneralError();}
   
                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+1,0.118)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 1,"11.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+2,0.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 2,"23.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+3,0.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 3,"38.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+4,0.5)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 4,"50.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+5,0.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 5,"61.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+6,0.764)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 6,"76.4     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+7,0.882)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 7,"88.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+8,1)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 8,"100.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+9,1.118)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 9,"111.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+10,1.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 10,"123.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+11,1.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 11,"138.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+12,1.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 12,"161.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+13,2)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 13,"200.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+14,2.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 14,"238.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+15,2.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 15,"261.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+16,3)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 16,"300.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+17,3.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 17,"338.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+18,3.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 18,"361.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+19,4)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 19,"400.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+20,4.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 20,"423.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+21,4.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 21,"461.8     %$")){GeneralError();}
      } 
    }

Ho dovuto fare una subroutine per richiedere il prezzo del livello. Eccola qui (puoi capirla se vuoi)

// ------------- PriceSignLevelUp() -----------------------------------------------
// функция возвращает цену сигнального уровня при прорисовке индикатора вверх
//---------------------------------------------------------------------------------
double PriceSignLevelUp(double Level,double Ind1,double Ind2){
  double Fibo0=0,Fibo100=0,Rst=0;
  Fibo0=Ind2;
  Fibo100=Ind1;
  Rst=Ind1-Ind2;
  switch(Level){
    case 0:          Level=NormalizeDouble(Fibo0,digits); break;
    case 11.8:       Level=NormalizeDouble(Fibo0+Rst*0.118,digits); break;
    case 23.6:       Level=NormalizeDouble(Fibo0+Rst*0.236,digits); break;
    case 38.2:       Level=NormalizeDouble(Fibo0+Rst*0.382,digits); break;
    case 50:         Level=NormalizeDouble(Fibo0+Rst*0.5,digits); break;
    case 61.8:       Level=NormalizeDouble(Fibo0+Rst*0.618,digits); break;
    case 76.4:       Level=NormalizeDouble(Fibo0+Rst*0.764,digits); break;
    case 88.2:       Level=NormalizeDouble(Fibo0+Rst*0.882,digits); break;
    case 100:        Level=NormalizeDouble(Fibo100,digits); break;
    case 111.8:      Level=NormalizeDouble(Fibo0+Rst*1.118,digits); break;
    case 123.6:      Level=NormalizeDouble(Fibo0+Rst*1.236,digits); break;
    case 138.2:      Level=NormalizeDouble(Fibo0+Rst*1.382,digits); break;
    case 161.8:      Level=NormalizeDouble(Fibo0+Rst*1.618,digits); break;
    case 200:        Level=NormalizeDouble(Fibo0+Rst*2,digits); break;
    case 238.2:      Level=NormalizeDouble(Fibo0+Rst*2.382,digits); break;
    case 261.8:      Level=NormalizeDouble(Fibo0+Rst*2.618,digits); break;
    case 300:        Level=NormalizeDouble(Fibo0+Rst*3,digits); break;
    case 338.2:      Level=NormalizeDouble(Fibo0+Rst*3.382,digits); break;
    case 361.8:      Level=NormalizeDouble(Fibo0+Rst*3.618,digits); break;
    case 400:        Level=NormalizeDouble(Fibo0+Rst*4,digits); break;
    case 423.6:      Level=NormalizeDouble(Fibo0+Rst*4.236,digits); break;
    case 461.8:      Level=NormalizeDouble(Fibo0+Rst*4.618,digits); break;
  }         
  return(Level);
}
 

Io stesso ieri sera ho rivisto il libro, nuove dimensioni del trading, Williams, ieri a 30, oggi a 50 pagine.

Ho un robot, ma non funziona affatto, nessun trade nel tester, e Alert("buy",GetLastError()) non dice nulla.

Mi piacerebbe accettare qualsiasi sano consiglio, per favore.

//+------------------------------------------------------------------+
//| Aligator.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp.
#proprietà link "http://www.metaquotes.net"
extern int jaw_period=13,teeth_period=8,jaw_shift=8,tteeth_period=5,teeth_shift=5,lips_period=3,lips_shift=3;
extern double volume=0.1,stoploss=20,takeprofit=50;
//+------------------------------------------------------------------+
//| funzione di inizializzazione dell'esperto |
//+------------------------------------------------------------------+
int init()
{
//----

//----
ritorno(0);
}
//+------------------------------------------------------------------+
//| funzione di deinizializzazione esperto |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
ritorno(0);
}
//+------------------------------------------------------------------+
//| funzione di inizio esperto |
//+------------------------------------------------------------------+
int tiket;
int start()
{double blu,red,grin;
//----
blu= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ;
red= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATOREETH, 0) ;
grin= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORLIPS, 0) ;
//----


double Fractalu,Fractall;Fractalu=iFractals( 0, 0, MODE_UPPER, 0) ;Fractall=iFractals( 0, 0,MODE_LOWER, 0);


se (Fractalu>0&&Fractalu>blu&&Fractalu>red&&Fractalu>grin)
{ tiket= OrderSend( 0, OP_BUY, volume, Bid, Point*3, Bid- stoploss*Point, Bid+ takeprofit*Point, "Pose66", 1234567890, 0, Red);Alert("buy",GetLastError());}

se (Fractall>0&&Fractalu<blu&&Fractalu<rosso&&Fractalu<grin)


{ tiket= OrderSend( 0, OP_SELL, volume, Ask, Point*3, Ask+ stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue);Alert("sell",GetLastError());}




ritorno(0);
}
//+------------------------------------------------------------------+

 
Dimka-novitsek:

Io stesso ieri sera ho rivisto il libro, nuove dimensioni del trading, Williams, ieri a 30, oggi a 50 pagine.

Ho un robot, ma non funziona affatto, nessun trade nel tester, e Alert("buy",GetLastError()) non dice nulla.

Mi piacerebbe ricevere qualche consiglio valido, per favore.

//+------------------------------------------------------------------+
//| Aligatorny.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp.
#proprietà link "http://www.metaquotes.net"
extern int jaw_period=13,teeth_period=8,jaw_shift=8,tteeth_period=5,teeth_shift=5,lips_period=3,lips_shift=3;
extern double volume=0.1,stoploss=20,takeprofit=50;
//+------------------------------------------------------------------+
//| funzione di inizializzazione dell'esperto |
//+------------------------------------------------------------------+
int init()
{
//----

//----
ritorno(0);
}
//+------------------------------------------------------------------+
//| funzione di deinizializzazione esperto |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
ritorno(0);
}
//+------------------------------------------------------------------+
//| funzione di inizio esperto |
//+------------------------------------------------------------------+
int tiket;
int start()
{double blu,red,grin;
//----
blu= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ;
red= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATOREETH, 0) ;
grin= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORLIPS, 0) ;
//----


double Fractalu,Fractall;Fractalu=iFractals( 0, 0, MODE_UPPER, 0) ;Fractall=iFractals( 0, 0,MODE_LOWER, 0);


se (Fractalu>0&&Fractalu>blu&&Fractalu>red&&Fractalu>grin)
{ tiket= OrderSend( 0, OP_BUY, volume, Bid, Point*3, Bid- stoploss*Point, Bid+ takeprofit*Point, "Pose66", 1234567890, 0, Red);Alert("buy",GetLastError());}

se (Fractall>0&&Fractalu<blu&&Fractalu<rosso&&Fractalu<grin)


{ tiket= OrderSend( 0, OP_SELL, volume, Ask, Point*3, Ask+ stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue);Alert("sell",GetLastError());}




ritorno(0);
}
//+------------------------------------------------------------------+


"Tutto è già stato rubato prima di te", così come "I tuoi cavalli stanno tranquillamente galoppando"... :-)))

Vedere qui.

 

Grazie!!!

Ma volevo anche imparare a codificare, quindi volevo capire cosa c'è di sbagliato.

 

Cosa potrebbe causare l'errore (prezzo sbagliato)?

Motivazione: