You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
timeframe TDI merging
Hey guys, hey Mladen,
as some of you use the TDI as a Signal provider I came across the TDI Alert System, as seen below (I just gives a signal or even EMail Alert when a cross in the TDI is happening). Probably this is nothing new. As it is more safe to trade the TDI with at least two timeframes (60min as basis, 5min for scalping) , I am asking if the following is possible:What I want is merge signals of at least two different timeframes to give me an overall more reliable signal: The larger timeframe is used as a basis, up or down gives the direction for the smaller one(s). If the same signal appears on the smaller timeframe, thats a trade; the trade is exited on the exit signal only depending on the smaller timeframe.
So here is the indicator I am talking about creating signals; what do you guys think or was something similar already posted?
Hey guys, hey Mladen,
as some of you use the TDI as a Signal provider I came across the TDI Alert System, as seen below (I just gives a signal or even EMail Alert when a cross in the TDI is happening). Probably this is nothing new. As it is more safe to trade the TDI with at least two timeframes (60min as basis, 5min for scalping) , I am asking if the following is possible:What I want is merge signals of at least two different timeframes to give me an overall more reliable signal: The larger timeframe is used as a basis, up or down gives the direction for the smaller one(s). If the same signal appears on the smaller timeframe, thats a trade; the trade is exited on the exit signal only depending on the smaller timeframe.
So here is the indicator I am talking about creating signals; what do you guys think or was something similar already posted?Will post the indicator in a second...
FxTrendsTrader Here you go
Dear Mladen
Would it be possible for you to add 'Coloring on Slope' in this indicator
Thanks in advance
secretcode
Will post the indicator in a second...
Heart attack....?...
Heart attack....?...
Nope no heart attack: Heres the code, just copy it and create the indicator, cant find the file
/*------------------------------------------------------------------------------------
Name: xTDI-Arrow.mq4
Copyright ?2010, Xaphod, Forex Whiz
Description: - Draws arrows for the TDI crosses
- Provides alerts for crossovers of the above three lines.
Change log:
2010-10-19. Xaphod, v1.00
- Initial Release
-------------------------------------------------------------------------------------*/
// Indicator properties
#property copyright "Copyright ? 2010, Xaphod"
#property link "http://forexwhiz.appspot.com"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 FireBrick
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1
#property indicator_maximum 1
#property indicator_minimum 0
// Constant definitions
#define INDICATOR_NAME "xTDI-Arrow"
#define INDICATOR_VERSION "v1.00"
#define BAR_HEIGHT 1.00
#define TDI_INDI "Traders_Dynamic_Index"
#define ARROW_THIN_UP 225
#define ARROW_THIN_DN 226
#define ARROW_THICK_UP 233
#define ARROW_THICK_DN 234
#define ARROW_HOLLOW_UP 241
#define ARROW_HOLLOW_DN 242
#define ARROW_ROUND_UP 221
#define ARROW_ROUND_DN 222
// Indicator parameters
extern string Indi.Copyright= "?2010, forexwhiz.appspot.com";
extern string Indi.Version= INDICATOR_VERSION;
extern string Show.Settings="????????????????????????????????????";
extern int Show.TimeFrame=0; // Timeframe to use. Current Timeframe=0.
extern bool Show.MarketBaseLine=true; // Show cross above/below market baseline in a different color
extern int Show.ArrowType=0; // 0=Thin, 1=Thick, 2=Hollow, 3=Round
extern int Show.ArrowSize=1; // Size of arrow (1-5)
extern int Show.ArrowOffset=10; // Offset from end of candle to show arrow
extern string TDI.Settings="????????????????????????????????????";
extern int TDI.RSIPeriod = 13; // Period. Recomended values: 8-25
extern int TDI.RSIPrice = 0; // 0=CLOSE, 1=OPEN, 2=HIGH, 3=LOW, 4=MEDIAN, 5=TYPICAL, 6=WEIGHTED
extern int TDI.VolatilityBand = 34; // Recomended values: 20-40
extern int TDI.RSIPriceLine = 2; // Period
extern int TDI.RSIPriceType = 0; // 0=SMA, 1=EMA, 2=SSMA, 3=LWMA
extern int TDI.TradeSignalLine = 7; // Period
extern int TDI.TradeSignalType = 0; // 0=SMA, 1=EMA, 2=SSMA, 3=LWMA
extern string Alert.Settings="????????????????????????????????????";
extern bool Alert.RSIPriceLine=true; // Alert if RSI price crosses Signal line. Green crosses red.
extern bool Alert.MarketBaseLine=true; // Alert if RSI price crosses Signal line & market base line. Green crosses red and yellow
extern bool Alert.NewBarOnly=true; // True=Alert when new bar is opened. False=Alert anytime lines cross
extern int Alert.Timeout=60; // Deactivate alerts for N seconds after an alert. Only when Alert.NewBarOnly=false
extern bool Alert.Popup=true; // Popup window & sound on alert
extern bool Alert.Email=false; // Send email on alert
// Global module varables
double dBuffer0[];
double dBuffer1[];
double dBuffer2[];
double dBuffer3[];
bool bStartup;
void SetArrowType(int& iArrowUp, int& iArrowDn) {
switch (Show.ArrowType) {
case 1: // Thin
iArrowDn=ARROW_THIN_DN;
iArrowUp=ARROW_THIN_UP;
break;
case 2: // Hollow
iArrowDn=ARROW_HOLLOW_DN;
iArrowUp=ARROW_HOLLOW_UP;
break;
case 3: // Round
iArrowDn=ARROW_ROUND_DN;
iArrowUp=ARROW_ROUND_UP;
break;
default: // Thick
iArrowDn=ARROW_THICK_DN;
iArrowUp=ARROW_THICK_UP;
break;
}
}
//-----------------------------------------------------------------------------
// function: init()
// Description: Custom indicator initialization function.
//-----------------------------------------------------------------------------
int init() {
int iArrowUp;
int iArrowDn;
string sType;
string 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="";
else
sTF=TF2Str(Show.TimeFrame);
IndicatorShortName(INDICATOR_NAME+" "+sTF);
bStartup=true;
return(0);
}
//-----------------------------------------------------------------------------
// function: deinit()
// Description: Custom indicator deinitialization function.
//-----------------------------------------------------------------------------
int deinit() {
return (0);
}
///-----------------------------------------------------------------------------
// function: start()
// Description: Custom indicator iteration function.
//-----------------------------------------------------------------------------
int start() {
int iNewBars;
int iCountedBars;
int i;
double dVBHighLine; // Upper volatility band - Upper Blue line
double dVBLowLine; // Lower volatility band - Lower Blue line
double dMarketBaseLine0; // Market Base Line - Yellow line
double dRSIPriceLine0; // RSI PriceLine - Green line
double dTradeSignalLine0; // Trade Signal Line - Red line
static double dMarketBaseLine1; // Market Base Line - Yellow line
static double dRSIPriceLine1; // RSI PriceLine - Green line
static double dTradeSignalLine1; // Trade Signal Line - Red line
double dOffset;
// Get unprocessed ticks
iCountedBars=IndicatorCounted();
if(iCountedBars < 0) return (-1);
if(iCountedBars>0) iCountedBars--;
iNewBars=Bars-iCountedBars;
for(i=iNewBars; i>=0; i--) {
// Get previous TDI data
//if (Time!=tCurTime) {
//tCurTime=Time;
dMarketBaseLine1=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,2,i+1); // Yellow line
dRSIPriceLine1=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,i+1); // Green line
dTradeSignalLine1=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,i+1); // Red line
//}
// Get current TDI Data
dMarketBaseLine0=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,2,i); // Yellow line
dRSIPriceLine0=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,i); // Green line
dTradeSignalLine0=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,i); // Red line
// Clear current display buffer
dBuffer0 = EMPTY_VALUE;
dBuffer1 = EMPTY_VALUE;
dBuffer2 = EMPTY_VALUE;
dBuffer3 = EMPTY_VALUE;
dOffset=Point*(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;
// Check for alerts
if (i==0) AlertCheck();
}
// Reset startup flag
if (bStartup) bStartup=false;
// Bye bye
return(0);
}
//+------------------------------------------------------------------+
//-----------------------------------------------------------------------------
// function: TF2Str()
// Description: Convert time-frame to a string
//-----------------------------------------------------------------------------
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");
default: return("M"+iPeriod);
}
}
//-----------------------------------------------------------------------------
// function: AlertCheck()
// Description: Check for alert conditions and perform alerts
//-----------------------------------------------------------------------------
void AlertCheck() {
string sAlertMsg;
static datetime tCurTime=0;
static int iAlertTimer[2];
static int iAlertStatus[2];
double dMarketBaseLine[2]; // Market Base Line - Yellow line
double dRSIPriceLine[2]; // RSI PriceLine - Green line
double dTradeSignalLine[2]; // Trade Signal Line - Red line
int i,j;
bool bNewBar=false;
// Abort if indicator just started up
if (bStartup) {
tCurTime=Time[0];
return(0);
}
// Check for alerts
if (Alert.RSIPriceLine || Alert.MarketBaseLine) {
// Alert if newbar only
if (Alert.NewBarOnly) {
// Reset Time
if(tCurTime!=Time[0]) {
tCurTime=Time[0];
bNewBar=true;
// Get TDI Data on new bar, ie bar 1 and 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); // Yellow line
dRSIPriceLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,j); // Green line
dTradeSignalLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,j); // Red line
} //endfor
}//endif
}
else {
// Get TDI Data on current bar, ie bar 0 and 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); // Yellow line
dRSIPriceLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,4,i); // Green line
dTradeSignalLine=iCustom(NULL,Show.TimeFrame,TDI_INDI,TDI.RSIPeriod,TDI.RSIPrice,TDI.VolatilityBand,TDI.RSIPriceLine,
TDI.RSIPriceType,TDI.TradeSignalLine,TDI.TradeSignalType,5,i); // Red line
} //endfor
} //end if(Alert.NewBarOnly)
if (bNewBar || (!Alert.NewBarOnly && iAlertTimer[0]<GetTickCount())) {
//Alert RSIPriceLine > TradeSignalLine
if (dRSIPriceLine[0]>dTradeSignalLine[0] && dRSIPriceLine[1]<dTradeSignalLine[1] && Alert.RSIPriceLine) {
if (!Alert.NewBarOnly) iAlertTimer[0]=GetTickCount()+Alert.Timeout*1000;
sAlertMsg="TDI Alert - "+Symbol()+" "+TF2Str(Period())+": RSIPriceLine Above TradeSignalLine.";
if (Alert.Popup) Alert(sAlertMsg);
if (Alert.Email) SendMail( sAlertMsg, "MT4 Alert!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n"+sAlertMsg);
} //end if
//Alert RSIPriceLine < TradeSignalLine
if (dRSIPriceLine[0]dTradeSignalLine[1] && Alert.RSIPriceLine) {
//PrintD("RSIPriceLine < TradeSignalLine");
if (!Alert.NewBarOnly) iAlertTimer[0]=GetTickCount()+Alert.Timeout*1000;
sAlertMsg="TDI Alert - "+Symbol()+" "+TF2Str(Period())+": RSIPriceLine Below TradeSignalLine.";
if (Alert.Popup) Alert(sAlertMsg);
if (Alert.Email) SendMail( sAlertMsg, "MT4 Alert!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n"+sAlertMsg);
} //end if
} //end if
if (bNewBar || (!Alert.NewBarOnly && iAlertTimer[1]<GetTickCount())) {
//Alert if 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="TDI Alert - "+Symbol()+" "+TF2Str(Period())+": RSIPriceLine Above TradeSignalLine and MarketBaseLine.";
if (Alert.Popup) Alert(sAlertMsg);
if (Alert.Email) SendMail( sAlertMsg, "MT4 Alert!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n"+sAlertMsg);
} //end if
} //end if
//Alert if 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="TDI Alert - "+Symbol()+" "+TF2Str(Period())+": RSIPriceLine Below TradeSignalLine and MarketBaseLine.";
if (Alert.Popup) Alert(sAlertMsg);
if (Alert.Email) SendMail( sAlertMsg, "MT4 Alert!\n" + TimeToStr(TIME_DATE|TIME_SECONDS )+"\n"+sAlertMsg);
} //end if
} //end if
} //end if
}//end if(Alert.RSIPriceLine || Alert.MarketBaseLine)
return(0);
}
ALERT: I split the code in two parts because of the 10k policy; so just copy both parts in one and create the indicator!
Ok guys here you go, sorry for all the formulas!
Wrong one Just copied the right code into another one, overwrote an old one, compiled it and the file is still using the old code?! Dont get it; anyhow the code is correct
Wrong one Just copied the right code into another one, overwrote an old one, compiled it and the file is still using the old code?! Dont get it; anyhow the code is correct
The code I posted before....
Have a Vista Version on my old Laptop here, thats why mq4 files keep disappearing; now it should work!