KG FI V.1.0





#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_levelcolor DarkSlateGray
#property indicator_buffers 1
#property indicator_color1 Blue

extern double KG_FI_Period = 4.0;
extern int MA_Mode = 3;
extern double Price_Type = 0.0;
extern double Filter = 4.0;
extern bool Alert_ON = FALSE;
int gi_unused_108 = 0;
string gs_112;
string gs_120;
double g_ibuf_128[];
int gi_132 = 0;
int gi_136 = 0;

int init() {
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, g_ibuf_128);
   string ls_0 = "KG FI";
   IndicatorShortName(ls_0);
   SetIndexLabel(0, ls_0);
   SetIndexDrawBegin(0, KG_FI_Period);
   return (0);
}

int start() {
   int l_ind_counted_4 = IndicatorCounted();
   if (Bars <= KG_FI_Period) return (0);
   if (l_ind_counted_4 < 1) for (int li_0 = 1; li_0 <= KG_FI_Period; li_0++) g_ibuf_128[Bars - li_0] = 0.0;
   li_0 = Bars - KG_FI_Period - 1.0;
   if (l_ind_counted_4 >= KG_FI_Period) li_0 = Bars - l_ind_counted_4 - 1;
   while (li_0 >= 0) {
      g_ibuf_128[li_0] = Volume[li_0] * (100.0 * iMA(NULL, 0, KG_FI_Period, 0, MA_Mode, Price_Type, li_0) / iMA(NULL, 0, KG_FI_Period, 0, MA_Mode, Price_Type, li_0 + 1) - 100.0);
      li_0--;
   }
   int li_8 = Bars - l_ind_counted_4;
   for (int li_12 = 0; li_12 < li_8; li_12++) {
      g_ibuf_128[li_12] = iMAOnArray(g_ibuf_128, Bars, Filter, 0, MODE_LWMA, li_12);
      if (g_ibuf_128[li_12] > g_ibuf_128[li_12 + 1]) gs_112 = "Up";
      if (g_ibuf_128[li_12] < g_ibuf_128[li_12 + 1]) gs_112 = "Down";
      if (g_ibuf_128[li_12] == g_ibuf_128[li_12 + 1]) gs_112 = "Flat";
      if (g_ibuf_128[li_12] > 0.0) gs_120 = "UP_TREND AREA";
      else {
         if (g_ibuf_128[li_12] < 0.0) gs_120 = "DOWN_TREND AREA";
         else gs_120 = "NEUTRAL AREA";
      }
      if (g_ibuf_128[li_12] < 0.0 && g_ibuf_128[li_12 + 1] >= 0.0) {
         if (li_12 == 0 && gi_136 == FALSE) {
            gi_136 = TRUE;
            gi_132 = FALSE;
            if (Alert_ON) Alert("KG_FI Go To DOWN TREND AREA");
         }
      }
      if (g_ibuf_128[li_12] > 0.0 && g_ibuf_128[li_12 + 1] <= 0.0) {
         if (li_12 == 0 && gi_132 == FALSE) {
            gi_132 = TRUE;
            gi_136 = FALSE;
            if (Alert_ON) Alert("KG_FI Go To UP TREND AREA");
         }
      }
      IndicatorShortName("KG FI   (" + gs_112 + ")    " + gs_120 + "    ");
   }
   return (0);
}



Sample





Analysis



Market Information Used:

Series array that contains tick volumes of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen