[MT4指标]附图显示其他货币指标
附图指标,附图显示其他货币指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//|                                                CurrencyChart.mq4 |
//|                                                          Strator |
//|                                                  [email protected] |
//+------------------------------------------------------------------+
#property copyright \"Strator\"
#property link      \"[email protected]\"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Green
//---- input parameters
extern string symbol = \"EURUSD\";
//---- buffers
double buffer_close;
//---- variables
bool exit = false;
//+------------------------------------------------------------------+
//| 襄疱忸? 耱痤觇 ? 忮瘐龛? 疱汨耱?                                 |
//+------------------------------------------------------------------+
string StringUCase(string str)
  {
   for(int i = 0; i < StringLen(str); i++)
     {
       int char = StringGetChar(str, i);
       if((char >= 97 && char <= 122) || (char >= 224 && char <= 255))
           char = char - 32;
       str = StringSetChar(str, i, char);
     }
   return(str);
  }
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   symbol = StringUCase(symbol);
   MarketInfo(symbol, MODE_TIME);
   int last_error = GetLastError();
   if(last_error == 4106) //ERR_UNKNOWN_SYMBOL
     {
       string msg = \"湾桤忮耱睇? 耔焘铍:\" + symbol;
       IndicatorShortName(msg);
       Print(msg);
       exit = true;
     }
   else
     {
       IndicatorShortName(symbol + \",M\" + Period());
       SetIndexBuffer(0, buffer_close);
       SetIndexStyle(0, DRAW_LINE);
       IndicatorDigits(MarketInfo(symbol, MODE_DIGITS));
     }
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   if(exit) 
       return(0);
   int counted_bars = Bars - IndicatorCounted() - 1;
   for(int i = 0; i < counted_bars; i++)
     {
       datetime time_bar = Time;
       int bar_no = iBarShift(symbol, Period(), time_bar, false);
       buffer_close = iClose(symbol, Period(), bar_no);
     }
   SetLevelStyle(DRAW_LINE, 1, DarkGray);
   SetLevelValue(0, MarketInfo(symbol, MODE_BID));
   return(0);
  }
//+------------------------------------------------------------------+
发表于:2016-09-20 20:48只看该作者
2楼 
谢谢分享
韬客社区www.talkfx.co













