Chicos, cuál es la mejor manera de hacerlo: quiero ver la distribución de los golpes de las operaciones perdedoras y rentables... No se me dan bien las matrices.
Chicos, cuál es la mejor manera de hacerlo: quiero ver la distribución de los golpes de las operaciones perdedoras y rentables... No se me dan bien las matrices.
Una serie de operaciones perdedoras y rentables. Distribución - por ejemplo tenemos 360 operaciones perdedoras (esto se puede ver en el informe), 110 series de 1 operación perdedora, 80 series de 2 operaciones perdedoras y 30 de 3 operaciones perdedoras.
Lo hice así:
Tras identificar la operación perdedora
k=k+1;
Tras determinar una operación rentable
si k==1 {k1=k1+1;}
si k==2 {k2=k2+1;}
si k==3 {k3=k3+1;}
k=0;
Pero esta entrada es demasiado grande e inconveniente para series de 15 o más pérdidas
Serie de operaciones perdedoras y rentables. Distribución - por ejemplo tenemos 360 operaciones perdedoras (esto se puede ver en el informe), 110 series de 1 operación perdedora, 80 series de 2 operaciones perdedoras y 30 de 3 operaciones perdedoras.
Lo hice así:
Tras identificar la operación perdedora
k=k+1;
Tras determinar una operación rentable
si k==1 {k1=k1+1;}
si k==2 {k2=k2+1;}
si k==3 {k3=k3+1;}
k=0;
Pero esta notación es demasiado grande e inconveniente para series de 15 o más pérdidas
No tengo muy clara su tarea.
¿Necesita determinar las series de las últimas posiciones rentables/perdedoras, o necesita recopilar todas estas series de todo el historial de operaciones?
A lo largo de la historia. Recoge y da salida a los datos al final de la prueba. Pero yo lo hago de forma sencilla: después de la primera ganancia tras una serie de pérdidas saco un número separado por comas... Pero quiero simplificar el código y utilizar arrays. ¿Es posible? ¿Y cuál es la mejor manera de hacerlo?
Gracias. Ahora abre algunas órdenes no en la señal y algunos no correctamente.
Se comprueba en una barra existente double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
El precio sube, hay un cruce del nivel 70 y se entra en la operación. En el hecho de cerrar la barra, ya se ve que el RSI está más bajo, pero antes estaba más alto, y luego volvió por debajo del nivel.
Haga la comprobación en una barra cerrada, entonces esto no sucederá, y las entradas serán en una señal confirmada:
Para iniciar sesión y usar el sitio web MQL5.com es necesario permitir el uso de Сookies.
Por favor, active este ajuste en su navegador, de lo contrario, no podrá iniciar sesión.
Ha iniciado sesión. La autenticación de dos factores se ha desactivado. Vuelva a configurarla y escanee un nuevo código QR, o continúe con la autenticación de dos factores desactivada.
Chicos, cuál es la mejor manera de hacerlo: quiero ver la distribución de los golpes de las operaciones perdedoras y rentables... No se me dan bien las matrices.
Después de una venta perdedora
Price_LastSell=5; Vol=Vol*Y; Izm=2; Opn_B=true; k=k+1;
/* Buf1[p]=Buf1[p]+1; p=0;
Alert ("Rentable ", Buf1[1], ", ", Buf1[2], ", ", Buf1[3], ", ", Buf1[4], ", ", Buf1[5], ", ", Buf1[6], ", ", Buf1[7], ", ", Buf1[8], ", Buf1[9], ", Buf1[10]); */
después de la venta rentable
Price_LastSell=5; Vol=VolumeOpen; Izm=2; Opn_S=true; p=p+1;
/* Buf2[k]=Buf2[k]+1; k=0;
Alerta ("Pérdidas ", Buf2[1], ", ", Buf2[2], ", ", Buf2[3], ", ", Buf2[4], ", ", Buf2[5], ",", Buf2[6], ", ", ", Buf2[7], ", ", Buf2[8], ", ", Buf2[9], ", ", Buf2[10], ", ", Buf2[11], ", ", Buf2[12], ", ", Buf2[13], ", ", Buf2[14], ", Buf2[15]); */
¿Qué pasa aquí? Sin escribir en /* todo funciona bien...
Chicos, cuál es la mejor manera de hacerlo: quiero ver la distribución de los golpes de las operaciones perdedoras y rentables... No se me dan bien las matrices.
Después de una venta perdedora
Price_LastSell=5; Vol=Vol*Y; Izm=2; Opn_B=true; k=k+1;
/* Buf1[p]=Buf1[p]+1; p=0;
Alert ("Rentable ", Buf1[1], ", ", Buf1[2], ", ", Buf1[3], ", ", Buf1[4], ", ", Buf1[5], ", ", Buf1[6], ", ", Buf1[7], ", ", Buf1[8], ", Buf1[9], ", Buf1[10]); */
después de la venta rentable
Price_LastSell=5; Vol=VolumeOpen; Izm=2; Opn_S=true; p=p+1;
/* Buf2[k]=Buf2[k]+1; k=0;
Alerta ("Pérdidas ", Buf2[1], ", ", Buf2[2], ", ", Buf2[3], ", ", Buf2[4], ", ", Buf2[5], ",", Buf2[6], ", ", ", Buf2[7], ", ", Buf2[8], ", ", Buf2[9], ", ", Buf2[10], ", ", Buf2[11], ", ", Buf2[12], ", ", Buf2[13], ", ", Buf2[14], ", ", Buf2[15]); */
¿Qué pasa aquí? Sin escribir en /* todo funciona bien...
Una serie de operaciones perdedoras y rentables. Distribución - por ejemplo tenemos 360 operaciones perdedoras (esto se puede ver en el informe), 110 series de 1 operación perdedora, 80 series de 2 operaciones perdedoras y 30 de 3 operaciones perdedoras.
Lo hice así:
Tras identificar la operación perdedora
k=k+1;
Tras determinar una operación rentable
si k==1 {k1=k1+1;}
si k==2 {k2=k2+1;}
si k==3 {k3=k3+1;}
k=0;
Pero esta entrada es demasiado grande e inconveniente para series de 15 o más pérdidas
Serie de operaciones perdedoras y rentables. Distribución - por ejemplo tenemos 360 operaciones perdedoras (esto se puede ver en el informe), 110 series de 1 operación perdedora, 80 series de 2 operaciones perdedoras y 30 de 3 operaciones perdedoras.
Lo hice así:
Tras identificar la operación perdedora
k=k+1;
Tras determinar una operación rentable
si k==1 {k1=k1+1;}
si k==2 {k2=k2+1;}
si k==3 {k3=k3+1;}
k=0;
Pero esta notación es demasiado grande e inconveniente para series de 15 o más pérdidas
No tengo muy clara su tarea.
¿Necesita determinar las series de las últimas posiciones rentables/perdedoras, o necesita recopilar todas estas series de todo el historial de operaciones?
Hice esto, ahora no se abre en cada tic, sino que pasa señales a la entrada...
double slSell,slBuy,tpSell,tpBuy,TotalBiu,TotalSell;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=OrdersTotal()-1; i>=0; i--) //Цикл по всем ордерам
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) //Выбрали ордер
{
if(OrderType()==OP_BUY)
{
TotalBiu++; //Кол. покупок
}
if(OrderType()==OP_SELL)
{
TotalSell++; //Кол. продаж
}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
double StopLossLevel;
double TakeProfitLevel;
if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0;
if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
tpBuy=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
slBuy=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
tpSell=NormalizeDouble(Bid-TakeProfit*_Point,_Digits);
slSell=NormalizeDouble(Ask+StopLoss*_Point,_Digits);
///---
if(TotalBiu==0)
if(OrderBuy<1 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,slBuy,tpBuy,NULL,MagicNumber,0,clrBlue);
}
if(TotalSell==0)
if(OrderSell<1 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,slSell,tpSell,NULL,MagicNumber,0,clrRed);
}
}
//+------------------------------------------------------------------+
Lo he ajustado. Debería funcionar.
double slSell,slBuy,tpSell,tpBuy,TotalBiu,TotalSell;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=OrdersTotal()-1; i>=0; i--) //Цикл по всем ордерам
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) //Выбрали ордер
{
if(OrderType()==OP_BUY)
{
OrderBuy++; //Кол. покупок
}
if(OrderType()==OP_SELL)
{
OrderSell++; //Кол. продаж
}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
double StopLossLevel;
double TakeProfitLevel;
if(StopLoss>0) StopLossLevel=Bid-StopLoss*Point; else StopLossLevel=0.0;
if(TakeProfit>0) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
tpBuy=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
slBuy=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
tpSell=NormalizeDouble(Bid-TakeProfit*_Point,_Digits);
slSell=NormalizeDouble(Ask+StopLoss*_Point,_Digits);
///---
if(OrderBuy==0 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,slBuy,tpBuy,NULL,MagicNumber,0,clrBlue);
if(ticket<0)Print("Ошибка открытия ордера № - ",GetLastError());
}
if(OrderSell==0 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,slSell,tpSell,NULL,MagicNumber,0,clrRed);
if(ticket<0)Print("Ошибка открытия ордера № - ",GetLastError());
}
}
//+------------------------------------------------------------------+
...
Arreglado. Debería funcionar.
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
for(int i=OrdersTotal()-1; i>=0; i--) //Цикл по всем ордерам
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) //Выбрали ордер
{
if(OrderType()==OP_BUY)
{
OrderBuy++; //Кол. покупок
}
if(OrderType()==OP_SELL)
{
OrderSell++; //Кол. продаж
}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
como que hay que poner a cero el resaltado
double slSell,slBuy,tpSell,tpBuy;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
OrderBuy=0; OrderSell=0;
//-
for(int i=OrdersTotal()-1; i>=0; i--) //Цикл по всем ордерам
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) //Выбрали ордер
{
if(OrderType()==OP_BUY)
{
OrderBuy++; //Кол. покупок
}
if(OrderType()==OP_SELL)
{
OrderSell++; //Кол. продаж
}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
tpBuy=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
slBuy=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
tpSell=NormalizeDouble(Bid-TakeProfit*_Point,_Digits);
slSell=NormalizeDouble(Ask+StopLoss*_Point,_Digits);
///---
if(OrderBuy==0 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,slBuy,tpBuy,NULL,MagicNumber,0,clrBlue);
if(ticket<0)Print("Ошибка открытия ордера № - ",GetLastError());
}
if(OrderSell==0 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,slSell,tpSell,NULL,MagicNumber,0,clrRed);
if(ticket<0)Print("Ошибка открытия ордера № - ",GetLastError());
}
}
//+------------------------------------------------------------------+
como que necesita concentrarse en lo más destacado
double slSell,slBuy,tpSell,tpBuy;
int tiket;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
OrderBuy=0; OrderSell=0;
//-
for(int i=OrdersTotal()-1; i>=0; i--) //Цикл по всем ордерам
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) //Выбрали ордер
{
if(OrderType()==OP_BUY)
{
OrderBuy++; //Кол. покупок
}
if(OrderType()==OP_SELL)
{
OrderSell++; //Кол. продаж
}
}
}
double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
double rsi1=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,1);
//+------------------------------------------------------------------+
tpBuy=NormalizeDouble(Ask+TakeProfit*_Point,_Digits);
slBuy=NormalizeDouble(Bid-StopLoss*_Point,_Digits);
tpSell=NormalizeDouble(Bid-TakeProfit*_Point,_Digits);
slSell=NormalizeDouble(Ask+StopLoss*_Point,_Digits);
///---
if(OrderBuy==0 && rsi>Urov_70 && rsi1<Urov_70)
{
tiket=OrderSend(_Symbol,OP_BUY,Lot,Ask,slippage,slBuy,tpBuy,NULL,MagicNumber,0,clrBlue);
if(ticket<0)Print("Ошибка открытия ордера № - ",GetLastError());
}
if(OrderSell==0 && rsi<Urov_30 && rsi1>Urov_30)
{
tiket=OrderSend(_Symbol,OP_SELL,Lot,Bid,slippage,slSell,tpSell,NULL,MagicNumber,0,clrRed);
if(ticket<0)Print("Ошибка открытия ордера № - ",GetLastError());
}
}
//+------------------------------------------------------------------+
Gracias. Ahora abre algunas órdenes no en la señal y algunos no correctamente.
Arreglado. Debería funcionar.
...
Gracias. Ahora abre algunas órdenes no en la señal y algunos no correctamente.
Se comprueba en una barra existente double rsi=iRSI(_Symbol,0,RSIperiod,PRICE_CLOSE,0);
El precio sube, hay un cruce del nivel 70 y se entra en la operación. En el hecho de cerrar la barra, ya se ve que el RSI está más bajo, pero antes estaba más alto, y luego volvió por debajo del nivel.
Haga la comprobación en una barra cerrada, entonces esto no sucederá, y las entradas serán en una señal confirmada:
double rsi=iRSI(_Símbolo,0,RSIperiod,PRECIO_CIERRE,1);
double rsi1=iRSI(_Símbolo,0,RSIperiod,PRECIO_CIERRE,2);