Author: Kalenzo
TFT_Colour

This technical tool is designed to analyze market price movements by identifying specific trends and providing visual cues based on price action relative to historical averages. Instead of simply following the price, it looks for "breakout" behaviors where the current price moves beyond established boundaries.

Core Functionality

The script operates by calculating a moving average based on a user-defined period (the "Lb" setting). Rather than using standard prices, it specifically monitors the High and Low points of previous candles to create a dynamic range for the market.

How the Logic Works

The indicator continuously scans the historical data to determine the current market state by comparing the closing price of a candle against these moving averages:

  • Trend Identification: The script checks if the current price has climbed above the high-point average or dropped below the low-point average of previous periods.
  • State Memory: It possesses a "memory" feature; once the price breaks out in a specific direction, the indicator maintains that trend status until a clear opposing movement occurs.
  • Dynamic Mapping: Depending on which direction the market "breaks," the script adjusts what it displays on your chart:
    • When identifying a downward move, it focuses on the high-point averages to mark the ceiling.
    • When identifying an upward move, it shifts its focus to the low-point averages to mark the floor.

Visual Representation

The indicator populates three distinct lines on your chart to help distinguish these different market conditions:

  1. Yellow Line: Acts as a primary reference point for one side of the price action.
  2. Red and Blue Lines: These provide thicker visual markers, highlighting the specific boundaries (ceilings or floors) that the script has identified based on the current trend.

By utilizing this logic, the tool helps traders filter out "market noise" and focus on whether the price is currently establishing a clear path upward or downward relative to its recent history.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
TFT_Colour
//+------------------------------------------------------------------+
//|                                                          SSL.mq4 |
//|                                                          Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_width1 1
#property indicator_width2 3
#property indicator_width3 3

extern int Lb = 10;
double ssla[],sslb[],sslc[],Hld,Hlv,Hlvprev;

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(3);
   SetIndexBuffer(0,sslc);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
   SetIndexBuffer(1,ssla);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID);
   SetIndexBuffer(2,sslb);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID);
//----
   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){
         sslc[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
         ssla[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
      }else{
         sslc[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
         sslb[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
      }
   }
  
  
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments