Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol()) continue;
//---Check Order Type
if(OrderType()==OP_BUY)
{
if(fastma < slowma)
{
if(OrderClose(OrderTicket(),Lots,OrderClosePrice(),10,clrNONE))
Print("Order Closed : ", OrderClosePrice());
else
Print("Error Closing order ", GetLastError());
}
}
if(OrderType()==OP_SELL)
{
if(fastma > slowma)
{
if(OrderClose(OrderTicket(),Lots,OrderClosePrice(),10,clrNONE))
Print("Order Closed : ", OrderClosePrice());
else
Print("Error Closing Order : ", GetLastError());
}
}
}
Sleep(300000);
return(0);
}
Sí, hay que hacer una cuenta atrás cuando se cierran las órdenes:
Sí, hay que hacer una cuenta atrás al cerrar las órdenes:
¿Por qué continuar?
¿Por qué continuar?
//|System start |
//+---------------------------------------------+
int start()
{
double fastma, slowma;
int ticket, total;
//---define Ma's
fastma = iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0);
slowma = iMA(NULL,0,8,0,MODE_SMA,PRICE_CLOSE,0);
total = OrdersTotal();
//---Start operations
if(total < 1)
{
if(fastma > slowma)
{
ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,10,0,0,"",0,0,Blue);
if(ticket > 0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
Print("Buy order opened : ", OrderOpenPrice());
}
else
Print("Error opening order : ", GetLastError());
return(0);
}
if(fastma < slowma)
{
ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,10,0,0,"",0,0,Red);
if(ticket > 0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
Print("Sell order opened : ", OrderOpenPrice());
}
else
Print("Error opening order : ", GetLastError());
return(0);
}
return(0);
}
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=MagicNumber && OrderSymbol()!=Symbol()) continue;
//---Check Order Type
if(OrderType()==OP_BUY)
{
if(fastma < slowma)
{
if(OrderClose(OrderTicket(),Lots,OrderClosePrice(),10,clrNONE))
Print("Order Closed : ", OrderClosePrice());
else
Print("Error Closing order ", GetLastError());
}
}
if(OrderType()==OP_SELL)
{
if(fastma > slowma)
{
if(OrderClose(OrderTicket(),Lots,OrderClosePrice(),10,clrNONE))
Print("Order Closed : ", OrderClosePrice());
else
Print("Error Closing Order : ", GetLastError());
}
}
}
Sleep(300000);
return(0);
}
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=MagicNumber || OrderSymbol()!=Symbol()) continue;
//---Check Order Type
if(OrderType()==OP_BUY)
OrderSelect(i,SELECT_BY_POS)
&& OrderMagicNumber() == MagicNumber
&& OrderSymbol() == Symbol()
){
//---Check Order Type
if(OrderType()==OP_BUY)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=MagicNumber && OrderSymbol()!=Symbol()) continue;
//---Check Order Type
if(OrderType()==OP_BUY)
OrderSelect(i,SELECT_BY_POS)
&& OrderMagicNumber() == MagicNumber
&& OrderSymbol() == Symbol()
){
//---Check Order Type
if(OrderType()==OP_BUY)
Cada gráfico sigue sin funcionar de forma independiente, ¿hay algo más que pueda hacer?
Y tal y como está codificado, ya no cierra las operaciones.
total = OrdersTotal();
//---Start operations
if(total <= 1)