Adjusting horizontal line length in MQ4

To add comments, please log in or register
iberenhaus
130
iberenhaus  

I would like to use an indicator written by Barry Stander that draws support and resistance lines based on Fractals. howeveer, the lines are very short. I would like them to extend to the right indefinitely. Actually I would prefer to be able to specify the number of bars that lines extend to the right, but indefinitely is better than the current situation. By specifying the number of bars I mean that if I specify 365 bars on a daily chart, the horizontal line would extend out a year. The code is below along with a Chart. I would like solid lines instead of dotted arrows.

Thanks for your help.

Ira Berenhaus

iberenhaus@comcast.net

(973) 566-0095

//+------------------------------------------------------------------+
//| Support and Resistance |
//| Copyright © 2004/5 Barry Stander |
//| http://www.4Africa.net/4meta/ |
//+------------------------------------------------------------------+
#property copyright "Support and Resistance Barry_Stander_4@yahoo.com"
#property link "http://www.4Africa.net/4meta/"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double v1[];
double v2[];
double val1;
double val2;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
//----
IndicatorBuffers(2);
SetIndexArrow(0, 119);
SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red);
SetIndexBuffer(0, v1);
SetIndexLabel(0,"Resistance");
SetIndexArrow(1, 119);
SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1,Blue);
SetIndexBuffer(1, v2);
SetIndexLabel(1,"Support");
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i=Bars;
//----
while(i>=0)
{
val1=iFractals(NULL, 0, MODE_UPPER,i);
if (val1 > 0) v1[i]=High[i];
else v1[i]=v1[i+1];
val2=iFractals(NULL, 0, MODE_LOWER,i);
if (val2 > 0) v2[i]=Low[i];
else v2[i]=v2[i+1];

i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
To add comments, please log in or register