No puedo hacer que en un EA emita una orden de compra o venta. Me salta un error (130): invalid stops. Aquí muestro el código super simplicado, únicamente para probar si puede efectuar la orden de compra. Pero no encuentro el error.
Alguien puede ayudarme?
/+------------------------------------------------------------------+
//| EA_pru.mq4 |
//| Copyright © 2011, Cla |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Cla"
#property link ""
#include <stdlib.mqh>
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
static int ticks;
ticks++;
if (ticks<3)
{
int ticket;
ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,Ask+250*Point,"Mi EApru",12345,0,Green);
if(ticket>0)
{
string texto1="entró en Orderselect"+ "\n";
Comment("",texto1);
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES);
}
if(ticket<0)
{
string texto2="entró en Error"+ "\n";
Comment("",texto2);
int err;
err=GetLastError();
Alert("buy error(",err,"): ",ErrorDescription(err));
Sleep(300);
}
else Alert("Ticket buy: ",ticket);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Una ayuda eneste EA muy simple por favor
-
- Mensajes: 2
- Registrado: 28 Mar 2011 15:43
Re: Una ayuda eneste EA muy simple por favor
Prueba a poner OrderSend(....... 3,0,NormalizeDouble(Ask+250*Point, Digits), ....)
NormalizeDouble. "The calculated StopLoss and TakeProfit values, as well as open price of pending orders must be normalized with a precision the value of which is stored in the pre-defined variable of Digits."
NormalizeDouble. "The calculated StopLoss and TakeProfit values, as well as open price of pending orders must be normalized with a precision the value of which is stored in the pre-defined variable of Digits."
Re: Una ayuda eneste EA muy simple por favor
Hay brokers que al cambio del €/$ le añaden un quinto céntimo y al del $/Y le añaden un tercer centimo (por ponerte dos ejemplos de dos cruces) es posible que este añadiendo un precio que no le guste a tu broker, porque tu borker sea de 5 y le estes dando cuatro ó al reves.
El error 130 te aparece porque estas poniendo un orden de Stop demasiado cerca del precio, invadiendo un área de seguridad que suele ser de 5 pips y que se llama STOPLEVEL.
He encontrado esto en http://www.forexfactory.com/showthread. ... 50&page=55
Error 130, means invalid stops. In back testing you don't have STOPLEVEL control therefore it work fine, But in forward testing if your StopLoss is less than you STOPLEVEL it becomes an invalid Stop and you receive error 130
espero que te valga.
El error 130 te aparece porque estas poniendo un orden de Stop demasiado cerca del precio, invadiendo un área de seguridad que suele ser de 5 pips y que se llama STOPLEVEL.
He encontrado esto en http://www.forexfactory.com/showthread. ... 50&page=55
Error 130, means invalid stops. In back testing you don't have STOPLEVEL control therefore it work fine, But in forward testing if your StopLoss is less than you STOPLEVEL it becomes an invalid Stop and you receive error 130
espero que te valga.
Si te ha gustado este hilo del Foro, ¡compártelo en redes!