TRUE Forex

Просмотр кода форекс индикатора !X-UK.INFO.BOX.mq4

// FOR THOSE OF YOU THAT IMPROVE UPON THIS HERE CODE I ASK YOU ONE THING
// PLEASE POST A COPY UP ON THE FOREX FORUMS FOR YOUR FELLOW TRADERS

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 C'32,100,255'
#property indicator_color2 Gold
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 C'32,100,255'
#property indicator_color6 Gold
#property indicator_color7 Red
#property indicator_color8 Red
///////////////////////////////
#define PI          3.14159265358979323846
#define MAXVALUE    1000000000
#define MINVALUE    0
///////////////////////////////
extern string  SymbolPair              ="";
extern string  buffer.name             = "zzzINFO.BOX.1";
extern int     shift.sideways          = 0;
extern int     shift.up.down           = -42;
///////////////////////////////
///////////////////////////////
int    CalcBars     = 500;
int    MA.Price     = PRICE_WEIGHTED;
int    MA.Mode      = MODE_EMA;
int    MA.Period    = 50;
int    SlopeBars    = 2;
double SlopeDegree  = 0.002;
extern string GlobalSuffix = "";    //only used if you have multiple instances of the indicator in the same chart
//////////////////////////////
extern bool   show.STM          = true;
extern bool   show.info.box     = true;
int     text.corner             =  2;
int     text.window             =  0;
string  text.type               = "Arial Black";
int     text.size               = 20;
color   text.color.up           = Lime;
color   text.color.down         = Violet;
color   text.color.wait         = Orange;
///////////////////////////////
bool    show.extra.digit  =  false;  
double  DecNos,myPoint;
color   color3            = White;
int     FontSize          =  11;
string  FontType          =  "Arial Black";
///////////////////////////////
int  TF = 0, Sensitivity = 1;
extern bool HideCandles = true;
extern int  Width       = 7;

int slowcci, fastcci;
double buf5[],buf6[],buf7[],buf8[],lvl=0;
double trend[];
double Up.Strong[], Dn.Strong[], Dn.Weak[], Up.Weak[];

int init() 
{
/*switch ( Period() )
   {
   case     5: AUTOSELECT = PERIOD_D1;break;
   case    15: AUTOSELECT = PERIOD_D1;break;
   case    30: AUTOSELECT = PERIOD_D1;break;
   case    60: AUTOSELECT = PERIOD_D1;break;
   case   240: AUTOSELECT = PERIOD_D1;break;
   case  1440: AUTOSELECT = PERIOD_D1;break;
   default   : AUTOSELECT = PERIOD_D1;break;
   }
*/
///////////////////////////////
   if(SymbolPair == "") SymbolPair=Symbol();
       myPoint = SetPoint();
   if (StringFind (Symbol(), "JPY", 0) != -1)       DecNos = 2;
   else if(StringSubstr(Symbol(),0,6) == "XAUUSD")  DecNos = 1;
   else if(StringSubstr(Symbol(),0,6) == "XAGUSD")  DecNos = 2;
   else if(StringSubstr(Symbol(),0,4) == "DJ30")    DecNos = 0;
   else if(StringSubstr(Symbol(),0,5) == "SP500")   DecNos = 1;
   else if(StringSubstr(Symbol(),0,6) == "SPI200")  DecNos = 1;
   else if(StringSubstr(Symbol(),0,7) == "FTSE100") DecNos = 1;
   else if(StringSubstr(Symbol(),0,5) == "DAX30")   DecNos = 1;   
   else                                             DecNos = 4;
   
   if (Sensitivity == 1)                                        {fastcci = 3; slowcci =  8;}
   if (Sensitivity == 0 || Sensitivity == 2 || Sensitivity > 3) {fastcci = 5; slowcci = 14;}
   if (Sensitivity == 3)                                        {fastcci = 3; slowcci =  2;}
   
///////////////////////////////
//   ObjectDelete("Close line");
//   ObjectCreate("Close line", OBJ_HLINE, 0, Time[50], Close[0]);
//   ObjectSet("Close line", OBJPROP_STYLE, STYLE_SOLID);
//   ObjectSet("Close line", OBJPROP_COLOR, White);
//   ObjectSet("Close line", OBJPROP_WIDTH, 2);
//   ObjectSet("Close line", OBJPROP_RAY, false);
//   ObjectSet("Close line", OBJPROP_BACK, 1);
///////////////////////////////
   IndicatorBuffers(8);
   string short_name; short_name= "CANDLES_SYSTEM"; IndicatorShortName(short_name);
   SetIndexBuffer(0, Up.Strong);
   SetIndexBuffer(1, Dn.Strong);
   SetIndexBuffer(2, Dn.Weak);
   SetIndexBuffer(3, Up.Weak);
   SetIndexBuffer(4, buf5);
   SetIndexBuffer(5, buf6);
   SetIndexBuffer(6, buf7); 
   SetIndexBuffer(7, buf8);
///////////////////////////////    
   for(int i=0;i<8;i++)
      if(HideCandles)   SetIndexStyle(i, DRAW_NONE);
   else                 
      if(i<4)  SetIndexStyle(i, DRAW_HISTOGRAM,STYLE_SOLID,Width);
      else     SetIndexStyle(i, DRAW_HISTOGRAM);
///////////////////////////////
   int xpos=4,ypos=7;      
//      Create_Object("AAA-Panel01", xpos+1,ypos,    "gg", 40, "Webdings", C'7,60,120');
      Create_Object("AAA-Panel02", xpos+3,ypos+42, "gg", 38, "Webdings", Brown);//C'7,60,120');
      Create_Object("AAA-Panel03", xpos+3,ypos+50, "gg", 38, "Webdings", Brown);//C'7,60,120');
      Create_Object("AAA-Panel04", xpos+6,ypos+46, "gg", 36, "Webdings", Silver);
      Create_Object("AAA-Panel05", xpos+6,ypos+50, "gg", 36, "Webdings", Silver);
///////////////////////////////
   return (0);}

