COCO研究院

 找回密碼
 註冊
搜索
查看: 3073|回復: 10

請好心人士幫我改一下mt4的指標內容

[複製鏈接]
發表於 14-1-12 11:33 | 顯示全部樓層 |閱讀模式
http://codebase.mql4.com/cn/4524

感謝好心人士幫我這個魯肉腳一下。把指標內容改一下,我想 應該很簡單的才對吧。
我想把月線,週線,30分線三個拿掉不用,然後把顏色改為相反,因為我們的下跌是綠色,上漲是紅色跟國外的剛好相反。這樣看起來的直覺反應才習慣。
以上二個請好心人士幫幫忙,感恩。
順便付上coco幣200以代感謝。
發表於 14-1-12 14:08 | 顯示全部樓層
TrackTrend_MACD_Color.zip (9.26 KB, 下載次數: 317)

將附件解壓後的兩個檔案縮放在您的 c:\program files\ 裡面您的 MT4 交易商的 folder 下的 \experts\indicators\

.mq4 是原始檔, .ex4 是執行檔, 您在 MT4 裡的 Custom Indicator 內就可以找到這個改過的指標, 我檔案還是用一樣的名字, 您如果不想覆蓋您原有的, 把檔名改一下即可.
回復 支持 1 反對 0

使用道具 舉報

發表於 14-1-12 13:27 | 顯示全部樓層
1326.png

我是自己做成這種方式
用五個週期
然後做成紅綠燈

評分

參與人數 1金錢 +1 收起 理由
mewmi + 1 有分享..非常讚

查看全部評分

 樓主| 發表於 14-1-12 13:29 | 顯示全部樓層
Acer2266 發表於 14-1-12 13:27
我是自己做成這種方式
用五個週期
然後做成紅綠燈

這程式的東西我不懂耶。只能寄望現成的而以。
發表於 14-1-12 13:39 | 顯示全部樓層
本帖最後由 ambercrystal 於 14-1-12 13:47 編輯

海鮮大, 之前跟您互動過, 隨手之勞不用言謝.  我順手將裡面的俄文註釋給清除, 也順便把作者拼錯字的函數名GreatObjectLabel改為CreatObjectLabel.

新的指標程式原碼和新產生的圖和在下面:

eurusdm5.png

  1. #property indicator_chart_window

  2. // 0 -
  3. // 1 - M1
  4. // 2 - M5
  5. // 3 - M15
  6. // 4 - H1
  7. // 5 - H4
  8. // 6 - D1

  9. int LabelCorner = 0;
  10. extern int MACD_Fast = 12;
  11. extern int MACD_Slow = 26;
  12. extern int Signal_Period = 9;
  13. int MACD_Price = 0;              // PRICE_CLOSE
  14. int MACD_Shift = 0;

  15. extern color color_Up;              
  16. extern color color_Dn;              
  17. extern color color_UpDn;            
  18. extern color color_DnUp;            
  19. extern color color_TimeFrame;      


  20. extern int FontSize = 14;           
  21. string Font = "Times New Roman";
  22.    

  23. //+------------------------------------------------------------------+
  24. //| Custom indicator initialization function                         |
  25. //+------------------------------------------------------------------+
  26. int init()
  27.   {
  28. //---- indicators
  29.    
  30.    int interval = 10;   
  31.    CreatObjectLabel("Label1_1",  10, 1*FontSize+interval);
  32.    CreatObjectLabel("Label1_2",  10, 2*FontSize+interval);
  33.    CreatObjectLabel("Label1_3",  10, 3*FontSize+interval);
  34.    CreatObjectLabel("Label1_4",  10, 4*FontSize+interval);
  35.    CreatObjectLabel("Label1_5",  10, 5*FontSize+interval);
  36.    CreatObjectLabel("Label1_6",  10, 6*FontSize+interval);
  37.    
  38.    
  39.    CreatObjectLabel("Label2_1",  60, 1*FontSize+interval);
  40.    CreatObjectLabel("Label2_2",  60, 2*FontSize+interval);
  41.    CreatObjectLabel("Label2_3",  60, 3*FontSize+interval);
  42.    CreatObjectLabel("Label2_4",  60, 4*FontSize+interval);
  43.    CreatObjectLabel("Label2_5",  60, 5*FontSize+interval);
  44.    CreatObjectLabel("Label2_6",  60, 6*FontSize+interval);
  45.    
  46. //----
  47.    return(0);
  48.   }
  49. //+------------------------------------------------------------------+
  50. //| Custom indicator deinitialization function                       |
  51. //+------------------------------------------------------------------+
  52. int deinit()
  53.   {
  54. //----
  55.   
  56.    ObjectDelete("Label1_1");
  57.    ObjectDelete("Label1_2");
  58.    ObjectDelete("Label1_3");
  59.    ObjectDelete("Label1_4");
  60.    ObjectDelete("Label1_5");
  61.    ObjectDelete("Label1_6");
  62.    
  63.    ObjectDelete("Label2_1");
  64.    ObjectDelete("Label2_2");
  65.    ObjectDelete("Label2_3");
  66.    ObjectDelete("Label2_4");
  67.    ObjectDelete("Label2_5");
  68.    ObjectDelete("Label2_6");
  69.    
  70. //----
  71.    return(0);
  72.   }
  73. //+------------------------------------------------------------------+
  74. //| Custom indicator iteration function                              |
  75. //+------------------------------------------------------------------+
  76. int start()
  77.   {
  78.    
  79.          

  80.    string com1, com2, com3, com4;
  81.    com1 = "Up";
  82.    com2 = "Down";
  83.    com3 = "Up->Down";
  84.    com4 = "Down->Up";
  85.    
  86.    color_TimeFrame = White;
  87.    color_Up = DeepPink;
  88.    color_Dn = Lime;
  89.    color_UpDn = DodgerBlue;
  90.    color_DnUp = DodgerBlue;
  91.    
  92.          
  93.    int limit, i;
  94.    int counted_bars = IndicatorCounted();
  95.    if(counted_bars < 0) return(-1);
  96.    if(counted_bars > 0) counted_bars--;
  97.    limit = Bars - counted_bars;
  98.    for(i=0; i<limit; i++)
  99.    
  100. {
  101. //======== D1 ======================================================================================
  102.      if(MACD(TimeFrame(6))==1)
  103.        {
  104.        ObjectSetText("Label1_1",StrTimeFrame(6),FontSize,Font,color_TimeFrame);
  105.        ObjectSetText("Label2_1",com1,FontSize,Font,color_Up);
  106.        }
  107.      if(MACD(TimeFrame(6))==2)
  108.        {
  109.        ObjectSetText("Label1_1",StrTimeFrame(6),FontSize,Font,color_TimeFrame);
  110.        ObjectSetText("Label2_1",com2,FontSize,Font,color_Dn);
  111.        }
  112.      if(MACD(TimeFrame(6))==3)
  113.        {
  114.        ObjectSetText("Label1_1",StrTimeFrame(6),FontSize,Font,color_TimeFrame);
  115.        ObjectSetText("Label2_1",com3,FontSize,Font,color_UpDn);
  116.        }
  117.      if(MACD(TimeFrame(6))==4)
  118.        {
  119.        ObjectSetText("Label1_1",StrTimeFrame(6),FontSize,Font,color_TimeFrame);
  120.        ObjectSetText("Label2_1",com4,FontSize,Font,color_DnUp);
  121.        }
  122. //======== H4 ======================================================================================
  123.      if(MACD(TimeFrame(5))==1)
  124.        {
  125.        ObjectSetText("Label1_2",StrTimeFrame(5),FontSize,Font,color_TimeFrame);
  126.        ObjectSetText("Label2_2",com1,FontSize,Font,color_Up);
  127.        }
  128.      if(MACD(TimeFrame(5))==2)
  129.        {
  130.        ObjectSetText("Label1_2",StrTimeFrame(5),FontSize,Font,color_TimeFrame);
  131.        ObjectSetText("Label2_2",com2,FontSize,Font,color_Dn);
  132.        }
  133.      if(MACD(TimeFrame(5))==3)
  134.        {
  135.        ObjectSetText("Label1_2",StrTimeFrame(5),FontSize,Font,color_TimeFrame);
  136.        ObjectSetText("Label2_2",com3,FontSize,Font,color_UpDn);
  137.        }
  138.      if(MACD(TimeFrame(5))==4)
  139.        {
  140.        ObjectSetText("Label1_2",StrTimeFrame(5),FontSize,Font,color_TimeFrame);
  141.        ObjectSetText("Label2_2",com4,FontSize,Font,color_DnUp);
  142.        }
  143. //======== H1 ======================================================================================
  144.      if(MACD(TimeFrame(4))==1)
  145.        {
  146.        ObjectSetText("Label1_3",StrTimeFrame(4),FontSize,Font,color_TimeFrame);
  147.        ObjectSetText("Label2_3",com1,FontSize,Font,color_Up);
  148.        }
  149.      if(MACD(TimeFrame(4))==2)
  150.        {
  151.        ObjectSetText("Label1_3",StrTimeFrame(4),FontSize,Font,color_TimeFrame);
  152.        ObjectSetText("Label2_3",com2,FontSize,Font,color_Dn);
  153.        }
  154.      if(MACD(TimeFrame(4))==3)
  155.        {
  156.        ObjectSetText("Label1_3",StrTimeFrame(4),FontSize,Font,color_TimeFrame);
  157.        ObjectSetText("Label2_3",com3,FontSize,Font,color_UpDn);
  158.        }
  159.      if(MACD(TimeFrame(4))==4)
  160.        {
  161.        ObjectSetText("Label1_3",StrTimeFrame(4),FontSize,Font,color_TimeFrame);
  162.        ObjectSetText("Label2_3",com4,FontSize,Font,color_DnUp);
  163.        }

  164. //======== M15 =====================================================================================
  165.      if(MACD(TimeFrame(3))==1)
  166.        {
  167.        ObjectSetText("Label1_4",StrTimeFrame(3),FontSize,Font,color_TimeFrame);
  168.        ObjectSetText("Label2_4",com1,FontSize,Font,color_Up);
  169.        }
  170.      if(MACD(TimeFrame(3))==2)
  171.        {
  172.        ObjectSetText("Label1_4",StrTimeFrame(3),FontSize,Font,color_TimeFrame);
  173.        ObjectSetText("Label2_4",com2,FontSize,Font,color_Dn);
  174.        }
  175.      if(MACD(TimeFrame(3))==3)
  176.        {
  177.        ObjectSetText("Label1_4",StrTimeFrame(3),FontSize,Font,color_TimeFrame);
  178.        ObjectSetText("Label2_4",com3,FontSize,Font,color_UpDn);
  179.        }
  180.      if(MACD(TimeFrame(3))==4)
  181.        {
  182.        ObjectSetText("Label1_4",StrTimeFrame(3),FontSize,Font,color_TimeFrame);
  183.        ObjectSetText("Label2_4",com4,FontSize,Font,color_DnUp);
  184.        }
  185. //======== M5 ======================================================================================
  186.      if(MACD(TimeFrame(2))==1)
  187.        {
  188.        ObjectSetText("Label1_5",StrTimeFrame(2),FontSize,Font,color_TimeFrame);
  189.        ObjectSetText("Label2_5",com1,FontSize,Font,color_Up);
  190.        }
  191.      if(MACD(TimeFrame(2))==2)
  192.        {
  193.        ObjectSetText("Label1_5",StrTimeFrame(2),FontSize,Font,color_TimeFrame);
  194.        ObjectSetText("Label2_5",com2,FontSize,Font,color_Dn);
  195.        }
  196.      if(MACD(TimeFrame(2))==3)
  197.        {
  198.        ObjectSetText("Label1_5",StrTimeFrame(2),FontSize,Font,color_TimeFrame);
  199.        ObjectSetText("Label2_5",com3,FontSize,Font,color_UpDn);
  200.        }
  201.      if(MACD(TimeFrame(2))==4)
  202.        {
  203.        ObjectSetText("Label1_5",StrTimeFrame(2),FontSize,Font,color_TimeFrame);
  204.        ObjectSetText("Label2_5",com4,FontSize,Font,color_DnUp);
  205.        }
  206. //======== M1 ======================================================================================     
  207.      if(MACD(TimeFrame(1))==1)
  208.        {
  209.       
  210.        ObjectSetText("Label1_6",StrTimeFrame(1),FontSize,Font,color_TimeFrame);
  211.        ObjectSetText("Label2_6",com1,FontSize,Font,color_Up);
  212.        }
  213.      if(MACD(TimeFrame(1))==2)
  214.        {
  215.        ObjectSetText("Label1_6",StrTimeFrame(1),FontSize,Font,color_TimeFrame);
  216.        ObjectSetText("Label2_6",com2,FontSize,Font,color_Dn);
  217.        }
  218.      if(MACD(TimeFrame(1))==3)
  219.        {
  220.        ObjectSetText("Label1_6",StrTimeFrame(1),FontSize,Font,color_TimeFrame);
  221.        ObjectSetText("Label2_6",com3,FontSize,Font,color_UpDn);
  222.        }
  223.      if(MACD(TimeFrame(1))==4)
  224.        {
  225.        ObjectSetText("Label1_6",StrTimeFrame(1),FontSize,Font,color_TimeFrame);
  226.        ObjectSetText("Label2_6",com4,FontSize,Font,color_DnUp);
  227.        }

  228. //==============================================================================================     
  229.      }
  230. //----
  231.    return(0);
  232.   }
  233. //==================================================================================================
  234. int MACD(int MACDTimeFrame)
  235.    {
  236.    int MACD_Trend;
  237.    
  238.    double MACD_Main_0;
  239.    double MACD_Main_1;
  240.    double MACD_Signal_0;
  241.    double MACD_Signal_1;

  242.    MACD_Main_0 = iMACD(Symbol(),MACDTimeFrame,MACD_Fast,MACD_Slow,Signal_Period,MACD_Price,MODE_MAIN,0);
  243.    MACD_Main_1 = iMACD(Symbol(),MACDTimeFrame,MACD_Fast,MACD_Slow,Signal_Period,MACD_Price,MODE_MAIN,1);
  244.    MACD_Signal_0 = iMACD(Symbol(),MACDTimeFrame,MACD_Fast,MACD_Slow,Signal_Period,MACD_Price,MODE_SIGNAL,0);
  245.    MACD_Signal_1 = iMACD(Symbol(),MACDTimeFrame,MACD_Fast,MACD_Slow,Signal_Period,MACD_Price,MODE_SIGNAL,1);
  246.    
  247.    if(MACD_Main_0>MACD_Main_1 && MACD_Signal_0>MACD_Signal_1 && MACD_Main_0>MACD_Signal_0) {MACD_Trend = 1;}   
  248.    if(MACD_Main_0<MACD_Main_1 && MACD_Signal_0<MACD_Signal_1 && MACD_Main_0<MACD_Signal_0) {MACD_Trend = 2;}   
  249.    if(MACD_Main_0<MACD_Main_1 && MACD_Signal_0>MACD_Signal_1 && MACD_Main_0>MACD_Signal_0) {MACD_Trend = 3;}   
  250.    if(MACD_Main_0>MACD_Main_1 && MACD_Signal_0<MACD_Signal_1 && MACD_Main_0<MACD_Signal_0) {MACD_Trend = 4;}   
  251.    return(MACD_Trend);
  252.    }


  253. //==================================================================================================
  254. int TimeFrame(int Time_Period)   
  255.   {
  256.    switch(Time_Period)
  257.      {
  258.       case 0: return(0);         
  259.       case 1: return(1);           // M1
  260.       case 2: return(5);           // M5
  261.       case 3: return(15);          // M15
  262.       case 4: return(60);          // H1
  263.       case 5: return(240);          // H4
  264.       case 6: return(1440);         // D1
  265.      }
  266.   }
  267. //==================================================================================================
  268. string StrTimeFrame(int T_Frame)  
  269.   {
  270.    switch(T_Frame)
  271.      {
  272.       case 0: return("Cur:");      
  273.       case 1: return("M1:");        // M1
  274.       case 2: return("M5:");        // M5
  275.       case 3: return("M15:");       // M15
  276.       case 4: return("H1:");        // H1
  277.       case 5: return("H4:");        // H4
  278.       case 6: return("D1:");        // D1
  279.      }
  280.   }
  281. //==================================================================================================
  282. int CreatObjectLabel(string NameObj, int Coord_X, int Coord_Y)
  283.   {
  284.    ObjectCreate(NameObj, OBJ_LABEL, 0, 0, 0);
  285.    ObjectSet(NameObj, OBJPROP_CORNER, LabelCorner);
  286.    ObjectSet(NameObj, OBJPROP_XDISTANCE, Coord_X);
  287.    ObjectSet(NameObj, OBJPROP_YDISTANCE, Coord_Y);
  288.   }
  289. //==================================================================================================

複製代碼






評分

參與人數 3金錢 +6 收起 理由
Ray-Ray + 2 太強了
bacardi + 2 太強了
Acer2266 + 2 按一個讚

查看全部評分

 樓主| 發表於 14-1-12 13:52 | 顯示全部樓層
ambercrystal 發表於 14-1-12 13:39
海鮮大, 之前跟您互動過, 隨手之勞不用言謝.  我順手將裡面的俄文註釋給清除, 也順便把作者拼錯字的函數名G ...

十萬分的感激您,可是可以再幫一個忙嗎,把檔案傳上來,我才會安裝,不然您用這程式碼,我也不會裝啊。
 樓主| 發表於 14-1-12 14:12 | 顯示全部樓層
ambercrystal 發表於 14-1-12 14:08
將附件解壓後的兩個檔案縮放在您的 c:\program files\ 裡面您的 MT4 交易商的 folder 下的 \experts\indi ...

感謝您的幫助,浪費您寶貴時間。萬分感激。謝謝。感恩。
發表於 14-1-12 22:21 | 顯示全部樓層
生猛海鮮 發表於 14-1-12 14:12
感謝您的幫助,浪費您寶貴時間。萬分感激。謝謝。感恩。

生猛大, 要不要改一下標題 "[已解決]"  
 樓主| 發表於 14-1-12 22:28 | 顯示全部樓層
靈光波動 發表於 14-1-12 22:21
生猛大, 要不要改一下標題 "[已解決]"

時間已過不能編輯

評分

參與人數 1金錢 +1 收起 理由
靈光波動 + 1 喔喔喔

查看全部評分

發表於 14-2-4 16:04 | 顯示全部樓層
這指標真的好用嗎?因我沒做過,有空試試用
 樓主| 發表於 14-2-4 17:30 | 顯示全部樓層
bytegiga168 發表於 14-2-4 16:04
這指標真的好用嗎?因我沒做過,有空試試用

這不是指標,而且須搭配均線使用。
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-5-9 03:43

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook