Jump to content
  • 0
Sign in to follow this  

Indicator Not Refreshing On Bar Close

Question

Guest Luke Z

I cant get this indicator to refresh on bar close, so in other words price keeps going but the indicator stops until i change timeframes and then it plots. Code is provided below:

#property indicator_separate_window
#property indicator_minimum -100.0
#property indicator_maximum 100.0
#property indicator_levelcolor Red
#property indicator_width1 2
#property indicator_level1 80.0
#property indicator_level2 -80.0

extern string ModeTravail = "Acheter à -100% et Vendre à 100%";
extern string TradeMode = "Choisir votre Mode de Trading : ";
extern bool Scalping = TRUE;
extern string IndColor = "Choisir La Couleur Indicateur : ";
extern color Couleur = Blue;
double g_ibuf_108[];
double g_ibuf_112[];
double g_ibuf_116[];
double gd_120;
double gd_128;
double gd_136;
int gi_144 = 5;
int gi_148;
int gi_152;
int g_period_156;

int init() {
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_LINE, EMPTY, 2, Couleur);
   SetIndexBuffer(0, g_ibuf_108);
   SetIndexBuffer(1, g_ibuf_116);
   SetIndexBuffer(2, g_ibuf_112);
   IndicatorShortName("Vostro © 2012 ForexMT4Systems      ");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   if (Year() >= 2020) return (0);
   if (Scalping == TRUE) g_period_156 = 100;
   else g_period_156 = 300;
   for (gi_152 = 0; gi_152 < Bars; gi_152++) {
      gd_120 = 0;
      for (gi_148 = gi_152; gi_148 < gi_144 + gi_152; gi_148++) gd_120 += (High[gi_148] + Low[gi_148]) / 2.0;
      gd_128 = gd_120 / gi_144;
      gd_120 = 0;
      for (gi_148 = gi_152; gi_148 < gi_144 + gi_152; gi_148++) gd_120 += High[gi_148] - Low[gi_148];
      gd_136 = 0.2 * (gd_120 / gi_144);
      g_ibuf_116[gi_152] = (Low[gi_152] - gd_128) / gd_136;
      g_ibuf_112[gi_152] = (High[gi_152] - gd_128) / gd_136;
      if (g_ibuf_112[gi_152] > 8.0 && High[gi_152] > iMA(NULL, 0, g_period_156, 0, MODE_LWMA, PRICE_MEDIAN, gi_152)) g_ibuf_108[gi_152] = 90.0;
      else {
         if (g_ibuf_116[gi_152] < -8.0 && Low[gi_152] < iMA(NULL, 0, g_period_156, 0, MODE_LWMA, PRICE_MEDIAN, gi_152)) g_ibuf_108[gi_152] = -90.0;
         else g_ibuf_108[gi_152] = 0.0;
      }
      if (g_ibuf_112[gi_152] > 8.0 && g_ibuf_112[gi_152 - 1] > 8.0) g_ibuf_108[gi_152] = 0;
      if (g_ibuf_112[gi_152] > 8.0 && g_ibuf_112[gi_152 - 1] > 8.0 && g_ibuf_112[gi_152 - 2] > 8.0) g_ibuf_108[gi_152] = 0;
      if (g_ibuf_116[gi_152] < -8.0 && g_ibuf_116[gi_152 - 1] < -8.0) g_ibuf_108[gi_152] = 0;
      if (g_ibuf_116[gi_152] < -8.0 && g_ibuf_116[gi_152 - 1] < -8.0 && g_ibuf_116[gi_152 - 2] < -8.0) g_ibuf_108[gi_152] = 0;
   }
   return (0);
}

Share this post


Link to post

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
You are posting as a guest. If you have an account, please sign in.
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×