[i]3MAsame_v1

Download script
Author: Ron T
[i]3MAsame_v1

This tool is designed to provide traders with a multi-layered visual representation of market trends by aggregating data from several different timeframes simultaneously. Instead of looking at the immediate price action on a small chart, this indicator "looks ahead" to capture the broader momentum of the market across various scales.

How the Logic Works

The core functionality revolves around calculating four distinct types of Moving Averages (SMA) based on historical opening prices. The script automatically fetches data from the following timeframes and projects them onto your current chart:

  • Weekly Perspective: It calculates a short-term average based on weekly data to identify the highest level of market structure.
  • Daily Perspective: It pulls a standard 20-period average from the daily timeframe to establish the medium-term trend.
  • 4-Hour Perspective: It incorporates a significant long-term average derived from 4-hour price action.
  • 1-Hour Perspective: It utilizes a deep, extended average based on hourly data to represent the foundational "base" of the current price movement.

Visual Representation and Purpose

By plotting these four different averages as lines on your chart, the script allows you to see the "confluence" of market sentiment.

Instead of making decisions based solely on a 5-minute price flicker, this logic helps you identify where the price sits in relation to major historical milestones. When these lines align or cluster together, it serves as a visual cue regarding the strength and direction of the trend across the entire trading spectrum—from the immediate hour to the broader week.

Price Data Components
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
[i]3MAsame_v1
//+------------------------------------------------------------------+
//| 5 Min RSI 12-period qual INDICATOR                               |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 4

#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 Aqua
#property indicator_color4 LightGreen


//---- buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {

   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   // 158 little dot
   // 168 open square
   // 120 box with X
   
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, Buffer1);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1, Buffer2);

   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2, Buffer3);

   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3, Buffer4);

   return(0);
  }


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i<Bars; i++ ) Buffer1[i]=0;
   for( i=0; i<Bars; i++ ) Buffer2[i]=0;
   for( i=0; i<Bars; i++ ) Buffer3[i]=0;
   for( i=0; i<Bars; i++ ) Buffer4[i]=0;

   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+


int start()
  {
   int      pos=Bars-100; // leave room for moving average periods
   int      ctr=0;

   double  ma1, ma2, ma3, ma4;
         
   double p=Point();
   
   while(pos>=0)
     {

      ma4= iMA(Symbol(),PERIOD_W1,4     ,0,PRICE_OPEN,MODE_SMA,pos);
      ma3= iMA(Symbol(),PERIOD_D1,20   ,0,PRICE_OPEN,MODE_SMA,pos);
      ma2= iMA(Symbol(),PERIOD_H4,20*6 ,0,PRICE_OPEN,MODE_SMA,pos);
      ma1= iMA(Symbol(),PERIOD_H1,20*24 ,0,PRICE_OPEN,MODE_SMA,pos);
      
      Buffer4[pos]=ma4;
      Buffer3[pos]=ma3;
      Buffer2[pos]=ma2;
      Buffer1[pos]=ma1;
      
 	   pos--;
     }

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

Comments