Re: Two Candles Pattern"s"

Jag, what are your coding credentials? A degree or a study course? Self-learned or well-taught?

I don't have "my relaxing" music, I listen to good music, that's a big difference. And when agitated, no music, sorry.

Below is the fix for the error, it should use less memory now.

Do whatever you like with the indi, if you stumble upon a brilliant idea, shout out loud.

Post's attachments

pattern search.cs 6.31 kb, 42 downloads since 2012-08-22 

You don't have the permssions to download the attachments of this post.

Re: Two Candles Pattern"s"

Biggest drawback might be that patterns which start with 0&1 do not get shown, due to the way my loop is built. The last found pat gets triggered and shows up. Theoretical maximum of 12 patterns are lost. That's the reason why 248 is everywhere you look.

Has anyone exported the indi data and position data, made the analysis and extracted pattern-specific results?

Maybe the indi should write a log if combination is hit? Is it possible, coding gurus? Or a counter, which shows how many hits happened during the bar...

Re: Two Candles Pattern"s"

footon wrote:

Jag, what are your coding credentials? A degree or a study course? Self-learned or well-taught?

I don't have "my relaxing" music, I listen to good music, that's a big difference. And when agitated, no music, sorry.

Below is the fix for the error, it should use less memory now.

Do whatever you like with the indi, if you stumble upon a brilliant idea, shout out loud.

Self taught I'm afraid still trying to learn it reading books etc when I get stuck, last time I did any programming I was using Basic so you can tell how long ago that was.
I don't have brilliant ideas sorry.
Jag

Re: Two Candles Pattern"s"

And if counter value is added at each bar, one would know the number of missed patterns.

Re: Two Candles Pattern"s"

Jag, what's your hit rate with your previous pattern work? 0.7 or better? You test your patterns to only one exit condition?

Re: Two Candles Pattern"s"

footon wrote:

Biggest drawback might be that patterns which start with 0&1 do not get shown, due to the way my loop is built. The last found pat gets triggered and shows up. Theoretical maximum of 12 patterns are lost. That's the reason why 248 is everywhere you look.

Has anyone exported the indi data and position data, made the analysis and extracted pattern-specific results?

Maybe the indi should write a log if combination is hit? Is it possible, coding gurus? Or a counter, which shows how many hits happened during the bar...

1's are shown haven't found any 0's though as yet but from what I can see of the parameters you could get 2 of the first three meeting the criteria so I don't know which one it would display on the output.

Re: Two Candles Pattern"s"

footon wrote:

Jag, what's your hit rate with your previous pattern work? 0.7 or better? You test your patterns to only one exit condition?

Sorry what do you class as hit rate

Re: Two Candles Pattern"s"

Jagmanmick wrote:

1's are shown haven't found any 0's though as yet but from what I can see of the parameters you could get 2 of the first three meeting the criteria so I don't know which one it would display on the output.

It would display the last which gives a signal, meaning if 036 and 258 are matches, 258 as the last one to go through the loop gets shown.

Re: Two Candles Pattern"s"

Jagmanmick wrote:
footon wrote:

Jag, what's your hit rate with your previous pattern work? 0.7 or better? You test your patterns to only one exit condition?

Sorry what do you class as hit rate

Win/loss ratio.

60 (edited by Jagmanmick 2012-08-22 17:12:01)

Re: Two Candles Pattern"s"

Don't take a lot of notice of win/loss ratio prefer to look at profit to loss ratio which is 2.9, I have found that in the strategy I'm doing some patterns give me very few losses compared to wins and in others I get a lot of small losses but less large value wins which reduces the win/loss ratio down to 0.4. Hopefully if I ever finish testing all these patterns I'll analyze my results and may only use the high win patterns.
I see you have changed the cndtn value to 50 is that all it was that was causing the memory error problem?

Re: Two Candles Pattern"s"

Jagmanmick wrote:

I see you have changed the cndtn value to 50 is that all it was that was causing the memory error problem?

Well, I'm self-taught coder myself (with the help from Krog, of course), so I can't say it with a full confidence if my change really fixes the problem. Let me give you an hindsight of the change - I didn't change the value, but I limited one half of the 2D array size to 50, thus it uses now less memory. I could be very wrong with this explanation, but it just reflects my level of understanding.

Re: Two Candles Pattern"s"

Jagmanmick wrote:

Hopefully if I ever finish testing all these patterns I'll analyze my results and may only use the high win patterns.

The list you posted earlier (250+ patterns), those are your patterns you want to test?

63 (edited by Jagmanmick 2012-08-22 20:30:37)

Re: Two Candles Pattern"s"

Yep, 512 I believe. 2 at a time one long one short.

Re: Two Candles Pattern"s"

ahmedalhoseny wrote:

Krog
i think i found a bug
the indicator takes trade while it still counting the bars " it take the trade while it still counting last bar !!!!!"

I checked and i found you select previous bar "how come" !!! 

Example aiCodes[2] = new int[] {1,-1,1,1,1};  it should count 5 bars then go in the 6th bar as follow

(up) (dn) (up) (up) (up) (Go)  but what actually happen (up) (dn) (up) (up) (up&go) 

Correct me if iam wrong

I think you're right, only use it with Bar Closing, not Bar Opening.

Re: Two Candles Pattern"s"

krog wrote:
ahmedalhoseny wrote:

Krog
i think i found a bug
the indicator takes trade while it still counting the bars " it take the trade while it still counting last bar !!!!!"

I checked and i found you select previous bar "how come" !!! 

Example aiCodes[2] = new int[] {1,-1,1,1,1};  it should count 5 bars then go in the 6th bar as follow

(up) (dn) (up) (up) (up) (Go)  but what actually happen (up) (dn) (up) (up) (up&go) 

Correct me if iam wrong

I think you're right, only use it with Bar Closing, not Bar Opening.

it working only with bar close but other opening points like previous high,low .... etc have the same problem all enter like bar open !!! any  recommendation

Re: Two Candles Pattern"s"

footon wrote:

I didn't change the value, but I limited one half of the 2D array size to 50, thus it uses now less memory. I could be very wrong with this explanation, but it just reflects my level of understanding.

I haven't had any error messages since and I'm using 111804 bars with tick data, I've added the short calc and used the same code and it is still running without error. Will try some other parameters for long and short patterns to see how it copes.

Re: Two Candles Pattern"s"

Jagmanmick wrote:
footon wrote:

I didn't change the value, but I limited one half of the 2D array size to 50, thus it uses now less memory. I could be very wrong with this explanation, but it just reflects my level of understanding.

I haven't had any error messages since and I'm using 111804 bars with tick data, I've added the short calc and used the same code and it is still running without error. Will try some other parameters for long and short patterns to see how it copes.

Glad to hear! I can do coding me big_smile

Occasionally good ideas pop up, if I find the time I'll rewrite the indi, add features and new combos, but Krog's version will still blow mine out of the water though smile

By the way, can anyone suggest a good reading material on combinatorics? Especially in C# as I read somewhere C++ is better for this kind of thing, special functions for looping through combos or something like that.

Re: Two Candles Pattern"s"

krog wrote:

Here's mine, it's only for if you're comfortable editing the indicator and recompiling. It figures if the bar is black (close lower than open) or white (close higher than open), you can type in patterns to test against.

- open in editor
- find CodePatterns at top
- follow guidelines in comments
When pattern is found, indicator draws a blue spike over histogram. Dynamic info will show which pattern was found as 0-based index (unfortunately will show a "-" if it's the first because the indicator components do that instead of 0).

Enter as 1 or -1, and it will convert to the opposite for shorts. If you enter "1,1,1,-1,-1,-1" (w,w,w,b,b,b) for long entry, it will also include "-1,-1,-1,1,1,1" (b,b,b,w,w,w) for short entry.

To test naturally occurring patterns, click the "Search Mode" box, set the Length parameter to how many bars you want in your pattern. Then, use the Index parameter to step forward. This takes a sample from your dataset and tests against that pattern and its opposite. If clicking the stepper takes too long, you can also use the Optimizer with it, I tried it a couple of times, it seemed to work. But then if you like the pattern, have to look at the  histogram to figure it out, I couldn't think of a way for it to display what the pattern is.

Mostly the same type of idea as Jagmanmick's, hopefully this approach saves some typing and makes the patterns easier to read. These are patterns of black - white bars, not comparing highs, lows and closes like ahmedalhoseny's idea.

hello
i tried to build the same concept but in small parts by manipulating Inside bar , or Narrow range indicators , my aim is to have a non directional indicator including both up and down bar options in the same indicator  but it ended with indicator show up only bars

i attached here my two indicators , any help to fix !!!!!

Regards

Post's attachments

up or Dn same indicator.rar 2.29 kb, 14 downloads since 2013-03-11 

You don't have the permssions to download the attachments of this post.

Re: Two Candles Pattern"s"

hello could any one modify the indicators here to work with the new fsb

thanks

Re: Two Candles Pattern"s"

Is this still a hot topic? The matter is that I worked on a very interesting project, unfortunately the total outcome turned out to be more of a rubbish bin material. But there's no bad without good - I learnt quite a few interesting things, I have couple of interesting lines, which can make magic. I reckon it would be easy for me to make extremely simple, but rather user-friendly pattern indi for quite plain testing. One would just enter the pattern sequence and get the result of it for longs and shorts. Patterns would be white-black-bars only though, no highs, lows or closes taken into account.

Dreaming a bit farther ahead - it would be possible to automate it, like a real pattern searcher. Let me emphasize - this part is in a dream state, at the moment I do not have time to accomplish this higher goal.

Cutting long story short - any takers?

Re: Two Candles Pattern"s"

Hello footon
its a dream as you said so i tried to breakout into small parts

in the attached 4 files i modified the volume indicator to work with OHLC instead of volume

so it can compare two variables only instead of comparison of two volumes i made it compare

(high & close) in one indicator
(low & close) in the second indicator
(open & close) in the third
(close & close) in the forth

But the problem we need to open more slots each slot will handle a small part which is '' comparison two variables in two price bars only'' 


The next logical step Can you footon merge the four indicators in one indicator !!!  it will be a great step to build that pattern search


Regards

Post's attachments

OHLC 4 indicators.rar 5.92 kb, 9 downloads since 2013-10-13 

You don't have the permssions to download the attachments of this post.

Re: Two Candles Pattern"s"

Only 2 candles involved? Can you explain the principles, how you set it up.

Re: Two Candles Pattern"s"

Yes its only 2 candles and the logic is the same logic as volume  indicator

In Volume indicator it compares two consecutive volumes if it raise so new volume > previous volume
and if volume fall this means new volume < previous volume

So i replaced volumes with OHLC values

For example CloseOpen indicator :  If Closeopen Raise this means close > previous open ....etc

// Calculation of the logic
            switch (IndParam.ListParam[0].Text)
            {
                case "CloseOpen rises":
                    for (int iBar = iPrvs + 1; iBar < Bars; iBar++)
                    {
                        Component[1].Value[iBar] = adCloses[iBar - iPrvs] > adOpens[iBar - iPrvs - 1] + Sigma() ? 1 : 0;
                        Component[2].Value[iBar] = adCloses[iBar - iPrvs] > adOpens[iBar - iPrvs - 1] + Sigma() ? 1 : 0;
                    }
                    break;

                case "CloseOpen falls":
                    for (int iBar = iPrvs + 1; iBar < Bars; iBar++)
                    {
                        Component[1].Value[iBar] = adCloses[iBar - iPrvs] < adOpens[iBar - iPrvs - 1] - Sigma() ? 1 : 0;
                        Component[2].Value[iBar] = adCloses[iBar - iPrvs] < adOpens[iBar - iPrvs - 1] - Sigma() ? 1 : 0;
                    }
                    break;

            }
        }

Re: Two Candles Pattern"s"

Every indi in FSB uses this for rise logic. Compare current to previous value. For example, if you take MA, period 1, logic rises, you get the same as your "close & close".