Traders dynamic index

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Traders dynamic index

Postby hydetom » Thu Aug 12, 2010 2:15 pm

Hi,

can you please translate this indicator exactly

thank you

Code: Select all
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Black
#property indicator_color2 MediumBlue
#property indicator_color3 Yellow
#property indicator_color4 MediumBlue
#property indicator_color5 Green
#property indicator_color6 Red

extern string Custom_Indicator = "Traders Dynamic Index";
extern string Copyright = "© 2009, CompassFX";
extern string Web_Address = "www.compassfx.com";
double g_ibuf_100[];
double g_ibuf_104[];
double g_ibuf_108[];
double g_ibuf_112[];
double g_ibuf_116[];
double g_ibuf_120[];

int init() {
   IndicatorShortName("Traders Dynamic Index | www.compassfx.com ");
   SetIndexBuffer(0, g_ibuf_100);
   SetIndexBuffer(1, g_ibuf_104);
   SetIndexBuffer(2, g_ibuf_108);
   SetIndexBuffer(3, g_ibuf_112);
   SetIndexBuffer(4, g_ibuf_116);
   SetIndexBuffer(5, g_ibuf_120);
   SetIndexStyle(0, DRAW_NONE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2, Yellow);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 2, Green);
   SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 2, Red);
   SetIndexLabel(0, NULL);
   SetIndexLabel(1, "VB High");
   SetIndexLabel(2, "Market Base Line");
   SetIndexLabel(3, "VB Low");
   SetIndexLabel(4, "RSI Price Line");
   SetIndexLabel(5, "Trade Signal Line");
   SetLevelValue(0, 50);
   SetLevelValue(1, 68);
   SetLevelValue(2, 32);
   SetLevelStyle(2, 1, DimGray);
   return (0);
}

int start() {
   double ld_0;
   double lda_8[];
   ArrayResize(lda_8, 34);
   int l_ind_counted_12 = IndicatorCounted();
   int li_16 = Bars - l_ind_counted_12 - 1;
   for (int li_20 = li_16; li_20 >= 0; li_20--) {
      g_ibuf_100[li_20] = iRSI(NULL, 0, 10, PRICE_TYPICAL, li_20);
      ld_0 = 0;
      for (int li_24 = li_20; li_24 < li_20 + 34; li_24++) {
         lda_8[li_24 - li_20] = g_ibuf_100[li_24];
         ld_0 += g_ibuf_100[li_24] / 34.0;
      }
      g_ibuf_104[li_20] = ld_0 + 1.6185 * StDev(lda_8, 34);
      g_ibuf_112[li_20] = ld_0 - 1.6185 * StDev(lda_8, 34);
      g_ibuf_108[li_20] = (g_ibuf_104[li_20] + g_ibuf_112[li_20]) / 2.0;
   }
   for (li_20 = li_16 - 1; li_20 >= 0; li_20--) {
      g_ibuf_116[li_20] = iMAOnArray(g_ibuf_100, 0, 2, 0, MODE_SMA, li_20);
      g_ibuf_120[li_20] = iMAOnArray(g_ibuf_100, 0, 7, 0, MODE_SMA, li_20);
   }
   return (0);
}

double StDev(double ada_0[], int ai_4) {
   return (MathSqrt(Variance(ada_0, ai_4)));
}

double Variance(double ada_0[], int ai_4) {
   double ld_8;
   double ld_16;
   for (int l_index_24 = 0; l_index_24 < ai_4; l_index_24++) {
      ld_8 += ada_0[l_index_24];
      ld_16 += MathPow(ada_0[l_index_24], 2);
   }
   return ((ld_16 * ai_4 - ld_8 * ld_8) / (ai_4 * (ai_4 - 1)));
}
hydetom
 
Posts: 26
Joined: Mon Mar 29, 2010 9:41 am

Re: Traders dynamic index

Postby Alexander.Gettinger » Sun Sep 05, 2010 10:35 pm

You may find indicator here: viewtopic.php?f=17&t=2069
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 33 guests