Congestion areas
Posted: 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);
[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);