SmoothCandle_Cv1.1

Download script
SmoothCandle_Cv1.1

The SmoothCandle S tool is designed to provide traders with a visually cleaner and more refined view of price action by applying mathematical smoothing to the fundamental components of a standard candlestick chart.

Core Concept: Smoothing the Foundation

In standard trading, "candles" are formed by four primary price points: the Open, High, Low, and Close. While these raw values can often be volatile and "noisy," this script processes each of those four points individually through a Moving Average calculation. By doing this, the indicator generates four new, smoothed lines that represent the underlying trends of the candle's structure rather than just the erratic price jumps.

How the Logic Works

Instead of simply calculating a moving average for the closing price (which is the most common method), this script applies a consistent smoothing logic to every part of the candle:

  • Smoothed Open: It tracks the "Open" price but smooths out the transitions between candles.
  • Smoothed High: It identifies the peak price points while filtering out minor, insignificant spikes.
  • Smoothed Low: It tracks the bottom price points, creating a clearer view of support levels by removing minor dips.
  • Smoothed Close: It follows the final price of the candle, providing a fluid trend line of the overall market movement.

Customization Options

The script allows users to fine-tune how this smoothing is applied through several user-defined parameters:

  1. Period: Determines the "window" of time used for the calculation (e.g., looking at the last 5 bars). A larger period creates a smoother, slower line; a smaller period stays closer to the real-time price.
  2. Mode: Users can choose different types of moving averages (such as Simple, Exponential, or Weighted) to change how much weight is given to recent price action versus older data.
  3. Shift: This allows the smoothed lines to be moved forward or backward on the chart for better visual alignment with specific trading strategies.
  4. Price Mapping: The logic ensures that each line stays dedicated to its original purpose (Open, High, Low, or Close), ensuring that the structural integrity of the price candle is maintained even while it is being "softened" for easier analysis.

Summary for the User

The primary goal of this script is clarity. By turning jagged, sharp candlesticks into smooth, flowing lines, it helps traders identify the true direction of the market and significant price levels without being distracted by minor market noise or "fake out" movements.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
SmoothCandle_Cv1.1
//+------------------------------------------------------------------+
//|                                         SmoothCandle S v1.00.mq4 |
//|  v1.1                           Copyright © 2005, Varus Henschke |
//+------------------------------------------------------------------+
//2009fxtsd     ki      
#property  copyright "Copyright © 2005, Varus Henschke"
//---- indicator settings
#property  indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Red
#property  indicator_color2  DimGray
#property  indicator_color3  DimGray
#property  indicator_color4  Blue
//---- indicator parameters
extern int MAperiod=5;
extern int MAmode=0;
extern int MAshift=0;
extern int MAClosePrice=0;

extern string   note_Price = "0C 1O 2H 3L 4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";
extern string   MA_Mode_  = "SMA0 EMA1 SMMA2 LWMA3";

//---- indicator buffers
double     nOpen[];
double     nHigh[];
double     nLow[];
double     nClose[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   IndicatorBuffers(4);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
//---- line shifts when drawing
   SetIndexShift(0,MAshift);
   SetIndexShift(1,MAshift);
   SetIndexShift(2,MAshift);
   SetIndexShift(3,MAshift);
//---- indicator buffers mapping
   if(!SetIndexBuffer(0,nOpen) &&
      !SetIndexBuffer(1,nHigh) && 
      !SetIndexBuffer(2,nLow) && 
      !SetIndexBuffer(3,nClose))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   //IndicatorShortName("SmoothCandle S SMA ( " +SMA+ " )");
   //SetIndexLabel(0,"Open");
   //SetIndexLabel(1,"High");
   //SetIndexLabel(2,"Low");
   //SetIndexLabel(3,"Close");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages of Candlestick                                   |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
//----   
   limit=Bars-counted_bars;
//----
    for(int i=limit; i>=0; i--)
 
        {
         nOpen[i] =iMA(NULL,0,MAperiod,0,MAmode,PRICE_OPEN,i);
         nHigh[i] =iMA(NULL,0,MAperiod,0,MAmode,PRICE_HIGH,i);
         nLow[i]  =iMA(NULL,0,MAperiod,0,MAmode,PRICE_LOW,i);
         nClose[i]=iMA(NULL,0,MAperiod,0,MAmode,MAClosePrice,i);

        }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments