Hi All,

Just a short note to help potential QuantConnectors 😊.

When you read the documentation on candlestick patterns, it refers to SetCandleSettings without giving too much detail. So here it is. It refers to global settings used FOR ALL candlestick patterns and stored in a private dictionary. You can change those settings by calling:

  1. CandleSettings.Set(CandleSettingType type, CandleSetting setting)

Set() here is a static method so you do not create an object first. You call it right like in the above.

The types are here:

  1. BodyLong
  2. Real body is long when it's longer than the average of the 10 previous candles' real body
  3. BodyVeryLong
  4. Real body is very long when it's longer than 3 times the average of the 10 previous candles' real body
  5. BodyShort
  6. Real body is short when it's shorter than the average of the 10 previous candles' real bodies
  7. BodyDoji
  8. Real body is like doji's body when it's shorter than 10% the average of the 10 previous candles' high-low range
  9. ShadowLong
  10. Shadow is long when it's longer than the real body
  11. ShadowVeryLong
  12. Shadow is very long when it's longer than 2 times the real body
  13. ShadowShort
  14. Shadow is short when it's shorter than half the average of the 10 previous candles' sum of shadows
  15. ShadowVeryShort
  16. Shadow is very short when it's shorter than 10% the average of the 10 previous candles' high-low range
  17. Near
  18. When measuring distance between parts of candles or width of gaps "near" means "<= 20% of the average of the 5 previous candles' high-low range"
  19. Far
  20. When measuring distance between parts of candles or width of gaps "far" means ">= 60% of the average of the 5 previous candles' high-low range"
  21. Equal
  22. When measuring distance between parts of candles or width of gaps "equal" means "<= 5% of the average of the 5 previous candles' high-low range"
+ Expand

To specify each of those types, you do:

  1. CandleSettingType.BodyLong

for instance.

Finally, a CandleSetting is created like this:

  1. CandleSetting(CandleRangeType rangeType, int averagePeriod, decimal factor)

CandleRangeType can have the following values:

  1. RealBody
  2. The part of the candle between open and close
  3. HighLow
  4. The complete range of the candle
  5. Shadows
  6. The shadows (or tails) of the candle

Again, specified like this:

  1. CandleRangeType.RealBody

for instance.

averagePeriod is “The number of previous candles to average” and factor is “A multiplier to calculate candle ranges”.

Note that the default values right now for CandleSettings are:

  1. { CandleSettingType.BodyLong, new CandleSetting(CandleRangeType.RealBody, 10, 1m) },
  2. { CandleSettingType.BodyVeryLong, new CandleSetting(CandleRangeType.RealBody, 10, 3m) },
  3. { CandleSettingType.BodyShort, new CandleSetting(CandleRangeType.RealBody, 10, 1m) },
  4. { CandleSettingType.BodyDoji, new CandleSetting(CandleRangeType.HighLow, 10, 0.1m) },
  5. { CandleSettingType.ShadowLong, new CandleSetting(CandleRangeType.RealBody, 0, 1m) },
  6. { CandleSettingType.ShadowVeryLong, new CandleSetting(CandleRangeType.RealBody, 0, 2m) },
  7. { CandleSettingType.ShadowShort, new CandleSetting(CandleRangeType.Shadows, 10, 1m) },
  8. { CandleSettingType.ShadowVeryShort, new CandleSetting(CandleRangeType.HighLow, 10, 0.1m) },
  9. { CandleSettingType.Near, new CandleSetting(CandleRangeType.HighLow, 5, 0.2m) },
  10. { CandleSettingType.Far, new CandleSetting(CandleRangeType.HighLow, 5, 0.6m) },
  11. { CandleSettingType.Equal, new CandleSetting(CandleRangeType.HighLow, 5, 0.05m) }

Fred

Author

Fred Painchaud

January 2022