Navigation:Home > Content >

SweetSpotsGOLD_TRO_MODIFIED_VERSION_(2).mq4

Time: 2014-09-01 | Download file:SweetSpotsGOLD_TRO_MODIFIED_VERSION_(2).mq4

//+------------------------------------------------------------------+
//|                                                   SweetSpots.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
//| SweetSpotsGOLD_TRO_MODIFIED_VERSION                              |
//| MODIFIED BY AVERY T. HORTON, JR. AKA [email protected]     |
//| I am NOT the ORIGINAL author 
//  and I am not claiming authorship of this indicator. 
//  All I did was modify it. I hope you find my modifications useful.|
//|                                                                  |
//+------------------------------------------------------------------+
 

#property copyright "Copyright Shimodax"
#property link      "http://www.strategybuilderfx.com"

#property indicator_chart_window

extern bool   TURN_OFF  = false ;
extern bool AutoAdjust  = false;
extern bool Show_Labels = false ;
extern int  ShiftLabel  =  5 ;

extern int NumLinesAboveBelow  = 1000;
extern int SweetSpotMainLevels = 1000;

extern color LineColorMain= DimGray;
extern int LineStyleMain  = STYLE_DOT;

extern bool ShowSubLevels = true;
extern int sublevels= 1000;

extern color LineColorSub = DimGray;
extern int LineStyleSub   = STYLE_DOT;


string symbol, tChartPeriod,  tShortName, pricelabel ;  
int    digits, period, digits2, mult = 1  ; 
double point ;
 
//+------------------------------------------------------------------+
int init()
{
   period       =  Period() ;    
   symbol       =  Symbol() ;
   digits       =  Digits ;   
   point        =  Point ;
 
   if(digits == 5 || digits == 3) { mult = 10; digits = digits - 1 ; point = point * 10 ; }   
    
   if(AutoAdjust && period > PERIOD_H1 && period < PERIOD_MN1) { mult = mult * 10; }
   if(AutoAdjust && period == PERIOD_MN1) { mult = mult * 100; }
   
 SweetSpotMainLevels = SweetSpotMainLevels * mult;
 
 sublevels           = sublevels * mult;
    
   deinit();
   
   return(0);
}

//+------------------------------------------------------------------+
int deinit()
{
   int obj_total= ObjectsTotal();
   
   for (int i= obj_total; i>=0; i--) {
      string name= ObjectName(i);
    
      if (StringSubstr(name,0,11)=="[SweetSpot]") 
         ObjectDelete(name);
   }
   return(0);
}
   
//+------------------------------------------------------------------+
int start()
{
   if( TURN_OFF ) { return(0) ; }

   static datetime timelastupdate= 0;
   static datetime lasttimeframe= 0;
   
    
   // no need to update these buggers too often   
   if (CurTime()-timelastupdate < 600 && Period()==lasttimeframe)
      return (0);
   
   deinit();  // delete all previous lines
      
   int i, ssp1, style, ssp, thickness; //sublevels= 50;
   double ds1;
   color linecolor;
   
   if (!ShowSubLevels)
      sublevels*= 2;
   
   ssp1= Bid / Point;
   ssp1= ssp1 - ssp1%sublevels;

   for (i= -NumLinesAboveBelow; i        

Recommend