Try this :
//+------------------------------------------------------------------+ //| ProjectName | //| Copyright 2012, CompanyName | //| http://www.companyname.net | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red extern double Range=25; extern int Arrow_Size=3; int Spacing = 50; double Up[],Dn[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { IndicatorShortName("Candle Range"); IndicatorDigits(Digits); SetIndexStyle(0,DRAW_ARROW,0,Arrow_Size); SetIndexArrow(0,233); SetIndexBuffer(0,Up); SetIndexStyle(1,DRAW_ARROW,0,Arrow_Size); SetIndexArrow(1,234); SetIndexBuffer(1,Dn); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { if(Bars<=3) return(0); int ExtCountedBars=IndicatorCounted(); if(ExtCountedBars<0) return(-1); int limit=Bars-2; if(ExtCountedBars>100) limit=Bars-ExtCountedBars-100; int pos; double Delta; pos=limit; while(pos>=0) { Delta=Range*(High[pos]-Low[pos])/100.; if(Close[pos]>High[pos]-Delta) { Up[pos]=Low[pos]-Spacing*Point; Dn[pos]=EMPTY_VALUE; } else { if(Close[pos]<Low[pos]+Delta) { Up[pos]=EMPTY_VALUE; Dn[pos]=High[pos]+Spacing*Point; } else { Up[pos]=EMPTY_VALUE; Dn[pos]=EMPTY_VALUE; } } pos--; } return(0); } //+------------------------------------------------------------------+
Next time please use SRC button :
Thank you Biantoro!! That did the trick, much appreciated. :-)
Volcom:
Thank you Biantoro!! That did the trick, much appreciated. :-)
You're welcome
Thank you Biantoro!! That did the trick, much appreciated. :-)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi All,
Can anyone tell me how to space out arrows so they aren't directly on the top/bottom of a candle? Below is my source code along with a screenshot attached of how they currently look.
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
extern double Range=25;
extern int Arrow_Size=3;
double Up[], Dn[];
int init()
{
IndicatorShortName("Candle Range");
IndicatorDigits(Digits);
SetIndexStyle(0,DRAW_ARROW,0,Arrow_Size);
SetIndexArrow(0,233);
SetIndexBuffer(0,Up);
SetIndexStyle(1,DRAW_ARROW,0,Arrow_Size);
SetIndexArrow(1,234);
SetIndexBuffer(1,Dn);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
if(Bars<=3) return(0);
int ExtCountedBars=IndicatorCounted();
if (ExtCountedBars<0) return(-1);
int limit=Bars-2;
if(ExtCountedBars>100) limit=Bars-ExtCountedBars-100;
int pos;
double Delta;
pos=limit;
while(pos>=0)
{
Delta=Range*(High[pos]-Low[pos])/100.;
if (Close[pos]>High[pos]-Delta)
{
Up[pos]=Low[pos];
Dn[pos]=EMPTY_VALUE;
}
else
{
if (Close[pos]<Low[pos]+Delta)
{
Up[pos]=EMPTY_VALUE;
Dn[pos]=High[pos];
}
else
{
Up[pos]=EMPTY_VALUE;
Dn[pos]=EMPTY_VALUE;
}
}
pos--;
}
return(0);
}