如何每10个点画一条参考线 - 页 4

 

它是确定的。

我得到了它的工作...!8)

感谢那些为之提供创意的人。

 

结果....,每条10点。

对我来说,它比默认的网格更容易看清,只需半秒钟就能看到你在看多少个点的移动。

新酒吧.mq4

 
//+------------------------------------------------------------------+
//|                                                       bgColorChanges10_20_30_40_50.mq4 |
//|                      Copyright ?2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#define  ONDA_BEGINS   0
#define  ONDA_CONTAINS 1


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
    for (int ix = 0; ix < nLines; ix++) // delete my horizontal lines
      {
      ObjectDelete("tensLines"+ix);
      }

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int nLines = 40;                                   // Number of total line to draw
   double lineInterval = 0.0010;                      // Interval between lines
   double normPrice = NormalizeDouble(Close[1],3);    // Current price is rounded to nearest "10"

   for (int ix = 0; ix < nLines; ix++)                // Loop span number of times
      {
      if(ObjectFind("tensLines"+ix) < 0) 
         ObjectCreate("tensLines"+ix, OBJ_HLINE, 0, 0, normPrice+((ix-(nLines/2))*lineInterval));    // Place half above and half below the current price

      else ObjectSet("tensLines"+ix, OBJPROP_PRICE1, normPrice+((ix-(nLines/2))*lineInterval));
      ObjectSet("tensLines"+ix,OBJPROP_COLOR,DarkSlateGray);      // Make the lines look better
      }
 
//----
   return(0);
  }
//+------------------------------------------------------------------+

void ObjectNameDeleteAll(string name, int where=ONDA_BEGINS, int type=EMPTY)
{
    for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--)
    {
        string on   = ObjectName(iObj);
        int    iPos = StringFind(on, name);
        if (iPos < 0)                         continue;
        if (iPos > 0 && where == ONDA_BEGINS) continue;
        if      (type == EMPTY))         ObjectDelete(on);
        else if (type == ObjectType(on)) ObjectDelete(on);
    }
}



//---

它不起作用,有很多错误,需要修正什么?

另外,当它进入更高的时间框架时,我希望它能被改变。

===> 1分钟 ~ 30分钟 ===> 每10点

===> 1小时 ======> 每50点

===> 4小时,每日 ======> 每100点

===> 每周,每月 ===> 每1000点

有什么帮助吗?希望用矩形代替线,这可能会导致与阻力线和支撑线的混淆。

请帮助,提前感谢~。