PDA

View Full Version : Logic Question bars with same low


Laserdan
11-07-2008, 06:29 PM
I am trying to write some code that will help me identify certain patterns on a chart. I am hoping someone can help me.

I would like to identify a series of bars that have the same lows, but obviously they all cant be equal. So I am trying to find a series of bars (all in a row) where lets say 8 out of 10 all have the same low.

I am thinking there is a way to create an object that i can iterate thru to check values and set flags. Can someone point me in the correct direction?

Thanks in advance

NinjaTrader_Ray
11-08-2008, 07:22 AM
You could create a HashTable or any other .NET collectiont hat can store a key and value pair, then you can iterate through the last 10 bars, store the key (price) and the value, the number of times you have seen this price. Then you can iterate through the HashTable to see if any of the objects contain values greater than X?

Laserdan
11-08-2008, 08:40 AM
Thanks Ray, this is what i actually wound up doing:

int x = 0;
int trueOccur = 0;

// Condition set 1
do
{
if (Low[x+1] == Low[0])
{
trueOccur = trueOccur + 1;
}

x = x + 1;
}
while (x < barsTested);


if (trueOccur >= barsLowEqual)
{
Do something here
}

NinjaTrader_Ray
11-08-2008, 08:50 AM
Got it. My approach is if the last lows did NOT have to equal the current low, which is what it looks like you are doing.