设为首页 收藏本站 切换语言
| 发表于 2025-6-27 21:11:07 | 显示全部楼层 |复制链接
指标名称:TDI[color=rgba(0, 0, 0, 0.9)]
版本:MT4  ver. 3.0


一、指标简介
TDI Alerts v3 是一款综合型交易指标,结合了趋势方向、市场强度和波动性分析。它通过多条颜色线帮助您快速判断市场状态:
image.jpg
  • 绿色线(RSI价格线):反映短期价格动向。  
  • 红色线(交易信号线):辅助判断买卖时机。  
  • 蓝色带(波动带):显示市场波动范围,扩张时趋势强,收缩时趋势弱。  
  • 黄色线(市场基准线):判断整体趋势方向,通常在中线(32-68)之间波动。


二、安装步骤
1. 下载指标,复制指标到MT4的 `MQL4/Indicators` 文件夹。  
2. 重启MT4,在“导航”窗口找到该指标,拖拽到图表即可。
三、核心信号解读
1. 趋势方向
短期趋势:
  • 绿线在红线上方 → 价格上涨。  
  • 红线在绿线上方 → 价格下跌。  

整体趋势:
  • 黄线向上且价格在黄线上方 → 适合做多。  
  • 黄线向下且价格在黄线下方 → 适合做空。


2. 买卖信号
  • 强买入:绿线 > 红线& 红线 > 黄线。  
  • 强卖出:绿线 < 红线& 红线 < 黄线。  
  • 超买/超卖:绿线触及上方蓝带(超买)或下方蓝带(超卖)。


3. 波动性
  • 蓝色带扩张 → 趋势强劲,适合跟随。  
  • 蓝色带收缩 → 市场盘整,谨慎交易。


六、常见问题
1. 指标不显示?  

检查是否安装到正确文件夹,重启MT4。  
2. 警报不工作?  

确保MT4允许弹出窗口和声音,邮件需提前设置SMTP。  
3. 如何调整灵敏度?  

减小`RSI_Period`或`Volatility_Band`值,指标会更敏感。
通过掌握TDI Alerts v3的多维度信号,能更自信地捕捉趋势和规避风险。
参数:
image.jpg
具体参数设置以及含义,可以参考部分代码展示内的参数注释。
部分代码展示:

  1. //+------------------------------------------------------------------+//|                                                    TDI Alerts v3.mq4 |//|                                Copyright © 2009-2024, www.QChaos.com |//|                                          https://www.qchaos.com/ |//+------------------------------------------------------------------+#define major   "2"#define minor   "a"#define indicatorName "TDI Alerts v3-" //"TDIvisual new"//----#property indicator_separate_window#property indicator_buffers 6#property indicator_color1 Gray#property indicator_color2 SkyBlue //MediumBlue#property indicator_color3 Yellow//#property indicator_width3 2#property indicator_color4 SkyBlue //MediumBlue#property indicator_color5 Green//#property indicator_width5 2#property indicator_color6 Red//#property indicator_color7 Aqua//#property indicator_style7 2
  2. ///////////////////////////////////////////////////////////////////////////////////////////|                                 外部可调参数(用户配置界面显示)                                 |/////////////////////////////////////////////////////////////////////////////////////////
  3. //---- 指标核心参数组 ----extern string NoteIndic=" --- 指标选项 --- ";                 // 参数分组标题extern int    RSI_Period          = 8;       // RSI计算周期(默认8,建议范围8-25)extern int    RSI_Price           = PRICE_MEDIAN; // RSI价格类型:0=收盘价,1=开盘价,2=最高价,3=最低价,4=中价(高+低)/2extern int    RSI_Price_Line_Shift= 0;       // RSI价格线位移(默认0,不偏移)extern int    Volatility_Band     = 23;      // 波动带计算周期(默认23,范围20-40)extern int    RSI_Price_Line      = 2;       // RSI价格线平滑周期(移动平均周期)extern int    RSI_Price_Type      = MODE_LWMA; // RSI价格线类型:0=SMA简单均线,1=EMA指数均线,2=SMMA平滑均线,3=LWMA线性加权
  4. //---- 交易信号线参数组 ----extern int    Trade_Signal_Line   = 7;       // 主交易信号线周期(默认7)extern int    Trade_Signal_Line_Shift=0;     // 信号线位移(默认0)extern int    Trade_Signal_Type   = PRICE_CLOSE; // 信号线价格类型:0=收盘价,1=开盘价,2=最高价等extern int    Trade_Signal2_Line  = 18;      // 第二交易信号线周期(默认18)extern int    Trade_Signal2_Line_Shift=0;    // 第二信号线位移extern int    Trade_Signal2_Type  = PRICE_MEDIAN; // 第二信号线价格类型extern bool   SHOW_Trade_Signal2_Line=FALSE; // 是否显示第二信号线(默认关闭)
  5. //---- 超买超卖参数组 ----extern string NoteLevels=" --- OB/OS Levels (32,68,20) --- "; // 水平线分组标题extern int    RSI_OversoldLevel   = 23;      // 超卖水平阈值(默认32)extern int    RSI_OverboughtLevel = 78;      // 超买水平阈值(默认68)extern int    VB_ConsolidationLevel=20;      // 波动带盘整阈值(带宽<20时视为盘整)
  6. //---- 警报系统参数组 ----extern string NoteAlerts=" --- Alert Options --- "; // 警报分组标题extern bool   StrongBuySellAlerts = true;    // 启用强买卖信号警报(默认开启)extern bool   MediumWeakBuySellAlerts=true;  // 启用中/弱信号警报(默认开启)extern bool   CautionAlerts       = true;    // 启用超买超卖警示(在指标窗口显示)extern int    AlertBar            = 1;       // 警报触发柱:0=当前柱,1=前一根K线等extern bool   SendTimeInfoAsTimeLocal=false; // 警报时间显示类型:true=本地时间,false=服务器时间extern string NoteAlerts1="*** ALERT METHODS ***:"; // 警报方式分组标题extern bool   PopupAlerts         = true;    // 启用弹窗警报(默认开启)extern bool   eMailAlerts         = false;   // 启用邮件警报(需配置MT4邮箱)extern bool   PushNotificationAlerts=false;  // 启用推送通知(需移动端支持)extern bool   SoundAlerts         = false;   // 启用声音警报(默认关闭)extern string SoundAlertFileLong  = "alert.wav";  // 多头信号音效文件extern string SoundAlertFileShort = "alert2.wav"; // 空头信号音效文件extern string SoundAlertFileCautionAlert="news.wav"; // 警示信号音效文件string SoundAlertFile;                       // 内部使用的音效文件变量datetime MyTime;                             // 时间戳变量
  7. //---- 可视化水平线参数组 ----extern string NoteLevel=" --- Visual Levels: ---"; // 可视化分组标题extern int Level2 = 50;                      // 中间水平线位置(默认50)
  8. //---- 颜色配置参数组 ----extern string NoteColor=" --- Colors --- ";  // 颜色分组标题extern color  BuyArrowColor      = Lime;     // 买入箭头颜色(莱姆绿)extern color  SellArrowColor     = Red;      // 卖出箭头颜色(纯红)extern color  StrongBuyArrowCautionColor=Chartreuse;  // 强势买入警示色(亮黄绿)extern color  StrongSellArrowCautionColor=DeepPink;   // 强势卖出警示色(深粉红)
  9. //---- 趋势信号颜色组 ----extern string NoteColor1=" --- TrendSignals --- ";extern color  WeakUpColor        = Green;    // 弱势上涨颜色(绿色)extern color  StrongUpColor      = Lime;     // 强势上涨颜色(亮绿色)extern color  WeakDownColor      = Orange;   // 弱势下跌颜色(橙色)extern color  StrongDownColor    = Red;      // 强势下跌颜色(红色)extern color  ConsolidationColor = Silver;   // 盘整阶段颜色(银色)
  10. //---- 趋势可视化颜色组 ----extern string NoteColor2=" --- TrendVisuals ---";extern color  StrongBuyColor     = Lime;     // 强买入信号颜色extern color  MediumBuyColor     = Green;    // 中等买入颜色extern color  WeakBuyColor       = SeaGreen; // 弱买入颜色(海绿色)extern color  StrongSellColor    = Red;      // 强卖出颜色extern color  MediumSellColor    = Tomato;   // 中等卖出颜色(番茄红)extern color  WeakSellColor      = Orange;   // 弱卖出颜色
  11. //---- 通用显示参数组 ----extern string NoteGeneral=" --- General Options (true,true,0,0) --- ";extern bool   Show_TrendVisuals  = true;     // 显示趋势可视化元素(默认开启)extern bool   Show_SignalArrows  = true;     // 显示交易信号箭头(默认开启)extern int    SHIFT_Sideway      = -50;      // 横盘信号横向偏移量(像素)extern int    SHIFT_Up_Down      = -10;      // 涨跌信号纵向偏移量(像素)
  12. //---- 字体设置参数组 ----extern string NoteFonts=" --- Font/Size (25,15,13,Tahoma Narrow) ---";extern int    TrendArrowFontSize = 15;       // 趋势箭头字体大小(默认15)extern int    TrendSignalsFontSize=10;       // 趋势信号文字大小(默认10)extern int    TrendPriceFontSize = 10;       // 价格标签字体大小(默认10)extern string TypeFace           = "Arial Black"; // 主要字体类型(默认Arial Black)
  13. //////////////////////////////////////////////////////////////////|                      高级自定义设置                       |////////////////////////////////////////////////////////////////
  14. //---- 随机指标替代组 ----extern string NoteIndiRsi=" --- misc: --- "; // 杂项分组标题extern string nirh="replace the RSI with:";  // 功能描述标签extern bool   UseStochInsteadOfRsi=FALSE;    // 启用随机指标替代RSI(默认关闭)extern int    stochKPeriod       = 11;       // 随机指标%K周期(默认11)extern int    stochDPeriod       = 2;        // 随机指标%D周期(默认2)extern int    stochSlowing       = 2;        // 随机指标平滑系数(默认2)extern int    stochMethod        = MODE_LWMA;// 随机指标计算方法:0=SMA,3=LWMAextern int    stochPrice         = 1;        // 随机指标价格类型:0=高/低,1=收盘价
  15. //---- 自定义交叉警报组 ----extern string NoteCustomAlert=" --- custom alert, nellycopter: --- ";extern string NoteCustomAlert1=" --- price cross tradesignal above/under marketbase line (optional ma-filter) --- ";extern bool RsiTradeSignalCrossAlerts=true;  // 启用RSI/信号线交叉警报extern bool RsiTradeSignalCrossMaFilter=false; // 启用移动平均过滤extern int filterMaPeriod = 60;              // 过滤用MA周期(默认60)extern int filterMaShift  = 0;               // MA位移(默认0)extern int filterMaMethod = MODE_EMA;        // MA类型:0=SMA,1=EMAextern int filterMaPrice  = PRICE_CLOSE;     // MA价格类型:0=收盘价extern string CustomAlertSoundFileLong = "news.wav";  // 自定义多头音效extern string CustomAlertSoundFileShort= "news.wav";  // 自定义空头音效
  16. //---- 界面控制按钮参数组 ----ENUM_BASE_CORNER btn_corner=CORNER_RIGHT_LOWER; // 按钮位置:右下角string btn_text    = "TDI1";          // 按钮显示文本string btn_Font    = "Arial";         // 按钮字体int    btn_FontSize= 8;               // 按钮文字大小color  btn_text_ON_color=clrWhite;    // 启用状态文字颜色(白色)color  btn_text_OFF_color=clrRed;     // 关闭状态文字颜色(红色)string btn_pressed = "TDI off";       // 按下时显示文本string btn_unpressed="TDI on";        // 弹起时显示文本color  btn_background_color=clrDimGray;// 按钮背景色(暗灰)color  btn_border_color=clrDarkGray;  // 按钮边框色(深灰)int    button_x    = 70;              // 按钮X坐标(距右边缘70像素)int    button_y    = 20;              // 按钮Y坐标(距下边缘20像素)int    btn_Width   = 60;              // 按钮宽度(60像素)int    btn_Height  = 20;              // 按钮高度(20像素)string soundBT     = "tick.wav";      // 按钮点击音效文件
  17. bool                      show_data             = true;string IndicatorName, IndicatorObjPrefix,buttonId ;//end mod.string indicatorsName;///////////////////////////////////////////////////////////////////////----bool InitialLoad=True;string prefix="TDIV_";double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[],McBuf[];string Signal="", Signal2="", Signal3="",Signal4="";color TDI_col,TDI_col2;int LastAlert=0, LastAlertBar,SigCounter=0;double BidCur;datetime TimeCur;//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+string GenerateIndicatorName(const string target)  {   string name = target;   int try         = 2;   while(WindowFind(name) != -1)     {      name = target + " #" + IntegerToString(try                                                ++);     }   return name;  }//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+int init()  {   /*    indicatorsName=indicatorName+major+minor+" (";    if (UseStochInsteadOfRsi) indicatorsName=indicatorsName+"STOCH)";      else indicatorsName=indicatorsName+"RSI)";    */   IndicatorShortName(indicatorName);//   SetIndexBuffer(0,RSIBuf); //Black/no color   SetIndexBuffer(1,UpZone); //SkyBlue, VB HIGH   SetIndexBuffer(2,MdZone); //Yellow,  MARKET BASE LINE   SetIndexBuffer(3,DnZone); //SkyBlue, VB LOW   SetIndexBuffer(4,MaBuf);  //Green,   RSI PRICE LINE   SetIndexBuffer(5,MbBuf);  //Red,     TRADE SIGNAL LINE   SetIndexBuffer(6,McBuf);  //Aqua,    TRADE SIGNAL2 LINE (has no function for signal generation)//----   if(SHOW_Trade_Signal2_Line == true)     {      SHOW_Trade_Signal2_Line = DRAW_LINE;     }   else     {      SHOW_Trade_Signal2_Line = DRAW_NONE;     }   SetIndexStyle(6,SHOW_Trade_Signal2_Line,0,2); // SetIndexStyle(6,SHOW_Trade_Signal2_Line);//SetIndexBuffer(6,McBuf);   SetIndexStyle(0,DRAW_NONE);   SetIndexStyle(1,DRAW_LINE);   SetIndexStyle(2,DRAW_LINE);   SetIndexStyle(3,DRAW_LINE);   SetIndexStyle(4,DRAW_LINE);   SetIndexStyle(5,DRAW_LINE);//----   SetIndexLabel(0,NULL);   SetIndexLabel(1,"VolatilityBand High");   SetIndexLabel(2,"Market Base Line");   SetIndexLabel(3,"VolatilityBand Low");
  18. //   if(UseStochInsteadOfRsi)      SetIndexLabel(4,"STOCH Price Line");   else      SetIndexLabel(4,"RSI Price Line");//
  19.    SetIndexLabel(5,"Trade Signal Line");   SetIndexLabel(6,"Trade Signal2 Line");//   /*   SetLevelValue(0,61.8);   SetLevelValue(1,50.0);   SetLevelValue(2,38.2);   SetLevelValue(3,23.6);   SetLevelStyle(STYLE_DOT,1,DimGray);   *///   LastAlertBar=Bars-1;//----   IndicatorName = GenerateIndicatorName(btn_text);   IndicatorObjPrefix = "__" + IndicatorName + "__";//  IndicatorShortName(WindowExpertName());   IndicatorDigits(Digits);   double val;   if(GlobalVariableGet(IndicatorName + "_visibility", val))      show_data = val != 0;
  20.    ChartSetInteger(ChartID(), CHART_EVENT_MOUSE_MOVE, 1);   buttonId = IndicatorObjPrefix+btn_text;   createButton(buttonId, btn_text, btn_Width, btn_Height, btn_Font, btn_FontSize, btn_background_color, btn_border_color, btn_text_ON_color);   ObjectSetInteger(ChartID(), buttonId, OBJPROP_YDISTANCE, button_y);   ObjectSetInteger(ChartID(), buttonId, OBJPROP_XDISTANCE, button_x);   return(0);  }//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+void createButton(string buttonID,string buttonText,int width,int height,string font,int fontSize,color bgColor,color borderColor,color txtColor)  {//  ObjectDelete    (ChartID(),buttonID);   ObjectCreate(ChartID(),buttonID,OBJ_BUTTON,WindowOnDropped(),0,0);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_COLOR,txtColor);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_BGCOLOR,bgColor);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_BORDER_COLOR,borderColor);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_XSIZE,width);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_YSIZE,height);   ObjectSetString(ChartID(),buttonID,OBJPROP_FONT,font);   ObjectSetString(ChartID(),buttonID,OBJPROP_TEXT,buttonText);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_FONTSIZE,fontSize);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_SELECTABLE,0);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_CORNER,btn_corner);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_HIDDEN,1);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_XDISTANCE,9999);   ObjectSetInteger(ChartID(),buttonID,OBJPROP_YDISTANCE,9999);  }//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+int deinit()  {   ObjectsDeleteAll(0,"TDI1");   ObjectsDeleteAll(ChartID(), IndicatorObjPrefix);
  21.    int total=ObjectsTotal();   for(int i=total-1; i>=0; i--)     {      string name=ObjectName(i);      if(StringFind(name, prefix)==0)         ObjectDelete(name);     }//----   return(0);  }
  22. //+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+bool recalc = true;void handleButtonClicks()  {   if(ObjectGetInteger(ChartID(), buttonId, OBJPROP_STATE))     {      ObjectSetInteger(ChartID(), buttonId, OBJPROP_STATE, false);      show_data = !show_data;      GlobalVariableSet(IndicatorName + "_visibility", show_data ? 1.0 : 0.0);      recalc = true;      start();     }  }//+------------------------------------------------------------------+//|                                                                  |//+------------------------------------------------------------------+void OnChartEvent(const int id,                  const long &lparam,                  const double &dparam,                  const string &sparam)  {   handleButtonClicks();   if(id==CHARTEVENT_OBJECT_CLICK && ObjectGet(sparam,OBJPROP_TYPE)==OBJ_BUTTON)     {      if(soundBT!="")         PlaySound(soundBT);     }  }
