Indicadores Multi Timeframe - página 405

 

fusión de TDI en el tiempo

Hola chicos, hola Mladen,

como algunos de ustedes utilizan el TDI como un proveedor de señales me encontré con el sistema de alerta TDI, como se ve a continuación (Acabo de dar una señal o incluso EMail de alerta cuando una cruz en el TDI está sucediendo). Probablemente esto no es nada nuevo. Como es más seguro para el comercio de la TDI con al menos dos marcos de tiempo (60min como base, 5min para scalping) , estoy preguntando si lo siguiente es posible:Lo que quiero es fusionar las señales de al menos dos marcos de tiempo diferentes para darme una señal general más fiable: El marco de tiempo más grande se utiliza como base, hacia arriba o hacia abajo da la dirección para el más pequeño (s). Si la misma señal aparece en el marco de tiempo más pequeño, eso es un comercio; el comercio se sale en la señal de salida sólo en función del marco de tiempo más pequeño.

Así que aquí está el indicador que estoy hablando de la creación de señales, ¿qué piensan ustedes o era algo similar ya publicado?

 
Jonny473:
Hola chicos, hola Mladen,

como algunos de ustedes utilizan el TDI como un proveedor de señal me encontré con el sistema de alerta TDI, como se ve a continuación (Acabo de dar una señal o incluso EMail de alerta cuando una cruz en el TDI está sucediendo). Probablemente esto no es nada nuevo. Como es más seguro para el comercio de la TDI con al menos dos marcos de tiempo (60min como base, 5min para scalping) , estoy preguntando si lo siguiente es posible:Lo que quiero es fusionar las señales de al menos dos marcos de tiempo diferentes para darme una señal general más fiable: El marco de tiempo más grande se utiliza como base, hacia arriba o hacia abajo da la dirección para el más pequeño (s). Si la misma señal aparece en el marco de tiempo más pequeño, eso es un comercio; el comercio se sale en la señal de salida sólo en función del marco de tiempo más pequeño.

Así que aquí está el indicador que estoy hablando de la creación de señales, lo que ustedes piensan o era algo similar ya publicado?

Publicaré el indicador en un segundo...

 
mladen:
FxTrendsTrader Aquí tienes

Estimado Mladen

¿Sería posible añadir "Colorear la pendiente" en este indicador?

Gracias de antemano

secretcode

 
Jonny473:
Publicaré el indicador en un segundo...

Ataque al corazón....?...

 
fxnewbie:
Ataque cardíaco....?...

No, no es un ataque al corazón: Aquí está el código, sólo tiene que copiar y crear el indicador, no puede encontrar el archivo

/*------------------------------------------------------------------------------------

Nombre: xTDI-Arrow.mq4

Copyright ?2010, Xaphod, Forex Whiz

Descripción: - Dibuja flechas para los cruces de TDI

- Proporciona alertas para los cruces de las tres líneas anteriores.

Registro de cambios:

2010-10-19. Xaphod, v1.00

- Versión inicial

-------------------------------------------------------------------------------------*/

// Propiedades de los indicadores

#property copyright "Copyright ? 2010, Xaphod"

#property link "http://forexwhiz.appspot.com"

#property ventana_gráfica_del_indicador

#property indicator_buffers 4

#propiedad indicador_color1 verde lima

#propiedad indicador_color2 Rojo

#propiedad indicator_color3 Verde

#propiedad indicator_color4 Ladrillo de fuego

#property indicator_width1 1

#Propiedad indicator_width2 1

#propiedad indicator_width3 1

#propiedad indicator_width4 1

#propiedad indicador_máximo 1

#propiedad indicador_mínimo 0

// Definiciones constantes

#define INDICATOR_NAME "xTDI-Arrow"

#define INDICATOR_VERSION "v1.00"

#define ALTURA_BARRA 1.00

#define TDI_INDI "Traders_Dynamic_Index"

#define FLECHA_ALTA 225

#define FLECHA_IN_DN 226

#define ARROW_THICK_UP 233

#define ARROW_THICK_DN 234

#define FLECHA_ALTA_ARRIBA 241

#define FLECHA_ALTA_DN 242

#define ARROW_ROUND_UP 221

#define ARROW_ROUND_DN 222

// Parámetros del indicador

extern string Indi.Copyright= "?2010, forexwhiz.appspot.com";

extern string Indi.Version= INDICATOR_VERSION;

extern string Show.Settings="????????????????????????????????????";

extern int Show.TimeFrame=0; // Plazo a utilizar. Timeframe actual=0.

extern bool Show.MarketBaseLine=true; // Mostrar el cruce por encima/debajo de la línea base del mercado en un color diferente

extern int Show.ArrowType=0; // 0=Fina, 1=Gruesa, 2=Hueca, 3=Ronda

extern int Show.ArrowSize=1; // Tamaño de la flecha (1-5)

extern int Show.ArrowOffset=10; // Desplazamiento desde el final de la vela para mostrar la flecha

extern string TDI.Settings="????????????????????????????????????";

extern int TDI.RSIPeriod = 13; // Periodo. Valores recomendados: 8-25

extern int TDI.RSIPrice = 0; // 0=Cerrado, 1=Abierto, 2=Alto, 3=Bajo, 4=Mediano, 5=Típico, 6=Ponderado

extern int TDI.VolatilityBand = 34; // Valores recomendados: 20-40

extern int TDI.RSIPriceLine = 2; // Periodo

extern int TDI.RSIPriceType = 0; // 0=SMA, 1=EMA, 2=SSMA, 3=LWMA

extern int TDI.TradeSignalLine = 7; // Periodo

extern int TDI.TradeSignalType = 0; // 0=SMA, 1=EMA, 2=SSMA, 3=LWMA

extern string Alert.Settings="????????????????????????????????????";

extern bool Alert.RSIPriceLine=true; // Alerta si el precio RSI cruza la línea de señal. El verde cruza el rojo.

extern bool Alert.MarketBaseLine=true; // Alerta si el precio RSI cruza la línea de señal y la línea base del mercado. El verde cruza el rojo y el amarillo

extern bool Alert.NewBarOnly=true; // True=Alerta cuando se abre una nueva barra. False=Alerta cada vez que se cruzan las líneas

extern int Alert.Timeout=60; // Desactiva las alertas durante N segundos después de una alerta. Sólo cuando Alert.NewBarOnly=false

extern bool Alert.Popup=true; // Ventana emergente y sonido en la alerta

extern bool Alert.Email=false; // Enviar correo electrónico en caso de alerta

// Variables globales del módulo

double dBuffer0[];

double dBuffer1[];

double dBuffer2[];

double dBuffer3[];

bool bStartup;

void SetArrowType(int& iArrowUp, int& iArrowDn) {

switch (Show.ArrowType) {

caso 1: // Delgado

iArrowDn=ARROW_THIN_DN;

iArrowUp=ARROW_THIN_UP;

romper;

caso 2: // Hueco

iArrowDn=ARROW_HOLLOW_DN;

iArrowUp=ARROW_HOLLOW_UP;

break;

caso 3: // Redondo

iArrowDn=ARROW_ROUND_DN;

iArrowUp=ARROW_ROUND_UP;

break;

por defecto: // Grueso

iArrowDn=ARROW_THICK_DN;

iArrowUp=ARROW_THICK_UP;

break;

}

}

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

// función: init()

// Descripción: Función de inicialización del indicador personalizado.

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

int init() {

int iArrowUp;

int iArrowDn;

string sType;

cadena sTF;

SetArrowType(iArrowUp, iArrowDn );

SetIndexStyle(0,DRAW_ARROW,EMPTY,Show.ArrowSize);

SetIndexBuffer(0,dBuffer0);

SetIndexLabel(0, "TDI:Mkt-Up");

SetIndexArrow(0, iArrowUp);

SetIndexStyle(1,DRAW_ARROW,EMPTY,Show.ArrowSize);

SetIndexBuffer(1,dBuffer1);

SetIndexLabel(1, "TDI:Mkt-Dn");

SetIndexArrow(1, iArrowDn);

SetIndexStyle(2,DRAW_ARROW,EMPTY,Show.ArrowSize);

SetIndexBuffer(2,dBuffer2);

SetIndexLabel(2, "TDI:Sig-Up");

SetIndexArrow(2, iArrowUp);

SetIndexStyle(3,DRAW_ARROW,EMPTY,Show.ArrowSize);

SetIndexBuffer(3,dBuffer3);

SetIndexLabel(3, "TDI:Sig-Dn");

SetIndexArrow(3, iArrowDn);

if (Show.TimeFrame==0)

sTF="";

si no

sTF=TF2Str(Show.TimeFrame);

IndicatorShortName(INDICATOR_NAME+" "+sTF);

bStartup=true;

return(0);

}

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

// función: deinit()

// Descripción: Función de desinicialización del indicador personalizada.

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

int deinit() {

return (0);

}

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

// función: start()

