Thank you very much.
Gee all I had to do was re-write the dam thing, HA HA HA. So much for copy and paste.
appreciate it.
Ray
Thank you very much.
Hi, the indicator has 2 buffers, I hope you find it useful.andrewocconer wrote: Wed May 15, 2019 4:08 am Hi guys,
I have this candle body indicator and i want add two buffers, the code is simple and I tried but my knowledge about programming is poor
Can someone do that?
Thanks!
TryTEAMTRADER wrote: Thu May 23, 2019 7:09 pm I tried to change the setting of the arrow index to 119 (diamond shape) - so that it is closer to the price as the 'X' goes off screen.
Could someone change this for me please?
Thanks
TEAMTRADER
Thanks - I have tried to change the size to 12 but again the code will not accept the change - could you apply this setting. Is there a reason why this indicator will not accept simple changes?
Code: Select all
#property strict
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 clrYellow
#property indicator_color2 clrRed
#property indicator_maximum 1
#property indicator_minimum 0
//---- input parameters
extern int Periodo = 20;
extern int Periodo_Media = 50;
extern int Divisore_ATRD1 = 3;
extern int numero_consecutivo_barre=3;
//---- buffers
double devstd[];
double media[];
double IndicatorBuffer[];
double atr[];
double band_dist[];
double SqueezeCount[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(6);
SetIndexBuffer(0,IndicatorBuffer);
SetIndexBuffer(1,SqueezeCount);
SetIndexBuffer(5, devstd);
SetIndexBuffer(2, media);
SetIndexBuffer(3, atr);
SetIndexBuffer(4, band_dist);
SetIndexStyle(0, DRAW_HISTOGRAM,0,5); //Set the style of our indicator
// SetIndexArrow(0,174); //Sets the icon for our indicator
SetIndexEmptyValue(0,0); //Sets default empty value
SetIndexLabel(0,"Squeeze");
SetIndexStyle(1, DRAW_HISTOGRAM,0,5); //Set the style of our indicator
// SetIndexArrow(0,174); //Sets the icon for our indicator
SetIndexEmptyValue(1,0); //Sets default empty value
SetIndexLabel(1,"Squeeze");
SetIndexDrawBegin(0, Periodo + Periodo_Media);
IndicatorShortName("Squeze ( Periodo std " + IntegerToString(Periodo) + ", Periodo Media " + DoubleToStr(Periodo_Media) + ")");
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
static datetime time = Time[0];
int count=0;
int start()
{
/* int counted_bars=IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
//
for(int i = limit; i >= 0; i--)
*/
int counted_bars=IndicatorCounted(),
limit;
if(counted_bars>0)
counted_bars--;
limit=Bars-counted_bars;
for(int i=0;i<limit;i++)
{
devstd[i]=iStdDev(Symbol(),0,Periodo,0,MODE_LWMA,PRICE_WEIGHTED,i);
media[i]=iMAOnArray(devstd,0,Periodo_Media,0,MODE_EMA,i);
atr[i]=iATR(Symbol(),PERIOD_D1,50,i)/Divisore_ATRD1;///Divisore_ATRD1
band_dist[i]= MathAbs(iBands(Symbol(),0,Periodo,2,0,PRICE_CLOSE,MODE_UPPER,i)-iBands(Symbol(),0,Periodo,2,0,PRICE_CLOSE,MODE_LOWER,i));
if(media[i] != EMPTY_VALUE && media[i]>devstd[i] && band_dist[i]<atr[i]){
//Comment(iBars(Symbol(),0));
IndicatorBuffer[i]=1;
if(Time[i] > time)//>
{
time = Time[i]; //newbar, update time
Print(time);
count++;
Comment(count);
if(count>numero_consecutivo_barre) SqueezeCount[i]=1;
}
}
else{
count=0;
}
}
return(0);
}
Users browsing this forum: No registered users and 12 guests