SweetSpotsGOLD

Download script
Author: Copyright Shimodax
SweetSpotsGOLD

Overview

The SweetSpots indicator is a visual tool designed to enhance your trading chart by automatically identifying and highlighting specific price levels. Instead of manually searching for significant price milestones, this script maps out "sweet spots" across the market, providing a clear structural layout of the price action.

Core Logic and Functionality

The primary purpose of this tool is to divide the price movement into organized, measurable segments. It identifies key zones based on specific pip increments, allowing you to see where significant price milestones occur at a glance.

Key features include:

  • Dynamic Level Mapping: The indicator calculates price levels relative to the current market price. It automatically generates a series of horizontal lines both above and below your current trading position, ensuring that the "map" of the market is always relevant to where the price is moving.
  • Hierarchical Visuals (Main vs. Sub-Levels): To prevent the chart from becoming cluttered while still providing detail, the script uses a tiered system:
    • Main Levels: These are primary milestones (set at 100-pip intervals). They are highlighted with distinct styling to act as major landmarks.
    • Sub-Levels: These are smaller increments (set at 25-pip intervals) that fill the gaps between the main levels, providing a more granular view of the price movement.
  • Visual Depth and Emphasis: The logic includes an automated thickness system. As the price hits even larger milestones (such as every 1,000 or 10,000 pips), the lines become thicker. This creates a "visual hierarchy," where the most significant historical levels stand out more prominently than minor ones.
  • Automated Maintenance: The script is designed to be efficient. It refreshes the lines automatically on your chart and clears previous markings as it updates, ensuring that your visual workspace remains clean and accurate without requiring manual intervention.

How it Benefits Your Trading

By using this indicator, you can quickly identify "round numbers" and psychological price levels where market activity often clusters. By providing a structured grid of these sweet spots, it allows for better spatial awareness of the market, helping you visualize potential targets or areas of interest based on standard pip increments.

16 Views
0 Downloads
0 Favorites
SweetSpotsGOLD
//+------------------------------------------------------------------+
//|                                                   SweetSpots.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright Shimodax"
#property link      "http://www.strategybuilderfx.com"

#property indicator_chart_window

/* Introduction:

   This indicator shows lines at sweet spots (50 and 100 
   pips levels). It is recommended to turn off the grid.
   
   Enjoy!

   Markus
*/

extern int NumLinesAboveBelow= 100;
extern int SweetSpotMainLevels= 100;
extern color LineColorMain= Gold;
extern int LineStyleMain= STYLE_SOLID;
extern bool ShowSubLevels= true;
extern int sublevels= 25;
extern color LineColorSub= Gold;
extern int LineStyleSub= STYLE_DOT;



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   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);
}
  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   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<NumLinesAboveBelow; i++) {
   
      ssp= ssp1+(i*sublevels); 
      
      if (ssp%SweetSpotMainLevels==0) {
         style= LineStyleMain;
         linecolor= LineColorMain;
      }
      else {
         style= LineStyleSub;
         linecolor= LineColorSub;
      }
      
      thickness= 1;
      
      if (ssp%(SweetSpotMainLevels*10)==0) {
         thickness= 2;      
      }

      if (ssp%(SweetSpotMainLevels*100)==0) {
         thickness= 3;      
      }
      
      ds1= ssp*Point;
      SetLevel(DoubleToStr(ds1,Digits), ds1,  linecolor, style, thickness, Time[10]);
   }

   return(0);
}


//+------------------------------------------------------------------+
//| Helper                                                           |
//+------------------------------------------------------------------+
void SetLevel(string text, double level, color col1, int linestyle, int thickness, datetime startofday)
{
   int digits= Digits;
   string linename= "[SweetSpot] " + text + " Line",
          pricelabel; 

   // create or move the horizontal line   
   if (ObjectFind(linename) != 0) {
      ObjectCreate(linename, OBJ_HLINE, 0, 0, level);
      ObjectSet(linename, OBJPROP_STYLE, linestyle);
      ObjectSet(linename, OBJPROP_COLOR, col1);
      ObjectSet(linename, OBJPROP_WIDTH, thickness);
      
      ObjectSet(linename, OBJPROP_BACK, True);
   }
   else {
      ObjectMove(linename, 0, Time[0], level);
   }
}
      

Comments