TRUE Forex

Просмотр кода форекс индикатора !Ret Setup.mq4

/*
   Ret Finder with Setup Bar
*/
#property copyright "Copyright © 2011, John Wustrack"
#property link      "john_wustrack@hotmail.com"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 MidnightBlue
#property indicator_width1 2
#property indicator_color2 ForestGreen
#property indicator_width2 2
#property indicator_color3 Crimson
#property indicator_width3 2

extern double dist_from_MA = 0.00024;
extern int xi_Period = 8;
extern double xd_Level = 50.0;
extern bool xb_Show_Diff = FALSE;
extern bool xb_Show_CB_Diff = FALSE;
extern int xi_MA = 10;
extern string ExInd1 = "0=SMA,1=EMA,2=SMMA,3=LWMA";
extern int xi_MA_Method = 0;
extern string ExInd2 = "0=Close,1=Open,2=High,3=Low";
extern string ExInd3 = "4=Median,5=Typical,6=Weighted";
extern int xi_MA_Price = 4;
extern color xc_Text = LightGray;
double g_ibuf_136[];
double g_ibuf_140[];
double g_ibuf_144[];
int g_window_148;
string gs_152;
int gi_160;

int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(0, g_ibuf_136);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(1, g_ibuf_140);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexBuffer(2, g_ibuf_144);
   IndicatorDigits(Digits - 1);
   gs_152 = "Ret Setup (" + xi_Period + ")";
   IndicatorShortName(gs_152);
   gi_160 = Get_Pips_Decimal();
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double l_icci_8;
   double l_ima_16;
   double l_ilow_64;
   double l_ihigh_64;
   double l_iclose_64;
   double ld_24;
   double ld_32;
   double twopfour;
   int li_0 = IndicatorCounted();
   if (li_0 < 0) return (-1);
   if (li_0 > 0) li_0--;
   int li_4 = Bars - li_0;
   for (int li_40 = li_4; li_40 >= 0; li_40--) {
      g_ibuf_136[li_40] = EMPTY_VALUE;
      g_ibuf_140[li_40] = EMPTY_VALUE;
      g_ibuf_144[li_40] = EMPTY_VALUE;
      l_icci_8 = iCCI(NULL, 0, xi_Period, PRICE_TYPICAL, li_40);
      l_ima_16 = iMA(NULL, 0, xi_MA, 0, xi_MA_Method, xi_MA_Price, li_40);
      l_ilow_64 = Low[li_40];
      l_ihigh_64 = High[li_40];
      l_iclose_64 = Close[li_40];
      if (l_icci_8 >= xd_Level && l_ilow_64 <= l_ima_16 + dist_from_MA && l_iclose_64 > l_ima_16) g_ibuf_140[li_40] = l_icci_8;
      else {
         if (l_icci_8 <= -1.0 * xd_Level && l_ihigh_64 >= l_ima_16 - dist_from_MA && l_iclose_64 < l_ima_16) g_ibuf_144[li_40] = l_icci_8;
         else g_ibuf_136[li_40] = l_icci_8;
      }
   }
   if (xb_Show_Diff) {
      l_ima_16 = iMA(NULL, 0, xi_MA, 0, xi_MA_Method, xi_MA_Price, 1);
      l_icci_8 = iCCI(NULL, 0, xi_Period, PRICE_TYPICAL, 1);
      if (l_icci_8 > 0.0) ld_24 = Low[1] - l_ima_16;
      else ld_24 = l_ima_16 - High[1];
      if (ld_24 < 0.0) ld_24 = 0;
      ld_32 = Convert_2_Pips(ld_24);
      Object_Create("!Retrace.Diff", 10, 5, "Prev Bar "+DoubleToStr(ld_32, gi_160));
   }
   if (xb_Show_CB_Diff) {
      l_ima_16 = iMA(NULL, 0, xi_MA, 0, xi_MA_Method, xi_MA_Price, 0);
      l_icci_8 = iCCI(NULL, 0, xi_Period, PRICE_TYPICAL, 0);
      if (l_icci_8 > 0.0) ld_24 = Low[0] - l_ima_16;
      else ld_24 = l_ima_16 - High[0];
      if (ld_24 < 0.0) ld_24 = 0;
      ld_32 = Convert_2_Pips(ld_24);
      Object_Create("!Retrace.Diff.CB", 10, 20, "Curn Bar "+DoubleToStr(ld_32, gi_160));
   }
   return (0);
}

void Object_Create(string a_name_0, int a_x_8, int a_y_12, string a_text_16 = " ", int a_fontsize_24 = 12, string a_fontname_28 = "Arial", color a_color_36 = -1) {
   if (a_color_36 == CLR_NONE) a_color_36 = xc_Text;
   g_window_148 = WindowFind(gs_152);
   ObjectCreate(a_name_0, OBJ_LABEL, g_window_148, 0, 0, 0, 0);
   ObjectSet(a_name_0, OBJPROP_CORNER, 1);
   ObjectSet(a_name_0, OBJPROP_COLOR, a_color_36);
   ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8);
   ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12);
   ObjectSetText(a_name_0, a_text_16, a_fontsize_24, a_fontname_28, a_color_36);
}

double Convert_2_Pips(double ad_0) {
   double ld_ret_8 = ad_0 / Point;
   if (Digits == 5 || (Digits == 3 && StringFind(Symbol(), "JPY") != -1)) ld_ret_8 = ad_0 / Point / 10.0;
   if (Digits == 6 || (Digits == 4 && StringFind(Symbol(), "JPY") != -1)) ld_ret_8 = ad_0 / Point / 100.0;
   return (ld_ret_8);
}

int Get_Pips_Decimal() {
   int li_ret_0 = 0;
   if (Digits == 5 || (Digits == 3 && StringFind(Symbol(), "JPY") != -1)) li_ret_0 = 1;
   if (Digits == 6 || (Digits == 4 && StringFind(Symbol(), "JPY") != -1)) li_ret_0 = 2;
   return (li_ret_0);
}

Комментарии к исходному коду форекс индикатора !Ret Setup.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !PriceStat.mq4
индикатор !Retracement Finder.mq4 »