// Descripción: Función de iteración del indicador personalizada.

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

int inicio() {

int iNewBars

int iBarrasContadas;

int i;

double dVBHighLine; // Banda superior de volatilidad - Línea azul superior

double dVBLowLine; // Banda inferior de volatilidad - Línea azul inferior

double dMarketBaseLine0; // Línea base del mercado - Línea amarilla

double dRSIPriceLine0; // RSI PriceLine - Línea verde

double dTradeSignalLine0; // Línea de señal de operación - Línea roja

static double dMarketBaseLine1; // Línea base del mercado - Línea amarilla

static double dRSIPriceLine1; // RSI PriceLine - Línea verde

static double dTradeSignalLine1; // Línea de señal de operación - Línea roja

double dOffset;

// Obtener los ticks no procesados

iCountedBars=IndicatorCounted();

if(iCountedBars < 0) devuelve (-1);

if(iCountedBars>0) iCountedBars--;

iNewBars=Bars-iCountedBars;

for(i=iNewBars; i>=0; i--) {

// Obtener los datos anteriores de TDI

//si (¡Time!=tCurTime) {

//tCurTime=Tiempo;

 

dMarketBaseLine1=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,2,i+1); // Línea amarilla

dRSIPriceLine1=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,i+1); // Línea verde

dTradeSignalLine1=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,i+1); // Línea roja

//}

// Obtener los datos actuales de TDI

dMarketBaseLine0=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,2,i); // Línea amarilla

dRSIPriceLine0=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,i); // Línea verde

dTradeSignalLine0=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,i); // Línea roja

// Borrar el buffer de visualización actual

dBuffer0 = EMPTY_VALUE;

dBuffer1 = EMPTY_VALUE;

dBuffer2 = EMPTY_VALUE;

dBuffer3 = EMPTY_VALUE;

dOffset=Punto*(10*Show.ArrowOffset/MarketInfo(Symbol(),MODE_TICKVALUE));

if (dRSIPriceLine0>dMarketBaseLine0 && dRSIPriceLine1dTradeSignalLine0 && Show.MarketBaseLine)

dBuffer0 = Low-dOffset;

else if (dRSIPriceLine0>dTradeSignalLine0 && dRSIPriceLine1<dTradeSignalLine1)

dBuffer2 = Low-dOffset;

if (dRSIPriceLine0dMarketBaseLine1 && dRSIPriceLine0<dTradeSignalLine0 && Show.MarketBaseLine)

dBuffer1 = High+dOffset;

else if (dRSIPriceLine0dTradeSignalLine1)

dBuffer3 = High+dOffset;

// Comprobar si hay alertas

if (i==0) AlertCheck();

}

// Restablecer la bandera de inicio

if (bStartup) bStartup=false;

// Adiós

return(0);

}

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

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

// función: TF2Str()

// Descripción: Convertir el tiempo en una cadena

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

string TF2Str(int iPeriod) {

switch(iPeriod) {

case PERIOD_M1: return("M1");

case PERIOD_M5: return("M5");

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");

por defecto: return("M "+iPeriod);

}

}

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

// función: AlertCheck()

// Descripción: Comprueba las condiciones de alerta y realiza las alertas

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

void AlertCheck() {

string sAlertMsg;

static datetime tCurTime=0;

static int iAlertTimer[2];

static int iAlertStatus[2];

double dMarketBaseLine[2]; // Línea base del mercado - Línea amarilla

double dRSIPriceLine[2]; // RSI PriceLine - Línea verde

double dTradeSignalLine[2]; // Línea de señal de operación - Línea roja

int i,j

bool bNewBar=false;

// Abortar si el indicador acaba de arrancar

if (bStartup) {

tCurTime=Tiempo[0];

return(0);

}

// Comprobar si hay alertas

if (Alert.RSIPriceLine | Alert.MarketBaseLine) {

// Alerta si sólo hay barra nueva

if (Alert.NewBarOnly) {

// Restablecer la hora

if(tCurTime!=Time[0]) {

tCurTime=Time[0];

bNewBar=true;

// Obtener datos TDI en la nueva barra, es decir, en las barras 1 y 2

for (i=0; i<2; i++) {

j=i+1;

dMarketBaseLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,2,j); // Línea amarilla

dRSIPriceLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,j); // Línea verde

dTradeSignalLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,j); // Línea roja

} //endfor

}//endif

}

else {

// Obtener datos TDI en la barra actual, es decir, en las barras 0 y 1

for (i=0; i<2; i++) {

dMarketBaseLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,2,i); // Línea amarilla

dRSIPriceLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,i); // Línea verde

dTradeSignalLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,

TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,i); // Línea roja

} //endfor

} //end if(Alert.NewBarOnly)

if (bNewBar || (!Alert.NewBarOnly && iAlertTimer[0]<GetTickCount()) {

//Alerta RSIPriceLine > TradeSignalLine

if (dRSIPriceLine[0]>dTradeSignalLine[0] && dRSIPriceLine[1]<dTradeSignalLine[1] && Alert.RSIPriceLine) {

if (!Alert.NewBarOnly) iAlertTimer[0]=GetTickCount()+Alert.Timeout*1000;

sAlertMsg="Alerta TDI - "+Símbolo()+" "+TF2Str(Periodo())+": RSIPriceLine Above TradeSignalLine";

if (Alert.Popup) Alert(sAlertMsg);

if (Alert.Email) SendMail( sAlertMsg, "¡Alerta MT4!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n "+sAlertMsg);

} //end if

//Alerta RSIPriceLine < TradeSignalLine

if (dRSIPriceLine[0]dTradeSignalLine[1] && Alert.RSIPriceLine) {

//PrintD("RSIPriceLine < TradeSignalLine");

if (!Alert.NewBarOnly) iAlertTimer[0]=GetTickCount()+Alert.Timeout*1000;

sAlertMsg="Alerta TDI - "+Símbolo()+" "+TF2Str(Periodo())+": RSIPriceLine Below TradeSignalLine";

if (Alert.Popup) Alert(sAlertMsg);

if (Alert.Email) SendMail( sAlertMsg, "¡Alerta MT4!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n "+sAlertMsg);

} //end if

} //end if

if (bNewBar || (!Alert.NewBarOnly && iAlertTimer[1]<GetTickCount()) {

//Alerta si RSIPriceLine > TradeSignalLine && dMarketBaseLine

if (dRSIPriceLine[0]>dMarketBaseLine[0] && dRSIPriceLine[1]<dMarketBaseLine[1] && Alert.MarketBaseLine) {

if (dRSIPriceLine[0]>dTradeSignalLine[0] && dRSIPriceLine[1]<dTradeSignalLine[1]) {

if (!Alert.NewBarOnly) iAlertTimer[1]=GetTickCount()+Alert.Timeout*1000;

sAlertMsg="Alerta TDI - "+Símbolo()+" "+TF2Str(Periodo())+": RSIPriceLine por encima de TradeSignalLine y MarketBaseLine";

if (Alert.Popup) Alert(sAlertMsg);

if (Alert.Email) SendMail( sAlertMsg, "¡Alerta MT4!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n "+sAlertMsg);

} //end if

} //end if

//Alerta si RSIPriceLine < TradeSignalLine && dMarketBaseLine

if (dRSIPriceLine[0]dMarketBaseLine[1] && Alert.MarketBaseLine) {

if (dRSIPriceLine[0]dTradeSignalLine[1] ) {

if (!Alert.NewBarOnly) iAlertTimer[1]=GetTickCount()+Alert.Timeout*1000;

sAlertMsg="Alerta TDI - "+Símbolo()+" "+TF2Str(Periodo())+": RSIPriceLine por debajo de TradeSignalLine y MarketBaseLine";

if (Alert.Popup) Alert(sAlertMsg);

if (Alert.Email) SendMail( sAlertMsg, "¡Alerta MT4!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n "+sAlertMsg);

} //end if

} //end if

} //end if

}//end if(Alert.RSIPriceLine || Alert.MarketBaseLine)

return(0);

}

¡ALERTA: Dividí el código en dos partes debido a la política de 10k; así que sólo copie ambas partes en una y cree el indicador!

 

Ok chicos aquí tenéis, ¡perdón por todas las fórmulas!

Archivos adjuntos:
tdi-2.mq4  4 kb
 

Equivocado Acabo de copiar el código correcto en otro, sobreescribí uno viejo, lo compilé y el archivo sigue usando el código viejo? No lo entiendo; de todas formas el código es correcto

 
Jonny473:
¡Equivocado Sólo copié el código correcto en otro, sobrescribí uno viejo, lo compilé y el archivo sigue usando el código viejo?! No lo entiendo; de todas formas el código es correcto

El código que publiqué antes....

 

Tengo una versión de Vista en mi viejo portátil, por eso los archivos mq4 siguen desapareciendo; ¡ahora debería funcionar!

Archivos adjuntos:
tdi-2.mq4  4 kb
Razón de la queja: