诚信为本
量力而为
当前位置:峰汇在线 > MetaTrader 4 > MT4指标 > 正文

K线倒计时指标 CandleTime.mq4

CandleTime指标是老版本的K线倒计时指标。可以选用注释模式。

图表:CandleTime指标

源码:

//====================================================================
//                                                   CandleTime.mq4
//                                                   by Derk Wehler
//====================================================================
#property copyright "Copyright @2005, Derk Wehler"
#property link      "http://www.125808047.com"

#property indicator_chart_window
extern bool		UseComment			= false;
extern color 	TextColor			= Aqua;
extern int	 	TextSize			= 8;
extern string	TextFont			= "Verdana";

double s1[];
//====================================================================
// Init and Deinit
//+------------------------------------------------------------------+
int OnInit()
  {  
   Comment("www.125808047.com");
   return(INIT_SUCCEEDED);
  }
  
void OnDeinit(const int reason)
  {
  ObjectDelete("time");
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
	double	i;
	int		m, s;
	string	output;
	
	m = Time[0] + Period() * 60 - CurTime();
	i = m / 60.0;
	s = m % 60;
	m = (m - m % 60) / 60;
	output = m + " minutes " + s + " seconds left to bar end";
	
	if (UseComment)
		Comment(output);
	else
	{
		ObjectDelete("time");
		ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]+ 0.0005);
		ObjectSetText("time", output, TextSize, TextFont, TextColor);
	}
	return(rates_total);
}
打赏
版权所有转载请注明标题及链接:峰汇在线 » K线倒计时指标 CandleTime.mq4
上一篇:
下一篇:
分享到: 更多 (0)

如您觉得此文不错请扫码打赏!

支付宝扫一扫打赏

微信扫一扫打赏