Ichimoku+GuppyAlligator1

Download script
Author: Copyright � 2009, ���X�g��FX!.
Ichimoku+GuppyAlligator1

This script is a custom technical analysis tool designed for the MetaTrader platform. It visualizes eight distinct moving averages on your trading chart simultaneously, providing a multi-layered view of price momentum and support/resistance levels based on the logic of the Ichimoku Kinko Hyo and Guppy Alligator systems.

Core Logic Overview

The primary mechanism of this script is to identify "equilibrium" prices over specific periods. Instead of using standard moving averages (which typically average the closing price), this tool looks at the highest highs and lowest lows within a fixed window of time and calculates the midpoint between them.

Component Breakdown

The indicator generates eight separate lines, grouped into two categories:

1. Fast Momentum Lines (Tenkan Series) There are four "Tenkan" lines (labeled 1 through 4) that use very short timeframes (ranging from 5 to 8 periods). These lines react quickly to immediate price changes, helping traders identify rapid shifts in momentum or "short-term" sentiment.

2. Slow Baseline Lines (Kijun Series) There are four "Kijun" lines (labeled 1 through 4) that utilize much longer timeframes (ranging from 22 to 25 periods). These act as slower, more stable anchors on the chart. They are designed to show broader market trends and identify significant areas of support and resistance where the price might stall or reverse.

How it Functions on a Chart

For every point in time, the script performs the following logic for all eight lines:

  • It looks back at a predetermined number of candles (the "period").
  • It scans those candles to find the absolute highest price and the absolute lowest price reached.
  • It calculates the average of that high and low.
  • It plots this midpoint as a dot-style line on your chart.

By displaying all eight lines at once, the script allows you to see the "spread" between short-term reaction and long-term stability. When these multiple lines cluster together or fan out, it provides visual cues regarding market volatility, trend strength, and potential entry or exit zones.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
Ichimoku+GuppyAlligator1
//+------------------------------------------------------------------+
//|                                     Ichimoku+GuppyAlligator1.mq4 |
//|                                   Copyright © 2009, “úXƒgƒŒFX!. |
//|@Žg—pŠ´‘z‚ȂǁA—Ç‚¢ˆ«‚¢‚Ç‚¿‚ç‚Å‚à‚ ‚Á‚Ä‚àŠ´‘z’¸‚¯‚ê‚ÎŠð‚µ‚¢‚Å‚·ô|
//|                             http://fx-insanity-trade.seesaa.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, “úXƒgƒŒFX!."
#property link      "http://fx-insanity-trade.seesaa.net/"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Blue
#property indicator_color7 Blue
#property indicator_color8 Blue
//---- input parameters
extern int Tenkan1=8;
extern int Tenkan2=7;
extern int Tenkan3=6;
extern int Tenkan4=5;
extern int Kijun1=25;
extern int Kijun2=24;
extern int Kijun3=23;
extern int Kijun4=22;
//---- buffers
double Tenkan1_Buffer[];
double Tenkan2_Buffer[];
double Tenkan3_Buffer[];
double Tenkan4_Buffer[];
double Kijun1_Buffer[];
double Kijun2_Buffer[];
double Kijun3_Buffer[];
double Kijun4_Buffer[];
//----
int a_begin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//----
   SetIndexStyle(0,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(0,Tenkan1_Buffer);
   SetIndexDrawBegin(0,Tenkan1-1);
   SetIndexLabel(0,"Tenkan1");
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(1,Tenkan2_Buffer);
   SetIndexDrawBegin(1,Tenkan2-1);
   SetIndexLabel(1,"Tenkan2");
   SetIndexStyle(2,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(2,Tenkan3_Buffer);
   SetIndexDrawBegin(2,Tenkan3-1);
   SetIndexLabel(2,"Tenkan3");
   SetIndexStyle(3,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(3,Tenkan4_Buffer);
   SetIndexDrawBegin(3,Tenkan4-1);
   SetIndexLabel(3,"Tenkan4");
//----
   SetIndexStyle(4,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(4,Kijun1_Buffer);
   SetIndexDrawBegin(4,Kijun1-1);
   SetIndexLabel(4,"Kijun1");
   SetIndexStyle(5,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(5,Kijun2_Buffer);
   SetIndexDrawBegin(5,Kijun2-1);
   SetIndexLabel(5,"Kijun2");
   SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(6,Kijun3_Buffer);
   SetIndexDrawBegin(6,Kijun3-1);
   SetIndexLabel(6,"Kijun3");
   SetIndexStyle(7,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(7,Kijun4_Buffer);
   SetIndexDrawBegin(7,Kijun4-1);
   SetIndexLabel(7,"Kijun4");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k;
   int    counted_bars=IndicatorCounted();
   double high,low,price;
//----
   if(Bars<=Tenkan1 || Bars<=Tenkan2 || Bars<=Tenkan3 || Bars<=Tenkan4 || Bars<=Kijun1 || Bars<=Kijun2 || Bars<=Kijun3 || Bars<=Kijun4) return(0);
//---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=Tenkan1;i++)    Tenkan1_Buffer[Bars-i]=0;
      for(i=1;i<=Tenkan2;i++)    Tenkan2_Buffer[Bars-i]=0;
      for(i=1;i<=Tenkan3;i++)    Tenkan3_Buffer[Bars-i]=0;
      for(i=1;i<=Tenkan4;i++)    Tenkan4_Buffer[Bars-i]=0;
      for(i=1;i<=Kijun1;i++)     Kijun1_Buffer[Bars-i]=0;
      for(i=1;i<=Kijun2;i++)     Kijun2_Buffer[Bars-i]=0;
      for(i=1;i<=Kijun3;i++)     Kijun3_Buffer[Bars-i]=0;
      for(i=1;i<=Kijun4;i++)     Kijun4_Buffer[Bars-i]=0;
     }
//---- Tenkan1
   i=Bars-Tenkan1;
   if(counted_bars>Tenkan1) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Tenkan1;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Tenkan1_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Tenkan2
   i=Bars-Tenkan2;
   if(counted_bars>Tenkan2) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Tenkan2;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Tenkan2_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Tenkan3
   i=Bars-Tenkan3;
   if(counted_bars>Tenkan3) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Tenkan3;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Tenkan3_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Tenkan4
   i=Bars-Tenkan4;
   if(counted_bars>Tenkan4) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Tenkan4;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Tenkan4_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Kijun1
   i=Bars-Kijun1;
   if(counted_bars>Kijun1) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Kijun1;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Kijun1_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Kijun2
   i=Bars-Kijun2;
   if(counted_bars>Kijun2) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Kijun2;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Kijun2_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Kijun3
   i=Bars-Kijun3;
   if(counted_bars>Kijun3) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Kijun3;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Kijun3_Buffer[i]=(high+low)/2;
      i--;
     }
//---- Kijun4
   i=Bars-Kijun4;
   if(counted_bars>Kijun4) i=Bars-counted_bars-1;
   while(i>=0)
     {
      high=High[i]; low=Low[i]; k=i-1+Kijun4;
      while(k>=i)
        {
         price=High[k];
         if(high<price) high=price;
         price=Low[k];
         if(low>price)  low=price;
         k--;
        }
      Kijun4_Buffer[i]=(high+low)/2;
      i--;
     }

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

Comments