@avadisabelle/ava-pi-trading 0.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -0
- package/dist/garden.d.ts +33 -0
- package/dist/garden.d.ts.map +1 -0
- package/dist/garden.js +15 -0
- package/dist/garden.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/instruments.d.ts +20 -0
- package/dist/instruments.d.ts.map +1 -0
- package/dist/instruments.js +2 -0
- package/dist/instruments.js.map +1 -0
- package/dist/trade-gate.d.ts +42 -0
- package/dist/trade-gate.d.ts.map +1 -0
- package/dist/trade-gate.js +21 -0
- package/dist/trade-gate.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/williams-5d.d.ts +74 -0
- package/dist/williams-5d.d.ts.map +1 -0
- package/dist/williams-5d.js +2 -0
- package/dist/williams-5d.js.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# @avadisabelle/ava-pi-trading
|
|
2
|
+
|
|
3
|
+
**Williams 5D trading types, ARIANE trade gate protocol, and garden metaphor for the Ava ecosystem**
|
|
4
|
+
|
|
5
|
+
This package provides the core type system and pure logic functions for implementing the Williams Method trading approach within the Ava PI ecosystem. It includes:
|
|
6
|
+
|
|
7
|
+
- **Williams 5 Dimensions**: TypeScript types for the Alligator, Awesome Oscillator (AO), Acceleration/Deceleration (AC), Fractals, and Fractal Divergent Bars (FDB)
|
|
8
|
+
- **ARIANE Trade Gate Protocol**: The Three Agreements framework and consensus-driven trade evaluation
|
|
9
|
+
- **Garden Metaphor**: Capital-as-soil portfolio health tracking using organic farming imagery
|
|
10
|
+
- **Instrument Management**: Tradeable instrument definitions and Candidate Data Series (CDS) entries
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @avadisabelle/ava-pi-trading
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import {
|
|
22
|
+
evaluateGate,
|
|
23
|
+
type ThreeAgreements,
|
|
24
|
+
type TradeVerdict,
|
|
25
|
+
type WilliamsDimensions,
|
|
26
|
+
dimensionsSupportDirection,
|
|
27
|
+
} from "@avadisabelle/ava-pi-trading";
|
|
28
|
+
|
|
29
|
+
// Evaluate the Three Agreements to get a trade verdict
|
|
30
|
+
const agreements: ThreeAgreements = {
|
|
31
|
+
trendAlignment: true,
|
|
32
|
+
signalPresence: true,
|
|
33
|
+
gardenCapacity: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const verdict: TradeVerdict = evaluateGate(agreements);
|
|
37
|
+
console.log(verdict); // "ALLOW"
|
|
38
|
+
|
|
39
|
+
// Check if Williams dimensions support a trade direction
|
|
40
|
+
const dims: WilliamsDimensions = {
|
|
41
|
+
instrument: "EUR/USD",
|
|
42
|
+
timeframe: "H1",
|
|
43
|
+
timestamp: new Date().toISOString(),
|
|
44
|
+
alligator: {
|
|
45
|
+
jaw: 1.1000,
|
|
46
|
+
teeth: 1.1010,
|
|
47
|
+
lips: 1.1020,
|
|
48
|
+
sleeping: false,
|
|
49
|
+
direction: "bullish",
|
|
50
|
+
spread: 0.0020,
|
|
51
|
+
},
|
|
52
|
+
ao: { value: 0.0005, trend: "rising", zeroCross: true, consecutiveBars: 3 },
|
|
53
|
+
ac: { value: 0.0002, acceleration: "positive" },
|
|
54
|
+
fractals: {
|
|
55
|
+
highFractal: 1.1050,
|
|
56
|
+
lowFractal: 1.0980,
|
|
57
|
+
highFractalTime: new Date().toISOString(),
|
|
58
|
+
lowFractalTime: new Date().toISOString(),
|
|
59
|
+
},
|
|
60
|
+
zone: "green",
|
|
61
|
+
fdb: {
|
|
62
|
+
direction: "long",
|
|
63
|
+
fractalLevel: 1.0980,
|
|
64
|
+
aoConfirms: true,
|
|
65
|
+
alligatorOpen: true,
|
|
66
|
+
strength: "strong",
|
|
67
|
+
barIndex: 5,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const supportsLong = dimensionsSupportDirection(dims, "long");
|
|
72
|
+
console.log(supportsLong); // true
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## API Overview
|
|
76
|
+
|
|
77
|
+
### Types
|
|
78
|
+
|
|
79
|
+
- **`TradeDirection`**: `"long" | "short"`
|
|
80
|
+
- **`TradeVerdict`**: `"ALLOW" | "WAIT" | "NO_TRADE"`
|
|
81
|
+
- **`Timeframe`**: `"M1" | "M5" | "M15" | "M30" | "H1" | "H4" | "D1" | "W1" | "MN"`
|
|
82
|
+
- **`SignalStrength`**: `"strong" | "moderate" | "weak"`
|
|
83
|
+
- **`MarketRegime`**: `"trending" | "ranging" | "volatile" | "quiet"`
|
|
84
|
+
- **`PatternStage`**: `"seed" | "sprout" | "sapling" | "tree" | "harvest" | "composting"`
|
|
85
|
+
|
|
86
|
+
### Williams 5D Interfaces
|
|
87
|
+
|
|
88
|
+
- **`AlligatorState`**: Jaw, teeth, lips, sleeping state, direction, and spread
|
|
89
|
+
- **`AOState`**: Awesome Oscillator value, trend, zero cross, and consecutive bars
|
|
90
|
+
- **`ACState`**: Acceleration/Deceleration value and acceleration direction
|
|
91
|
+
- **`FractalLevels`**: High/low fractal levels and timestamps
|
|
92
|
+
- **`FDBSignal`**: Fractal Divergent Bar signal details
|
|
93
|
+
- **`Zone`**: Current bar zone (`"green" | "red" | "gray"`)
|
|
94
|
+
- **`WilliamsDimensions`**: Complete snapshot of all 5 dimensions
|
|
95
|
+
|
|
96
|
+
### Trade Gate
|
|
97
|
+
|
|
98
|
+
- **`ThreeAgreements`**: Trend alignment, signal presence, and garden capacity
|
|
99
|
+
- **`FaceVerdict`**: Individual council face verdict
|
|
100
|
+
- **`GateAssessment`**: Complete gate assessment output
|
|
101
|
+
- **`evaluateGate(agreements)`**: Pure function to evaluate the Three Agreements → verdict
|
|
102
|
+
- **`dimensionsSupportDirection(dims, direction)`**: Check if Williams dimensions support a trade direction
|
|
103
|
+
|
|
104
|
+
### Garden
|
|
105
|
+
|
|
106
|
+
- **`GardenState`**: Portfolio health metrics using soil/planting metaphor
|
|
107
|
+
- **`PatternLifecycle`**: Pattern lifecycle tracking for an instrument
|
|
108
|
+
- **`gardenHasCapacity(garden)`**: Check if the garden can accept a new trade
|
|
109
|
+
- **`assessWeather(volatility, trendStrength)`**: Determine market regime
|
|
110
|
+
|
|
111
|
+
### Instruments
|
|
112
|
+
|
|
113
|
+
- **`Instrument`**: Tradeable instrument definition
|
|
114
|
+
- **`CDSEntry`**: Candidate Data Series signal entry
|
|
115
|
+
|
|
116
|
+
## Relationship to `@avadisabelle/ava-council`
|
|
117
|
+
|
|
118
|
+
This package depends on `@avadisabelle/ava-council` and uses its `ConsensusResult` type in the `GateAssessment` interface. The council provides the multi-face consensus mechanism that powers the ARIANE trade gate protocol.
|
|
119
|
+
|
|
120
|
+
## Philosophy: The Three Agreements
|
|
121
|
+
|
|
122
|
+
The ARIANE gate protocol is built on the principle of **unanimous consent**. All three agreements must hold:
|
|
123
|
+
|
|
124
|
+
1. **Trend Alignment**: Higher timeframe trend supports the direction
|
|
125
|
+
2. **Signal Presence**: A valid entry signal (FDB) exists on the trading timeframe
|
|
126
|
+
3. **Garden Capacity**: Capital/risk allows the trade (soil health, planting density)
|
|
127
|
+
|
|
128
|
+
If all three align → `ALLOW`
|
|
129
|
+
If signal or capacity is missing → `NO_TRADE`
|
|
130
|
+
Otherwise → `WAIT`
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT © Guillaume JG Isabelle
|
package/dist/garden.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { MarketRegime, PatternStage } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Garden state — the capital-as-soil metaphor.
|
|
4
|
+
* Tracks portfolio health using organic farming imagery.
|
|
5
|
+
*/
|
|
6
|
+
export interface GardenState {
|
|
7
|
+
/** Soil health: 0-100 (available margin / total capital) */
|
|
8
|
+
soilHealth: number;
|
|
9
|
+
/** Planting density: open positions vs maximum allowed */
|
|
10
|
+
plantingDensity: number;
|
|
11
|
+
/** Current market regime as weather */
|
|
12
|
+
weather: MarketRegime;
|
|
13
|
+
/** P&L trajectory as growth rate */
|
|
14
|
+
growthRate: number;
|
|
15
|
+
/** Total open positions */
|
|
16
|
+
openPositions: number;
|
|
17
|
+
/** Maximum positions allowed */
|
|
18
|
+
maxPositions: number;
|
|
19
|
+
}
|
|
20
|
+
/** Pattern lifecycle tracking for a single instrument. */
|
|
21
|
+
export interface PatternLifecycle {
|
|
22
|
+
instrument: string;
|
|
23
|
+
timeframe: string;
|
|
24
|
+
stage: PatternStage;
|
|
25
|
+
enteredStageAt: string;
|
|
26
|
+
signals: string[];
|
|
27
|
+
nextMilestone: string;
|
|
28
|
+
}
|
|
29
|
+
/** Check if the garden has capacity for a new trade. */
|
|
30
|
+
export declare function gardenHasCapacity(garden: GardenState): boolean;
|
|
31
|
+
/** Assess garden weather from market conditions. */
|
|
32
|
+
export declare function assessWeather(volatility: number, trendStrength: number): MarketRegime;
|
|
33
|
+
//# sourceMappingURL=garden.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"garden.d.ts","sourceRoot":"","sources":["../src/garden.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,wDAAwD;AACxD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAE9D;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,YAAY,CAKrF","sourcesContent":["import type { MarketRegime, PatternStage } from \"./types.js\";\n\n/**\n * Garden state — the capital-as-soil metaphor.\n * Tracks portfolio health using organic farming imagery.\n */\nexport interface GardenState {\n\t/** Soil health: 0-100 (available margin / total capital) */\n\tsoilHealth: number;\n\t/** Planting density: open positions vs maximum allowed */\n\tplantingDensity: number;\n\t/** Current market regime as weather */\n\tweather: MarketRegime;\n\t/** P&L trajectory as growth rate */\n\tgrowthRate: number;\n\t/** Total open positions */\n\topenPositions: number;\n\t/** Maximum positions allowed */\n\tmaxPositions: number;\n}\n\n/** Pattern lifecycle tracking for a single instrument. */\nexport interface PatternLifecycle {\n\tinstrument: string;\n\ttimeframe: string;\n\tstage: PatternStage;\n\tenteredStageAt: string;\n\tsignals: string[];\n\tnextMilestone: string;\n}\n\n/** Check if the garden has capacity for a new trade. */\nexport function gardenHasCapacity(garden: GardenState): boolean {\n\treturn garden.soilHealth > 20 && garden.plantingDensity < 0.8 && garden.openPositions < garden.maxPositions;\n}\n\n/** Assess garden weather from market conditions. */\nexport function assessWeather(volatility: number, trendStrength: number): MarketRegime {\n\tif (volatility > 0.7) return \"volatile\";\n\tif (trendStrength > 0.6) return \"trending\";\n\tif (volatility < 0.2 && trendStrength < 0.2) return \"quiet\";\n\treturn \"ranging\";\n}\n"]}
|
package/dist/garden.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Check if the garden has capacity for a new trade. */
|
|
2
|
+
export function gardenHasCapacity(garden) {
|
|
3
|
+
return garden.soilHealth > 20 && garden.plantingDensity < 0.8 && garden.openPositions < garden.maxPositions;
|
|
4
|
+
}
|
|
5
|
+
/** Assess garden weather from market conditions. */
|
|
6
|
+
export function assessWeather(volatility, trendStrength) {
|
|
7
|
+
if (volatility > 0.7)
|
|
8
|
+
return "volatile";
|
|
9
|
+
if (trendStrength > 0.6)
|
|
10
|
+
return "trending";
|
|
11
|
+
if (volatility < 0.2 && trendStrength < 0.2)
|
|
12
|
+
return "quiet";
|
|
13
|
+
return "ranging";
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=garden.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"garden.js","sourceRoot":"","sources":["../src/garden.ts"],"names":[],"mappings":"AA+BA,wDAAwD;AACxD,MAAM,UAAU,iBAAiB,CAAC,MAAmB,EAAW;IAC/D,OAAO,MAAM,CAAC,UAAU,GAAG,EAAE,IAAI,MAAM,CAAC,eAAe,GAAG,GAAG,IAAI,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;AAAA,CAC5G;AAED,oDAAoD;AACpD,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,aAAqB,EAAgB;IACtF,IAAI,UAAU,GAAG,GAAG;QAAE,OAAO,UAAU,CAAC;IACxC,IAAI,aAAa,GAAG,GAAG;QAAE,OAAO,UAAU,CAAC;IAC3C,IAAI,UAAU,GAAG,GAAG,IAAI,aAAa,GAAG,GAAG;QAAE,OAAO,OAAO,CAAC;IAC5D,OAAO,SAAS,CAAC;AAAA,CACjB","sourcesContent":["import type { MarketRegime, PatternStage } from \"./types.js\";\n\n/**\n * Garden state — the capital-as-soil metaphor.\n * Tracks portfolio health using organic farming imagery.\n */\nexport interface GardenState {\n\t/** Soil health: 0-100 (available margin / total capital) */\n\tsoilHealth: number;\n\t/** Planting density: open positions vs maximum allowed */\n\tplantingDensity: number;\n\t/** Current market regime as weather */\n\tweather: MarketRegime;\n\t/** P&L trajectory as growth rate */\n\tgrowthRate: number;\n\t/** Total open positions */\n\topenPositions: number;\n\t/** Maximum positions allowed */\n\tmaxPositions: number;\n}\n\n/** Pattern lifecycle tracking for a single instrument. */\nexport interface PatternLifecycle {\n\tinstrument: string;\n\ttimeframe: string;\n\tstage: PatternStage;\n\tenteredStageAt: string;\n\tsignals: string[];\n\tnextMilestone: string;\n}\n\n/** Check if the garden has capacity for a new trade. */\nexport function gardenHasCapacity(garden: GardenState): boolean {\n\treturn garden.soilHealth > 20 && garden.plantingDensity < 0.8 && garden.openPositions < garden.maxPositions;\n}\n\n/** Assess garden weather from market conditions. */\nexport function assessWeather(volatility: number, trendStrength: number): MarketRegime {\n\tif (volatility > 0.7) return \"volatile\";\n\tif (trendStrength > 0.6) return \"trending\";\n\tif (volatility < 0.2 && trendStrength < 0.2) return \"quiet\";\n\treturn \"ranging\";\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { GardenState, PatternLifecycle } from "./garden.js";
|
|
2
|
+
export { assessWeather, gardenHasCapacity } from "./garden.js";
|
|
3
|
+
export type { CDSEntry, Instrument } from "./instruments.js";
|
|
4
|
+
export type { FaceVerdict, GateAssessment, ThreeAgreements } from "./trade-gate.js";
|
|
5
|
+
export { dimensionsSupportDirection, evaluateGate } from "./trade-gate.js";
|
|
6
|
+
export type { MarketRegime, PatternStage, SignalStrength, Timeframe, TradeDirection, TradeVerdict, } from "./types.js";
|
|
7
|
+
export type { ACState, AlligatorState, AOState, FDBSignal, FractalLevels, WilliamsDimensions, Zone, } from "./williams-5d.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE7D,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3E,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,EACT,cAAc,EACd,YAAY,GACZ,MAAM,YAAY,CAAC;AAEpB,YAAY,EACX,OAAO,EACP,cAAc,EACd,OAAO,EACP,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,IAAI,GACJ,MAAM,kBAAkB,CAAC","sourcesContent":["// Types\n\n// Garden\nexport type { GardenState, PatternLifecycle } from \"./garden.js\";\nexport { assessWeather, gardenHasCapacity } from \"./garden.js\";\n// Instruments\nexport type { CDSEntry, Instrument } from \"./instruments.js\";\n// Trade Gate\nexport type { FaceVerdict, GateAssessment, ThreeAgreements } from \"./trade-gate.js\";\nexport { dimensionsSupportDirection, evaluateGate } from \"./trade-gate.js\";\nexport type {\n\tMarketRegime,\n\tPatternStage,\n\tSignalStrength,\n\tTimeframe,\n\tTradeDirection,\n\tTradeVerdict,\n} from \"./types.js\";\n// Williams 5D\nexport type {\n\tACState,\n\tAlligatorState,\n\tAOState,\n\tFDBSignal,\n\tFractalLevels,\n\tWilliamsDimensions,\n\tZone,\n} from \"./williams-5d.js\";\n"]}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AAIR,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAK/D,OAAO,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Types\n\n// Garden\nexport type { GardenState, PatternLifecycle } from \"./garden.js\";\nexport { assessWeather, gardenHasCapacity } from \"./garden.js\";\n// Instruments\nexport type { CDSEntry, Instrument } from \"./instruments.js\";\n// Trade Gate\nexport type { FaceVerdict, GateAssessment, ThreeAgreements } from \"./trade-gate.js\";\nexport { dimensionsSupportDirection, evaluateGate } from \"./trade-gate.js\";\nexport type {\n\tMarketRegime,\n\tPatternStage,\n\tSignalStrength,\n\tTimeframe,\n\tTradeDirection,\n\tTradeVerdict,\n} from \"./types.js\";\n// Williams 5D\nexport type {\n\tACState,\n\tAlligatorState,\n\tAOState,\n\tFDBSignal,\n\tFractalLevels,\n\tWilliamsDimensions,\n\tZone,\n} from \"./williams-5d.js\";\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Timeframe } from "./types.js";
|
|
2
|
+
/** A tradeable instrument in the universe. */
|
|
3
|
+
export interface Instrument {
|
|
4
|
+
symbol: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: "forex" | "index" | "commodity" | "crypto";
|
|
7
|
+
pipSize: number;
|
|
8
|
+
/** Default timeframes to scan for this instrument */
|
|
9
|
+
defaultTimeframes: Timeframe[];
|
|
10
|
+
}
|
|
11
|
+
/** CDS (Candidate Data Series) entry — the signal detection layer. */
|
|
12
|
+
export interface CDSEntry {
|
|
13
|
+
instrument: string;
|
|
14
|
+
timeframe: Timeframe;
|
|
15
|
+
timestamp: string;
|
|
16
|
+
signalType: string;
|
|
17
|
+
signalStrength: number;
|
|
18
|
+
metadata: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=instruments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruments.d.ts","sourceRoot":"","sources":["../src/instruments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,iBAAiB,EAAE,SAAS,EAAE,CAAC;CAC/B;AAED,wEAAsE;AACtE,MAAM,WAAW,QAAQ;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC","sourcesContent":["import type { Timeframe } from \"./types.js\";\n\n/** A tradeable instrument in the universe. */\nexport interface Instrument {\n\tsymbol: string;\n\tname: string;\n\ttype: \"forex\" | \"index\" | \"commodity\" | \"crypto\";\n\tpipSize: number;\n\t/** Default timeframes to scan for this instrument */\n\tdefaultTimeframes: Timeframe[];\n}\n\n/** CDS (Candidate Data Series) entry — the signal detection layer. */\nexport interface CDSEntry {\n\tinstrument: string;\n\ttimeframe: Timeframe;\n\ttimestamp: string;\n\tsignalType: string;\n\tsignalStrength: number;\n\tmetadata: Record<string, unknown>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruments.js","sourceRoot":"","sources":["../src/instruments.ts"],"names":[],"mappings":"","sourcesContent":["import type { Timeframe } from \"./types.js\";\n\n/** A tradeable instrument in the universe. */\nexport interface Instrument {\n\tsymbol: string;\n\tname: string;\n\ttype: \"forex\" | \"index\" | \"commodity\" | \"crypto\";\n\tpipSize: number;\n\t/** Default timeframes to scan for this instrument */\n\tdefaultTimeframes: Timeframe[];\n}\n\n/** CDS (Candidate Data Series) entry — the signal detection layer. */\nexport interface CDSEntry {\n\tinstrument: string;\n\ttimeframe: Timeframe;\n\ttimestamp: string;\n\tsignalType: string;\n\tsignalStrength: number;\n\tmetadata: Record<string, unknown>;\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ConsensusResult } from "@avadisabelle/ava-council";
|
|
2
|
+
import type { Timeframe, TradeDirection, TradeVerdict } from "./types.js";
|
|
3
|
+
import type { WilliamsDimensions } from "./williams-5d.js";
|
|
4
|
+
/**
|
|
5
|
+
* The Three Agreements — the core decision framework.
|
|
6
|
+
* All three must align for ALLOW. Any disagreement produces WAIT or NO_TRADE.
|
|
7
|
+
*/
|
|
8
|
+
export interface ThreeAgreements {
|
|
9
|
+
/** Agreement 1: Higher timeframe trend supports the direction */
|
|
10
|
+
trendAlignment: boolean;
|
|
11
|
+
/** Agreement 2: A valid entry signal (FDB) exists on the trading timeframe */
|
|
12
|
+
signalPresence: boolean;
|
|
13
|
+
/** Agreement 3: Capital/risk allows the trade (garden has capacity) */
|
|
14
|
+
gardenCapacity: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Individual face verdict in the council assessment. */
|
|
17
|
+
export interface FaceVerdict {
|
|
18
|
+
faceId: string;
|
|
19
|
+
faceName: string;
|
|
20
|
+
verdict: TradeVerdict;
|
|
21
|
+
reasoning: string;
|
|
22
|
+
confidence: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Complete gate assessment — the output of the ARIANE protocol.
|
|
26
|
+
*/
|
|
27
|
+
export interface GateAssessment {
|
|
28
|
+
instrument: string;
|
|
29
|
+
timeframe: Timeframe;
|
|
30
|
+
direction: TradeDirection;
|
|
31
|
+
verdict: TradeVerdict;
|
|
32
|
+
agreements: ThreeAgreements;
|
|
33
|
+
faces: FaceVerdict[];
|
|
34
|
+
consensus: ConsensusResult | null;
|
|
35
|
+
reasoning: string;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
}
|
|
38
|
+
/** Evaluate the Three Agreements and produce a verdict. Pure logic — no MCP calls, no side effects. */
|
|
39
|
+
export declare function evaluateGate(agreements: ThreeAgreements): TradeVerdict;
|
|
40
|
+
/** Check if Williams dimensions support a trade direction. */
|
|
41
|
+
export declare function dimensionsSupportDirection(dims: WilliamsDimensions, direction: TradeDirection): boolean;
|
|
42
|
+
//# sourceMappingURL=trade-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-gate.d.ts","sourceRoot":"","sources":["../src/trade-gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,iEAAiE;IACjE,cAAc,EAAE,OAAO,CAAC;IACxB,8EAA8E;IAC9E,cAAc,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,cAAc,EAAE,OAAO,CAAC;CACxB;AAED,yDAAyD;AACzD,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,SAAS,EAAE,eAAe,GAAG,IAAI,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,yGAAuG;AACvG,wBAAgB,YAAY,CAAC,UAAU,EAAE,eAAe,GAAG,YAAY,CAYtE;AAED,8DAA8D;AAC9D,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO,CAWvG","sourcesContent":["import type { ConsensusResult } from \"@avadisabelle/ava-council\";\nimport type { Timeframe, TradeDirection, TradeVerdict } from \"./types.js\";\nimport type { WilliamsDimensions } from \"./williams-5d.js\";\n\n/**\n * The Three Agreements — the core decision framework.\n * All three must align for ALLOW. Any disagreement produces WAIT or NO_TRADE.\n */\nexport interface ThreeAgreements {\n\t/** Agreement 1: Higher timeframe trend supports the direction */\n\ttrendAlignment: boolean;\n\t/** Agreement 2: A valid entry signal (FDB) exists on the trading timeframe */\n\tsignalPresence: boolean;\n\t/** Agreement 3: Capital/risk allows the trade (garden has capacity) */\n\tgardenCapacity: boolean;\n}\n\n/** Individual face verdict in the council assessment. */\nexport interface FaceVerdict {\n\tfaceId: string;\n\tfaceName: string;\n\tverdict: TradeVerdict;\n\treasoning: string;\n\tconfidence: number;\n}\n\n/**\n * Complete gate assessment — the output of the ARIANE protocol.\n */\nexport interface GateAssessment {\n\tinstrument: string;\n\ttimeframe: Timeframe;\n\tdirection: TradeDirection;\n\tverdict: TradeVerdict;\n\tagreements: ThreeAgreements;\n\tfaces: FaceVerdict[];\n\tconsensus: ConsensusResult | null;\n\treasoning: string;\n\ttimestamp: string;\n}\n\n/** Evaluate the Three Agreements and produce a verdict. Pure logic — no MCP calls, no side effects. */\nexport function evaluateGate(agreements: ThreeAgreements): TradeVerdict {\n\tconst { trendAlignment, signalPresence, gardenCapacity } = agreements;\n\n\tif (trendAlignment && signalPresence && gardenCapacity) {\n\t\treturn \"ALLOW\";\n\t}\n\n\tif (!signalPresence || !gardenCapacity) {\n\t\treturn \"NO_TRADE\";\n\t}\n\n\treturn \"WAIT\";\n}\n\n/** Check if Williams dimensions support a trade direction. */\nexport function dimensionsSupportDirection(dims: WilliamsDimensions, direction: TradeDirection): boolean {\n\tconst alligatorSupports =\n\t\t!dims.alligator.sleeping &&\n\t\t((direction === \"long\" && dims.alligator.direction === \"bullish\") ||\n\t\t\t(direction === \"short\" && dims.alligator.direction === \"bearish\"));\n\n\tconst aoSupports = (direction === \"long\" && dims.ao.value > 0) || (direction === \"short\" && dims.ao.value < 0);\n\n\tconst fdbPresent = dims.fdb !== null && dims.fdb.direction === direction;\n\n\treturn alligatorSupports && aoSupports && fdbPresent;\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Evaluate the Three Agreements and produce a verdict. Pure logic — no MCP calls, no side effects. */
|
|
2
|
+
export function evaluateGate(agreements) {
|
|
3
|
+
const { trendAlignment, signalPresence, gardenCapacity } = agreements;
|
|
4
|
+
if (trendAlignment && signalPresence && gardenCapacity) {
|
|
5
|
+
return "ALLOW";
|
|
6
|
+
}
|
|
7
|
+
if (!signalPresence || !gardenCapacity) {
|
|
8
|
+
return "NO_TRADE";
|
|
9
|
+
}
|
|
10
|
+
return "WAIT";
|
|
11
|
+
}
|
|
12
|
+
/** Check if Williams dimensions support a trade direction. */
|
|
13
|
+
export function dimensionsSupportDirection(dims, direction) {
|
|
14
|
+
const alligatorSupports = !dims.alligator.sleeping &&
|
|
15
|
+
((direction === "long" && dims.alligator.direction === "bullish") ||
|
|
16
|
+
(direction === "short" && dims.alligator.direction === "bearish"));
|
|
17
|
+
const aoSupports = (direction === "long" && dims.ao.value > 0) || (direction === "short" && dims.ao.value < 0);
|
|
18
|
+
const fdbPresent = dims.fdb !== null && dims.fdb.direction === direction;
|
|
19
|
+
return alligatorSupports && aoSupports && fdbPresent;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=trade-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-gate.js","sourceRoot":"","sources":["../src/trade-gate.ts"],"names":[],"mappings":"AAyCA,yGAAuG;AACvG,MAAM,UAAU,YAAY,CAAC,UAA2B,EAAgB;IACvE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC;IAEtE,IAAI,cAAc,IAAI,cAAc,IAAI,cAAc,EAAE,CAAC;QACxD,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,EAAE,CAAC;QACxC,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC;AAAA,CACd;AAED,8DAA8D;AAC9D,MAAM,UAAU,0BAA0B,CAAC,IAAwB,EAAE,SAAyB,EAAW;IACxG,MAAM,iBAAiB,GACtB,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ;QACxB,CAAC,CAAC,SAAS,KAAK,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,KAAK,SAAS,CAAC;YAChE,CAAC,SAAS,KAAK,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC;IAErE,MAAM,UAAU,GAAG,CAAC,SAAS,KAAK,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAE/G,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC;IAEzE,OAAO,iBAAiB,IAAI,UAAU,IAAI,UAAU,CAAC;AAAA,CACrD","sourcesContent":["import type { ConsensusResult } from \"@avadisabelle/ava-council\";\nimport type { Timeframe, TradeDirection, TradeVerdict } from \"./types.js\";\nimport type { WilliamsDimensions } from \"./williams-5d.js\";\n\n/**\n * The Three Agreements — the core decision framework.\n * All three must align for ALLOW. Any disagreement produces WAIT or NO_TRADE.\n */\nexport interface ThreeAgreements {\n\t/** Agreement 1: Higher timeframe trend supports the direction */\n\ttrendAlignment: boolean;\n\t/** Agreement 2: A valid entry signal (FDB) exists on the trading timeframe */\n\tsignalPresence: boolean;\n\t/** Agreement 3: Capital/risk allows the trade (garden has capacity) */\n\tgardenCapacity: boolean;\n}\n\n/** Individual face verdict in the council assessment. */\nexport interface FaceVerdict {\n\tfaceId: string;\n\tfaceName: string;\n\tverdict: TradeVerdict;\n\treasoning: string;\n\tconfidence: number;\n}\n\n/**\n * Complete gate assessment — the output of the ARIANE protocol.\n */\nexport interface GateAssessment {\n\tinstrument: string;\n\ttimeframe: Timeframe;\n\tdirection: TradeDirection;\n\tverdict: TradeVerdict;\n\tagreements: ThreeAgreements;\n\tfaces: FaceVerdict[];\n\tconsensus: ConsensusResult | null;\n\treasoning: string;\n\ttimestamp: string;\n}\n\n/** Evaluate the Three Agreements and produce a verdict. Pure logic — no MCP calls, no side effects. */\nexport function evaluateGate(agreements: ThreeAgreements): TradeVerdict {\n\tconst { trendAlignment, signalPresence, gardenCapacity } = agreements;\n\n\tif (trendAlignment && signalPresence && gardenCapacity) {\n\t\treturn \"ALLOW\";\n\t}\n\n\tif (!signalPresence || !gardenCapacity) {\n\t\treturn \"NO_TRADE\";\n\t}\n\n\treturn \"WAIT\";\n}\n\n/** Check if Williams dimensions support a trade direction. */\nexport function dimensionsSupportDirection(dims: WilliamsDimensions, direction: TradeDirection): boolean {\n\tconst alligatorSupports =\n\t\t!dims.alligator.sleeping &&\n\t\t((direction === \"long\" && dims.alligator.direction === \"bullish\") ||\n\t\t\t(direction === \"short\" && dims.alligator.direction === \"bearish\"));\n\n\tconst aoSupports = (direction === \"long\" && dims.ao.value > 0) || (direction === \"short\" && dims.ao.value < 0);\n\n\tconst fdbPresent = dims.fdb !== null && dims.fdb.direction === direction;\n\n\treturn alligatorSupports && aoSupports && fdbPresent;\n}\n"]}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Trade direction */
|
|
2
|
+
export type TradeDirection = "long" | "short";
|
|
3
|
+
/** Trade verdict — the output of the gate protocol */
|
|
4
|
+
export type TradeVerdict = "ALLOW" | "WAIT" | "NO_TRADE";
|
|
5
|
+
/** Timeframes used in the Williams Method hierarchy */
|
|
6
|
+
export type Timeframe = "M1" | "M5" | "M15" | "M30" | "H1" | "H4" | "D1" | "W1" | "MN";
|
|
7
|
+
/** Signal strength assessment */
|
|
8
|
+
export type SignalStrength = "strong" | "moderate" | "weak";
|
|
9
|
+
/** Market regime (garden weather) */
|
|
10
|
+
export type MarketRegime = "trending" | "ranging" | "volatile" | "quiet";
|
|
11
|
+
/** Pattern lifecycle stage (seed → sprout → tree) */
|
|
12
|
+
export type PatternStage = "seed" | "sprout" | "sapling" | "tree" | "harvest" | "composting";
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C,wDAAsD;AACtD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAEzD,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvF,iCAAiC;AACjC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAE5D,qCAAqC;AACrC,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAEzE,yDAAqD;AACrD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC","sourcesContent":["/** Trade direction */\nexport type TradeDirection = \"long\" | \"short\";\n\n/** Trade verdict — the output of the gate protocol */\nexport type TradeVerdict = \"ALLOW\" | \"WAIT\" | \"NO_TRADE\";\n\n/** Timeframes used in the Williams Method hierarchy */\nexport type Timeframe = \"M1\" | \"M5\" | \"M15\" | \"M30\" | \"H1\" | \"H4\" | \"D1\" | \"W1\" | \"MN\";\n\n/** Signal strength assessment */\nexport type SignalStrength = \"strong\" | \"moderate\" | \"weak\";\n\n/** Market regime (garden weather) */\nexport type MarketRegime = \"trending\" | \"ranging\" | \"volatile\" | \"quiet\";\n\n/** Pattern lifecycle stage (seed → sprout → tree) */\nexport type PatternStage = \"seed\" | \"sprout\" | \"sapling\" | \"tree\" | \"harvest\" | \"composting\";\n"]}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/** Trade direction */\nexport type TradeDirection = \"long\" | \"short\";\n\n/** Trade verdict — the output of the gate protocol */\nexport type TradeVerdict = \"ALLOW\" | \"WAIT\" | \"NO_TRADE\";\n\n/** Timeframes used in the Williams Method hierarchy */\nexport type Timeframe = \"M1\" | \"M5\" | \"M15\" | \"M30\" | \"H1\" | \"H4\" | \"D1\" | \"W1\" | \"MN\";\n\n/** Signal strength assessment */\nexport type SignalStrength = \"strong\" | \"moderate\" | \"weak\";\n\n/** Market regime (garden weather) */\nexport type MarketRegime = \"trending\" | \"ranging\" | \"volatile\" | \"quiet\";\n\n/** Pattern lifecycle stage (seed → sprout → tree) */\nexport type PatternStage = \"seed\" | \"sprout\" | \"sapling\" | \"tree\" | \"harvest\" | \"composting\";\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { SignalStrength, Timeframe, TradeDirection } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Alligator indicator state.
|
|
4
|
+
* The Alligator's jaw, teeth, and lips determine trend state.
|
|
5
|
+
*/
|
|
6
|
+
export interface AlligatorState {
|
|
7
|
+
jaw: number;
|
|
8
|
+
teeth: number;
|
|
9
|
+
lips: number;
|
|
10
|
+
sleeping: boolean;
|
|
11
|
+
direction: "bullish" | "bearish" | "neutral";
|
|
12
|
+
/** Distance between jaw and lips — wider = stronger trend */
|
|
13
|
+
spread: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Awesome Oscillator (AO) state.
|
|
17
|
+
* Measures market momentum as the difference between 5-period and 34-period SMAs.
|
|
18
|
+
*/
|
|
19
|
+
export interface AOState {
|
|
20
|
+
value: number;
|
|
21
|
+
trend: "rising" | "falling" | "flat";
|
|
22
|
+
/** Whether AO crossed zero recently */
|
|
23
|
+
zeroCross: boolean;
|
|
24
|
+
/** Number of consecutive same-color bars */
|
|
25
|
+
consecutiveBars: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Acceleration/Deceleration Oscillator (AC) state.
|
|
29
|
+
* Measures acceleration of momentum change.
|
|
30
|
+
*/
|
|
31
|
+
export interface ACState {
|
|
32
|
+
value: number;
|
|
33
|
+
acceleration: "positive" | "negative";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fractal levels — key support/resistance markers.
|
|
37
|
+
*/
|
|
38
|
+
export interface FractalLevels {
|
|
39
|
+
highFractal: number | null;
|
|
40
|
+
lowFractal: number | null;
|
|
41
|
+
/** Recent fractal formation timestamps */
|
|
42
|
+
highFractalTime: string | null;
|
|
43
|
+
lowFractalTime: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Fractal Divergent Bar (FDB) — the primary entry signal in Williams Method.
|
|
47
|
+
* An FDB occurs when a fractal forms with divergent momentum.
|
|
48
|
+
*/
|
|
49
|
+
export interface FDBSignal {
|
|
50
|
+
direction: TradeDirection;
|
|
51
|
+
fractalLevel: number;
|
|
52
|
+
aoConfirms: boolean;
|
|
53
|
+
alligatorOpen: boolean;
|
|
54
|
+
strength: SignalStrength;
|
|
55
|
+
/** Bar index where the FDB was detected */
|
|
56
|
+
barIndex: number;
|
|
57
|
+
}
|
|
58
|
+
/** Zone — the coloring of the current bar based on AO + AC alignment. */
|
|
59
|
+
export type Zone = "green" | "red" | "gray";
|
|
60
|
+
/**
|
|
61
|
+
* Complete Williams 5 Dimensions snapshot for an instrument/timeframe.
|
|
62
|
+
*/
|
|
63
|
+
export interface WilliamsDimensions {
|
|
64
|
+
instrument: string;
|
|
65
|
+
timeframe: Timeframe;
|
|
66
|
+
timestamp: string;
|
|
67
|
+
alligator: AlligatorState;
|
|
68
|
+
ao: AOState;
|
|
69
|
+
ac: ACState;
|
|
70
|
+
fractals: FractalLevels;
|
|
71
|
+
zone: Zone;
|
|
72
|
+
fdb: FDBSignal | null;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=williams-5d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"williams-5d.d.ts","sourceRoot":"","sources":["../src/williams-5d.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC7C,+DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IACrC,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,eAAe,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,0CAA0C;IAC1C,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACzB,SAAS,EAAE,cAAc,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,cAAc,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,2EAAyE;AACzE,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,cAAc,CAAC;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;CACtB","sourcesContent":["import type { SignalStrength, Timeframe, TradeDirection } from \"./types.js\";\n\n/**\n * Alligator indicator state.\n * The Alligator's jaw, teeth, and lips determine trend state.\n */\nexport interface AlligatorState {\n\tjaw: number;\n\tteeth: number;\n\tlips: number;\n\tsleeping: boolean;\n\tdirection: \"bullish\" | \"bearish\" | \"neutral\";\n\t/** Distance between jaw and lips — wider = stronger trend */\n\tspread: number;\n}\n\n/**\n * Awesome Oscillator (AO) state.\n * Measures market momentum as the difference between 5-period and 34-period SMAs.\n */\nexport interface AOState {\n\tvalue: number;\n\ttrend: \"rising\" | \"falling\" | \"flat\";\n\t/** Whether AO crossed zero recently */\n\tzeroCross: boolean;\n\t/** Number of consecutive same-color bars */\n\tconsecutiveBars: number;\n}\n\n/**\n * Acceleration/Deceleration Oscillator (AC) state.\n * Measures acceleration of momentum change.\n */\nexport interface ACState {\n\tvalue: number;\n\tacceleration: \"positive\" | \"negative\";\n}\n\n/**\n * Fractal levels — key support/resistance markers.\n */\nexport interface FractalLevels {\n\thighFractal: number | null;\n\tlowFractal: number | null;\n\t/** Recent fractal formation timestamps */\n\thighFractalTime: string | null;\n\tlowFractalTime: string | null;\n}\n\n/**\n * Fractal Divergent Bar (FDB) — the primary entry signal in Williams Method.\n * An FDB occurs when a fractal forms with divergent momentum.\n */\nexport interface FDBSignal {\n\tdirection: TradeDirection;\n\tfractalLevel: number;\n\taoConfirms: boolean;\n\talligatorOpen: boolean;\n\tstrength: SignalStrength;\n\t/** Bar index where the FDB was detected */\n\tbarIndex: number;\n}\n\n/** Zone — the coloring of the current bar based on AO + AC alignment. */\nexport type Zone = \"green\" | \"red\" | \"gray\";\n\n/**\n * Complete Williams 5 Dimensions snapshot for an instrument/timeframe.\n */\nexport interface WilliamsDimensions {\n\tinstrument: string;\n\ttimeframe: Timeframe;\n\ttimestamp: string;\n\talligator: AlligatorState;\n\tao: AOState;\n\tac: ACState;\n\tfractals: FractalLevels;\n\tzone: Zone;\n\tfdb: FDBSignal | null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"williams-5d.js","sourceRoot":"","sources":["../src/williams-5d.ts"],"names":[],"mappings":"","sourcesContent":["import type { SignalStrength, Timeframe, TradeDirection } from \"./types.js\";\n\n/**\n * Alligator indicator state.\n * The Alligator's jaw, teeth, and lips determine trend state.\n */\nexport interface AlligatorState {\n\tjaw: number;\n\tteeth: number;\n\tlips: number;\n\tsleeping: boolean;\n\tdirection: \"bullish\" | \"bearish\" | \"neutral\";\n\t/** Distance between jaw and lips — wider = stronger trend */\n\tspread: number;\n}\n\n/**\n * Awesome Oscillator (AO) state.\n * Measures market momentum as the difference between 5-period and 34-period SMAs.\n */\nexport interface AOState {\n\tvalue: number;\n\ttrend: \"rising\" | \"falling\" | \"flat\";\n\t/** Whether AO crossed zero recently */\n\tzeroCross: boolean;\n\t/** Number of consecutive same-color bars */\n\tconsecutiveBars: number;\n}\n\n/**\n * Acceleration/Deceleration Oscillator (AC) state.\n * Measures acceleration of momentum change.\n */\nexport interface ACState {\n\tvalue: number;\n\tacceleration: \"positive\" | \"negative\";\n}\n\n/**\n * Fractal levels — key support/resistance markers.\n */\nexport interface FractalLevels {\n\thighFractal: number | null;\n\tlowFractal: number | null;\n\t/** Recent fractal formation timestamps */\n\thighFractalTime: string | null;\n\tlowFractalTime: string | null;\n}\n\n/**\n * Fractal Divergent Bar (FDB) — the primary entry signal in Williams Method.\n * An FDB occurs when a fractal forms with divergent momentum.\n */\nexport interface FDBSignal {\n\tdirection: TradeDirection;\n\tfractalLevel: number;\n\taoConfirms: boolean;\n\talligatorOpen: boolean;\n\tstrength: SignalStrength;\n\t/** Bar index where the FDB was detected */\n\tbarIndex: number;\n}\n\n/** Zone — the coloring of the current bar based on AO + AC alignment. */\nexport type Zone = \"green\" | \"red\" | \"gray\";\n\n/**\n * Complete Williams 5 Dimensions snapshot for an instrument/timeframe.\n */\nexport interface WilliamsDimensions {\n\tinstrument: string;\n\ttimeframe: Timeframe;\n\ttimestamp: string;\n\talligator: AlligatorState;\n\tao: AOState;\n\tac: ACState;\n\tfractals: FractalLevels;\n\tzone: Zone;\n\tfdb: FDBSignal | null;\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@avadisabelle/ava-pi-trading",
|
|
3
|
+
"version": "0.63.1",
|
|
4
|
+
"description": "Williams 5D trading types, ARIANE trade gate protocol, and garden metaphor for the Ava ecosystem",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"clean": "shx rm -rf dist",
|
|
20
|
+
"build": "tsgo -p tsconfig.json",
|
|
21
|
+
"dev": "tsgo -p tsconfig.json --watch --preserveWatchOutput",
|
|
22
|
+
"test": "vitest --run",
|
|
23
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"trading",
|
|
27
|
+
"williams-5d",
|
|
28
|
+
"ariane",
|
|
29
|
+
"trade-gate",
|
|
30
|
+
"fdb",
|
|
31
|
+
"alligator",
|
|
32
|
+
"garden",
|
|
33
|
+
"ava"
|
|
34
|
+
],
|
|
35
|
+
"author": "Guillaume JG Isabelle",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/avadisabelle/ava-pi.git",
|
|
40
|
+
"directory": "packages/trading"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@avadisabelle/ava-council": "^0.63.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^22.10.5",
|
|
47
|
+
"typescript": "^5.9.2",
|
|
48
|
+
"vitest": "^3.2.4"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=20.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|