MACD_CCIobos_mtf_Alert_v1

Download script
MACD_CCIobos_mtf_Alert_v1

This script is a custom technical analysis tool designed for the MetaTrader platform to help traders identify specific momentum and price action signals. It functions by combining two well-known market indicators—the MACD (Moving Average Convergence Divergence) and the CCI (Commodity Channel Index)—into a single visual system.

How the Logic Works

The tool monitors the relationship between market speed and price extremes to generate visual cues on your chart. Instead of just looking at one indicator, it requires two specific conditions to be met simultaneously before highlighting a signal:

  • Bullish Sentiment: The script looks for a situation where the price is reaching an "overbought" level (based on the CCI) while the MACD trend is moving upward. When these two conditions align, it triggers a specific visual marker (colored Royal Blue).
  • Bearish Sentiment: Conversely, it identifies when the price is hitting an "oversold" level while the MACD trend is moving downward. When both occur together, it triggers a different visual marker (colored Red).

Key Features

  • Multi-Timeframe Capability: A unique aspect of this script is its ability to look at higher timeframes than the one currently displayed on your screen. This allows you to see trends from larger periods (like daily or weekly moves) while trading on smaller charts (like 15-minute or hourly charts).
  • Visual Alerts: The tool provides immediate visual feedback by placing markers directly on the chart bars. It is also equipped with an automated alert system; if the script detects a shift in market sentiment (switching from one signal type to another), it will trigger a notification to inform you instantly.
  • Customizable Parameters: Users can adjust the sensitivity of the MACD and CCI, as well as the specific "levels" that define overbought or oversold conditions. This allows the tool to be tuned to different assets, such as volatile currencies or more stable stocks.

Summary for the User

Essentially, this script acts as a filter. It ignores minor price fluctuations and only highlights instances where the overall momentum (MACD) and the relative price strength (CCI) are moving in harmony. This helps traders identify high-probability trend directions by confirming that "the crowd" is moving in the same direction at the same time.

Indicators Used
MACD Histogram
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
7 Views
0 Downloads
0 Favorites
MACD_CCIobos_mtf_Alert_v1
//+------------------------------------------------------------------+
//|                                                     MACD_CCI.mq4 |
//|                                   Copyright © 2009, challenger78 |
//+------------------------------------------------------------------+
//mod mtf
//19.jun.2009 - Add Alert for change color to "RoyalBlue" or "Red" (GF)

#property  copyright "challenger78"

#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  RoyalBlue
#property  indicator_color2  Red
#property  indicator_color3  Orange

#property  indicator_minimum 0
#property  indicator_maximum 77

extern int TimeFrame=0;

extern int macdMAfast   =144;  //12
extern int macdMAslow   =233;  //26;
extern int macdSigMA    =21;   //9
extern int macdPrice    =0;
extern int macdLnMode   =0;

extern int CCIperiod = 50;
extern int CCIprice  = 5;
extern int cciOBlevel =  100;
extern int cciOSlevel = -100;

extern double BarLevl = 5;

//0main;1signal
extern string  MA_Method_Price = "SMA0 EMA1 SMMA2 LWMA3||0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6||macdLnMode:0main 1sig";
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";

extern int alertSwitch = 1; 

double buffer1[], buffer2[], buffer3[];
int lastABar;


int init()
{
   SetIndexStyle(0,DRAW_ARROW);    SetIndexArrow(0,167);    SetIndexBuffer(0,buffer1);    SetIndexEmptyValue(0,EMPTY_VALUE); 
   SetIndexStyle(1,DRAW_ARROW);    SetIndexArrow(1,167);    SetIndexBuffer(1,buffer2);    SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexStyle(2,DRAW_ARROW);    SetIndexArrow(2,167);    SetIndexBuffer(2,buffer3);    SetIndexEmptyValue(2,EMPTY_VALUE); 
   
   
   TimeFrame=MathMax(TimeFrame,Period());  
   
   string name1= " macd: "+macdMAfast+","+macdMAslow+","+macdSigMA;
   string name2= " cci: " +CCIperiod;

   IndicatorShortName("MACDCCI_"+name1+name2+" "+TimeFrame);  

   
   return(0);
}



int start()
{
   int i,limit;
   int counted_bars = IndicatorCounted();
   if(counted_bars < 0) return(-1);
   if(counted_bars > 0) counted_bars--;
   limit = Bars - counted_bars;
         if(TimeFrame!=Period())
         limit = MathMax(limit,TimeFrame/Period());
   
   for (i=limit; i>= 0; i--)
   {
              int y =iBarShift(NULL,TimeFrame,Time[i]);
                  
      double  macd0 =iMACD(NULL,TimeFrame,macdMAfast,macdMAslow,macdSigMA,macdPrice,macdLnMode,y);
      double  macd1 =iMACD(NULL,TimeFrame,macdMAfast,macdMAslow,macdSigMA,macdPrice,macdLnMode,y+1);

      double  cci   =iCCI (NULL,TimeFrame,CCIperiod,CCIprice,y);
                
                
                         
      buffer1[i]=EMPTY_VALUE;    buffer2[i]=EMPTY_VALUE;      buffer3[i]=EMPTY_VALUE;    
      
      if (cci > cciOBlevel && macd0 > macd1 )   buffer1[i] = BarLevl;  
      else 
      if (cci < cciOSlevel && macd0 < macd1 )   buffer2[i] = BarLevl;  
      else                                      buffer3[i] = BarLevl;
   
   }
   if (alertSwitch == 1 && Bars > lastABar) {
      if (buffer1[0] != EMPTY_VALUE && buffer1[1] == EMPTY_VALUE) {
         Alert(Symbol(), " Indicator MACD_CCI OBOS change color to 'color0'");
         lastABar = Bars;
      }
      if (buffer2[0] != EMPTY_VALUE && buffer2[1] == EMPTY_VALUE) {
         Alert(Symbol(), " Indicator MACD_CCI OBOS change color to 'color1'");
         lastABar = Bars;
      }
   }
            
   return(0);
}



Comments