cm H V levels

Author: Copyright 2017, cmillion@narod.ru
0 Views
0 Downloads
0 Favorites
cm H V levels
ÿþ//+------------------------------------------------------------------+

#property copyright "Copyright 2017, cmillion@narod.ru"

#property link      "http://cmillion.ru"

#property version   "2.00"

#property show_inputs

#property strict

//+------------------------------------------------------------------+

enum tf 

{

   t1=0,     // =5B @07<5B:8 

   t5=5,     // M5

   t15=15,    // M15

   t30=30,    // M30

   t60=60,    // H1

   t240=240,   // H4

   t1440=1440,  // D1

};

enum pr 

{

   d0=0,     // =5B @07<5B:8 

   d1=1,     // 45AOBK5 

   d2=2,     // A>BK5

   d3=3,     // BKAOG=K5

};

input  pr      point    = d1;       //48A:@5B=>ABL @07<5B:8 ?> F5=5 (0->B:;)

input  tf      tfcandle = 60;       //?5@8>4 @07<5B:8 ?> 2@5<5=8

extern int     with     = 1;        //B>;I8=0  

extern ENUM_LINE_STYLE   style    = 0;        //AB8;L  

extern color   colr     = clrGray;  //F25B   

//+------------------------------------------------------------------+

void OnStart()

{

   ObjectsDeleteAll(0);

   if(point!=0)

   {

      double level=NormalizeDouble(Bid,Digits-point);

      drawhline(level);

      for (int i=0; i<1000; i++)

      { 

         drawhline(NormalizeDouble(level+point*10*Point*i ,Digits));

         drawhline(NormalizeDouble(level-point*10*Point*i ,Digits));

      }

   }   

   if(tfcandle!=0)

   {

      for (int i=0; i<1000; i++)

      { 

         drawvline(iTime(NULL,tfcandle,i));

      }

   }   

}

//+------------------------------------------------------------------+

void drawhline(double level)

{

   string name = StringConcatenate("Level_",level);

   if (ObjectFind(name)!=-1) ObjectDelete(name);

   ObjectCreate(name, OBJ_HLINE, 0, 0, level, 0,0);

   ObjectSet   (name, OBJPROP_COLOR, colr);

   ObjectSet   (name, OBJPROP_WIDTH,with);

   ObjectSet   (name, OBJPROP_STYLE,style);

}   

//--------------------------------------------------------------------

void drawvline(datetime time)

{

   string name = TimeToStr(time);

   if (ObjectFind(name)!=-1) ObjectDelete(name);

   ObjectCreate(name, OBJ_VLINE, 0, time, 0, 0,0);

   ObjectSet   (name, OBJPROP_COLOR, colr);

   ObjectSet   (name, OBJPROP_WIDTH,with);

   ObjectSet   (name, OBJPROP_STYLE,style);

}   

//--------------------------------------------------------------------

Comments