请选择 进入手机版 | 继续访问电脑版
外汇ea之家
现在注册
已注册用户请  登录
精品资源
国外系统汉化
外汇ea之家    指标源码库

UFX TREND multiMeter

  •   admin · 2018-3-1 17:55:03 · 619 次点击 ·阅读模式     
    XAUUSDH1.png

    1. //+------------------------------------------------------------------+

    2. #property indicator_chart_window

    3. extern bool Show_Heading = true;

    4. extern string IndName = "CAN" ; // change

    5. extern bool Corner_of_Chart_RIGHT_TOP = true;

    6. extern int Shift_UP_DN =0;
    7. extern int Adjust_Side_to_side  = 20; // 20

    8. extern color BarLabel_color = LightBlue;
    9. extern color CommentLabel_color = LightBlue;

    10. extern color Up_color = Lime;
    11. extern color Eq_color = Yellow;
    12. extern color Dn_color = Red;
    13. //*******************
    14. // change inputs for your indicator

    15. extern int MA_Fast = 1;
    16. extern int MA_Slow = 5;
    17. extern int MA_MODE = 1;
    18. extern int MA_PRICE_TYPE = 0;

    19. //*******************

    20. string ObjHead01,ObjHead02,ObjHead03,ObjHead04,ObjHead05,ObjHead06,ObjHead07,ObjHead08,ObjHead09,ObjHead10,ObjHead11;  

    21. string Obj0001,Obj0002,Obj0003,Obj0004,Obj0005,Obj0006,Obj0007,Obj0008,Obj0009,Obj0010,Obj0011;  

    22. //+---------------
    23. double prDiff(int i, int j)
    24. {
    25.   double _Diff = ( iClose( NULL , i,j) - iOpen( NULL , i,j) ) ;
    26.   return (_Diff);
    27. }
    28. //+---------------
    29. //+------------------------------------------------------------------+
    30. //| Custom indicator initialization function                         |
    31. //+------------------------------------------------------------------+
    32. int init()
    33.   {
    34. //----


    35. //----
    36.    return(0);
    37.   }

    38. //+------------------------------------------------------------------+
    39. //| Custom indicator iteration function                              |
    40. //+------------------------------------------------------------------+
    41. int start()
    42.   {   
    43.    //***********************************************************************************************************************

    44. string LabelTime="";

    45. if (LabelTime=="") {LabelTime=TimeToStr(TimeLocal(),TIME_SECONDS); }

    46.    int    counted_bars=IndicatorCounted();
    47.    
    48.    
    49.    ObjHead01 = "CANColHead01" + LabelTime ;
    50.    ObjHead02 = "CANColHead02" + LabelTime ;
    51.    ObjHead03 = "CANColHead03" + LabelTime ;
    52.    ObjHead04 = "CANColHead04" + LabelTime ;
    53.    ObjHead05 = "CANColHead05" + LabelTime ;
    54.    ObjHead06 = "CANColHead06" + LabelTime ;
    55.    ObjHead07 = "CANColHead07" + LabelTime ;
    56.    ObjHead08 = "CANColHead08" + LabelTime ;
    57.    ObjHead09 = "CANColHead09" + LabelTime ;
    58.          
    59.    string CAN_ObjHead01 ="M1 " ;
    60.    string CAN_ObjHead02 ="M5  " ;     
    61.    string CAN_ObjHead03 ="M15 " ;
    62.    string CAN_ObjHead04 =" M30 " ;
    63.    string CAN_ObjHead05 ="H1  " ;     
    64.    string CAN_ObjHead06 ="H4  " ;
    65.    string CAN_ObjHead07 ="D1  " ;
    66.    string CAN_ObjHead08 ="W1  " ;
    67.    string CAN_ObjHead09 ="MN1" ;   
    68.    
    69.    
    70.         
    71.     if (Corner_of_Chart_RIGHT_TOP == true)
    72.     { int Col01x = 170+Adjust_Side_to_side ;                 
    73.       int Col01y = 28+Shift_UP_DN ;
    74.     }
    75.     if (Corner_of_Chart_RIGHT_TOP == false)
    76.    { Col01x = 159+Adjust_Side_to_side ;      
    77.      Col01y = 24+Shift_UP_DN ;
    78.     }
    79.    
    80.    int ColAdj = -20 ;
    81.    int Col02x = Col01x + ColAdj ;   
    82.    int Col03x = Col01x + ColAdj*2 ;
    83.    int Col04x = Col01x + ColAdj*3 ;
    84.    int Col05x = Col01x + ColAdj*4 ;
    85.    int Col06x = Col01x + ColAdj*5 ;
    86.    int Col07x = Col01x + ColAdj*6 ;   
    87.    int Col08x = Col01x + ColAdj*7 ;
    88.    int Col09x = Col01x + ColAdj*8 ;     
    89.    
    90.    if ( Show_Heading) {        
    91.    ObjectCreate(ObjHead01, OBJ_LABEL, 0, 0, 0);
    92.    ObjectSetText(ObjHead01,CAN_ObjHead01 , 7, "Tahoma Narrow", BarLabel_color);
    93.    ObjectSet(ObjHead01, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    94.    ObjectSet(ObjHead01, OBJPROP_XDISTANCE, Col01x);
    95.    ObjectSet(ObjHead01, OBJPROP_YDISTANCE, Col01y);

    96.    ObjectCreate(ObjHead02, OBJ_LABEL, 0, 0, 0);
    97.    ObjectSetText(ObjHead02,CAN_ObjHead02 , 7, "Tahoma Narrow", BarLabel_color);
    98.    ObjectSet(ObjHead02, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    99.    ObjectSet(ObjHead02, OBJPROP_XDISTANCE, Col02x);
    100.    ObjectSet(ObjHead02, OBJPROP_YDISTANCE, Col01y);   
    101.       
    102.    ObjectCreate(ObjHead03, OBJ_LABEL, 0, 0, 0);
    103.    ObjectSetText(ObjHead03,CAN_ObjHead03 , 7, "Tahoma Narrow", BarLabel_color);
    104.    ObjectSet(ObjHead03, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    105.    ObjectSet(ObjHead03, OBJPROP_XDISTANCE, Col03x);
    106.    ObjectSet(ObjHead03, OBJPROP_YDISTANCE, Col01y);

    107.    ObjectCreate(ObjHead04, OBJ_LABEL, 0, 0, 0);
    108.    ObjectSetText(ObjHead04,CAN_ObjHead04 , 7, "Tahoma Narrow", BarLabel_color);
    109.    ObjectSet(ObjHead04, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    110.    ObjectSet(ObjHead04, OBJPROP_XDISTANCE, Col04x);
    111.    ObjectSet(ObjHead04, OBJPROP_YDISTANCE, Col01y);
    112.    
    113.    ObjectCreate(ObjHead05, OBJ_LABEL, 0, 0, 0);
    114.    ObjectSetText(ObjHead05,CAN_ObjHead05 , 7, "Tahoma Narrow", BarLabel_color);
    115.    ObjectSet(ObjHead05, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    116.    ObjectSet(ObjHead05, OBJPROP_XDISTANCE, Col05x);
    117.    ObjectSet(ObjHead05, OBJPROP_YDISTANCE, Col01y);
    118.             
    119.    ObjectCreate(ObjHead06, OBJ_LABEL, 0, 0, 0);
    120.    ObjectSetText(ObjHead06,CAN_ObjHead06 , 7, "Tahoma Narrow", BarLabel_color);
    121.    ObjectSet(ObjHead06, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    122.    ObjectSet(ObjHead06, OBJPROP_XDISTANCE, Col06x);
    123.    ObjectSet(ObjHead06, OBJPROP_YDISTANCE, Col01y);

    124.    ObjectCreate(ObjHead07, OBJ_LABEL, 0, 0, 0);
    125.    ObjectSetText(ObjHead07,CAN_ObjHead07 , 7, "Tahoma Narrow", BarLabel_color);
    126.    ObjectSet(ObjHead07, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    127.    ObjectSet(ObjHead07, OBJPROP_XDISTANCE, Col07x);
    128.    ObjectSet(ObjHead07, OBJPROP_YDISTANCE, Col01y);
    129.          
    130.    ObjectCreate(ObjHead08, OBJ_LABEL, 0, 0, 0);
    131.    ObjectSetText(ObjHead08,CAN_ObjHead08 , 7, "Tahoma Narrow", BarLabel_color);
    132.    ObjectSet(ObjHead08, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    133.    ObjectSet(ObjHead08, OBJPROP_XDISTANCE, Col08x);
    134.    ObjectSet(ObjHead08, OBJPROP_YDISTANCE, Col01y);

    135.    ObjectCreate(ObjHead09, OBJ_LABEL, 0, 0, 0);
    136.    ObjectSetText(ObjHead09,CAN_ObjHead09 , 7, "Tahoma Narrow", BarLabel_color);
    137.    ObjectSet(ObjHead09, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    138.    ObjectSet(ObjHead09, OBJPROP_XDISTANCE, Col09x);
    139.    ObjectSet(ObjHead09, OBJPROP_YDISTANCE, Col01y);
    140.       
    141. } // Show_Heading

    142. //*******************   change for  your indicator ********************

    143.    
    144.     string M1_CAN= "-",M5_CAN= "-", M15_CAN= "-", M30_CAN= "-", H1_CAN= "-", H4_CAN= "-", D1_CAN= "-",PRC1, W1_CAN= "-", MN1_CAN= "-";

    145.     color  color_CANm1,color_CANm5,color_CANm15,color_CANm30,color_CANH1,color_CANH4,color_CAND1,color_CANW1,color_CANMN1;     
    146.          

    147.    //CAN Signals


    148.     double CAN_M1  = prDiff( PERIOD_M1, 0 );
    149.     double CAN_M5  = prDiff( PERIOD_M5, 0 );
    150.     double CAN_M15 = prDiff( PERIOD_M15, 0 );
    151.     double CAN_M30 = prDiff( PERIOD_M30, 0 );
    152.     double CAN_H1  = prDiff( PERIOD_H1, 0 );
    153.     double CAN_H4  = prDiff( PERIOD_H4, 0 );
    154.     double CAN_D1  = prDiff( PERIOD_D1, 0 );
    155.     double CAN_W1  = prDiff( PERIOD_W1, 0 );
    156.     double CAN_MN1 = prDiff( PERIOD_MN1, 0 );

    157.    
    158.     if ( CAN_M1 > 0 ) color_CANm1 = Up_color;
    159.     else {
    160.     if ( CAN_M1 < 0 )  color_CANm1 = Dn_color;
    161.     else color_CANm1 = Eq_color; }
    162.       
    163.     if (CAN_M5 >0)  color_CANm5 = Up_color;
    164.     else {
    165.     if (CAN_M5 <0)  color_CANm5 = Dn_color;
    166.     else color_CANm5 = Eq_color; }
    167.         
    168.     if (CAN_M15>0) color_CANm15 = Up_color;
    169.     else {
    170.     if (CAN_M15<0)   color_CANm15 = Dn_color;
    171.     else color_CANm15 = Eq_color; }
    172.    
    173.     if (CAN_M30>0) color_CANm30 = Up_color;
    174.     else {
    175.     if (CAN_M30<0) color_CANm30 = Dn_color;
    176.     else color_CANm30 = Eq_color; }

    177.     if ( CAN_H1>0) color_CANH1 = Up_color;
    178.     else {
    179.     if ( CAN_H1<0) color_CANH1 = Dn_color;
    180.     else color_CANH1 = Eq_color; }

    181.     if (CAN_H4>0) color_CANH4 = Up_color;
    182.     else {
    183.     if (CAN_H4<0) color_CANH4 = Dn_color;
    184.     else color_CANH4 = Eq_color; }

    185.     if (CAN_D1>0) color_CAND1 = Up_color;
    186.     else {
    187.     if (CAN_D1<0) color_CAND1 = Dn_color;
    188.     else color_CAND1 = Eq_color; }

    189.     if (CAN_W1>0)  color_CANW1 = Up_color;
    190.     else {
    191.     if (CAN_W1<0)  color_CANW1 = Dn_color;
    192.     else color_CANW1 = Eq_color; }

    193.     if (CAN_MN1>0)  color_CANMN1 = Up_color;
    194.     else {
    195.     if (CAN_MN1<0)   color_CANMN1 = Dn_color;
    196.     else color_CANMN1 = Eq_color; }

    197.             
    198.    
    199. //*******************         
    200.    
    201.     int Col00x = Col01x + 20 ;
    202.     int Col00y = 50+Shift_UP_DN ;
    203.    
    204.     Col01y = 20+Shift_UP_DN ;
    205.    
    206.    Obj0002 = "SignalCANM1t" + LabelTime ;
    207.            
    208.            ObjectCreate(Obj0002, OBJ_LABEL, 0, 0, 0);
    209.    ObjectSetText(Obj0002,IndName, 7, "Tahoma Narrow",  BarLabel_color);  
    210.    ObjectSet(Obj0002, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    211.    ObjectSet(Obj0002, OBJPROP_XDISTANCE, Col00x);
    212.    ObjectSet(Obj0002, OBJPROP_YDISTANCE, Col00y);  // 50+Shift_UP_DN

    213.    Obj0003 = "SignalCANM1" + LabelTime ;        
    214.            ObjectCreate(Obj0003, OBJ_LABEL, 0, 0, 0);
    215.    ObjectSetText(Obj0003, M1_CAN, 40, "Tahoma Narrow",  color_CANm1);
    216.    ObjectSet(Obj0003, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    217.    ObjectSet(Obj0003, OBJPROP_XDISTANCE, Col01x);
    218.    ObjectSet(Obj0003, OBJPROP_YDISTANCE, Col01y);

    219.    Obj0004 = "SignalCANM5" + LabelTime ;         
    220.            ObjectCreate(Obj0004, OBJ_LABEL, 0, 0, 0);
    221.    ObjectSetText(Obj0004, M5_CAN, 40, "Tahoma Narrow",  color_CANm5);
    222.    ObjectSet(Obj0004, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    223.    ObjectSet(Obj0004, OBJPROP_XDISTANCE, Col02x);
    224.    ObjectSet(Obj0004, OBJPROP_YDISTANCE, Col01y);
    225.       
    226.    Obj0005 = "SignalCANM15" + LabelTime ;
    227.    ObjectCreate(Obj0005, OBJ_LABEL, 0, 0, 0);
    228.    ObjectSetText(Obj0005, M15_CAN, 40, "Tahoma Narrow",  color_CANm15);
    229.    ObjectSet(Obj0005, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    230.    ObjectSet(Obj0005, OBJPROP_XDISTANCE, Col03x);
    231.    ObjectSet(Obj0005, OBJPROP_YDISTANCE, Col01y);
    232.       
    233.    Obj0006 = "SignalCANM30" + LabelTime ;
    234.    ObjectCreate(Obj0006, OBJ_LABEL, 0, 0, 0);
    235.    ObjectSetText(Obj0006, M30_CAN, 40, "Tahoma Narrow",  color_CANm30);
    236.    ObjectSet(Obj0006, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    237.    ObjectSet(Obj0006, OBJPROP_XDISTANCE, Col04x);
    238.    ObjectSet(Obj0006, OBJPROP_YDISTANCE, Col01y);

    239.    Obj0007 = "SignalCANM60" + LabelTime ;      
    240.            ObjectCreate(Obj0007, OBJ_LABEL, 0, 0, 0);
    241.    ObjectSetText(Obj0007, H1_CAN, 40, "Tahoma Narrow",  color_CANH1);
    242.    ObjectSet(Obj0007, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    243.    ObjectSet(Obj0007, OBJPROP_XDISTANCE, Col05x);
    244.    ObjectSet(Obj0007, OBJPROP_YDISTANCE, Col01y);

    245.    Obj0008 = "SignalCANM240" + LabelTime ;         
    246.            ObjectCreate(Obj0008, OBJ_LABEL, 0, 0, 0);
    247.    ObjectSetText(Obj0008, H4_CAN, 40, "Tahoma Narrow",  color_CANH4);
    248.    ObjectSet(Obj0008, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    249.    ObjectSet(Obj0008, OBJPROP_XDISTANCE, Col06x);
    250.    ObjectSet(Obj0008, OBJPROP_YDISTANCE, Col01y);

    251.    Obj0009 = "SignalCANM1440" + LabelTime ;   
    252.            ObjectCreate(Obj0009, OBJ_LABEL, 0, 0, 0);
    253.    ObjectSetText(Obj0009, D1_CAN, 40, "Tahoma Narrow",  color_CAND1);
    254.    ObjectSet(Obj0009, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    255.    ObjectSet(Obj0009, OBJPROP_XDISTANCE, Col07x);
    256.    ObjectSet(Obj0009, OBJPROP_YDISTANCE, Col01y);
    257.    
    258.    Obj0010 = "SignalCANW1" + LabelTime ;   
    259.            ObjectCreate(Obj0010, OBJ_LABEL, 0, 0, 0);
    260.    ObjectSetText(Obj0010, W1_CAN, 40, "Tahoma Narrow",  color_CANW1);
    261.    ObjectSet(Obj0010, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    262.    ObjectSet(Obj0010, OBJPROP_XDISTANCE, Col08x);
    263.    ObjectSet(Obj0010, OBJPROP_YDISTANCE, Col01y);   
    264.    
    265.    Obj0011 = "SignalCANMN1" + LabelTime ;   
    266.            ObjectCreate(Obj0011, OBJ_LABEL, 0, 0, 0);
    267.    ObjectSetText(Obj0011, MN1_CAN, 40, "Tahoma Narrow",  color_CANMN1);
    268.    ObjectSet(Obj0011, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
    269.    ObjectSet(Obj0011, OBJPROP_XDISTANCE, Col09x);
    270.    ObjectSet(Obj0011, OBJPROP_YDISTANCE, Col01y);
    271.      
    272. //----
    273.    return(0);
    274.   }
    275. //+------------------------------------------------------------------+

    276. //+------------------------------------------------------------------+
    277. //| Custom indicator deinitialization function                       |
    278. //+------------------------------------------------------------------+
    279. int deinit()
    280.   {
    281. //----

    282. ObjectsDeleteAll(0,OBJ_HLINE);
    283. ObjectsDeleteAll(0,OBJ_TEXT);
    284. ObjectsDeleteAll(0,OBJ_LABEL);
    285. deleteObject();

    286. //----
    287.    return(0);
    288.   }
    289.   
    290. void deleteObject()
    291.   {
    292. //ObjectDelete(Obj0001);  
    293. ObjectDelete(Obj0002);
    294. ObjectDelete(Obj0003);
    295. ObjectDelete(Obj0004);
    296. ObjectDelete(Obj0005);
    297. ObjectDelete(Obj0006);
    298. ObjectDelete(Obj0007);
    299. ObjectDelete(Obj0008);
    300. ObjectDelete(Obj0009);
    301. ObjectDelete(Obj0010);
    302. ObjectDelete(Obj0011);

    303. ObjectDelete(ObjHead01);  
    304. ObjectDelete(ObjHead02);
    305. ObjectDelete(ObjHead03);
    306. ObjectDelete(ObjHead04);
    307. ObjectDelete(ObjHead05);
    308. ObjectDelete(ObjHead06);
    309. ObjectDelete(ObjHead07);
    310. ObjectDelete(ObjHead08);
    311. ObjectDelete(ObjHead09);

    312.   }


    复制代码


    UFX TREND multiMeter (1).mq4 (14.1 KB, 下载次数: 3)
      Reply  
    招金进银  2020-3-28 20:58:19 
    谢谢楼主,共同发展
    添加一条新回复
    您需要登录后才可以回帖 登录 | 注册

    请勿自己恶意顶贴
    关于我们   广告投放   我们的愿景   帮助中心   感谢   友站   外汇交易平台大全   法律声明   防骗指南  
    最大的外汇智能交易社区!
    外汇EA有风险, 请不要让EA左右您的意志,交易造成的亏损,EA之家不承担责任! 蜀ICP备15006086号
    快速回复 返回顶部 返回列表