hedgequantx 2.9.222 → 2.9.224
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.
|
@@ -561,7 +561,8 @@ class HQXUltraScalpingStrategy extends EventEmitter {
|
|
|
561
561
|
// Set last bar time to now
|
|
562
562
|
this.lastBarTime.set(contractId, Date.now());
|
|
563
563
|
|
|
564
|
-
|
|
564
|
+
// Tick-based strategy uses bars only for warmup reference data (volatility, ranges)
|
|
565
|
+
this.emit('log', { type: 'info', message: `Reference data loaded (${histBars.length} periods) - tick engine ready` });
|
|
565
566
|
}
|
|
566
567
|
|
|
567
568
|
/**
|
package/package.json
CHANGED
|
@@ -14,225 +14,225 @@
|
|
|
14
14
|
// ============================================================================
|
|
15
15
|
|
|
16
16
|
const INSTRUMENT_CONTEXT = {
|
|
17
|
-
// NASDAQ (NQ/MNQ) -
|
|
17
|
+
// NASDAQ (NQ/MNQ) - High volatility, momentum-driven
|
|
18
18
|
NQ: {
|
|
19
19
|
name: 'Nasdaq',
|
|
20
|
-
traits: ['
|
|
20
|
+
traits: ['high-volatility', 'momentum', 'mean-reverting'],
|
|
21
21
|
bullish: [
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
22
|
+
'Positive Z-score momentum building',
|
|
23
|
+
'OFI bid imbalance detected',
|
|
24
|
+
'Buyers absorbing at bid levels',
|
|
25
|
+
'Momentum factor positive',
|
|
26
|
+
'Upside tick pressure increasing',
|
|
27
|
+
'Bid depth strengthening',
|
|
28
|
+
'Volume-weighted flow bullish',
|
|
29
|
+
'VWAP reclaim in progress',
|
|
30
|
+
'Positive order flow divergence',
|
|
31
|
+
'Cumulative delta rising',
|
|
32
32
|
],
|
|
33
33
|
bearish: [
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
34
|
+
'Negative Z-score momentum building',
|
|
35
|
+
'OFI offer imbalance detected',
|
|
36
|
+
'Sellers pressing through bids',
|
|
37
|
+
'Momentum factor negative',
|
|
38
|
+
'Downside tick pressure increasing',
|
|
39
|
+
'Offer depth building',
|
|
40
|
+
'Volume-weighted flow bearish',
|
|
41
|
+
'VWAP breakdown confirmed',
|
|
42
|
+
'Negative order flow divergence',
|
|
43
|
+
'Cumulative delta falling',
|
|
44
44
|
],
|
|
45
45
|
neutral: [
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'
|
|
46
|
+
'Z-score normalized, awaiting extremity',
|
|
47
|
+
'OFI balanced, no clear flow',
|
|
48
|
+
'Price discovery phase active',
|
|
49
|
+
'Volatility compression detected',
|
|
50
|
+
'Range-bound tick action',
|
|
51
51
|
],
|
|
52
52
|
},
|
|
53
53
|
|
|
54
|
-
// S&P 500 (ES/MES) -
|
|
54
|
+
// S&P 500 (ES/MES) - Balanced, institutional flow
|
|
55
55
|
ES: {
|
|
56
56
|
name: 'S&P 500',
|
|
57
|
-
traits: ['
|
|
57
|
+
traits: ['balanced', 'institutional', 'mean-reverting'],
|
|
58
58
|
bullish: [
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'
|
|
59
|
+
'Positive Z-score building',
|
|
60
|
+
'OFI bid imbalance confirmed',
|
|
61
|
+
'Absorption at bid levels',
|
|
62
|
+
'Momentum factor turning up',
|
|
63
|
+
'Positive tick divergence',
|
|
64
|
+
'Bid stack building',
|
|
65
|
+
'Volume delta positive',
|
|
66
|
+
'VWAP support holding',
|
|
67
|
+
'Order flow imbalance bullish',
|
|
68
|
+
'Delta accumulation detected',
|
|
69
69
|
],
|
|
70
70
|
bearish: [
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
77
|
-
'
|
|
78
|
-
'
|
|
79
|
-
'
|
|
80
|
-
'
|
|
71
|
+
'Negative Z-score building',
|
|
72
|
+
'OFI offer imbalance confirmed',
|
|
73
|
+
'Absorption at offer levels',
|
|
74
|
+
'Momentum factor turning down',
|
|
75
|
+
'Negative tick divergence',
|
|
76
|
+
'Offer stack building',
|
|
77
|
+
'Volume delta negative',
|
|
78
|
+
'VWAP resistance holding',
|
|
79
|
+
'Order flow imbalance bearish',
|
|
80
|
+
'Delta distribution detected',
|
|
81
81
|
],
|
|
82
82
|
neutral: [
|
|
83
|
-
'
|
|
84
|
-
'
|
|
85
|
-
'
|
|
86
|
-
'
|
|
87
|
-
'
|
|
83
|
+
'Z-score near zero, balanced',
|
|
84
|
+
'OFI neutral, no edge',
|
|
85
|
+
'Tick flow balanced',
|
|
86
|
+
'Volatility regime stable',
|
|
87
|
+
'Awaiting statistical extremity',
|
|
88
88
|
],
|
|
89
89
|
},
|
|
90
90
|
|
|
91
|
-
// Crude Oil (CL/MCL) -
|
|
91
|
+
// Crude Oil (CL/MCL) - High volatility, trend-following
|
|
92
92
|
CL: {
|
|
93
93
|
name: 'Crude Oil',
|
|
94
|
-
traits: ['
|
|
94
|
+
traits: ['high-volatility', 'trending', 'momentum'],
|
|
95
95
|
bullish: [
|
|
96
|
-
'
|
|
97
|
-
'
|
|
98
|
-
'
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
'
|
|
102
|
-
'
|
|
103
|
-
'
|
|
104
|
-
'
|
|
105
|
-
'
|
|
96
|
+
'Positive Z-score momentum',
|
|
97
|
+
'OFI bid pressure building',
|
|
98
|
+
'Absorption at bid levels',
|
|
99
|
+
'Momentum vector positive',
|
|
100
|
+
'Upside tick acceleration',
|
|
101
|
+
'Bid depth increasing',
|
|
102
|
+
'Volume flow bullish',
|
|
103
|
+
'Delta accumulation strong',
|
|
104
|
+
'Positive tick imbalance',
|
|
105
|
+
'Order flow divergence up',
|
|
106
106
|
],
|
|
107
107
|
bearish: [
|
|
108
|
-
'
|
|
109
|
-
'
|
|
110
|
-
'
|
|
111
|
-
'
|
|
112
|
-
'
|
|
113
|
-
'
|
|
114
|
-
'
|
|
115
|
-
'
|
|
116
|
-
'
|
|
117
|
-
'
|
|
108
|
+
'Negative Z-score momentum',
|
|
109
|
+
'OFI offer pressure building',
|
|
110
|
+
'Absorption at offer levels',
|
|
111
|
+
'Momentum vector negative',
|
|
112
|
+
'Downside tick acceleration',
|
|
113
|
+
'Offer depth increasing',
|
|
114
|
+
'Volume flow bearish',
|
|
115
|
+
'Delta distribution strong',
|
|
116
|
+
'Negative tick imbalance',
|
|
117
|
+
'Order flow divergence down',
|
|
118
118
|
],
|
|
119
119
|
neutral: [
|
|
120
|
-
'
|
|
121
|
-
'
|
|
122
|
-
'
|
|
123
|
-
'
|
|
124
|
-
'
|
|
120
|
+
'Z-score near mean',
|
|
121
|
+
'OFI balanced, no edge',
|
|
122
|
+
'Tick flow equilibrium',
|
|
123
|
+
'Volatility regime stable',
|
|
124
|
+
'Awaiting directional signal',
|
|
125
125
|
],
|
|
126
126
|
},
|
|
127
127
|
|
|
128
|
-
// Gold (GC/MGC) -
|
|
128
|
+
// Gold (GC/MGC) - Mean-reverting, volatility sensitive
|
|
129
129
|
GC: {
|
|
130
130
|
name: 'Gold',
|
|
131
|
-
traits: ['
|
|
131
|
+
traits: ['mean-reverting', 'volatility-sensitive', 'balanced'],
|
|
132
132
|
bullish: [
|
|
133
|
-
'
|
|
134
|
-
'
|
|
135
|
-
'
|
|
136
|
-
'
|
|
137
|
-
'
|
|
138
|
-
'
|
|
139
|
-
'
|
|
140
|
-
'
|
|
141
|
-
'
|
|
142
|
-
'
|
|
133
|
+
'Positive Z-score deviation',
|
|
134
|
+
'OFI bid imbalance',
|
|
135
|
+
'Buyers absorbing offers',
|
|
136
|
+
'Momentum turning positive',
|
|
137
|
+
'Positive tick pressure',
|
|
138
|
+
'Bid stack building',
|
|
139
|
+
'Volume delta positive',
|
|
140
|
+
'Cumulative flow bullish',
|
|
141
|
+
'Order imbalance up',
|
|
142
|
+
'Statistical edge long',
|
|
143
143
|
],
|
|
144
144
|
bearish: [
|
|
145
|
-
'
|
|
146
|
-
'
|
|
147
|
-
'
|
|
148
|
-
'
|
|
149
|
-
'
|
|
150
|
-
'
|
|
151
|
-
'
|
|
152
|
-
'
|
|
153
|
-
'
|
|
154
|
-
'
|
|
145
|
+
'Negative Z-score deviation',
|
|
146
|
+
'OFI offer imbalance',
|
|
147
|
+
'Sellers absorbing bids',
|
|
148
|
+
'Momentum turning negative',
|
|
149
|
+
'Negative tick pressure',
|
|
150
|
+
'Offer stack building',
|
|
151
|
+
'Volume delta negative',
|
|
152
|
+
'Cumulative flow bearish',
|
|
153
|
+
'Order imbalance down',
|
|
154
|
+
'Statistical edge short',
|
|
155
155
|
],
|
|
156
156
|
neutral: [
|
|
157
|
-
'
|
|
158
|
-
'
|
|
159
|
-
'
|
|
160
|
-
'
|
|
161
|
-
'
|
|
157
|
+
'Z-score normalized',
|
|
158
|
+
'OFI balanced',
|
|
159
|
+
'Tick flow neutral',
|
|
160
|
+
'Volatility compression',
|
|
161
|
+
'No statistical edge',
|
|
162
162
|
],
|
|
163
163
|
},
|
|
164
164
|
|
|
165
|
-
// Russell 2000 (RTY/M2K) -
|
|
165
|
+
// Russell 2000 (RTY/M2K) - High beta, momentum-driven
|
|
166
166
|
RTY: {
|
|
167
167
|
name: 'Russell 2000',
|
|
168
|
-
traits: ['
|
|
168
|
+
traits: ['high-beta', 'momentum', 'volatile'],
|
|
169
169
|
bullish: [
|
|
170
|
-
'
|
|
171
|
-
'
|
|
172
|
-
'
|
|
173
|
-
'
|
|
174
|
-
'
|
|
175
|
-
'
|
|
176
|
-
'
|
|
177
|
-
'
|
|
178
|
-
'
|
|
179
|
-
'
|
|
170
|
+
'Positive Z-score momentum',
|
|
171
|
+
'OFI bid imbalance strong',
|
|
172
|
+
'Absorption at bid levels',
|
|
173
|
+
'Momentum factor bullish',
|
|
174
|
+
'Upside tick pressure',
|
|
175
|
+
'Bid depth building',
|
|
176
|
+
'Volume flow positive',
|
|
177
|
+
'Delta accumulation',
|
|
178
|
+
'Tick imbalance bullish',
|
|
179
|
+
'Order flow divergence up',
|
|
180
180
|
],
|
|
181
181
|
bearish: [
|
|
182
|
-
'
|
|
183
|
-
'
|
|
184
|
-
'
|
|
185
|
-
'
|
|
186
|
-
'
|
|
187
|
-
'
|
|
188
|
-
'
|
|
189
|
-
'
|
|
190
|
-
'
|
|
191
|
-
'
|
|
182
|
+
'Negative Z-score momentum',
|
|
183
|
+
'OFI offer imbalance strong',
|
|
184
|
+
'Absorption at offer levels',
|
|
185
|
+
'Momentum factor bearish',
|
|
186
|
+
'Downside tick pressure',
|
|
187
|
+
'Offer depth building',
|
|
188
|
+
'Volume flow negative',
|
|
189
|
+
'Delta distribution',
|
|
190
|
+
'Tick imbalance bearish',
|
|
191
|
+
'Order flow divergence down',
|
|
192
192
|
],
|
|
193
193
|
neutral: [
|
|
194
|
-
'
|
|
195
|
-
'
|
|
196
|
-
'
|
|
197
|
-
'
|
|
198
|
-
'
|
|
194
|
+
'Z-score balanced',
|
|
195
|
+
'OFI neutral',
|
|
196
|
+
'Tick flow even',
|
|
197
|
+
'Volatility stable',
|
|
198
|
+
'No statistical edge',
|
|
199
199
|
],
|
|
200
200
|
},
|
|
201
201
|
|
|
202
|
-
// Dow Jones (YM/MYM) -
|
|
202
|
+
// Dow Jones (YM/MYM) - Balanced, mean-reverting
|
|
203
203
|
YM: {
|
|
204
204
|
name: 'Dow Jones',
|
|
205
|
-
traits: ['
|
|
205
|
+
traits: ['balanced', 'mean-reverting', 'stable'],
|
|
206
206
|
bullish: [
|
|
207
|
-
'
|
|
208
|
-
'
|
|
209
|
-
'
|
|
210
|
-
'
|
|
211
|
-
'
|
|
212
|
-
'
|
|
213
|
-
'
|
|
214
|
-
'
|
|
215
|
-
'
|
|
216
|
-
'
|
|
207
|
+
'Positive Z-score building',
|
|
208
|
+
'OFI bid imbalance',
|
|
209
|
+
'Buyers absorbing',
|
|
210
|
+
'Momentum positive',
|
|
211
|
+
'Tick pressure up',
|
|
212
|
+
'Bid stack strong',
|
|
213
|
+
'Volume delta bullish',
|
|
214
|
+
'Cumulative flow up',
|
|
215
|
+
'Order imbalance long',
|
|
216
|
+
'Statistical edge bullish',
|
|
217
217
|
],
|
|
218
218
|
bearish: [
|
|
219
|
-
'
|
|
220
|
-
'
|
|
221
|
-
'
|
|
222
|
-
'
|
|
223
|
-
'
|
|
224
|
-
'
|
|
225
|
-
'
|
|
226
|
-
'
|
|
227
|
-
'
|
|
228
|
-
'
|
|
219
|
+
'Negative Z-score building',
|
|
220
|
+
'OFI offer imbalance',
|
|
221
|
+
'Sellers absorbing',
|
|
222
|
+
'Momentum negative',
|
|
223
|
+
'Tick pressure down',
|
|
224
|
+
'Offer stack strong',
|
|
225
|
+
'Volume delta bearish',
|
|
226
|
+
'Cumulative flow down',
|
|
227
|
+
'Order imbalance short',
|
|
228
|
+
'Statistical edge bearish',
|
|
229
229
|
],
|
|
230
230
|
neutral: [
|
|
231
|
-
'
|
|
232
|
-
'
|
|
233
|
-
'
|
|
234
|
-
'
|
|
235
|
-
'
|
|
231
|
+
'Z-score normalized',
|
|
232
|
+
'OFI balanced',
|
|
233
|
+
'Tick flow neutral',
|
|
234
|
+
'Volatility compression',
|
|
235
|
+
'Awaiting extremity',
|
|
236
236
|
],
|
|
237
237
|
},
|
|
238
238
|
};
|
|
@@ -78,7 +78,12 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
78
78
|
sessionLogger.log('CONFIG', `account=${account.accountId} rithmicId=${account.rithmicAccountId || 'N/A'}`);
|
|
79
79
|
|
|
80
80
|
strategy.on('log', (log) => {
|
|
81
|
-
|
|
81
|
+
// Debug logs only go to session file, not UI (too verbose)
|
|
82
|
+
if (log.type === 'debug') {
|
|
83
|
+
sessionLogger.log('DEBUG', log.message);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const type = log.type === 'info' ? 'analysis' : 'system';
|
|
82
87
|
ui.addLog(type, log.message);
|
|
83
88
|
sessionLogger.log(type.toUpperCase(), log.message);
|
|
84
89
|
});
|
|
@@ -352,12 +357,12 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
352
357
|
if (histBars && histBars.length > 0) {
|
|
353
358
|
strategy.preloadBars(contractId, histBars);
|
|
354
359
|
// Different message for tick-based vs bar-based strategies
|
|
355
|
-
const isTickBased = strategyId === 'ultra-scalping';
|
|
360
|
+
const isTickBased = strategyId === 'ultra-scalping' || strategyId === 'hqx-scalping';
|
|
356
361
|
const msg = isTickBased
|
|
357
|
-
? `
|
|
362
|
+
? `Reference data loaded - QUANT tick engine initializing...`
|
|
358
363
|
: `Loaded ${histBars.length} historical bars - ready to trade!`;
|
|
359
364
|
ui.addLog('system', msg);
|
|
360
|
-
sessionLogger.log('
|
|
365
|
+
sessionLogger.log('WARMUP', isTickBased ? `Tick engine warmup with ${histBars.length} ref periods` : `Preloaded ${histBars.length} bars`);
|
|
361
366
|
} else {
|
|
362
367
|
ui.addLog('system', 'No history - warming up with live ticks...');
|
|
363
368
|
}
|
|
@@ -74,13 +74,15 @@ const executeMultiSymbol = async ({ service, account, contracts, config, strateg
|
|
|
74
74
|
// Filter logs - only show important events (swings, zones, signals)
|
|
75
75
|
strategy.on('log', (log) => {
|
|
76
76
|
const msg = log.message || '';
|
|
77
|
+
// Skip debug logs in UI (too verbose)
|
|
78
|
+
if (log.type === 'debug') return;
|
|
77
79
|
// Skip bar close logs (too noisy with 5 symbols)
|
|
78
80
|
if (msg.includes('[BAR]')) return;
|
|
79
81
|
// Skip routine pivot checks
|
|
80
82
|
if (msg.includes('Checking pivot')) return;
|
|
81
83
|
// Show swing and zone events
|
|
82
84
|
const prefix = `[${symbolCode}] `;
|
|
83
|
-
ui.addLog(
|
|
85
|
+
ui.addLog('analysis', prefix + msg);
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
88
|
|