[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .ela for automatic support/resistance lines ?



PureBytes Links

Trading Reference Links

I wrote this some time ago, so I don't mind sharing.
Here it goes:

-----------------------*----------------------
Input: SwingStrength(4);
array: Support[3](0), Resistance[3](0);
vars: temp(0), s(0), r(0);

If BarNumber = 1 then Begin
	Support[1] = TL_New(date[1], time[1], High[1], date,
time, high);	
	Support[2] = TL_New(date[1], time[1], High[1], date,
time, high);	
	Support[3] = TL_New(date[1], time[1], High[1], date,
time, high);	
	Resistance[1] = TL_New(date[1], time[1], Low[1],
date, time, Low);	
	Resistance[2] = TL_New(date[1], time[1], Low[1],
date, time, Low);	
	Resistance[3] = TL_New(date[1], time[1], Low[1],
date, time, Low);	
	s = 1;
	r = 1;
end;

Value1 = SwingHighBar(1, High, SwingStrength,
SwingStrength+1);
Value2 = SwingLowBar(1, Low, SwingStrength,
SwingStrength+1);
If value1 = SwingStrength then Begin
	temp = TL_SetEnd(support[s], Date[value1],
Time[value1], high[value1]);
	temp = TL_SetBegin(support[s], Date[value1-1],
time[value1-1], High[value1]);
	temp = TL_SetExtRight(support[s], true);
	s = s + 1;
	If s > 3 then
		s = 1;
end;

If value2 = SwingStrength then Begin
	temp = TL_SetEnd(resistance[r], Date[value2],
Time[value2], Low[value2]);
	temp = TL_SetBegin(resistance[r], Date[value2-1],
time[value2-1], Low[value2]);
	temp = TL_SetExtRight(resistance[r], true);
	r = r + 1;
	if r > 3 then
		r = 1;
end;

If False then
	Plot1(0,"X");
-----------------------*----------------------

Victor

--- Kent Shaw <kshaw@xxxxxxxxxxxx> wrote:
> This is a great idea (I think) for intraday traders
> and even position
> traders may find it useful :
> I want to code horizontal lines (like the drawing
> objects you can add from
> the icon) that are located at the 3 most
> recent swinglows of a particular strength and then
> do the same for
> swinghighs. And then right the code so that  when a
> new line is created the
> oldest one is deleted. I think this would be great
> so you don't have to keep
> doing this by hand during the trading day
> and I think it makes you more aware of upcoming
> levels that you might not
> see right away.
> The problem with this is I have absolutely NO
> experience coding trendlines.
> I have written millions of show me studies but
> no trendline code. The .ela help is completely
> useless as expected.
> 
> ANY help at all in this area would be VERY VERY
> welcome and I think other
> traders here may appreciate it as well.
> If someone can help , other perks would be to have
> the lines above the
> current price turn red and the lines below the price
> turn green.
> 
> many THANKS in advance !!!!
> 
> 
>         Kent Shaw
> 
>