ma_4MAs_histo_cw

Download script
Author: Copyright � 2007 Steve Bowley
ma_4MAs_histo_cw

The 9Squared Trader is a specialized visual analysis tool designed for the MetaTrader platform to help traders identify market trends and momentum by monitoring price action through moving averages. Rather than relying on a single data point, this script calculates and displays four distinct moving averages simultaneously, providing a multi-layered view of how the market is behaving.

Core Logic and Functionality

The indicator operates by categorizing market data into two primary "speeds": Fast and Slow. By comparing these two speeds, the tool helps traders distinguish between immediate price fluctuations and broader, long-term trends.

1. Dual-Speed Tracking

The script tracks two different types of price data at two different speeds:

  • Fast Indicators: These react quickly to recent price changes. They are designed to capture immediate momentum and short-term shifts in the market.
  • Slow Indicators: These smooth out the "noise" of daily price movements. They are used to identify the underlying primary trend, showing where the market is headed over a longer duration.

2. Price Source Differentiation

The logic differentiates between different types of price points (such as "Open" and "Close" prices). By calculating averages for both, the tool provides a comprehensive picture:

  • Closing Price Trends: Show the final sentiment of a trading period.
  • Opening Price Trends: Provide context on where the market began relative to where it ended.

3. Visual Representation (Histograms)

Instead of drawing simple lines, the script renders this data as histograms. This visual choice makes it easier for traders to see the "weight" and direction of the trend at a glance. The different colors and thicknesses assigned to each data set allow for a clear visual hierarchy:

  • The Fast data sets highlight immediate volatility.
  • The Slow data sets provide the structural backbone of the chart.

How it Benefits the Trader

By layering these four moving averages, the 9Squared Trader allows a user to see "confluence." When the fast-moving trends align with the slow-moving trends, it suggests a strong, high-probability direction for the market. Conversely, when they diverge, it can signal potential changes in momentum or periods of indecision.

In summary, this tool transforms complex price history into a structured visual map, helping traders separate short-term "noise" from long-term opportunities.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
ma_4MAs_histo_cw
//+------------------------------------------------------------------+
//|                                              9Squared Trader.mq4 |
//|                                    Copyright © 2007 Steve Bowley |
//|                                        http://www.9squaredfx.com |
//+------------------------------------------------------------------+
//Rads HAS Ext.mq4
//mod 4MAs_histo_cw.mq4
//
#property copyright "Copyright © 2007 Steve Bowley"
#property link      "http://www.9squaredfx.com"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 DeepSkyBlue
#property indicator_color4 Orange


#property indicator_width1     3
#property indicator_width2     3
#property indicator_width3     1
#property indicator_width4     1

//---- input parameters
extern int FastClosePeriod=5;
extern int FastCloseShift=0;
extern int FastCloseMode=1;
extern int FastClosePrice=0;

extern int FastOpenPeriod=13;
extern int FastOpenShift=0;
extern int FastOpenMode=1;
extern int FastOpenPrice=0;

extern int SlowClosePeriod=9;
extern int SlowCloseShift=0;
extern int SlowCloseMode=1;
extern int SlowClosePrice=0;

extern int SlowOpenPeriod=21;
extern int SlowOpenShift=0;
extern int SlowOpenMode=1;
extern int SlowOpenPrice=0;





//---- indicator buffers
double FastCloseBuffer[];
double FastOpenBuffer[];
double SlowCloseBuffer[];
double SlowOpenBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- line shifts when drawing
   SetIndexShift(0,FastCloseShift);
   SetIndexShift(1,FastOpenShift);
   SetIndexShift(2,SlowCloseShift);
   SetIndexShift(3,SlowOpenShift);
//---- first positions skipped when drawing
   SetIndexDrawBegin(0,FastCloseShift+FastClosePeriod);
   SetIndexDrawBegin(1,FastOpenShift+FastOpenPeriod);
   SetIndexDrawBegin(2,SlowCloseShift+SlowClosePeriod);
   SetIndexDrawBegin(3,SlowOpenShift+SlowOpenPeriod);
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,SlowCloseBuffer);
   SetIndexBuffer(1,SlowOpenBuffer);
   SetIndexBuffer(2,FastCloseBuffer);
   SetIndexBuffer(3,FastOpenBuffer);
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_HISTOGRAM);
//---- index labels
   SetIndexLabel(0,"FastClose");
   SetIndexLabel(1,"FastOpen");
   SetIndexLabel(2,"SlowClose");
   SetIndexLabel(3,"SlowOpen");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| 9Squared Trader                                             |
//+------------------------------------------------------------------+
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;
//---- main loop
   for(int i=0; i<limit; i++)
     {
      //---- ma_shift set to 0 because SetIndexShift called abowe
      FastCloseBuffer[i]=iMA(NULL,0,FastClosePeriod,0,FastCloseMode,FastClosePrice,i);
      FastOpenBuffer[i] =iMA(NULL,0,FastOpenPeriod, 0,FastOpenMode, FastOpenPrice,i);
      SlowCloseBuffer[i]=iMA(NULL,0,SlowClosePeriod,0,SlowCloseMode,SlowClosePrice,i);
      SlowOpenBuffer[i] =iMA(NULL,0,SlowOpenPeriod, 0,SlowOpenMode, SlowOpenPrice,i);
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+


Comments