update
This commit is contained in:
parent
e45c62215e
commit
d8f8b04943
15 changed files with 458 additions and 162 deletions
|
|
@ -1,9 +1,4 @@
|
|||
interface Candle {
|
||||
open: number;
|
||||
close: number;
|
||||
low: number;
|
||||
high: number;
|
||||
}
|
||||
import { Candle } from "../dao/candles";
|
||||
|
||||
type PatternType =
|
||||
| "Doji"
|
||||
|
|
@ -647,3 +642,28 @@ export function isHighVolatilityCandle(candles: Candle[]): boolean {
|
|||
// A candle is considered high volatility if either its range or its body size (or both) are significantly larger
|
||||
return isRangeHigh || isBodySizeHigh;
|
||||
}
|
||||
|
||||
function upperShadow(candle: Candle): number {
|
||||
return candle.high - Math.max(candle.open, candle.close);
|
||||
}
|
||||
|
||||
function lowerShadow(candle: Candle): number {
|
||||
return Math.min(candle.open, candle.close) - candle.low;
|
||||
}
|
||||
|
||||
export function isPinBar(candle: Candle): {isPinBar: boolean, isBullish: boolean, isBearish: boolean} {
|
||||
const bodySize = getBodySize(candle);
|
||||
const totalRange = getTotalRange(candle);
|
||||
const upperShadowSize = upperShadow(candle);
|
||||
const lowerShadowSize = lowerShadow(candle);
|
||||
|
||||
if (bodySize < totalRange * 0.3 && upperShadowSize > bodySize * 2) {
|
||||
return {isPinBar: true, isBullish: true, isBearish: false};
|
||||
}
|
||||
|
||||
if (bodySize < totalRange * 0.3 && lowerShadowSize > bodySize * 2) {
|
||||
return {isPinBar: true, isBullish: false, isBearish: true};
|
||||
}
|
||||
|
||||
return {isPinBar: false, isBullish: false, isBearish: false};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue