maf_2





#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 SteelBlue
#property indicator_color2 Orange
#property indicator_color3 Black
#property indicator_color4 Blue
#property indicator_color5 Red

double g_ibuf_76[];
double g_ibuf_80[];
double g_ibuf_84[];
double g_ibuf_88[];
double g_ibuf_92[];
extern int period = 10;
extern int price = 0;
extern bool Mode_Fast = FALSE;
extern bool Signals = FALSE;
extern int MA1period = 9;
extern int MA2period = 45;
extern string TypeHelp = "SMA- 0, EMA - 1, SMMA - 2, LWMA- 3";
extern string TypeHelp2 = "TypeMA1=0, TypeMA2=3";
extern int TypeMA1 = 0;
extern int TypeMA2 = 3;
double gd_144 = 0.0;
double gd_152 = 0.0;
double gd_unused_160 = 0.0;
double gd_168 = 0.0;
double gd_176 = 0.0;
double gd_184 = 0.0;
int gi_unused_192 = 0;
int gi_unused_196 = 0;

int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 1, SteelBlue);
   SetIndexBuffer(0, g_ibuf_76);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 1, Orange);
   SetIndexBuffer(1, g_ibuf_80);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexLabel(2, "line");
   SetIndexBuffer(2, g_ibuf_84);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexLabel(3, "MA1 " + MA1period);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexLabel(4, "MA2 " + MA2period);
   SetIndexBuffer(3, g_ibuf_88);
   SetIndexBuffer(4, g_ibuf_92);
   return (0);
}

int deinit() {
   for (int l_count_0 = 0; l_count_0 < Bars; l_count_0++) {
      ObjectDelete("Sell Signal: " + DoubleToStr(l_count_0, 0));
      ObjectDelete("Buy Signal: " + DoubleToStr(l_count_0, 0));
      ObjectDelete("Exit: " + DoubleToStr(l_count_0, 0));
   }
   return (0);
}

int start() {
   double l_price_12;
   double ld_unused_20;
   int li_0 = IndicatorCounted();
   double ld_28 = 0;
   double ld_36 = 0;
   double ld_44 = 1.2;
   if (li_0 > 0) li_0--;
   int li_8 = Bars - li_0;
   if (Mode_Fast) li_8 = 100;
   for (int li_4 = 0; li_4 < li_8; li_4++) {
      ld_36 = High[iHighest(NULL, 0, MODE_HIGH, period, li_4)];
      ld_28 = Low[iLowest(NULL, 0, MODE_LOW, period, li_4)];
      switch (price) {
      case 1:
         l_price_12 = Open[li_4];
         break;
      case 2:
         l_price_12 = Close[li_4];
         break;
      case 3:
         l_price_12 = High[li_4];
         break;
      case 4:
         l_price_12 = Low[li_4];
         break;
      case 5:
         l_price_12 = (High[li_4] + Low[li_4] + Close[li_4]) / 3.0;
         break;
      case 6:
         l_price_12 = (Open[li_4] + High[li_4] + Low[li_4] + Close[li_4]) / 4.0;
         break;
      case 7:
         l_price_12 = (Open[li_4] + Close[li_4]) / 2.0;
         break;
      default:
         l_price_12 = (High[li_4] + Low[li_4]) / 2.0;
      }
      gd_144 = 0.66 * ((l_price_12 - ld_28) / (ld_36 - ld_28) - 0.5) + 0.67 * gd_152;
      gd_144 = MathMin(MathMax(gd_144, -0.999), 0.999);
      gd_168 = MathLog((gd_144 + 1.0) / (1 - gd_144)) / 2.0 + gd_176 / 2.0;
      g_ibuf_76[li_4] = 0;
      g_ibuf_80[li_4] = 0;
      if (gd_168 < 0.0 && gd_176 > 0.0) {
         if (Signals) {
            ObjectCreate("Exit Trade: " + DoubleToStr(li_4, 0), OBJ_TEXT, 0, Time[li_4], l_price_12);
            ObjectSetText("Exit Trade: " + DoubleToStr(li_4, 0), "Exit Trade At " + DoubleToStr(l_price_12, 4), 7, "Arial", White);
         }
         gi_unused_192 = 0;
      }
      if (gd_168 > 0.0 && gd_176 < 0.0) {
         if (Signals) {
            ObjectCreate("Exit Trade: " + DoubleToStr(li_4, 0), OBJ_TEXT, 0, Time[li_4], l_price_12);
            ObjectSetText("Exit Trade: " + DoubleToStr(li_4, 0), "Exit Trade At " + DoubleToStr(l_price_12, 4), 7, "Arial", White);
         }
         gi_unused_196 = 0;
      }
      if (gd_168 >= 0.0) {
         g_ibuf_76[li_4] = gd_168;
         g_ibuf_84[li_4] = gd_168;
      } else {
         g_ibuf_80[li_4] = gd_168;
         g_ibuf_84[li_4] = gd_168;
      }
      ld_unused_20 = li_4;
      if (gd_168 < (-ld_44) && gd_168 > gd_176 && gd_176 <= gd_184) {
         if (Signals) {
            ObjectCreate("Sell Signal: " + DoubleToStr(li_4, 0), OBJ_TEXT, 0, Time[li_4], l_price_12);
            ObjectSetText("Sell Signal: " + DoubleToStr(li_4, 0), "Open Sell Trade At " + DoubleToStr(l_price_12, 4), 7, "Arial", Red);
         }
         gi_unused_196 = 1;
      }
      if (gd_168 > ld_44 && gd_168 < gd_176 && gd_176 >= gd_184) {
         if (Signals) {
            ObjectCreate("Sell Signal: " + DoubleToStr(li_4, 0), OBJ_TEXT, 0, Time[li_4], l_price_12);
            ObjectSetText("Sell Signal: " + DoubleToStr(li_4, 0), "Open Sell Trade At " + DoubleToStr(l_price_12, 4), 7, "Arial", Lime);
         }
         gi_unused_192 = 1;
      }
      gd_152 = gd_144;
      gd_184 = gd_176;
      gd_176 = gd_168;
   }
   for (li_4 = 0; li_4 < li_8; li_4++) g_ibuf_88[li_4] = iMAOnArray(g_ibuf_84, Bars, MA1period, 0, TypeMA1, li_4);
   for (li_4 = 0; li_4 < li_8; li_4++) g_ibuf_92[li_4] = iMAOnArray(g_ibuf_88, Bars, MA2period, 0, TypeMA2, li_4);
   return (0);
}



Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains open prices of each bar
Series array that contains close prices for each bar
Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type DRAW_HISTOGRAM

Implements a curve of type DRAW_LINE

Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: