display candle of superior TF in inferior TF

To add comments, please log in or register
tomtom1379
66
tomtom1379  

Hi everyone,

I m trying to create an indicator to display candle of superior time frame in chart on inferior time frame (in separate window). I don t get to create a "candle shape" with body and shadow of the candle. I write this code :

#property copyright ""
#property link      ""

#define vers   "1.1"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_width1 1 

extern int TF = PERIOD_H4;



double CandleClose[];
double CandleOpen[];



//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void init()
{

  SetIndexBuffer(0, CandleClose);
  SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_DOT);
  SetIndexEmptyValue(0, 0);
  SetIndexDrawBegin(0, 0);
  SetIndexLabel(0, "Close");
  
  SetIndexBuffer(1, CandleOpen);
  SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_DOT);
  SetIndexEmptyValue(1, 0);
  SetIndexDrawBegin(1, 0);
  SetIndexLabel(1, "Open");
  

}

void deinit()
{
}

void start()
{
  int counted_bars = IndicatorCounted();
  if(counted_bars < 0) return;
  if(counted_bars > 0) counted_bars--;

  int limit = Bars-counted_bars;
  limit += TF/Period();

  for (int i=limit; i >= 0; i--)
  {
    int shift = iBarShift(NULL, TF, Time[i], true);
    if (shift == -1) continue;
    
    CandleClose[i] = iClose(NULL, TF, shift);
    CandleOpen[i] = iOpen(NULL, TF, shift);
    
  }
}


Thanks in advance for you help ;)

To add comments, please log in or register