@tradejs/strategy-double-tap 3.0.0
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/LICENSE +96 -0
- package/README.md +34 -0
- package/dist/index.cjs +1677 -0
- package/dist/index.d.cts +90 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +1653 -0
- package/package.json +65 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { StrategyConfig, Interval, BacktestPriceMode, Direction, StrategyRegistryEntry, StrategyManifest, StrategyAiAdapter } from '@tradejs/types';
|
|
2
|
+
|
|
3
|
+
interface DoubleTapSideConfig {
|
|
4
|
+
enable: boolean;
|
|
5
|
+
direction: Direction;
|
|
6
|
+
minRiskRatio: number;
|
|
7
|
+
}
|
|
8
|
+
type DoubleTapEntryMode = "breakout" | "close_acceptance" | "retest";
|
|
9
|
+
declare const config: {
|
|
10
|
+
readonly ENV: "BACKTEST";
|
|
11
|
+
readonly INTERVAL: Interval;
|
|
12
|
+
readonly MAKE_ORDERS: true;
|
|
13
|
+
readonly CLOSE_OPPOSITE_POSITIONS: false;
|
|
14
|
+
readonly BACKTEST_PRICE_MODE: "open";
|
|
15
|
+
readonly AI_ENABLED: false;
|
|
16
|
+
readonly AI_MODE: "llm";
|
|
17
|
+
readonly ML_ENABLED: false;
|
|
18
|
+
readonly ML_THRESHOLD: 0.1;
|
|
19
|
+
readonly MIN_AI_QUALITY: 4;
|
|
20
|
+
readonly FEE_PERCENT: 0.001;
|
|
21
|
+
readonly MAX_LOSS_VALUE: 10;
|
|
22
|
+
readonly MA_FAST: 14;
|
|
23
|
+
readonly MA_MEDIUM: 49;
|
|
24
|
+
readonly MA_SLOW: 50;
|
|
25
|
+
readonly OBV_SMA: 10;
|
|
26
|
+
readonly ATR: 14;
|
|
27
|
+
readonly ATR_PCT_SHORT: 7;
|
|
28
|
+
readonly ATR_PCT_LONG: 30;
|
|
29
|
+
readonly BB: 20;
|
|
30
|
+
readonly BB_STD: 2;
|
|
31
|
+
readonly MACD_FAST: 12;
|
|
32
|
+
readonly MACD_SLOW: 26;
|
|
33
|
+
readonly MACD_SIGNAL: 9;
|
|
34
|
+
readonly DOUBLETAP_PIVOT_LENGTH: 35;
|
|
35
|
+
readonly DOUBLETAP_PIVOT_TOLERANCE_PCT: 12;
|
|
36
|
+
readonly DOUBLETAP_TARGET_FIB_PCT: 180;
|
|
37
|
+
readonly DOUBLETAP_STOP_FIB_PCT: 0;
|
|
38
|
+
readonly DOUBLETAP_MIN_PATTERN_HEIGHT_PCT: 0.2;
|
|
39
|
+
readonly DOUBLETAP_MIN_PATTERN_HEIGHT_ATR: 1;
|
|
40
|
+
readonly DOUBLETAP_ATR_PERIOD: 14;
|
|
41
|
+
readonly DOUBLETAP_MIN_TAP_SPACING_BARS: 3;
|
|
42
|
+
readonly DOUBLETAP_MAX_PATTERN_AGE_BARS: 180;
|
|
43
|
+
readonly DOUBLETAP_MIN_LEG_SYMMETRY_RATIO: 0.25;
|
|
44
|
+
readonly DOUBLETAP_MIN_BREAKOUT_DISTANCE_ATR: 0.05;
|
|
45
|
+
readonly DOUBLETAP_MAX_BREAKOUT_DISTANCE_HEIGHT_RATIO: 0.8;
|
|
46
|
+
readonly DOUBLETAP_MAX_BREAKOUT_DISTANCE_PCT: 0.8;
|
|
47
|
+
readonly DOUBLETAP_ENTRY_MODE: DoubleTapEntryMode;
|
|
48
|
+
readonly DOUBLETAP_CONFIRMATION_MAX_BARS: 2;
|
|
49
|
+
readonly DOUBLETAP_MAX_ENTRY_CONFIRMATION_BARS: 0;
|
|
50
|
+
readonly DOUBLETAP_MAX_ENTRY_CONFIRMATION_BARS_LONG: 1;
|
|
51
|
+
readonly DOUBLETAP_MAX_ENTRY_CONFIRMATION_BARS_SHORT: 0;
|
|
52
|
+
readonly DOUBLETAP_MAX_BB_WIDTH_PCT: 0;
|
|
53
|
+
readonly DOUBLETAP_MAX_BB_WIDTH_PCT_LONG: 0;
|
|
54
|
+
readonly DOUBLETAP_MAX_BB_WIDTH_PCT_SHORT: 6;
|
|
55
|
+
readonly DOUBLETAP_RETEST_MAX_BARS: 4;
|
|
56
|
+
readonly DOUBLETAP_RETEST_TOLERANCE_ATR: 0.25;
|
|
57
|
+
readonly DOUBLETAP_EXIT_ON_OPPOSITE_PATTERN: true;
|
|
58
|
+
readonly LONG: {
|
|
59
|
+
readonly enable: true;
|
|
60
|
+
readonly direction: "LONG";
|
|
61
|
+
readonly minRiskRatio: 0.7;
|
|
62
|
+
};
|
|
63
|
+
readonly SHORT: {
|
|
64
|
+
readonly enable: true;
|
|
65
|
+
readonly direction: "SHORT";
|
|
66
|
+
readonly minRiskRatio: 0.7;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
type DoubleTapConfig = StrategyConfig & Omit<typeof config, "BACKTEST_PRICE_MODE" | "LONG" | "SHORT" | "MIN_AI_QUALITY"> & {
|
|
70
|
+
BACKTEST_PRICE_MODE: BacktestPriceMode;
|
|
71
|
+
MIN_AI_QUALITY: number;
|
|
72
|
+
DOUBLETAP_ENTRY_MODE: DoubleTapEntryMode;
|
|
73
|
+
LONG: DoubleTapSideConfig;
|
|
74
|
+
SHORT: DoubleTapSideConfig;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
declare const DoubleTapStrategyDefinition: StrategyRegistryEntry<DoubleTapConfig>;
|
|
78
|
+
|
|
79
|
+
declare const doubleTapManifest: StrategyManifest;
|
|
80
|
+
|
|
81
|
+
declare const doubleTapAiAdapter: StrategyAiAdapter;
|
|
82
|
+
|
|
83
|
+
declare const strategyEntries: StrategyRegistryEntry[];
|
|
84
|
+
declare const getBuiltInStrategyDefaultConfig: (strategyName: string) => StrategyConfig | undefined;
|
|
85
|
+
|
|
86
|
+
declare const _default: {
|
|
87
|
+
strategyEntries: StrategyRegistryEntry<any>[];
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { DoubleTapStrategyDefinition, _default as default, doubleTapAiAdapter, config as doubleTapDefaultConfig, doubleTapManifest, getBuiltInStrategyDefaultConfig, strategyEntries };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { StrategyConfig, Interval, BacktestPriceMode, Direction, StrategyRegistryEntry, StrategyManifest, StrategyAiAdapter } from '@tradejs/types';
|
|
2
|
+
|
|
3
|
+
interface DoubleTapSideConfig {
|
|
4
|
+
enable: boolean;
|
|
5
|
+
direction: Direction;
|
|
6
|
+
minRiskRatio: number;
|
|
7
|
+
}
|
|
8
|
+
type DoubleTapEntryMode = "breakout" | "close_acceptance" | "retest";
|
|
9
|
+
declare const config: {
|
|
10
|
+
readonly ENV: "BACKTEST";
|
|
11
|
+
readonly INTERVAL: Interval;
|
|
12
|
+
readonly MAKE_ORDERS: true;
|
|
13
|
+
readonly CLOSE_OPPOSITE_POSITIONS: false;
|
|
14
|
+
readonly BACKTEST_PRICE_MODE: "open";
|
|
15
|
+
readonly AI_ENABLED: false;
|
|
16
|
+
readonly AI_MODE: "llm";
|
|
17
|
+
readonly ML_ENABLED: false;
|
|
18
|
+
readonly ML_THRESHOLD: 0.1;
|
|
19
|
+
readonly MIN_AI_QUALITY: 4;
|
|
20
|
+
readonly FEE_PERCENT: 0.001;
|
|
21
|
+
readonly MAX_LOSS_VALUE: 10;
|
|
22
|
+
readonly MA_FAST: 14;
|
|
23
|
+
readonly MA_MEDIUM: 49;
|
|
24
|
+
readonly MA_SLOW: 50;
|
|
25
|
+
readonly OBV_SMA: 10;
|
|
26
|
+
readonly ATR: 14;
|
|
27
|
+
readonly ATR_PCT_SHORT: 7;
|
|
28
|
+
readonly ATR_PCT_LONG: 30;
|
|
29
|
+
readonly BB: 20;
|
|
30
|
+
readonly BB_STD: 2;
|
|
31
|
+
readonly MACD_FAST: 12;
|
|
32
|
+
readonly MACD_SLOW: 26;
|
|
33
|
+
readonly MACD_SIGNAL: 9;
|
|
34
|
+
readonly DOUBLETAP_PIVOT_LENGTH: 35;
|
|
35
|
+
readonly DOUBLETAP_PIVOT_TOLERANCE_PCT: 12;
|
|
36
|
+
readonly DOUBLETAP_TARGET_FIB_PCT: 180;
|
|
37
|
+
readonly DOUBLETAP_STOP_FIB_PCT: 0;
|
|
38
|
+
readonly DOUBLETAP_MIN_PATTERN_HEIGHT_PCT: 0.2;
|
|
39
|
+
readonly DOUBLETAP_MIN_PATTERN_HEIGHT_ATR: 1;
|
|
40
|
+
readonly DOUBLETAP_ATR_PERIOD: 14;
|
|
41
|
+
readonly DOUBLETAP_MIN_TAP_SPACING_BARS: 3;
|
|
42
|
+
readonly DOUBLETAP_MAX_PATTERN_AGE_BARS: 180;
|
|
43
|
+
readonly DOUBLETAP_MIN_LEG_SYMMETRY_RATIO: 0.25;
|
|
44
|
+
readonly DOUBLETAP_MIN_BREAKOUT_DISTANCE_ATR: 0.05;
|
|
45
|
+
readonly DOUBLETAP_MAX_BREAKOUT_DISTANCE_HEIGHT_RATIO: 0.8;
|
|
46
|
+
readonly DOUBLETAP_MAX_BREAKOUT_DISTANCE_PCT: 0.8;
|
|
47
|
+
readonly DOUBLETAP_ENTRY_MODE: DoubleTapEntryMode;
|
|
48
|
+
readonly DOUBLETAP_CONFIRMATION_MAX_BARS: 2;
|
|
49
|
+
readonly DOUBLETAP_MAX_ENTRY_CONFIRMATION_BARS: 0;
|
|
50
|
+
readonly DOUBLETAP_MAX_ENTRY_CONFIRMATION_BARS_LONG: 1;
|
|
51
|
+
readonly DOUBLETAP_MAX_ENTRY_CONFIRMATION_BARS_SHORT: 0;
|
|
52
|
+
readonly DOUBLETAP_MAX_BB_WIDTH_PCT: 0;
|
|
53
|
+
readonly DOUBLETAP_MAX_BB_WIDTH_PCT_LONG: 0;
|
|
54
|
+
readonly DOUBLETAP_MAX_BB_WIDTH_PCT_SHORT: 6;
|
|
55
|
+
readonly DOUBLETAP_RETEST_MAX_BARS: 4;
|
|
56
|
+
readonly DOUBLETAP_RETEST_TOLERANCE_ATR: 0.25;
|
|
57
|
+
readonly DOUBLETAP_EXIT_ON_OPPOSITE_PATTERN: true;
|
|
58
|
+
readonly LONG: {
|
|
59
|
+
readonly enable: true;
|
|
60
|
+
readonly direction: "LONG";
|
|
61
|
+
readonly minRiskRatio: 0.7;
|
|
62
|
+
};
|
|
63
|
+
readonly SHORT: {
|
|
64
|
+
readonly enable: true;
|
|
65
|
+
readonly direction: "SHORT";
|
|
66
|
+
readonly minRiskRatio: 0.7;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
type DoubleTapConfig = StrategyConfig & Omit<typeof config, "BACKTEST_PRICE_MODE" | "LONG" | "SHORT" | "MIN_AI_QUALITY"> & {
|
|
70
|
+
BACKTEST_PRICE_MODE: BacktestPriceMode;
|
|
71
|
+
MIN_AI_QUALITY: number;
|
|
72
|
+
DOUBLETAP_ENTRY_MODE: DoubleTapEntryMode;
|
|
73
|
+
LONG: DoubleTapSideConfig;
|
|
74
|
+
SHORT: DoubleTapSideConfig;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
declare const DoubleTapStrategyDefinition: StrategyRegistryEntry<DoubleTapConfig>;
|
|
78
|
+
|
|
79
|
+
declare const doubleTapManifest: StrategyManifest;
|
|
80
|
+
|
|
81
|
+
declare const doubleTapAiAdapter: StrategyAiAdapter;
|
|
82
|
+
|
|
83
|
+
declare const strategyEntries: StrategyRegistryEntry[];
|
|
84
|
+
declare const getBuiltInStrategyDefaultConfig: (strategyName: string) => StrategyConfig | undefined;
|
|
85
|
+
|
|
86
|
+
declare const _default: {
|
|
87
|
+
strategyEntries: StrategyRegistryEntry<any>[];
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { DoubleTapStrategyDefinition, _default as default, doubleTapAiAdapter, config as doubleTapDefaultConfig, doubleTapManifest, getBuiltInStrategyDefaultConfig, strategyEntries };
|