Congestion areas

post your indicators here

Moderator: moderators

Lynx
rank: <50 posts
rank: <50 posts
Posts: 34
Joined: Mon May 14, 2007 3:27 pm
Reputation: 0
Gender: None specified

Congestion areas

Postby Lynx » Thu Sep 06, 2007 5:58 pm

I have been trying to code an indicator that plots two lines within certain caracteristics on the chart but it has proven to be a bit out of my league. Gave it a try for some time now but failed. I was wondering if anyone is interested in tackiling it. The idea behind this is to find small consolidation areas that happen naturally in the chart. I dont think the code i have come up with will work but will include it. I failed miserably at figuring out the logic behind this occurences to code it. Im putting some examples of the occurences as well with two horizontal lines to depict them. So far the rules I have to find them is that each line is requiered to be touched by at least two bars and is usually two to eight bars in length. Hope this helps explain it. I will include the code I have come up with but so far it does not work. Any ideas, suggestions or attempts at it are welcomed.










[code]
Inputs:
MaximumLength(5);


Vars:
HighestHigh(0),
LowestLow(0),
counterh(0),
counterl(0),
hightop(false),
lowbottom(false);

hightop = false;
lowbottom = false;
counterh = 0;
counterl = 0;

HighestHigh = highest(high[1],Maximumlength);

LowestLow = lowest(low[1],Maximumlength);



if low[1] = lowestlow then counterl = counterl + 1;
if low[2] = lowestlow then counterl = counterl + 1;
if low[3] = lowestlow then counterl = counterl + 1;
if low[4] = lowestlow then counterl = counterl + 1;
if low[5] = lowestlow then counterl = counterl + 1;
if low[6] = lowestlow then counterl = counterl + 1;
if low[7] = lowestlow then counterl = counterl + 1;
if low[8] = lowestlow then counterl = counterl + 1;


if low[1] = highesthigh then counterh = counterh + 1;
if low[2] = highesthigh then counterh = counterh + 1;
if low[3] = highesthigh then counterh = counterh + 1;
if low[4] = highesthigh then counterh = counterh + 1;
if low[5] = highesthigh then counterh = counterh + 1;
if low[6] = highesthigh then counterh = counterh + 1;
if low[7] = highesthigh then counterh = counterh + 1;
if low[8] = highesthigh then counterh = counterh + 1;



if counterl >1 then begin
hightop = true;
end;
If counterh >1 then begin
lowbottom = true;
end;


If close < highesthigh and close > lowestlow then
plot1(highesthigh,"HighBar",cyan)
else
noplot(1);
If close < highesthigh and close > lowestlow then
plot2(lowestlow,"LowBar",yellow)
else
noplot(1);

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

zeller4
rank: 150+ posts
rank: 150+ posts
Posts: 152
Joined: Sat Jul 29, 2006 9:16 pm
Reputation: 0
Location: Geneva, FL
Gender: None specified

Postby zeller4 » Thu Sep 06, 2007 6:42 pm

I'm trying something similar in Esignal using TRO dynamic S/R since they show tightening ranges when the S or R dots adjust (pull back) and levelling off areas when they go flat. I'm not very far along yet myself but will be hoping to show something for it within a couple weeks.
I hope you have good success.
kz

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 15558
Joined: Sun May 14, 2006 9:31 pm
Reputation: 3035
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Thu Sep 06, 2007 7:41 pm

Try using Low <= lowest low and high > lowest low in your test for low.

Try using High >= Highest High and Low < Highest High in your test for High.

That may work a little better.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!

Please do NOT PM me with trading or coding questions, post them in a thread.

Lynx
rank: <50 posts
rank: <50 posts
Posts: 34
Joined: Mon May 14, 2007 3:27 pm
Reputation: 0
Gender: None specified

Postby Lynx » Thu Sep 13, 2007 2:27 pm

Thanks for your reply, tried it but still does not work. Do you have any more suggestions to try? Thanks, really appreciate it.

Good trading.

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 15558
Joined: Sun May 14, 2006 9:31 pm
Reputation: 3035
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sat Sep 15, 2007 12:36 am

Lynx wrote:Thanks for your reply, tried it but still does not work. Do you have any more suggestions to try? Thanks, really appreciate it.

Good trading.


Post the revised code and a screenshot so we can see what it is doing.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!



Please do NOT PM me with trading or coding questions, post them in a thread.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

kay
rank: <50 posts
rank: <50 posts
Posts: 3
Joined: Fri Jun 23, 2006 5:03 pm
Reputation: 0
Gender: None specified

Postby kay » Thu Sep 20, 2007 4:02 pm

This one is from the Conway/Behle book

Indikator

Code: Select all

Inputs: RectangleLength(4),
      RangeLength(12),
      RangeFactor(1),
      RangeRatioLimit(.3);

Vars:    RectangleHigh(0),
      RectangleLow(0),
      UpperLine(-1),
      LowerLine(-1);



RectangleHigh = Highest (High, RectangleLength);
RectangleLow  = Lowest (Low, RectangleLength);
If AcmeRectangular(RectangleLength, RangeLength, RangeFactor, RangeRatioLimit) Then begin
   UpperLine = TL_New(Date [RectangleLength-1], Time [RectangleLength-1], RectangleHigh, Date [0], Time [0], RectangleHigh);
   If Upperline >= 0 then begin
      If GetBackGroundColor = Black then
         TL_SetColor(Upperline, Yellow)
      else
         TL_SetColor(Upperline, Black);
      TL_SetSize(Upperline,1);
   End;
   Lowerline =TL_New(Date [RectangleLength-1], Time [RectangleLength-1], RectangleLow, Date [0], Time [0], RectangleLow);
   If Lowerline >= 0 then begin
      If GetBackGroundColor = Black then
         TL_SetColor(Upperline, Yellow)
      else
         TL_SetColor(Upperline, Black);
      TL_SetSize(Upperline,1);
   End;
End;



and the function AcmeRectangular

Code: Select all

Inputs: RectangleLength(numeric),
      RangeLength(Numeric),
      RangeFactor(Numeric),
      RangeRatio(Numeric);

Vars:    ATR(0.0),
      VLength(30),
      RectangleHigh(0),
      RectangleLow(0),
      RectangleHeight(0),
      RangeHigh(0),
      RangeLow(0),
      RangeHeight(0);

AcmeRectangular = False;
ATR = Average (Range, VLength);

RectangleHigh = Highest (High, RectangleLength);
RectangleLow  = Lowest (Low, RectangleLength);
RectangleHeight = RectangleHigh-RectangleLow;

RangeHigh = Highest (High, RangeLength) [RectangleLength];
RangeLow = Lowest  (Low, RangeLength) [RectangleLength];
RangeHeight = RangeHigh-RangeLow;

If RectangleHeight >0 and RangeHeight>0 then
   If (RectangleHeight/RangeHeight) <= RangeRatio and
   RectangleHeight <=RangeFactor  * ATR then
      AcmeRectangular = True;



Lynx
rank: <50 posts
rank: <50 posts
Posts: 34
Joined: Mon May 14, 2007 3:27 pm
Reputation: 0
Gender: None specified

Postby Lynx » Thu Sep 20, 2007 4:35 pm

I had not seen this thread in a couple of days, I will try to post some screenshots of the revised code.

Kay:
The function does not verify, the function returns a true/false value and when i try to verify it it says that it expects a numeric expression. Any help?

kay
rank: <50 posts
rank: <50 posts
Posts: 3
Joined: Fri Jun 23, 2006 5:03 pm
Reputation: 0
Gender: None specified

Postby kay » Fri Sep 21, 2007 11:40 am

At the editor rigth click to properties -> Return Type: boolean(true/false).

You can find another code at Clyde Lees yahoo groups, called Find_Coils.ELS which also searchs for congestion zones based on Ross.
http://finance.groups.yahoo.com/group/swingmachine/

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “Tradestation indicators”