CandlePattern class in custom indicator
Author: pscanlon1
Creation Date: 9/23/2015 3:05 PM
profile picture

pscanlon1

#1
Hello,

I would like to make an indicator that essentially returns the # of candlepattern matches over N bars in the past. Im having trouble with getting it going.. Right now i would use something like the following on each bar to execute and get if there IS a candlepattern that matches.

CODE:
Please log in to see this code.


If i go to visual studio, i can create indicators, but what I am stuck on, first of all, is that I pass "this" to the Candle function, which is the wealthscript... What would "this" be in the custom indicator?

2. I would like to make all the candle functions once in a helper method, and then basically my psuedo code would be.. for each bar, getNumberOfBearishCandles(bar);

this would return an int, which i would set as the OHLC values for this indicators bar.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Hello,

1 - CandlePattern requires an instance of WealthScript which is not available in an Indicator. As a workaround, you could re-code the candle pattern from scratch in your indicator.
profile picture

pscanlon1

#3
OK, thanks Eugene, just wanted to verify that the CandlePattern code is currently not open source correct?
profile picture

KEVINP

#4
The Wealth Lab rules class contains CandlePattern methods. If I am not mistaken, every static candlepattern method has an array parameter passed by reference that indicates how many times the pattern shows up during the length of the bars object. So, just examine this array and count the number of times the pattern occurs.

QUOTE:
I would like to make an indicator that essentially returns the # of candlepattern matches over N bars in the past.


Why not just count the number times it occurs in the array? Am I missing something?
profile picture

Eugene

#5
QUOTE:
OK, thanks Eugene, just wanted to verify that the CandlePattern code is currently not open source correct?

Sorry, it's closed source.
profile picture

stanleywang

#6
Hi Eugene,

Understand that it is closed source, but am I able to read the default settings of each pattern? Settings such as 65% would be classified as a long tail, 10% body would be called a doji, etc. Checked the manual, not mentioned there.

And if there is a place to read these default settings, is there a place in the CandlePattern rule to input customized parameters? thanks!

cheers,
Stanley Wang
profile picture

Eugene

#7
Hi Stanley,

Unfortunately, the answer to both questions is no.
profile picture

Cone

#8
No matter what percentages you use, patterns are subjective. Even the Candlestick pattern "bible" (Beyond Candlesticks by Nisson) isn't precise in defining relationships between bodies, shadows, etc. As Eugene pointed out, there is currently no easy way to change these relationships (they are hard-coded based on a library build for Wealth-Lab 4 more than a decade ago). Nonetheless, I don't see a good reason to keep the code for this particular module a secret, so we'll discuss that internally.

For now, if the Candlestick.Rules don't detect the patterns that you're interested in, I'd recommended building your own rules in a script for those specific patterns.