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
Estimado Mladen,
Lo siento por la pregunta básica - Siempre estoy en problemas cuando un código necesita la operación con la fecha y la hora. Hay una constante 120 en la línea 97 del EA de AverageJoe que publicaste en este foro hace un par de días:
if (OrderType() == OP_SELL && CurTime()-LastSellTime >=120) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
¿Cuál es la unidad de medida de ese 120?
Saludos,
Chrisstoff
Chrisstoff Esos son segundos (metatrader guardar el tiempo como un número de segundos pasa desde 1.1.1970 si no me equivoco, pero el punto es que siempre funciona con segundos cuando se declara una variable datetime o una función como CurrentTime() se llama)
Mladen,
Gracias por la rápida respuesta.
Estimado Mladen,
Perdón por la pregunta básica - siempre estoy en problemas cuando un código necesita operación con fecha y hora. Hay una constante 120 en la línea 97 del EA de AverageJoe que publicaste en este foro hace un par de días:
if (OrderType() == OP_SELL && CurTime()-LastSellTime >=120) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
¿Cuál es la unidad de medida de ese 120?
Saludos,
ChrisstoffChrisstoff
Son segundos (metatrader guarda el tiempo como un número de segundos transcurridos desde 1.1.1970 si no me equivoco, pero la cuestión es que siempre trabaja con segundos cuando se declara una variable datetime o se llama a una función como CurrentTime())
Modificar los indicadores ¡Gracias a!
#property ventana_gráfica_del_indicador
#propiedad indicator_buffers 5
//---- parámetros de entrada
extern int TimeFramePeriod;
extern int N=100;
//
extern double CustoMA1;
extern double CustoMA2;
extern double CustoMA3
extern double CustoMA4;
extern double CustoMA2; extern double CustoMA3; extern double CustoMA4
extern double low20;
//
#propiedad indicador_color1 Rojo
#propiedad indicador_color2 Cal
#propiedad indicador_color3 Naranja
#propiedad indicador_color4 Rojo
//--- buffers
double CustoMA1[];
double CustoMA2[];
double CustoMA3[]
double CustoMA4[];
doble tr[];
//
int init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, CustoMA1);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, CustoMA2);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(2, CustoMA3);
SetIndexStyle(3, DRAW_LINE);
SetIndexBuffer(3, CustoMA4);
SetIndexStyle(4, DRAW_LINE);
SetIndexBuffer(4,tr);
return (0);
}
//---- buffers
doble buff[];
//+------------------------------------------------------------------+
//| Función de inicialización del indicador personalizada ||.
//+------------------------------------------------------------------+
//int init()
//{
//if (Bars < MIN_BARS_REQUIRED) return(-1);
//IndicatorDigits(Dígitos);
//SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
//SetIndexBuffer(0, buff);
//string paramDesc = "("+getPeriodDesc(TimeFramePeriod) + ", "")";
//IndicatorShortName(" + paramDesc);
// Establecer etiquetas de índice
//SetIndexLabel(0, "" + paramDesc);
//----
//return(0);
}
//+------------------------------------------------------------------+
//| Función de desinicialización del indicador personalizada ||
//+------------------------------------------------------------------+
int inicio()
{
int Límite;
int counted_bars=IndicatorCounted();
//----
if(counted_bars<0) return(-1);
if(barras_contadas>0) barras_contadas--;
int limit=Barras_contadas;
int i=0;
for (i=Mathmin(Bars-5,Limit);i>=0;i--);
tr[]=MathMax(MathMax(High-Low,MathAbs(Close-High)),MathAbs(Close-Low));
higt20=H=HHV(H,N);
low20=L=LLV(L,N);
//
MA1=H-tr[]*0,1;
MA2=H-tr[]*0,2;
MA3=L+tr[]*0,1;
MA4=L+tr[]*0,2;
//
CustoMA1=REF(MA1,BarsSince(higt20));
CustoMA2=REF(MA2,BarsSince(higt20));
CustoMA3=REF(MA3,BarsSince(low20));
CustoMA4=REF(MA4,BarsSince(low20));
//
Plot(CustoMA1, "TREND",colorRed);
Plot(CustoMA2, "TENDENCIA",colorLima);
Plot(CustoMA3, "TENDENCIA",colorNaranja);
Plot(CustoMA4, "TENDENCIA",colorRojo);
//----
return(0);
//+------------------------------------------------------------------+
string getPeriodDesc(int aNumMinutes)
{
switch(aNumMinutes)
{
case PERIOD_M1 : return("M1");
case PERIOD_M15: return("M15");
case PERIOD_M30: return("M30");
case PERIOD_H1 : return("H1");
case PERIOD_H4 : return("H4");
case PERIOD_D1 : return("D1");
case PERIOD_W1 : return("W1");
case PERIOD_MN1: return("MN1");
case 0: return("Gráfico");
por defecto: return("M" + aNumMinutes);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double getDeMarker(int aShift)
{
return(iDeMarker(NULL, TimeFramePeriod, 13, iBarShift(NULL, TimeFramePeriod, Time[aShift]));
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int inicio()
{
for(int shift=Bars-1;shift>=0;shift--)
{
buff[shift]=getDeMarker(shift);
}
return(0);
}
//+------------------------------------------------------------------+
¡Lo siento ! Pegue el código aquí
Kreangast
2013/5/21
¡Modificar los indicadores Gracias a!
#property ventana_del_gráfico
#propiedad indicator_buffers 5
//---- parámetros de entrada
extern int TimeFramePeriod;
extern int N=100;
//
extern double CustoMA1;
extern double CustoMA2;
extern double CustoMA3
extern double CustoMA4;
extern double CustoMA2; extern double CustoMA3; extern double CustoMA4
extern double low20;
//
#propiedad indicador_color1 Rojo
#propiedad indicador_color2 Cal
#propiedad indicador_color3 Naranja
#propiedad indicador_color4 Rojo
//--- buffers
double CustoMA1[];
double CustoMA2[];
double CustoMA3[]
double CustoMA4[];
doble tr[];
//
int init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, CustoMA1);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, CustoMA2);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(2, CustoMA3);
SetIndexStyle(3, DRAW_LINE);
SetIndexBuffer(3, CustoMA4);
SetIndexStyle(4, DRAW_LINE);
SetIndexBuffer(4,tr);
return (0);
}
//---- buffers
doble buff[];
//+------------------------------------------------------------------+
//| Función de inicialización del indicador personalizada ||.
//+------------------------------------------------------------------+
//int init()
//{
//if (Bars < MIN_BARS_REQUIRED) return(-1);
//IndicatorDigits(Dígitos);
//SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
//SetIndexBuffer(0, buff);
//string paramDesc = "("+getPeriodDesc(TimeFramePeriod) + ", "")";
//IndicatorShortName(" + paramDesc);
// Establecer etiquetas de índice
//SetIndexLabel(0, "" + paramDesc);
//----
//return(0);
}
//+------------------------------------------------------------------+
//| Función de desinicialización del indicador personalizada ||
//+------------------------------------------------------------------+
int inicio()
{
int Límite;
int counted_bars=IndicatorCounted();
//----
if(counted_bars<0) return(-1);
if(barras_contadas>0) barras_contadas--;
int limit=Barras_contadas;
int i=0;
for (i=Mathmin(Bars-5,Limit);i>=0;i--);
tr[]=MathMax(MathMax(High-Low,MathAbs(Close-High)),MathAbs(Close-Low));
higt20=H=HHV(H,N);
low20=L=LLV(L,N);
//
MA1=H-tr[]*0,1;
MA2=H-tr[]*0,2;
MA3=L+tr[]*0,1;
MA4=L+tr[]*0,2;
//
CustoMA1=REF(MA1,BarsSince(higt20));
CustoMA2=REF(MA2,BarsSince(higt20));
CustoMA3=REF(MA3,BarsSince(low20));
CustoMA4=REF(MA4,BarsSince(low20));
//
Plot(CustoMA1, "TREND",colorRed);
Plot(CustoMA2, "TENDENCIA",colorLima);
Plot(CustoMA3, "TENDENCIA",colorNaranja);
Plot(CustoMA4, "TENDENCIA",colorRojo);
//----
return(0);
//+------------------------------------------------------------------+
string getPeriodDesc(int aNumMinutes)
{
switch(aNumMinutes)
{
case PERIOD_M1 : return("M1");
case PERIOD_M15: return("M15");
case PERIOD_M30: return("M30");
case PERIOD_H1 : return("H1");
case PERIOD_H4 : return("H4");
case PERIOD_D1 : return("D1");
case PERIOD_W1 : return("W1");
case PERIOD_MN1: return("MN1");
case 0: return("Gráfico");
por defecto: return("M" + aNumMinutes);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double getDeMarker(int aShift)
{
return(iDeMarker(NULL, TimeFramePeriod, 13, iBarShift(NULL, TimeFramePeriod, Time[aShift]));
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int inicio()
{
for(int shift=Bars-1;shift>=0;shift--)
{
buff[shift]=getDeMarker(shift);
}
return(0);
}
//+------------------------------------------------------------------+
¡Lo siento ! Pegue el código aquí
Kreangast
2013/5/21Eso es alguien tratando de combinar el código de tadestation con un código de metatrader. No funcionará de esa manera y no se puede combinar de esa manera
Para :mladen
¿Podría usted en MT4 bien? Una sección de código TS, no voy a escribir MT4 . Gracias.
Kreangast
2013-5-21
Para :mladen
¿Podría usted en MT4 bien? Una sección de código TS, no voy a escribir MT4 . Gracias.
Kreangast
2013-5-21De lo que has posteado no es posible ver lo que debería hacer
Para :mladen
Me gustaría preguntar cómo se hace?
Gracias
Kreangast
Para :mladen
Me gustaría preguntar cómo se hace?
Gracias
KreangastPara empezar, primero tendrás que leer esto : https://www.mql5.com/en/forum/172969/page2 y luego algo similar para tradestation y luego puedes convertir el código de un lenguaje de codificación a otro lenguaje de codificación
Para empezar, primero tendrá que leer estos : https://www.mql5.com/en/forum/172969/page2 y luego algo similar para tradestation y luego puede convertir el código de un lenguaje de codificación a otro lenguaje de codificación
Pero este código no se escribe , problemas en MT4 bien ? Muy agradecido
Kreangast
2013/5/21