📅 财经日历 📊 实时波动 📈 大盘云图 📶 行情走势 🆚 投机情绪 🚀 今日热点

    私藏的MT4量能指标,专抓放量拐点和假突破!源码自取 

    2026-06-23 · 354 阅读
    昨天才更新源码,后台就有兄弟催我了。
    看来大家还是更喜欢这种能直接拿去研究的指标。今天继续安排一款比较有意思的MT4指标:双资金RSI监测指标。

    普通RSI大家都见过,基本就是一条线,看超买超卖。但问题也很明显:信号太粗,很多时候只能看到价格强弱,看不出背后是哪类资金在推动。

    这款指标的思路,是把资金状态分成两条线来看:

    条偏短线资金,可以理解为游资、快进快出的力量;
    另一条偏长线资金,更像是大资金、主力资金的方向参考。

    信号也比较直观。底部出现蓝色向上箭头,代表短线资金进入明显超卖区域,同时如果K线开始转强,就可以重点留意反弹机会。

    顶部出现红色向下箭头,说明资金可能进入过热区,如果K线同步转弱,就要小心回落风险


    不过也实话实说,这只是指标,不是完整交易系统。它没有自带止盈止损,也不会替你控制仓位。

    最好配合均线、趋势线或者支撑阻力一起用,尤其要先判断大方向,再看RSI信号,效果会稳很多。

    源码我还是老规矩放下面了。不会安装、不会调均线过滤的朋友,可以来问:
    1. // More information about this indicator can be found at:
    2. // https://fxcodebase.com/code/viewtopic.php?f=38&t=73431

    3. //+------------------------------------------------------------------------------------------------+
    4. //|                                                            Copyright © 2023, Gehtsoft USA LLC  |
    5. //|                                                                         http://fxcodebase.com  |
    6. //+------------------------------------------------------------------------------------------------+
    7. //|                                                                   Developed by : Mario Jemic   |
    8. //|                                                                       mario.jemic@gmail.com    |
    9. //|                                                        https://AppliedMachineLearning.systems  |
    10. //|                                                                       https://mario-jemic.com/ |
    11. //+------------------------------------------------------------------------------------------------+

    12. //+------------------------------------------------------------------------------------------------+
    13. //|                                           Our work would not be possible without your support. |
    14. //+------------------------------------------------------------------------------------------------+
    15. //|                                                               Paypal: https://goo.gl/9Rj74e    |
    16. //|                                                             Patreon :  https://goo.gl/GdXWeN   |
    17. //+------------------------------------------------------------------------------------------------+

    18. #property copyright "Copyright © 2023, Gehtsoft USA LLC"
    19. #property link "http://fxcodebase.com"
    20. #property version "1.0"
    21. #property strict
    22. #property indicator_chart_window
    23. #property indicator_buffers 2
    24. #property indicator_plots 2
    25. #property indicator_label1 "Arrow Up"
    26. #property indicator_type1  DRAW_ARROW
    27. #property indicator_color1 clrWhite
    28. #property indicator_style1 STYLE_SOLID
    29. #property indicator_width1 1
    30. #property indicator_label2 "Arrow Down"
    31. #property indicator_type2  DRAW_ARROW
    32. #property indicator_color2 clrWhite
    33. #property indicator_style2 STYLE_SOLID
    34. #property indicator_width2 1
    35. #property indicator_type2 DRAW_NONE
    36. //--- indicator buffers


    37. // ------------------------------------------------------------------
    38. extern ENUM_TIMEFRAMES TimeFrame   = PERIOD_CURRENT;    // Time frame
    39. input double m                     = 2;      // Key value:
    40. input double atrPeriods            = 14;     // ATR periods:
    41. input bool   h                     = false;  // Signals From Heinken Ashi Candles
    42. input string T1                    = "== Notifications ==";  // ————————————
    43. input bool   notifications         = false;                  // Notifications On?
    44. input bool   desktop_notifications = false;                  // Desktop MT4 Notifications
    45. input bool   email_notifications   = false;                  // Email Notifications
    46. input bool   push_notifications    = false;                  // Push Mobile Notifications
    47. input string T2                    = "== Set Arrows ==";     // ————————————
    48. input bool   ArrowsOn              = true;                   // Arrows On?
    49. input bool   inpArrowsOnFirst      = false;                  // Arrows on first mtf bar
    50. input color  ArrowUpClr            = clrWhite;                // Arrow Up Color:
    51. input color  ArrowDnClr            = clrWhite;                 // Arrow Down Color:

    52. double ArrowUp[];
    53. double ArrowDn[];
    54. double xATRTrailingStop[],count[];

    55. //--- variables
    56. double nLoss, xATR;
    57. string indicatorFileName;
    58. #define _mtfCall(_buff,_ind) iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,m,atrPeriods,h,T1,notifications,desktop_notifications,email_notifications,push_notifications,T2,ArrowsOn,inpArrowsOnFirst,ArrowUpClr,ArrowDnClr,_buff,_ind)
    59. // ------------------------------------------------------------------
    60. class CCandle
    61. {
    62.   int    _timeFrame;
    63.   string _symbol;
    64.   double _open;
    65.   double _high;
    66.   double _low;
    67.   double _close;
    68.   float  _size;
    69.   string _type;
    70.   string _direction;
    71.   float  _bodySize;
    72.   float  _shadowSup;
    73.   float  _shadowInf;

    74. public:
    75.   CCandle() { ; }
    76.   CCandle(string sym, int tf) : _symbol(sym), _timeFrame(tf) {}
    77.   ~CCandle() { ; }

    78.   // Getters
    79.   float  Size(void) { return _size; }
    80.   string Type(void) { return _type; }
    81.   double Open(void) { return _open; }
    82.   double High(void) { return _high; }
    83.   double Low(void) { return _low; }
    84.   double Close(void) { return _close; }
    85.   string Direction(void) { return _direction; }
    86.   float  BodySize(void) { return _bodySize; }
    87.   float  ShadowSup(void) { return _shadowSup; }
    88.   float  ShadowInf(void) { return _shadowInf; }

    89.   void setCandle(int shift = 1)
    90.   {
    91.     _open  = iOpen(_symbol, _timeFrame, shift);
    92.     _high  = iHigh(_symbol, _timeFrame, shift);
    93.     _low   = iLow(_symbol, _timeFrame, shift);
    94.     _close = iClose(_symbol, _timeFrame, shift);

    95.     setDirection();
    96.     setSize();
    97.     setBodySize();
    98.     setShadows();
    99.   }
    100.   void setSize()
    101.   {
    102.     _size = 1;
    103.     if (Distance(_high, _low, _symbol) > 0)
    104.     {
    105.       _size = Distance(_high, _low, _symbol);
    106.     }
    107.   }
    108.   void setBodySize()
    109.   {
    110.     _bodySize = 1;
    111.     if (Distance(_open, _close, _symbol) > 0)
    112.     {
    113.       _bodySize = Distance(_open, _close, _symbol);
    114.     }
    115.   }
    116.   void setDirection()
    117.   {
    118.     if (_open < _close)
    119.     {
    120.       _direction = "up";
    121.     }
    122.     if (_open > _close)
    123.     {
    124.       _direction = "down";
    125.     }
    126.     if (_open == _close)
    127.     {
    128.       _direction = "null";
    129.     }
    130.   }
    131.   void PrintCandle()
    132.   {
    133.     Print(__FUNCTION__, " ", "symbol", " ", _symbol);
    134.     Print(__FUNCTION__, " ", "open", " ", _open);
    135.     Print(__FUNCTION__, " ", "high", " ", _high);
    136.     Print(__FUNCTION__, " ", "low", " ", _low);
    137.     Print(__FUNCTION__, " ", "close", " ", _close);
    138.     Print(__FUNCTION__, " ", "_size;", " ", _size);
    139.     Print(__FUNCTION__, " ", "_type;", " ", _type);
    140.     Print(__FUNCTION__, " ", "_direction;", " ", _direction);
    141.     Print(__FUNCTION__, " ", "_bodySize;", " ", _bodySize);
    142.     Print(__FUNCTION__, " ", "_shadowSup;", " ", _shadowSup);
    143.     Print(__FUNCTION__, " ", "_shadowInf;", " ", _shadowInf);
    144.   }
    145.   void setShadows()
    146.   {
    147.     if (Direction() == "up")
    148.     {
    149.       _shadowInf = Distance(_open, _low, _symbol);
    150.       _shadowSup = Distance(_close, _high, _symbol);
    151.     }
    152.     if (Direction() == "down")
    153.     {
    154.       _shadowInf = Distance(_close, _low, _symbol);
    155.       _shadowSup = Distance(_open, _high, _symbol);
    156.     }
    157.     if (Direction() == "null")
    158.     {
    159.       _shadowInf = Distance(_close, _low, _symbol);
    160.       _shadowSup = Distance(_open, _high, _symbol);
    161.     }
    162.   }
    163.   float Distance(double precioA, double precioB, string par)
    164.   {
    165.     double mPoint     = MarketInfo(par, MODE_POINT);
    166.     double dist       = fabs(precioA - precioB);
    167.     double distReturn = 0;
    168.     if (mPoint > 0) distReturn = dist / mPoint;
    169.     return distReturn;
    170.   }
    171. };
    172. CCandle candle1();
    173. CCandle candle2();

    174. class CNewCandle
    175. {
    176. private:
    177.   int    _initialCandles;
    178.   string _symbol;
    179.   int    _tf;

    180. public:
    181.   CNewCandle(string symbol, int tf) : _symbol(symbol), _tf(tf), _initialCandles(iBars(symbol, tf)) {}
    182.   CNewCandle()
    183.   {
    184.     // toma los valores del chart actual
    185.     _initialCandles = iBars(Symbol(), Period());
    186.     _symbol         = Symbol();
    187.     _tf             = Period();
    188.   }
    189.   ~CNewCandle() { ; }

    190.   bool IsNewCandle()
    191.   {
    192.     int _currentCandles = iBars(_symbol, _tf);
    193.     if (_currentCandles > _initialCandles)
    194.     {
    195.       _initialCandles = _currentCandles;
    196.       return true;
    197.     }

    198.     return false;
    199.   }
    200. };
    201. CNewCandle newCandle();

    202. // ------------------------------------------------------------------
    203. int OnInit()
    204. {
    205.   IndicatorBuffers(4);
    206.   SetIndexBuffer(0, ArrowUp, INDICATOR_DATA);
    207.   SetIndexArrow(0, 233);
    208.   SetIndexStyle(0, DRAW_ARROW, EMPTY, 3, ArrowUpClr);
    209.   SetIndexBuffer(1, ArrowDn, INDICATOR_DATA);
    210.   SetIndexArrow(1, 234);
    211.   SetIndexStyle(1, DRAW_ARROW, EMPTY, 3, ArrowDnClr);
    212.   SetIndexBuffer(2, xATRTrailingStop);
    213.   //SetIndexStyle(2, DRAW_NONE);
    214.   SetIndexBuffer(3, count);

    215.   if (!ArrowsOn)
    216.   {
    217.     SetIndexStyle(0, DRAW_NONE);
    218.     SetIndexStyle(1, DRAW_NONE);
    219.   }
    220.   
    221.   indicatorFileName = WindowExpertName();
    222.   TimeFrame         = fmax(TimeFrame,_Period);
    223.   return (INIT_SUCCEEDED);
    224. }
    225. void OnDeinit(const int reason) {}
    226. // ------------------------------------------------------------------

    227. int OnCalculate(const int       rates_total,
    228.                 const int       prev_calculated,
    229.                 const datetime& time[],
    230.                 const double&   open[],
    231.                 const double&   high[],
    232.                 const double&   low[],
    233.                 const double&   close[],
    234.                 const long&     tick_volume[],
    235.                 const long&     volume[],
    236.                 const int&      spread[])
    237. {
    238.    int i=rates_total-prev_calculated+1; if (i>=rates_total) i=rates_total-1; count[0]=i;
    239.       if (TimeFrame!=_Period)
    240.       {
    241.          i = (int)fmax(i,fmin(rates_total-1,_mtfCall(3,0)*TimeFrame/_Period));
    242.          for (; i>=0 && !_StopFlag; i--)
    243.          {
    244.              int y = iBarShift(_Symbol,TimeFrame,time[i]);
    245.              int x = y;
    246.              if (inpArrowsOnFirst)
    247.                    {  if (i<rates_total-1) x = iBarShift(_Symbol,TimeFrame,time[i+1]);               }
    248.              else  {  if (i>0)             x = iBarShift(_Symbol,TimeFrame,time[i-1]); else x = -1;  }
    249.                   ArrowUp[i] = ArrowDn[i] = EMPTY_VALUE;
    250.                   if (x!=y)
    251.                   {
    252.                     ArrowUp[i] = _mtfCall(0,y);
    253.                     ArrowDn[i] = _mtfCall(1,y);
    254.                   }
    255.           }           
    256.    return(rates_total);
    257.    }
    258.    
    259.    //
    260.    //
    261.    //
    262.    
    263.    for (; i>=0 && !_StopFlag; i--)
    264.    {
    265.      xATR  = iATR(NULL, 0, (int)atrPeriods, i);
    266.      nLoss = m * xATR;

    267.      double cl  = close[i];
    268.      double cl1 = (i<rates_total-1) ? close[i+1] : close[i];
    269.        
    270.                 // clang-format off
    271.     xATRTrailingStop[i] = (i<rates_total-1) ? cl > xATRTrailingStop[i + 1] && cl1 > xATRTrailingStop[i + 1] ? fmax(xATRTrailingStop[i + 1], cl - nLoss) :
    272.                                                                                  cl < xATRTrailingStop[i + 1] && cl1 < xATRTrailingStop[i + 1] ? fmin(xATRTrailingStop[i + 1], cl + nLoss) :
    273.                                                                                                                cl > xATRTrailingStop[i + 1] ? cl - nLoss : cl + nLoss : 0;
    274.    
    275.                
    276.                
    277.                 bool crossUp = (i<rates_total-1) ? cl > xATRTrailingStop[i] && cl1 < xATRTrailingStop[i+1] : 0;
    278.                 bool crossDn = (i<rates_total-1) ? cl < xATRTrailingStop[i] && cl1 > xATRTrailingStop[i+1] : 0;
    279.       ArrowUp[i] = ArrowDn[i] = EMPTY_VALUE;
    280.                 if (cl > xATRTrailingStop[i] && crossUp==true)
    281.     {
    282.       ArrowUp[i] = low[i] - xATR/2;

    283.       if (newCandle.IsNewCandle()) { Notifications(0); }
    284.     }

    285.     if (cl < xATRTrailingStop[i] && crossDn == true)
    286.     {
    287.       ArrowDn[i] = high[i] + xATR/2;

    288.       if (newCandle.IsNewCandle()) { Notifications(1); }
    289.     }
    290.   }

    291.   return (rates_total);
    292. }

    293. // ------------------------------------------------------------------
    294. void setCandles(int i, int shift)
    295. {
    296.   candle1.setCandle(i + shift);
    297.   candle2.setCandle(i);
    298. }

    299. // clang-format off
    300. bool haveSignalUp(int i)
    301. {
    302.   // TODO: signal up
    303.        
    304.         // double cl =  iClose(NULL,0,i);
    305.        
    306.         // if(cl > xATRTrailingStop[i] )
    307.   // {
    308.   //   return true;
    309.   // }

    310.   return false;
    311. }

    312. bool haveSignalDown(int i)
    313. {
    314.   // TODO: signal down
    315.   
    316.         // double cl =  iClose(NULL,0,i);

    317.         // if(cl  < xATRTrailingStop[i] )
    318.   // {
    319.   //   return true;
    320.   // }

    321.   return false;
    322. }

    323. void Notifications(int type)
    324. {
    325.   string text = "";
    326.   if (type == 0)
    327.     text += _Symbol + " " + GetTimeFrame(_Period) + " BUY ";
    328.   else
    329.     text += _Symbol + " " + GetTimeFrame(_Period) + " SELL ";

    330.   text += " ";

    331.   if (!notifications)
    332.     return;
    333.   if (desktop_notifications)
    334.     Alert(text);
    335.   if (push_notifications)
    336.     SendNotification(text);
    337.   if (email_notifications)
    338.     SendMail("MetaTrader Notification", text);
    339. }

    340. string GetTimeFrame(int lPeriod)
    341. {
    342.   switch (lPeriod)
    343.   {
    344.     case PERIOD_M1:
    345.       return ("M1");
    346.     case PERIOD_M5:
    347.       return ("M5");
    348.     case PERIOD_M15:
    349.       return ("M15");
    350.     case PERIOD_M30:
    351.       return ("M30");
    352.     case PERIOD_H1:
    353.       return ("H1");
    354.     case PERIOD_H4:
    355.       return ("H4");
    356.     case PERIOD_D1:
    357.       return ("D1");
    358.     case PERIOD_W1:
    359.       return ("W1");
    360.     case PERIOD_MN1:
    361.       return ("MN1");
    362.   }
    363.   return IntegerToString(lPeriod);
    364. }

    365. //
    366. //
    367. //

    368. string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
    369. int    iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};

    370. string timeFrameToString(int tf)
    371. {
    372.    for (int i=ArraySize(iTfTable)-1; i>=0; i--)
    373.          if (tf==iTfTable[i]) return(sTfTable[i]);
    374.                               return("");
    375. }

    376. //+------------------------------------------------------------------------------------------------+
    377. //|                                                                    We appreciate your support. |
    378. //+------------------------------------------------------------------------------------------------+
    379. //|                                                               Paypal: https://goo.gl/9Rj74e    |
    380. //|                                                             Patreon :  https://goo.gl/GdXWeN   |
    381. //+------------------------------------------------------------------------------------------------+
    382. //|                                                                   Developed by : Mario Jemic   |
    383. //|                                                                       mario.jemic@gmail.com    |
    384. //|                                                        https://AppliedMachineLearning.systems  |
    385. //|                                                                       https://mario-jemic.com/ |
    386. //+------------------------------------------------------------------------------------------------+

    387. //+------------------------------------------------------------------------------------------------+
    388. //|BitCoin                    : 15VCJTLaz12Amr7adHSBtL9v8XomURo9RF                                 |
    389. //|Ethereum                   : 0x8C110cD61538fb6d7A2B47858F0c0AaBd663068D                         |
    390. //|SOL Address                : 4tJXw7JfwF3KUPSzrTm1CoVq6Xu4hYd1vLk3VF2mjMYh                       |
    391. //|Cardano/ADA                : addr1v868jza77crzdc87khzpppecmhmrg224qyumud6utqf6f4s99fvqv         |
    392. //|Dogecoin Address           : DBGXP1Nc18ZusSRNsj49oMEYFQgAvgBVA8                                 |
    393. //|SHIB Address               : 0x1817D9ebb000025609Bf5D61E269C64DC84DA735                         |
    394. //|Binance(ERC20 & BSC only)  : 0xe84751063de8ade7c5fbff5e73f6502f02af4e2c                         |
    395. //|BitCoin Cash               : 1BEtS465S3Su438Kc58h2sqvVvHK9Mijtg                                 |
    396. //|LiteCoin                   : LLU8PSY2vsq7B9kRELLZQcKf5nJQrdeqwD                                 |
    397. //+------------------------------------------------------------------------------------------------+
    复制代码



    webwxgetmsgimg (1).jpg
    ""
    还没有人打赏,支持一下
    回复

    举报

     

    回答|共 10 个

    15011601491 LV3

    发表于 6 天前 | 显示全部楼层

    100多项错误·

    da1s3da1 LV2

    发表于 6 天前 | 显示全部楼层

    本帖最后由 da1s3da1 于 2026-6-23 16:54 编辑

    “”“”“”“”?

    da1s3da1 LV2

    发表于 6 天前 | 显示全部楼层

    代码里根本没有RSI,也没有两条资金线。代码实际是 UT Bot(ATR 移动止损翻转箭头)指标(作者 Mario Jemic 移植的经典 UT Bot Alerts):核心是 ATR × 倍数m 算一条移动止损线,价格上穿出↑、下穿出↓

    我说的对不对?

    王德峰34951 LV4

    发表于 6 天前 | 显示全部楼层

    我这里倒是可以编译,如图是加载后的效果。。。。
    XAUUSDM30.png

    shanwuren LV7

    发表于 6 天前 | 显示全部楼层

    有偏移

    _4943 LV4

    发表于 5 天前 | 显示全部楼层

    王德峰34951 发表于 2026-6-23 22:01
    我这里倒是可以编译,如图是加载后的效果。。。。

    会飘不

    刘彦昌52693 LV0

    发表于 5 天前 | 显示全部楼层

    几个箭头就是拐点?

    王德峰34951 LV4

    发表于 5 天前 | 显示全部楼层


    不知道,没往下再进行😊

    明瑶湾 LV0

    发表于 5 天前 | 显示全部楼层

    王德峰34951 发表于 2026-6-23 22:01
    我这里倒是可以编译,如图是加载后的效果。。。。

    中间那段震荡区,会亏得底裤都没有
    12下一页
    您需要登录后才可以回帖 登录 | 注册

    提醒: 禁止引战、谩骂、灌水内容

    微信二维码

    有问题联系客服