¡Pide! - página 77

 

Para CodersGuru : necesito ayuda sobre 10 puntos 3 EA....

Hola CodersGuru,

Soy nuevo en el comercio de divisas y nuevo en este foro también. La primera vez, estoy aprendiendo es EuroX2_sl, ampliado de 10 puntos 3 EA script. Después de hacer algunas pruebas de avance, este EA hizo posición abierta bien, pero no cerró la posición bien como lo necesito cuando el mercado inverso. Tal vez, algo está mal con el código ( cos ' no soy un programador ) y creo que necesito su ayuda para resolverlo. ¿Podría comprobar qué parte está mal?

La condición es :

1. 1. ABRIR COMPRA cuando la condición del indicador existe, es decir, estocástico

2. 2. CERRAR COMPRA cuando existe un indicador de VENTA ABIERTA, es decir, estocástico.

3. ABRIR VENDER cuando la condición del indicador ( no. 2 arriba ) existe. ie : estocástico

4. CERRAR VENDER cuando la condición del indicador ( no. 1 arriba ) existe. ie : estocástico

Creo que la posición ABIERTA está bien, pero el problema es con la POSICIÓN DE CIERRE, ya que no se cerró (COMPRA o VENTA), incluso cuando el indicador existe.

El código como lo hice es :

-------- parte de la secuencia de comandos de EuroX2_sl ampliado de 10 puntos 3 como creo que para cerrar la posición -------

// es importante entrar en el mercado correctamente,

// pero es más importante salir correctamente...

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL && // comprueba la posición abierta

OrderType()<=OP_BUY &&

OrderType()>=OP_SELL &&

OrderType()>=OP_BUY &&

OrderSymbol()==Symbol()) // comprobar el símbolo

{

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

if(OrderType()==OP_BUY) // se abre una posición larga

{

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

//+ CONDICIÓN PARA CERRAR LA POSICIÓN

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

//+--------------- CERRAR POSICIÓN DE COMPRA ----------------------------

if ( Stoch_Main_M15_Cu < Stoch_Sig_M15_Cu )

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

{

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; // cerrar posición

return(0); // salir

}

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

// comprobar el trailing stop

if(TrailingStop>0)

{

if(Bid-OrderOpenPrice()>Punto*TrailingStop)

{

if(OrderStopLoss()<Bid-Point*TrailingStop)

{

OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);

return(0);

}

}

}

}

//+---------------CLOSE VENDER POSICIÓN --------------------------------

else // pasar a posición corta

{ //+ NO ELIMINAR

if(OrderType()==OP_SELL) // se abre la posición corta

{

}

// ¿se debe cerrar?

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

if ( Stoch_Main_M15_Cu > Stoch_Sig_M15_Cu )

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

{

OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet) ; // cerrar posición

return(0); // salir

}

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

// comprobar el trailing stop

if(TrailingStop>0)

{

if((OrderOpenPrice()-Ask)>(Point*TrailingStop))

{

if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))

{

OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);

return(0);

}

}

}

}

}

}

--------------------------------------------------------------

Gracias,

fxgroup

 

Lectura de datos de otra ventana de par de divisas

Mi EA está en la ventana "GBPJPY", pero necesito encontrar ObjectDescription() de otra ventana, digamos "USDJPY". (Desafortunadamente, es un indicador Pivot que no devuelve valores de iCustom())

¿Alguien conoce la forma de referirse a otra ventana del par (no la actual) para poder utilizar funciones como ObjectDescription() en ella?

¿O MQ4 no lo permite?

Gracias

euro

 

¿Cómo puedo aislar los beneficios de una divisa de las demás?

color color_of_pipsprofit;

color_of_pipsprofit = White;

int m,totalbuy;

totalbuy=OrdersTotal();

for(m=0;m<totalbuy;m++)

OrderSelect(m, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips_profit=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

int n,totalsell;

totalsell=OrdersTotal();

for(n=0;n<totalsell;n++)

OrderSelect(n, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0);

ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit);

ObjectSet("pips_profit", OBJPROP_CORNER, 3);

ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35);

ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20);

}

He creado esta codificación, pero no puedo aislar los beneficios de una divisa de otras divisas que se negocian. ¿Qué me falta en mi código?

Por favor, revise. Gracias por su ayuda.

Dave

 

Beneficios

Prueba este código:

int start()

{

int total = OrdersTotal();

for (int cnt = total ; cnt >=0 ; cnt--)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)

{

Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice());

}

}

return(0);

}

double Profit(int type, string currency, double open)

{

if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy

if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy

return(-1);

}[/php]

1Dave7:
[php]

color color_of_pipsprofit;

color_of_pipsprofit = White;

int m,totalbuy;

totalbuy=OrdersTotal();

for(m=0;m<totalbuy;m++)

OrderSelect(m, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips_profit=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

int n,totalsell;

totalsell=OrdersTotal();

for(n=0;n<totalsell;n++)

OrderSelect(n, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0);

ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit);

ObjectSet("pips_profit", OBJPROP_CORNER, 3);

ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35);

ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20);

}

I created this coding, but I cannot isolate the profits of one currency from other currencies being traded. What am I lacking in my code??

Please review. Thanks for your help!

Dave
 
codersguru:
Pruebe este código:
int start()

{

int total = OrdersTotal();

for (int cnt = total ; cnt >=0 ; cnt--)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)

{

Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice());

}

}

return(0);

}

double Profit(int type, string currency, double open)

{

if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy

if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy

return(-1);

}

Hola Coder,

Esto no es exactamente lo que necesito. Adjunto una imagen del gráfico para ilustrar lo que busco. ¿Puede modificar la codificación para mostrar los beneficios? Si es así, puedo conseguir que los colores cambien en la cantidad de beneficios. Sólo estoy buscando el beneficio para cada moneda específica.

Archivos adjuntos:
 

indicador adjunto

Hola Codersguru

estoy deseando que el indicador adjunto muestre la apertura a medianoche gmt, y no la hora del servidor de los corredores, ¿es esto posible?

muchas gracias monty

 

Ayuda con el código

¿Puede explicar el código? Estoy obteniendo un valor incorrecto (ver abajo "Cuenta") y luego se rellena correctamente pero no estoy seguro de por qué.

int Cuenta = 123456;

if (Account != AccountNumber())

{

Comment("No puede utilizar este programa con esta cuenta");

return (0);

}

else

{

Comment("Bienvenido al programa");

}

 

Pregunta simple

¿El asesor experto funcionará normalmente sin las funciones init() y deinit()?

 
n7drazen:
¿El asesor experto funcionará normalmente sin las funciones init() y deinit()?

Sí,

Sólo se requiere la función init().

 

Kalenzo,

tengo una pregunta:

HEDGING:

Estoy buscando:

si (OrderOpenPrice() = = Bid (o Ask)

Elprecio abierto debe ser igual al nuevo precio.

Hago una cobertura con el mismo par EURUSD.

Si el precio de apertura es de venta y el precio es 1.3580,

el precio de compra debe ser el mismo.

Gracias. Aquí están los códigos.

B.

//------------------------------------------

if(Buy==0)

{

RefreshRates();

OrderSend(Symbol_1,OP_BUY,lotsi,MarketInfo(Symbol_ 1,MODE_ASK),...

RefreshRates();

si (OrderOpenPrice() == Bid)

{

OrderSend(Symbol_1,OP_SELL,lotsi,MarketInfo(Symbol _1,MODE_BID),...

}