Author: Kalenzo
SSL

This custom indicator is designed to provide a visual trend signal on your trading charts by tracking price momentum and identifying shifts in market direction. It works by analyzing the relationship between current market prices and historical high and low averages over a specific period.

How it Works

The logic functions by continuously monitoring the closing price of each candle against two different types of moving averages: one based on the "High" prices and another based on the "Low" prices. By comparing these values, the script determines the current "mood" of the market trend.

The Core Logic Flow

  1. Trend Detection: The script looks back at a user-defined number of previous bars to calculate an average price point. It then checks if the current price is trading above or below these calculated averages.
  2. Directional Memory:
    • If the current price breaks significantly above the high-price average, the script identifies an upward bias.
    • If the current price falls significantly below the low-price average, it identifies a downward bias.
  3. Visual Signal Generation: Once a trend direction is established, the indicator plots a dotted line on your chart. This line serves as a dynamic reference point:
    • In an uptrend, the line follows the calculated high-price averages to help define the upper boundary of the movement.
    • In a downtrend, the line follows the low-price averages to track the lower boundary of the movement.

Summary for Traders

Instead of just showing a simple moving average, this tool acts as a reactive trend tracker. It waits for price action to confirm a direction before committing to a visual path. The resulting dotted line on your chart provides a real-time representation of the current market's prevailing strength, helping you visualize whether the momentum is leaning toward the highs or the lows.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
SSL
//+------------------------------------------------------------------+
//|                                                          SSL.mq4 |
//|                                                          Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"
#property indicator_buffers 1
#property indicator_color1 CornflowerBlue
extern int Lb = 10;
double ssl[],Hld,Hlv;
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,ssl);
   SetIndexStyle(0,DRAW_LINE,STYLE_DOT,1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
 
//----
   for(int i=Bars-Lb;i>=0;i--)
   {
      if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1))
      Hld = 1;
      else 
      {
       if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1))  
       Hld = -1;
       else
       Hld = 0;
      }
      
      if(Hld!=0)
      Hlv = Hld;
            
      if(Hlv == -1)
      ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
      else
      ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
   }
  

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

Comments