¿Cómo codificar? - página 231

 

Excelente, ¡gracias!

 

hombre, matrices y funciones, no es mi taza de té.

 

Ayuda para EA

Quiero hacer lo siguiente:

Utilizar marcos M15 y abrir durante este intervalo dos órdenes como máximo comparando el precio actual con el cierre M15 anterior(close[1]). Sin embargo, no sé cómo escribir el código para ello, ya que quiero que este procedimiento se lleve a cabo cada marco M15 siguiente. ¿Cómo mantener las variables correctas para contar 2 órdenes en el máximo cada M15 ya que la función de inicio siempre se ejecuta?

Gracias

 

Necesito ayuda con un script para abrir órdenes pendientes.

Sé que hay muchos scripts aquí que abren y cierran órdenes pero no puedo encontrar uno que abra órdenes pendientes.

Lo que necesito son 2 scripts, 1 Sellstop y 1 Buystop.

Me gustaría que el Buystop abriera una orden Buystop 15 pips por encima del Pivote diario y que el SellStop abriera 15 pips por debajo del Pivote diario.

He jugado con ello y tengo el código de abajo para un SellStop, pero no soy un codificador y no funciona. Supongo que se me ha escapado algo.

¿Alguien puede ayudarme con esto, por favor.

PD: no importa, ya lo tengo. Tuve que cambiar mi precio de oferta a la PVTGreen . Yo estaba recibiendo un error de 130 ..

Ahora funciona...

Ok, un problema más, ¿Puede alguien decirme cómo cambiar la hora de caducidad de 24 horas más tarde a 22:00 del mismo día.

//+------------------------------------------------------------------+

//| script "send pending order with expiration data" |

//+------------------------------------------------------------------+

int start()

{

int ticket,expiration;

double point;

double PVTYellow = iCustom(NULL, 0, "pivot_alllevels", 0, 0, 0);

double PVTBlue = iCustom(NULL, 0, "pivot_alllevels", 0, 1, 0);

double PVTGreen = iCustom(NULL, 0, "pivot_alllevels", 0, 2, 0);

double PVTRed = iCustom(NULL, 0, "pivot_alllevels", 0, 3, 0);

double PVTMagenta = iCustom(NULL, 0, "pivot_alllevels", 0, 4, 0);

//----

point=MarketInfo(Symbol(),MODE_POINT);

expiration=TimeCurrent()+PERIOD_D1*60;

//----

while(true)

{

ticket = OrderSend(Symbol(),OP_SELLSTOP, 0.10, PVTGreen-15*Point, 3, PVTGreen+20*Point, PVTGreen-20*Point, 0,0,expiration,Red);

if(ticket<=0) Print("Error = ",GetLastError());

else { Print("ticket = ",ticket); break; }

//---- 10 seconds wait

Sleep(10000);

}

//----

return(0);

}

//+------------------------------------------------------------------+
 

Para hacer que la expiración sea a las 22:00 podrías hacer esto...

int iHour = TimeHour(TimeCurrent());

int iMinute = TimeMinute(TimeCurrent());

int iDiff = 22%iHour;

datetime dtExpiryDate = (TimeCurrent()+(iDiff*60*60))-(iMinute*60);

Print(TimeToStr(dtExpiryDate));

No hay comprobación de errores así que si crees que lo vas a necesitar asegúrate de añadirlo.

Lux

 

Agarrar los símbolos de la vigilancia del mercado

Hola a todos,

Me preguntaba si hay una manera de agarrar todos los símbolos disponibles en la vigilancia del mercado para el seguimiento en lugar de alimentar manualmente la EA?

En otras palabras, quiero que mi EA vaya a través de cualquier símbolo que esté disponible en la ventana de vigilancia del mercado y los monitoree para un determinado criterio.

cualquier ayuda es muy apreciada.

 

Ayuda - Balance de cuenta el domingo

Hola,

Estoy tratando desde ayer para jugar un caché de mi toda la semana desde el Balance de la cuenta del domingo (éxito del mercado de apertura) revela.

Necesito Para llevar a ejecutar un Balance de la cuenta de EA del domingo en el éxito del mercado de apertura para el administrador de la equidad correctamente.

doble usedacc = 0;

...

if (usedacc == 0 | | DayOfWeek () == 0) usedacc = Account Balance ();

...

Simplemente no funciona

Tal vez alguien me puede ayudar como mejor l Puede

Lo siento a la mala Inglés

 

por favor, borre este mensaje - gracias

 

¿Cómo puedo obtener los datos del indicador?

Hola a todos,

Necesito para un EA los valores FIBO100 y FIBO0 del indicador. ¿Cómo puedo obtenerlos?

Gracias

derumuro

Archivos adjuntos:
 

¿Cómo lo consigues?

Compañero, me encontré con un problema similar

Scott

La comunicación "inter script" (o "inter indicador") en MQL pasa exclusivamente por los buffers. Este código :

trendset = iCustom(NULL,0, "VGA HISTOGRAM~",0,0);

Significa que quiere recuperar el valor de la barra actual del primer buffer (público) del indicador "VGA HISTOGRAM~". No se pueden recuperar valores de variables declaradas en otro indicador (y no importa si están declaradas como externas) Se puede intentar con variables globales, pero las variables globales son difíciles de trabajar y ofrecen más posibilidades de cometer un error que de trabajar correctamente con ellas o se puede escribir una DLL (metatrader utiliza sólo una instancia de una DLL por gráfico, independientemente de los parámetros, así que puedes hacer una especie de "semáforo" que mantenga y devuelva valores dependiendo de IDs de cualquier tipo - eso aseguraría la comunicación entre códigos mql y evitaría la lectura de variables erróneas (las variables globales por ejemplo pueden ser fácilmente confundidas y puedes leer variables de un gráfico completamente diferente sin siquiera saberlo)

saludos

Mladen

En realidad he hecho una solución para esto que voy a compartir con ustedes.

En tu indicador haz una nueva función para que las cosas no se compliquen.

void PASSINFO() {

int trendcondtemp; //cambia esto por el nombre que desees, no importa, déjalo si eres perezoso

if (Close[1] > Open[2] && Volume[1] < Volume[2]) trendcondtemp=1; //bullish - esto sólo establece un valor a la variable usa tu código

if (Close[1] < Open[2] && Volume[1] < Volume[2]) trendcondtemp=2; //bearish - lo mismo, diferente olor

if (Volume[1] > Volume[2])trendcondtemp=3; //mierda todo lo que pasa - meh

if (Symbol()=="USDCHF") GlobalVariableSet("TRENDSETUSDCHF ",trendcondtemp);

if (Symbol()=="GBPUSD") GlobalVariableSet("TRENDSETGBPUSD",trendcondtemp);

if (Symbol()=="EURUSD") GlobalVariableSet("TRENDSETEURUSD",trendcondtemp);

if (Symbol()=="USDJPY") GlobalVariableSet("TRENDSETUSDJPY",trendcondtemp);

if (Symbol()=="USDCAD") GlobalVariableSet("TRENDSETUSDCAD",trendcondtemp);

if (Symbol()=="NZDUSD") GlobalVariableSet("TRENDSETNZDUSD",trendcondtemp);

if (Symbol()=="AUDUSD") GlobalVariableSet("TRENDSETAUDUSD",trendcondtemp);

if (Symbol()=="AUDNZD") GlobalVariableSet("TRENDSETAUDNZD",trendcondtemp);

if (Symbol()=="AUDCAD") GlobalVariableSet("TRENDSETAUDCAD",trendcondtemp);

if (Symbol()=="EURUSD") GlobalVariableSet("TRENDSETEURUSD",trendcondtemp);

if (Symbol()=="AUDCHF") GlobalVariableSet("TRENDSETAUDCHF",trendcondtemp);

if (Symbol()=="AUDJPY") GlobalVariableSet("TRENDSETAUDJPY",trendcondtemp);

si (Symbol()=="CHFJPY") GlobalVariableSet("TRENDSETCHFJPY",trendcondtemp);

if (Symbol()=="EURGBP") GlobalVariableSet("TRENDSETEURGBP",trendcondtemp);

if (Symbol()=="EURAUD") GlobalVariableSet("TRENDSETEURAUD",trendcondtemp);

if (Symbol()=="EURCHF") GlobalVariableSet("TRENDSETEURCHF",trendcondtemp);

if (Symbol()=="EURJPY") GlobalVariableSet("TRENDSETEURJPY",trendcondtemp);

if (Symbol()=="EURNZD") GlobalVariableSet("TRENDSETEURNZD",trendcondtemp);

if (Symbol()=="GBPCHF") GlobalVariableSet("TRENDSETGBPCHF",trendcondtemp);

if (Symbol()=="GBPAUD") GlobalVariableSet("TRENDSETGBPAUD",trendcondtemp);

if (Symbol()=="GBPCAD") GlobalVariableSet("TRENDSETGBPCAD",trendcondtemp);

if (Symbol()=="GBPJPY") GlobalVariableSet("TRENDSETGBPJPY",trendcondtemp);

if (Symbol()=="NZDJPY") GlobalVariableSet("TRENDSETNZDJPY",trendcondtemp);

//añade el petróleo/oro/chicharros/lo que sea que negocies después de esto cubrí todo lo que hace mi broker

}

Ok ahora porque su moneda depende theres ninguna posibilidad de que el cruce con otra moneda y el relleno de los valores para arriba. Ahora tiene que poner esto en su función de inicio / lo que sea antes de llamar al valor.

int trendset;

if (Symbol()=="USDCHF") trendset= GlobalVariableGet("TRENDSETUSDCHF");

if (Symbol()=="GBPUSD") trendset= GlobalVariableGet("TRENDSETGBPUSD");

if (Symbol()=="EURUSD") trendset= GlobalVariableGet("TRENDSETEURUSD");

if (Symbol()=="USDJPY") trendset= GlobalVariableGet("TRENDSETUSDJPY");

if (Symbol()=="USDCAD") trendset= GlobalVariableGet("TRENDSETUSDCAD");

if (Symbol()=="NZDUSD") trendset= GlobalVariableGet("TRENDSETNZDUSD");

if (Symbol()=="AUDUSD") trendset= GlobalVariableGet("TRENDSETAUDUSD");

if (Symbol()=="AUDNZD") trendset= GlobalVariableGet("TRENDSETAUDNZD");

if (Symbol()=="AUDCAD") trendset= GlobalVariableGet("TRENDSETAUDCAD");

if (Symbol()=="EURUSD") trendset= GlobalVariableGet("TRENDSETEURUSD");

if (Symbol()=="AUDCHF") trendset= GlobalVariableGet("TRENDSETAUDCHF");

if (Symbol()=="AUDJPY") trendset= GlobalVariableGet("TRENDSETAUDJPY");

si (Symbol()=="CHFJPY") trendset= GlobalVariableGet("TRENDSETCHFJPY");

if (Symbol()=="EURGBP") trendset= GlobalVariableGet("TRENDSETEURGBP");

if (Symbol()=="EURAUD") trendset= GlobalVariableGet("TRENDSETEURAUD");

if (Symbol()=="EURCHF") trendset= GlobalVariableGet("TRENDSETEURCHF");

if (Symbol()=="EURJPY") trendset= GlobalVariableGet("TRENDSETEURJPY");

if (Symbol()=="EURNZD") trendset= GlobalVariableGet("TRENDSETEURNZD");

if (Symbol()=="GBPCHF") trendset= GlobalVariableGet("TRENDSETGBPCHF");

if (Symbol()=="GBPAUD") trendset= GlobalVariableGet("TRENDSETGBPAUD");

if (Symbol()=="GBPCAD") trendset= GlobalVariableGet("TRENDSETGBPCAD");

if (Symbol()=="GBPJPY") trendset= GlobalVariableGet("TRENDSETGBPJPY");

if (Symbol()=="NZDJPY") trendset= GlobalVariableGet("TRENDSETNZDJPY");

¡¡¡Tenga en cuenta!!! (usted probablemente ya se da cuenta de esto) pero usted tiene que tener el indicador que se ejecuta en su moneda su ea se ejecuta en los valores para cambiar de lo contrario sólo obtendrá la antigua variable que se almacena durante semanas en mt4.