Author: Copyright � 2007 O.Konovalov
MarketWay

Market Way Indicator Logic Overview

The "Market Way" indicator is designed to analyze market sentiment by measuring the momentum and "pressure" of buying (bullish) and selling (bearish) forces. Instead of looking at simple price action alone, it calculates how much strength is being accumulated by each side relative to their historical averages.

Here is a breakdown of the logic used to generate these insights:

1. Data Accumulation

The script first looks at a specific number of past candles (determined by the input settings) to establish three types of "Accumulation" values:

  • Total Market Accumulation: This represents the raw sum of all price movements (the difference between each candle's open and close prices) over the selected period. It captures the total net movement of the market regardless of direction.
  • Bullish Accumulation: The script filters the data to only include "bullish" moves (where the closing price is higher than or equal to the opening price). It sums up these positive movements to show the total strength of buying pressure.
  • Bearish Accumulation: Conversely, the script filters for "bearish" moves (where the closing price is lower than or equal to the opening price) and sums them up to show the total strength of selling pressure.

2. Moving Average Smoothing

To make sense of these raw accumulation totals, the script applies a Simple Moving Average (SMA) to each of the three values mentioned above. This helps smooth out "noise" from the market and establishes a baseline or "normal" level of activity for:

  • The total market activity.
  • The average bullish pressure.
  • The average bearish pressure.

3. Pressure Analysis (The Final Output)

The primary purpose of the indicator is to calculate the current "Power" or "Pressure" by comparing the current accumulation against its moving average. This identifies whether the current market strength is stronger or weaker than usual:

  • Bull Power: This is calculated by subtracting the Bullish Moving Average from the current Bullish Accumulation.

    • A positive result indicates that bullish pressure is currently stronger than its recent average (Strong Form).
    • A negative result suggests that while there is buying, it is weaker than usual (Weak Form).
  • Bear Power: This is calculated by subtracting the Bearish Moving Average from the current Bearish Accumulation.

    • In this specific logic, a negative result signifies strong bearish pressure (Strong Form), as it indicates selling force is outpacing its average.
    • A positive result suggests that bearish pressure is weakening (Weak Form).

Summary for Traders

By visualizing these values, the indicator allows you to see not just where the price is going, but how hard the "bulls" and "bears" are pushing. It distinguishes between a steady market trend and a sudden surge in pressure by comparing real-time accumulation against smoothed historical averages.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
MarketWay
//+------------------------------------------------------------------+
//|                                         Indicator Market Way.mq4 |
//|                       Copyright © 2007, O.Konovalov aka Regul    |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007 O.Konovalov"
#property link      "E-mail:O_Konovalov@ukr.net"
#property link      "E-mail:RegulStar@gmail.com"

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 SteelBlue
#property indicator_color2 Goldenrod
#property indicator_color3 Navy
#property indicator_color4 YellowGreen
#property indicator_color5 DeepPink
#property indicator_color6 OrangeRed
#property indicator_color7 DarkOliveGreen
#property indicator_color8 MediumPurple

//---- input parameters
extern int       IdMain   = 12; // main line
extern int       IdBull   = 12; // bull line 
extern int       IdBear   = 12; // bear line 
extern int       IdArray  = 12; // all sma line  

//---- buffers
double ExtMapBuffer[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- ïàðàìåòðû èíäèêàòîðîâ
   SetIndexStyle(0,DRAW_HISTOGRAM,0,4);
   SetIndexBuffer(0,ExtMapBuffer);
   SetIndexArrow(0,158);
   //---
   SetIndexStyle(1,DRAW_HISTOGRAM,0,4);
   SetIndexBuffer(1,ExtMapBuffer1);
   SetIndexArrow(1,158);
   //---
   SetIndexStyle(2,DRAW_ARROW,0,3);
   SetIndexBuffer(2,ExtMapBuffer2);
   SetIndexArrow(2,158);
   //---
   SetIndexStyle(3,DRAW_LINE,0,1);
   SetIndexBuffer(3,ExtMapBuffer3);
   //---
   SetIndexStyle(4,DRAW_LINE,0,1);
   SetIndexBuffer(4,ExtMapBuffer4);
   //---
   SetIndexStyle(5,DRAW_LINE,0,1);
   SetIndexBuffer(5,ExtMapBuffer5);
   SetIndexArrow(5,158);
   //---
   SetIndexStyle(6,DRAW_LINE,0,1);
   SetIndexBuffer(6,ExtMapBuffer6);
   SetIndexArrow(3,158);
   //---
   SetIndexStyle(7,DRAW_LINE,0,1);
   SetIndexBuffer(7,ExtMapBuffer7);


   //--- Íàèìåíîâàíèå èíäèêàòîðà è ïàðàìåòðû çíà÷åíèé íà ýêðàíå
   IndicatorShortName("Market Way");
   //---
   SetIndexLabel(0, "Bull Pressue_MW0");
   SetIndexLabel(1, "Bear Pressue_MW1");
   SetIndexLabel(2, "Main Accumulation_MW2"); 
   SetIndexLabel(3, "Bull Accumulation_MW3");
   SetIndexLabel(4, "Bear Accumulation_MW4");
   SetIndexLabel(5, "Main SMA_MW5");
   SetIndexLabel(6, "Bull SMA_MW6");
   SetIndexLabel(7, "Bear SMA_MW7");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   double   bull,bear,faster,fast,main;
//----
   int counted_bars=IndicatorCounted();
   if  (counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars-1;
   int i=limit;
   //--- Îïèñàíèå ïåðåìåííûõ
   //---
//***********************************************ÁÓÔÅÐÀ ÄËß ÐÀÑ×ÅÒÎÂ**********************************************
   while (i>=0)
   {
      //--- MW2 ÁÓÔÅÐ ÑÓÌÌÀÐÍÀß(Áûêè è Ìåäâåäè) àêêóìóëÿöèÿ íàïðàâëåíèÿ äâèæåíèÿ ðûíêà
      //òî æå ÷òî è ïàðà äâóõ IdMain-òè ïåðèîäíûõ (SMA) ðàñ÷èòàíûõ ïî îòêðûòèÿì è çàêðûòèÿì  
      //ïîëîæèòåëíûå çíà÷åíèÿ óêàçûâàþò íà íàõîæäåíèå SMA îò Close âûøå ÷åì SMA îò Open, îòðèöàòåëüíûå íàîáîðîò! 
      //Bull's & Bear's accumulation 
      //However, that and a pair of two IdMain-tee time periods (SMA) is apply for the opening and closing 
      main=0;
      for(int m=0;m<IdMain;m++)
         {
         main = main+(Close[i+m]-Open[i+m]); //ñóììà ðàçíèöû îòêðûòèÿ è çàêðûòèÿ çà IdMain ïåðèîä 
         }
         ExtMapBuffer2[i]=NormalizeDouble(main,Digits);
      
      //--- MW3 ÁÓÔÅÐ Áû÷üÿ àêêóìóëÿöèÿ íàïðàâëåíèÿ äâèæåíèÿ (òî æå, ÷òî è SÌÀ îò Close)
      //çäåñü ðàñ÷èòàíû òîëüêî áû÷üè áàðû è äîæè çà óêàçàíûé ïåðèîä, ò.å. òå, êîòîðûå òâå÷àþò óñëîâèþ Close-Open>=0
      //only Bull's bars accumulation
      //calculated only bullish & doji bars for the periods IdBull. fulfill the condition (Close-Open>=0).
      bull=0;
      for(int bu=0;bu<IdBull;bu++)
         {
         if (Close[i+bu]-Open[i+bu]>=0.0000)
         bull = bull+(Close[i+bu]-Open[i+bu]); 
         }
         ExtMapBuffer3[i]=NormalizeDouble(bull,Digits);
   
      //--- MW4 ÁÓÔÅÐ Ìåäâåæüÿ àêêóìóëÿöèÿ íàïðàâëåíèÿ äâèæåíèÿ (òî æå, ÷òî è SÌÀ îò Open)
      //çäåñü ðàñ÷èòàíû òîëüêî ìåäâåæüè áàðû è äîæè çà óêàçàíûé ïåðèîä, ò.å. òå, êîòîðûå òâå÷àþò óñëîâèþ Close-Open<=0
      //only Bear's bars accumulation 
      //calculated only bearish & doji bars for the periods IdBear. fulfill the condition (Close-Open<=0).
      bear=0;
      for(int be=0;be<IdBear;be++)
         {
         if (Close[i+be]-Open[i+be]<=0.0000)
         bear = bear+(Close[i+be]-Open[i+be]); 
         }
         ExtMapBuffer4[i]=NormalizeDouble(bear,Digits);
   i--; //óìåíüøåíèå çíà÷åíèÿ èíäåêñà
   }
//----------------------------------------------------- SMA 
      //--- MW5 ÁÓÔÅÐ  SMA îò ÑÓÌÌÀÐÍÎÉ àêêóìóëÿöèè //SMA from MAIN accumalation (Bull's & Bear's bars)
      for(i=0; i<limit; i++)
      ExtMapBuffer5[i] = NormalizeDouble(iMAOnArray(ExtMapBuffer2,0,IdArray,0,MODE_SMA,i),Digits);
      
      //--- MW6 ÁÓÔÅÐ  SMA Áû÷üåé àêêóìóëÿöèè //SMA from Bull accumalation
      for(i=0; i<limit; i++)
      ExtMapBuffer6[i] = NormalizeDouble(iMAOnArray(ExtMapBuffer3,0,IdArray,0,MODE_SMA,i),Digits);

      //--- MW7 ÁÓÔÅÐ  SMA Ìåäâåæüåé àêêóìóëÿöèè //SMA from Bear accumalation
      for(i=0; i<limit; i++)
      ExtMapBuffer7[i] = NormalizeDouble(iMAOnArray(ExtMapBuffer4,0,IdArray,0,MODE_SMA,i),Digits);

//----------------------------------------------------- ðàçíîñòè SMA è ðàñ÷åòíûõ äàííûõ 
      //--- MW0 ÁÓÔÅÐ "Áû÷üå Äàâëåíèå" 
      //"ÑÈËÀ ÁÛÊÎÂ" ïðèíèìàåò "ñèëüíóþ" ôîðìó ñî çíàêîì "+"
      //ïðè çíà÷åíèè ñî çíàêîì "-" èìååò îáðàòíóþ ôîðìó "ÑËÀÁÎÑÒÜ")
      //îïðåäåëÿåòñÿ ïîñðåäñòâîì ñëîæåíèÿ è/èëè âû÷èòàíèÿ òåêóùèõ àêêóìóëÿöèé è èõ ÑÌÀ "ïî ðûíêó" çà âûáðàííûé ïåðèîä
      //"BULL POWER" MW0 Buffer
      //Difference between Bull accumulation & Bull SMA. With a plus sign has a strong form, with the minus sign has a weak form  
      for(i=0; i<limit; i++)
      ExtMapBuffer[i] = ExtMapBuffer3[i]-ExtMapBuffer6[i];
      
      //--- MW1 ÁÓÔÅÐ "Ìåäâåæüå Äàâëåíèå"
      //"ÑÈËÀ ÌÅÄÂÅÄÅÉ" ïðèíèìàåò "ñèëüíóþ" ôîðìó ñî çíàêîì "-"
      //ïðè çíà÷åíèè ñî çíàêîì "+" èìååò îáðàòíóþ ôîðìó "ÑËÀÁÎÑÒÜ")
      //îïðåäåëÿåòñÿ ïîñðåäñòâîì ñëîæåíèÿ è/èëè âû÷èòàíèÿ òåêóùèõ àêêóìóëÿöèé è èõ ÑÌÀ "ïî ðûíêó" çà âûáðàííûé ïåðèîä
      //"BEAR POWER" MW1 Buffer
      //Difference between Bear accumulation & Bear SMA. With a minus sign has a strong form, with the plus sign has a weak form 
      for(i=0; i<limit; i++)
      ExtMapBuffer1[i] = ExtMapBuffer4[i]-ExtMapBuffer7[i];

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

Comments