[¡Archivo!] Cualquier pregunta de novato, para no saturar el foro. Profesionales, no lo dejéis pasar. No podría ir a ningún sitio sin ti - 2. - página 229

 
Sh.ProTrader:

Hola a todos.

¿Pueden ayudarme con esta pregunta?

Estoy intentando obtener el valor exacto de apertura(Open[i]) o cierre(Close[i]) del par de divisas EURUSD con un valor de cinco dígitos después de cero, pero en respuesta siempre obtengo un valor redondeado.


utilizar la función DoubleToStr(valor, Dígitos) al mostrar el valor;
 

Hola.

Tengo una pregunta como principiante:

cómo obtener datos en MQL4 sobre el "Beneficio" actual por posiciones abiertas y total; cómo obtener datos sobre el saldo actual.

 

Si no hay ninguna función para la información de un pedido, hay que recorrer todos los pedidos y obtener la información requerida para los correctos.

 

¿Puedes decirme cómo determinar si una vela ha cerrado por debajo o por encima de un determinado nivel de Fibonacci?

Close[i] está claro, pero ¿cómo puedo saber dónde está el nivel en relación con el precio?

 
alsu:
utilizar DoubleToStr(valor, Dígitos) al mostrar el valor;

¡Muchas gracias!

Ya lo he averiguado, he buscado en todo el foro, en este tema, pero nadie ha respondido con claridad, en realidad es bastante sencillo.

Resulta que el valor se redondea a 4 dígitos sólo cuando se intenta imprimir con Alert(), Comment() o Print() sin DoubleToStr(value, Digits).

Y para calcular el programa utiliza los valores sin redondear al 4º signo, si se quiere redondear se debe utilizar el

NormalizarDoble( valor, Dijist).

Así que deberías leer la ayuda con más atención y todo irá bien ;)

 
fury2006:

¿Puedes decirme cómo determinar si una vela cerró por debajo o por encima de un determinado nivel de abanico de Fibonacci?

Close[i] está claro, pero ¿cómo puedo saber dónde está el nivel en relación con el precio?


El precio del nivel debe solicitarse por medio de un programa. Para ello, debe haber colocado y configurado previamente (todo ello de forma programada) el objeto "Fibo" en el gráfico. Esto no es tan fácil como puede parecer a primera vista. Sin embargo, los dioses no queman la olla. Una vez tuve que jugar con los niveles de Fibo. Y ahora estoy trabajando con el procesamiento de estos niveles. En general, si quieres, puedes averiguarlo.

Aquí hay un ejemplo de código para crear un Fibo en un gráfico.

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

Tuve que hacer una subrutina para solicitar el precio del nivel. Aquí está (si quieres, puedes averiguarlo)

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

Buenas noches! Yo mismo anoche revisé el libro, nuevas dimensiones del comercio, Williams, ayer a 30, hoy a 50 páginas.

Tengo un robot, pero no funciona en absoluto, no hay operaciones en el probador, y Alert("buy",GetLastError()) no dice nada.

Me encantaría recibir cualquier consejo sensato, por favor.

//+------------------------------------------------------------------+
//| Aligator.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp.
#enlace de propiedad "http://www.metaquotes.net"
extern int periodo_de_la_mandíbula=13,periodo_de_los_dientes=8,desplazamiento_de_la_mandíbula=8,periodo_de_los_dientes=5,desplazamiento_de_los_dientes=5,periodo_de_los_labios=3,desplazamiento_de_los_labios=3;
extern double volumen=0.1,stoploss=20,takeprofit=50;
//+------------------------------------------------------------------+
//| función de inicialización de expertos |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| función de desinicialización experta |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| función de inicio experto |
//+------------------------------------------------------------------+
int tiket;
int inicio()
{doble blu,red,grin;
//----
blu= iAlligator( 0, 0, periodo_mandíbula, desplazamiento_mandíbula, periodo_dientes, desplazamiento_dientes, periodo_labios, desplazamiento_labios, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ;
red= iAlligator( 0, 0, periodo_mandíbula, desplazamiento_mandíbula, periodo_dientes, desplazamiento_dientes, periodo_labios, desplazamiento_labios, 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);


if (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());}

if (Fractall>0&&Fractalu<blu&&Fractalu<red&&Fractalu<grin)


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




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

 
Dimka-novitsek:

Buenas noches! Yo mismo anoche revisé el libro, nuevas dimensiones del comercio, Williams, ayer a 30, hoy a 50 páginas.

Tengo un robot, pero no funciona en absoluto, no hay operaciones en el probador, y Alert("buy",GetLastError()) no dice nada.

Me encantaría recibir algún consejo sólido, por favor.

//+------------------------------------------------------------------+
//| Aligatorny.mq4 ||
//| Copyright © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#enlace de propiedad "http://www.metaquotes.net"
extern int periodo_de_la_mandíbula=13,periodo_de_los_dientes=8,desplazamiento_de_la_mandíbula=8,periodo_de_los_dientes=5,desplazamiento_de_los_dientes=5,periodo_de_los_labios=3,desplazamiento_de_los_labios=3;
extern double volumen=0.1,stoploss=20,takeprofit=50;
//+------------------------------------------------------------------+
//| función de inicialización de expertos |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| función de desinicialización experta |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| función de inicio experto |
//+------------------------------------------------------------------+
int tiket;
int inicio()
{doble blu,red,grin;
//----
blu= iAlligator( 0, 0, periodo_mandíbula, desplazamiento_mandíbula, periodo_dientes, desplazamiento_dientes, periodo_labios, desplazamiento_labios, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ;
red= iAlligator( 0, 0, periodo_mandíbula, desplazamiento_mandíbula, periodo_dientes, desplazamiento_dientes, periodo_labios, desplazamiento_labios, 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);


if (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());}

if (Fractall>0&&Fractalu<blu&&Fractalu<red&&Fractalu<grin)


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




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


"Todo ha sido ya robado antes que tú", así como "Tus caballos galopan tranquilamente"... :-)))

Vea aquí.

 

¡¡¡Gracias!!!

Pero también quería aprender a codificar, así que quería entender lo que está mal.

 

¿Cuál puede ser la causa del error (precio incorrecto)?

Razón de la queja: