MQL4 - automated forex trading   /  

Forum

Login | Register | Language: ru cn en
Buy Latest Technical Indicators in MetaTrader Market

GannHiLo-Histo indicator.

Back to topics list To post a new topic, please log in or register
avatar
16
GreenPoint 2013.05.25 13:46
 

Hi All,

Could you please help me and advise what needs to be updated in the attached code to see Red/Blue values in the data window?

Thanks in advance.

Regards 

//+------------------------------------------------------------------+
//   GannHiLo-Histo
//+------------------------------------------------------------------+
// Indicator properties
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 RoyalBlue
#property indicator_color2 Crimson
#property indicator_color3 Black
#property indicator_width1  4
#property indicator_width2  4
#property indicator_width3  4
#property indicator_maximum 1
#property indicator_minimum 0

// indicator parameters
extern int period=10;

// indicator buffers
double up_buffer[];
double dn_buffer[];
double ghl_buffer[];

//+------------------------------------------------------------------+
int init() {
  IndicatorBuffers(3); 
  SetIndexStyle(0,DRAW_HISTOGRAM);
  SetIndexBuffer(0,up_buffer);
  SetIndexLabel(0,NULL);
  SetIndexStyle(1,DRAW_HISTOGRAM);
  SetIndexBuffer(1,dn_buffer);
  SetIndexLabel(1,NULL);
  SetIndexStyle(2,DRAW_NONE);
  SetIndexBuffer(2,ghl_buffer);
  SetIndexLabel(2,NULL);
  IndicatorShortName("Gann HiLo");
  return(0);
}

//+------------------------------------------------------------------+
int deinit() {
   return (0);
}


//+------------------------------------------------------------------+
int start() {
  int limit, counted_bars, i;
  double period_high, period_low, period_mid, cur_level, prev_level, prev_value;
  
  counted_bars=IndicatorCounted();
  if(counted_bars < 0) return (-1); 
  if(counted_bars>0) counted_bars--;
  limit=MathMax(Bars-counted_bars,period);
  limit=Bars-counted_bars;
  
  //for (i=0; i<limit; i++) {
  for (i=limit; i>=0; i--) {
    ghl_buffer[i]=ghl_buffer[i+1];
    
    if (Close[i]==0)
      ghl_buffer[i]=EMPTY_VALUE;
    else if(Close[i]>iMA(Symbol(),0,period,0,MODE_SMA,PRICE_HIGH,i+1))
      ghl_buffer[i]=1;
    else if(Close[i]<iMA(Symbol(),0,period,0,MODE_SMA,PRICE_LOW,i+1))
      ghl_buffer[i]=-1;
    
    
    up_buffer[i] = EMPTY_VALUE;
    dn_buffer[i] = EMPTY_VALUE;
    
    if (ghl_buffer[i]==1) {
      up_buffer[i] = 1;
      dn_buffer[i] = 0;
    }
    else if (ghl_buffer[i]==-1){
      dn_buffer[i] = 1;
      up_buffer[i] = 0;
    }
    
  }
  return(0);
}
//+------------------------------------------------------------------+

 
Sims 4 - A 'Second Life' that needs as much time as the first
The Sims 4 is an intricate, detailed 'second life' in an offline game - for those who have time to play it. In advance of writing this review I imagined I'd have immeasurable hours of gametime under my belt. In reality, I don't have as many as I would have expected. The Sims 4 is, yet again, a more intricate, more detailed iteration of the game, and even the simplest of interactions can take longer as a result - meaning gamers need to set aside serious time to give the game the attention it deserves.
avatar
9810
WHRoeder 2013.05.25 14:38 #
 
GreenPoint: what needs to be updated in the attached code to see Red/Blue values in the data window?
SetIndexLabel - MQL4 Documentation



avatar
16
GreenPoint 2013.05.25 21:44 #
 

Hi William,

Thank you for prompt response but it doesn't help me as I'm not that good in coding.

Thanks for additional help.

Regards

 
Back to topics list  

To add comments, please log in or register