indicator count and indicator array order

Back to topics list To post a new topic, please log in or register
avatar
211
Subgenius 2016.08.04 03:41
 

hi

i've got this code iv worked  to make better indicator coding skills and what im hoping to do is to replace the candlesticks.

suggestions?

//+------------------------------------------------------------------+
//|   Indicator Name: ChartBucket
//|      E-mail: subgenius@inbox.com
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Brian Lillard"
#property link      "http://5026.net78.net/"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
//+------------------------------------------------------------------+
color   HL_Bull             = Lime;
int     HL_Bull_Width       = 1;
color   OC_Bull             = Lime;
int     OC_Bull_Width       = 6;
//--
color   HL_Bear             = Red;
int     HL_Bear_Width       = 1;
color   OC_Bear             = Red;
int     OC_Bear_Width       = 6;
//--
//+------------------------------------------------------------------+
double ExtMapBuffer1[]; 
double ExtMapBuffer2[];
double ExtMapBuffer3[]; 
double ExtMapBuffer4[];
//-
int ExtCountedBars=0;
//+------------------------------------------------------------------+
int init()
 {
 SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(0,DRAW_HISTOGRAM,0,HL_Bear_Width,HL_Bear);
 SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(1,DRAW_HISTOGRAM,0,HL_Bull_Width,HL_Bull);
 SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(2,DRAW_HISTOGRAM,0,OC_Bear_Width,OC_Bear);
 SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(3,DRAW_HISTOGRAM,0,OC_Bull_Width,OC_Bull);
 return(0);
 }
//+------------------------------------------------------------------+
int start()
 {
 ExtCountedBars=IndicatorCounted();
 if(ExtCountedBars<0){return(-1);}
 if(ExtCountedBars>0){ExtCountedBars--;}
 int pos=Bars-ExtCountedBars-1;
 while(pos>=0)
  {
  //set tops & bottoms
  if(Open[pos]<Close[pos])
   {
   ExtMapBuffer1[pos]=Low[pos]; 
   ExtMapBuffer2[pos]=High[pos];
   }
  else
   {
   ExtMapBuffer1[pos]=High[pos]; 
   ExtMapBuffer2[pos]=Low[pos];
   }
  //set body
  ExtMapBuffer3[pos]=Open[pos]; 
  ExtMapBuffer4[pos]=Close[pos];
  //-
  pos--;
  }
 return(0);
 }
Attached files:
  chartbucket.mq4  (2.03 KB)
  chartbucket_1.mq4  (2.02 KB)
avatar
211
Subgenius 2016.08.04 04:29 #
 

i dont see any problems accept  this is whats happening-only on the minute chart


avatar
211
Subgenius 2016.08.04 04:38 #
 

oops  i fixed it

 while(pos>=0)
  {
  
  if(Open[pos]<=Close[pos])
   {
   ExtMapBuffer1[pos]=Low[pos]; 
   ExtMapBuffer2[pos]=High[pos];
   }
Back to topics list  

To add comments, please log in or register