复制代码

TDI Alerts v3.ex4

72.35 KB, 下载次数: 6, 下载积分: 活跃度 -5 售价: 1 H币  [记录]  [下载]

评分
  • 1
  • 2
  • 3
  • 4
  • 5
平均分:NAN    参与人数:0    我的评分:未评 下载时遇到问题?
如果有帮助,就支持一下我呗
举报

评论 使用道具

精彩评论3

lilihuan
C
| 发表于 2025-6-28 07:02:11 | 显示全部楼层
太复杂了,看不懂
举报

点赞 评论 使用道具

jj644719356
DDD
| 发表于 2025-6-29 10:52:21 | 显示全部楼层
结合了趋势方向、市场强度和波动性分析
举报

点赞 评论 使用道具

weixi
DD
| 发表于 2025-8-1 13:11:12 | 显示全部楼层
非常实用的系统
举报

点赞 评论 使用道具

发新帖
EA交易
您需要登录后才可以评论 登录 | 立即注册

简体中文
繁體中文
English(英语)
日本語(日语)
Deutsch(德语)
Русский язык(俄语)
بالعربية(阿拉伯语)
Türkçe(土耳其语)
Português(葡萄牙语)
ภาษาไทย(泰国语)
한어(朝鲜语/韩语)
Français(法语)