梦飞花 发表于 2017-12-26 14:22:59

实时显示ticks指标







#property copyright "Copyright ?2007, okwh."
#property link "http://blog.sina.com.cn/"

//#property indicator_chart_window
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_color2 Aqua
#property indicator_color3 CornflowerBlue
#property indicator_color4 Gold
#property indicator_color5 SkyBlue
//---- input parameters
extern intTbars = 1000; //Ц»јЗВјЧоЅь1000μг
//---- buffers
double ExtMapBuffer1[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function      tick               |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                     |
//+------------------------------------------------------------------+
int deinit()
{
//----
   
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

   double nows=0;
int num=0,i=0;

int start()

{
int Ncounted_bars = Bars-IndicatorCounted();
if (Ncounted_bars == Bars) //КЧґОЈ¬ёґЦЖcloseКэѕЭ ІўЗТУРК±¶аКэѕЭ±д»ЇЈ¬MTЅцμчУГЦё±кТ»ґО
{
   num = Ncounted_bars;
   for (int i=num;i>0;i--)
   ExtMapBuffer1= Close; //ТФ¶УБР·ЅКЅјЗВјticks јЫёс
   return(0);
}
nows = MarketInfo(Symbol(),MODE_BID);//MarketInfo(Symbol(),MODE_ASK);//+MarketInfo(Symbol(),MODE_BID))/2.0;
SetLevelValue(0, nows) ;
if (Ncounted_bars>1) //УРК±¶аКэѕЭ±д»ЇЈ¬MTЅцμчУГЦё±кТ»ґО,РиМоідїХ°Ч УЙУЪMTμДКэѕЭёьРВ·ЅКЅ
   {
    for ( i=Ncounted_bars;i>0;i--)
   ExtMapBuffer1= ExtMapBuffer1; //ТФ¶УБР·ЅКЅјЗВјticks јЫёс
   }
if (num>0)
   {
   if (nows == ExtMapBuffer1) return (0);//Ц»јЗВјУР±д»ЇμДКэѕЭ
      if (num>Tbars)num = Tbars;
      for ( i=num;i>0;i--)
      {
      ExtMapBuffer1= ExtMapBuffer1; //ТФ¶УБР·ЅКЅјЗВјticks јЫёс
   }
   }
   ExtMapBuffer1 =   nows;
   num++;
   WindowRedraw( ) ;
return(0);

}


小茜 发表于 2020-1-31 20:43:05

谢谢楼主,共同发展

app 发表于 2020-5-6 11:40:23

沙发!沙发!

一只小小鸟 发表于 2020-6-13 15:46:52

有竞争才有进步嘛

fm206806 发表于 2020-6-13 18:31:02

好好 学习了 确实不错

tuicao 发表于 2020-6-21 11:12:56

路过,学习下

winterlight 发表于 2020-7-2 11:45:46

路过,学习下

qq堂 发表于 2020-7-7 11:54:12

谢谢楼主分享

我说你喜欢我 发表于 2020-8-1 15:47:25

谢谢楼主分享

生活小贴士 发表于 2020-8-13 21:39:12

谢谢楼主分享
页: [1] 2
查看完整版本: 实时显示ticks指标