///////////////////////////////
int deinit() { deleteObjects(); ObjectDelete("Close line"); return (0); }
///////////////////////////////

int start() {
 
   double cci3, cci8,Trend;
   int limit;
   
   RefreshRates();
   
   ObjectMove("Close line", 0, Time[50], Close[0]);
  
   int counted_bars = IndicatorCounted();
   if (Bars <= 15) return (0);
   int Barsi;
   if (counted_bars < 1) {
      for (int i = 1; i <= 15; i++) 
         {
         Barsi=Bars - i;
         Up.Strong[Barsi] = 0.0;
         Dn.Weak[Barsi] = 0.0;
         Dn.Strong[Barsi] = 0.0;
         Up.Weak[Barsi] = 0.0;
         buf5[Bars - i] = 0.0;
         buf7[Bars - i] = 0.0;
         buf6[Bars - i] = 0.0;
         buf8[Bars - i] = 0.0;
      }
   }
   if (counted_bars > 0) limit = Bars - counted_bars;
   if (counted_bars == 0) limit = Bars - 15 - 1;

   for( i=limit; i>=0; i--){trend[i] = trend[i+1];}   

   for (i = limit; i >= 0; i--) {
      cci3 = iCCI(SymbolPair, TF, fastcci, PRICE_TYPICAL, i);
      cci8 = iCCI(SymbolPair, TF, slowcci, PRICE_TYPICAL, i);
      
      Up.Strong[i] = EMPTY_VALUE;
      Dn.Weak[i] = EMPTY_VALUE;
      Dn.Strong[i] = EMPTY_VALUE;
      Up.Weak[i] = EMPTY_VALUE;
      buf5[i] = EMPTY_VALUE;
      buf7[i] = EMPTY_VALUE;
      buf6[i] = EMPTY_VALUE;
      buf8[i] = EMPTY_VALUE;
      
      if (cci3 >= 0.0 && cci8 >= 0.0) {
         Up.Strong[i] = MathMax(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
         Dn.Strong[i] = MathMin(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
         buf5[i] = iHigh(SymbolPair,TF,i);
         buf6[i] = iLow(SymbolPair,TF,i);
         Trend=2;
      } else {
         if (cci8 >= 0.0 && cci3 < 0.0) {
            Dn.Weak[i] = MathMax(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
            Up.Weak[i] = MathMin(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
            buf7[i] = iHigh(SymbolPair,TF,i);
            buf8[i] = iLow(SymbolPair,TF,i);
            Trend=-1;
         } else {
            if (cci3 < 0.0 && cci8 < 0.0) {
               Dn.Strong[i] = MathMax(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
               Up.Strong[i] = MathMin(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
               buf6[i] = iHigh(SymbolPair,TF,i);
               buf5[i] = iLow(SymbolPair,TF,i);
               Trend=-2;
            } else {
               if (cci8 < 0.0 && cci3 > 0.0) {
                  Up.Weak[i] = MathMax(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
                  Dn.Weak[i] = MathMin(iOpen(SymbolPair,TF,i), iClose(SymbolPair,TF,i));
                  buf8[i] = iHigh(SymbolPair,TF,i);
                  buf7[i] = iLow(SymbolPair,TF,i);
                  Trend=1;
            }}}}}
///////////////////////////////
   if (show.STM){
    int j,cb,trendX;
    double sma,sma_prev,sma_slp,slope;
    
    
    if (CalcBars > Bars)
        cb = Bars;
    else
        cb = CalcBars;
        
    trendX = 2;
    for (i=cb-1; i>=0; i--) 
      {
        sma =        iMA(SymbolPair,0,MA.Period,0,MA.Mode,MA.Price,i);
        sma_prev =   iMA(SymbolPair,0,MA.Period,0,MA.Mode,MA.Price,i+1);
        sma_slp =    iMA(SymbolPair,0,MA.Period,0,MA.Mode,MA.Price,i+SlopeBars);

        slope = 180/PI*MathArctan((sma-sma_slp)/SlopeBars);

        if      (slope > SlopeDegree)    trendX = 1; 
        else if (slope < -SlopeDegree)   trendX =-1;       
        else if (trendX != 0)            trendX = 0;    
      }
///////////////////////////////      
   double dTrend=trendX;
   GlobalVariableSet(SymbolPair+"STM"+GlobalSuffix,dTrend);   
///////////////////////////////   
   int xpos=20, ypos=4;
      
/*   trend[0] = trendX;
   if(trendX == 1)
      {
      if (cci3 >=0.0 && cci8 >=0.0)    Create_Object("XardX", xpos+6, ypos+ 1,  "BUY",  text.size, text.type, text.color.up);
      else                             Create_Object("XardX", xpos+4, ypos+ 1,  "EXIT", text.size, text.type, text.color.up);   
      }

   else if(trendX ==-1)
      {
      if (cci3 <= 0.0 && cci8 <= 0.0)  Create_Object("XardX", xpos+2,   ypos+ 1,  "SELL", text.size, text.type, text.color.down); 
      else                             Create_Object("XardX", xpos+4, ypos+ 1,  "EXIT", text.size, text.type, text.color.down); 
      }
   else                                Create_Object("XardX", xpos+1, ypos+ 1,  "WAIT", text.size, text.type, text.color.wait); 
  
  */
  } 
///////////////////////////////

         if (show.info.box) Show_InformationBox();
///////////////////////////////
   return (0);
}
///////////////////////////////
   double      SetPoint(){if (MarketInfo(SymbolPair,MODE_DIGITS) < 4) myPoint = 0.01; else myPoint = 0.0001; return(myPoint);}
///////////////////////////////
   int Create_Object( string K, int x, int y,  string Text, int FontSize, string Font, color Color ) 
   {
   K=buffer.name+K;
   ObjectCreate( K, OBJ_LABEL, 0, 0, 0 );
   ObjectSet( K, OBJPROP_CORNER, 2);
   ObjectSet( K, OBJPROP_XDISTANCE,x+shift.sideways);
   ObjectSet( K, OBJPROP_YDISTANCE,y+shift.up.down);
   ObjectSetText(K, Text, FontSize, Font, Color);
   }
///////////////////////////////
void  Show_InformationBox()
   {
   
   int xpos=4,ypos=4,digits=1;  
   double spread = (MarketInfo(SymbolPair,MODE_ASK)-MarketInfo(SymbolPair,MODE_BID))/myPoint; 
   Create_Object("Xard1",xpos+10,ypos+78, StringSubstr(SymbolPair,0,7) , 16, "Arial Bold", Black);  
   Create_Object("Xard2",xpos+14,ypos+58, DoubleToStr(MarketInfo(SymbolPair,MODE_BID),DecNos) , 16, "Arial Black", Brown);

   if(spread>=1 && spread<=9)int shift.spread=0;
   else if(spread>=10 && spread<=99)shift.spread=-6;
   else if(spread>=100 && spread<=999)shift.spread=-15;
   Create_Object("Xard3",xpos+20+shift.spread,ypos+48, "SPRD: "+DoubleToStr(spread,1), FontSize-1, FontType, Black);
 
   }
///////////////////////////////   
///////////////////////////////   
void deleteObjects()
   {
   for(int i=0;   i<10;i++) ObjectDelete(buffer.name+"Xard" + i);
   ObjectDelete(buffer.name+"AAA-Panel01");   ObjectDelete(buffer.name+"AAA-Panel02");
   ObjectDelete(buffer.name+"AAA-Panel03");   ObjectDelete(buffer.name+"AAA-Panel04");
   ObjectDelete(buffer.name+"AAA-Panel05");   ObjectDelete(buffer.name+"AAA-Panel06");
   ObjectDelete(buffer.name+"AAA-Panel088");  ObjectDelete(buffer.name+"XardX");
   ObjectDelete(buffer.name+"Panel039");
   GetLastError();
   }         
///////////////////////////////
//--------------------------------------------Xard@hotmail.co.uk-----+
/*                                                                   
                              ud$$$**$$$$$$$bc.                          
                          u@**"        4$$$$$$$Nu                       
                        J                ""#$$$$$$r                     
                       @                       $$$$b                    
                     .F                        ^*3$$$                   
                    :% 4                         J$$$N                  
                    $  :F                       :$$$$$                  
                   4F  9                       J$$$$$$$                 
                   4$   k             4$$$$bed$$$$$$$$$                 
                   $$r  'F            $$$$$$$$$$$$$$$$$r                
                   $$$   b.           $$$$$$$$$$$$$$$$$N                
                   $$$$$k 3eeed$$b    XARD777."$$$$$$$$$                
    .@$**N.        $$$$$" $$$$$$F'L $$$$$$$$$$$  $$$$$$$                
    :$$L  'L       $$$$$ 4$$$$$$  * $$$$$$$$$$F  $$$$$$F         edNc   
   @$$$$N  ^k      $$$$$  3$$$$*%   $F4$$$$$$$   $$$$$"        d"  z$N  
   $$$$$$   ^k     '$$$"   #$$$F   .$  $$$$$c.u@$$$          J"  @$$$$r 
   $$$$$$$b   *u    ^$L            $$  $$$$$$$$$$$$u@       $$  d$$$$$$ 
    ^$$$$$$.    "NL   "N. z@*     $$$  $$$$$$$$$$$$$P      $P  d$$$$$$$ 
       ^"*$$$$b   '*L   9$E      4$$$  d$$$$$$$$$$$"     d*   J$$$$$r   
            ^$$$$u  '$.  $$$L     "#" d$$$$$$".@$$    .@$"  z$$$$*"     
              ^$$$$. ^$N.3$$$       4u$$$$$$$ 4$$$  u$*" z$$$"          
                '*$$$$$$$$ *$b      J$$$$$$$b u$$P $"  d$$P             
                   #$$$$$$ 4$ 3*$"$*$ $"$'c@@$$$$ .u@$$$P               
                     "$$$$  ""F~$ $uNr$$$^&J$$$$F $$$$#                 
                       "$$    "$$$bd$.TZUMAN$$$$F $$"                   
                         ?k         ?$$$$$$$$$$$F'*                     
                          9$$bL     z$$$$$$$$$$$F                       
                           $$$$    $$$$$$$$$$$$$                        
                            '#$$c  '$$$$$$$$$"                          
                             .@"#$$$$$$$$$$$$b                          
                           z*      $$$$$$$$$$$$N.                       
                         e"      z$$"  #$$$k  '*$$.                     
                     .u*      u@$P"      '#$$c   "$$c                   
              u@$*"""       d$$"            "$$$u  ^*$$b.               
            :$F           J$P"                ^$$$c   '"$$$$$$bL        
           d$$  ..      @$#                      #$$b         '#$       
           #ISMAEL#   4$$                          ^$$k         '$      
            "$$6""$b u$$                             '$    d$$$$$P      
              '$F $$$$$"                              ^b  ^$$$$b$       
               '$W$$$$"                                'b@$$$$"         
                                                        ^$$$*  
*/

Комментарии к исходному коду форекс индикатора !X-UK.INFO.BOX.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !X-UK.CLOCK.mq4
индикатор !X-UK.NMA.4.mq4 »