10핍마다 참조선을 그리는 방법 - 페이지 4

 

괜찮아,

일하게 되었어요..!! 8)

이에 대한 아이디어를 제공해 주신 분들께 감사드립니다.

 

결과는 .... 막대당 10핍입니다.

나에게는 기본 그리드보다 눈에 훨씬 더 쉽고 보고 있는 핍의 움직임을 확인하는 데 0.5초가 걸립니다.

새로운 바 .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핍마다

도움이 되셨나요? 저항선 및 지지선과 혼동을 일으킬 수 있는 선 대신 직사각형이 바람직합니다.

도와주세요, 미리 감사드립니다~