To use candle pattern detection in Advanced mode in the scan or paintbar, reference the CandlePattern object and select the appropriate candle pattern detector in it.
For example:
if (CandlePattern.EveningDojiStar(DojiPercent: 5)) { |
Note that there are various tweaking parameters you can use in each candle pattern check if the defaults are not sufficient for your purposes. Those are documented in the autocomplete for each function call.
The usual parameters are below. There are some other, special parameters, for some patterns, look them up in the documentation for a particular pattern function.
Optional Candle Pattern Function Call Parameters
Purpose |
||
---|---|---|
Ago |
int |
The candle to look at for the last candle of the pattern. 0 means current candle, 1 is one candle back etc. |
TrendLength |
int |
Length of the trend (in candles) preceding the first candle of the pattern - for some patterns it is a down-, for some it is an up-trend. |
RangeAveragePeriod |
int |
The period, in candles, over which the body size of the candle is averaged to determine various qualitative definitions in the patterns such as a long candle, a short candle, a short wick, what is the maximum size for Doji, etc. This average is referred to in function comments as range average. |
DojiPercent |
double |
The % of range average used to determine the maximum candle body size for a Doji candle. |
LongWickPercent |
double |
The length of the wick, in % of the candle body size, that would make it a long wick. |
SmallWickPercent |
double |
The length of the wick, in % of Range Average, that would make it a short wick, suitable for Doji and Marubozu candles. |
ShortPercent |
double |
The body length, in % of Range Average, that would make the candle a short one. |
NearPercent |
double |
The amount of leeway, in % of Range Average, that is used to determine when two values (for example, Close of one candle and Open of another one) are almost the same. |
Note that there are various tweaking parameters you can use in each candle pattern check if the defaults are not sufficient for your purposes. Those are documented in the autocomplete for each function call (and you can also see them in the Available Candle Patterns list.
NOTE: If one paintbar uses numerous candle patterns (5+), it would speed it up if you pre-cached the values used in the matching calculations. Just put this code in front of the paintbar's MainCalculation function:
|