hedgequantx 2.9.95 → 2.9.96

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.
@@ -1 +1 @@
1
- const _0x183474=_0xa0d7;function _0xa0d7(_0x603741,_0x487671){_0x603741=_0x603741-0xb7;const _0x1fe0b1=_0x1fe0();let _0xa0d7ea=_0x1fe0b1[_0x603741];return _0xa0d7ea;}function _0x1fe0(){const _0x5362e2=['isDST','startTime','isWithinSession','RESISTANCE','_detectSweep','cooldownBars','811560xmeNET','push','maxDurationBars','exitBarIndex','session','open','_updateZones',',\x20TF=1min','isValid','Collecting\x20data...\x20','execution','onTrade','liquidityZones','now','[HQX-2B]\x20Params:\x20Stop=','info','breakevenTicks','pnl','maxZoneDistanceTicks','losses','targetTicks','28448910SsjWLs','strength','extremePrice','t\x20|\x20Vol:','\x20|\x20Pen:','sweepType','priceHigh','4000653PuitKT','sell','map','symbol','MODERATE','117235CAEGgI','debug','volumeRatio','find','stats','entryBarIndex','high','tickValue','[HQX-2B]\x20Preload\x20complete:\x20','low','short','log','min','1tQzsIO','split','tickSize','swing','object','priceLow','_generateSignal','maxPenetrationTicks','SUPPORT','getLevel','_mergeConfig','onTick','signal','processTick','zone','currentBar','stopTicks','enabled','clusterToleranceTicks','buy','sweptAt','distance','lastSignalTime','initialize','createdAt','get','[2B]\x20NEW\x20SWING\x20','_getVolumeRatio','lookbackBars','activeSweeps','HIGH_SWEEP','max','\x20|\x20Total:\x20','trades','LOSS','preloadBars','recordTradeResult','\x20|\x20Pen:\x20','touches','\x20bars,\x20','\x20@\x20','_detectSwings','t\x20|\x20Q:\x20','delete','[HQX-2B]\x20','timestamp','7MmcEyw','config','getBarHistory','7781496IBGcLi','set','trailTriggerTicks','\x20historical\x20signals\x20detected\x20(ignored)','minPenetrationTicks','type','toFixed','swingPoints','generateSignal','WEAK','[HQX-2B]\x20Initialized\x20for\x20','volume','price','floor','strategy','lastUsedBarIndex','[2B]\x20SWEEP\x20','durationBars','toUpperCase','_scoreSweep','qualityScore','\x20zones',',\x20value=','getFullYear','penetrationTicks','VERY_STRONG','resistance','processBar','getAnalysisState','has','long','BID','\x20|\x20Valid:\x20','barIndex','1213746dXecYN','barHistory','support','ASK','recentTrades','getTimezoneOffset','length','200HwALzf','shift','1488962xYcTRT','abs','reset','LOW_SWEEP','emit','close'];_0x1fe0=function(){return _0x5362e2;};return _0x1fe0();}(function(_0x1f217b,_0x27b1fa){const _0x31f12a=_0xa0d7,_0x5304b0=_0x1f217b();while(!![]){try{const _0x1d1bbf=parseInt(_0x31f12a(0xca))/0x1*(parseInt(_0x31f12a(0x126))/0x2)+-parseInt(_0x31f12a(0x11d))/0x3+-parseInt(_0x31f12a(0x124))/0x4*(parseInt(_0x31f12a(0xbd))/0x5)+parseInt(_0x31f12a(0x132))/0x6+parseInt(_0x31f12a(0xf8))/0x7*(-parseInt(_0x31f12a(0xfb))/0x8)+-parseInt(_0x31f12a(0xb8))/0x9+parseInt(_0x31f12a(0x147))/0xa;if(_0x1d1bbf===_0x27b1fa)break;else _0x5304b0['push'](_0x5304b0['shift']());}catch(_0x3ae918){_0x5304b0['push'](_0x5304b0['shift']());}}}(_0x1fe0,0xb2580));const EventEmitter=require('events'),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x183474(0xc3),'LOW_SWEEP':_0x183474(0xc6)},ZoneType={'RESISTANCE':_0x183474(0x115),'SUPPORT':_0x183474(0x11f)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.2,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':!![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':'America/New_York'}};class SwingPoint{constructor(_0x1103eb,_0xc92303,_0x5f5708,_0x2c1e3c,_0x14682b=0x1){this['type']=_0x1103eb,this['price']=_0xc92303,this['barIndex']=_0x5f5708,this['timestamp']=_0x2c1e3c,this['strength']=_0x14682b;}}class LiquidityZone{constructor(_0xdfc396,_0x17e55e,_0x1ecdc7,_0x15ae41,_0x44cfe7){const _0x571717=_0x183474;this['id']=uuidv4(),this[_0x571717(0x100)]=_0xdfc396,this['priceHigh']=_0x17e55e,this['priceLow']=_0x1ecdc7,this[_0x571717(0xe2)]=_0x15ae41,this[_0x571717(0x11c)]=_0x44cfe7,this[_0x571717(0xf0)]=0x1,this['swept']=![],this['sweptAt']=null,this[_0x571717(0x10a)]=-0x3e7,this['qualityScore']=0.5;}['containsPrice'](_0x54c83b,_0x1bb25c,_0x46950d){const _0x395a18=_0x183474,_0x51b03d=_0x1bb25c*_0x46950d;return _0x54c83b>=this[_0x395a18(0xcf)]-_0x51b03d&&_0x54c83b<=this[_0x395a18(0xb7)]+_0x51b03d;}['getLevel'](){const _0x14d7d1=_0x183474;return(this[_0x14d7d1(0xb7)]+this['priceLow'])/0x2;}}class SweepEvent{constructor(_0x1b137b,_0x18b8ae,_0x4e4a8c,_0x4b741b,_0x138da8){const _0xa4cd4e=_0x183474;this[_0xa4cd4e(0x14c)]=_0x1b137b,this['zone']=_0x18b8ae,this[_0xa4cd4e(0xc2)]=_0x4e4a8c,this['extremeBarIndex']=_0x4b741b,this[_0xa4cd4e(0x149)]=_0x138da8,this['exitBarIndex']=null,this[_0xa4cd4e(0x13a)]=![],this['qualityScore']=0x0,this['penetrationTicks']=0x0,this['durationBars']=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x2c3245={}){const _0x49ac6a=_0x183474;super(),this['config']=this[_0x49ac6a(0xd4)](DEFAULT_CONFIG,_0x2c3245),this[_0x49ac6a(0xcc)]=this[_0x49ac6a(0xf9)][_0x49ac6a(0xcc)],this[_0x49ac6a(0xc4)]=this['config']['tickValue'],this['barHistory']=new Map(),this['swingPoints']=new Map(),this['liquidityZones']=new Map(),this[_0x49ac6a(0xe7)]=new Map(),this[_0x49ac6a(0xd9)]=new Map(),this['barIntervalMs']=0xea60,this[_0x49ac6a(0xe0)]=0x0,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x49ac6a(0x121)]=[];}['_mergeConfig'](_0x1c2002,_0x5e145a){const _0x2d9f6f=_0x183474,_0x40b63d={..._0x1c2002};for(const _0x28c5e4 in _0x5e145a){typeof _0x5e145a[_0x28c5e4]===_0x2d9f6f(0xce)&&!Array['isArray'](_0x5e145a[_0x28c5e4])?_0x40b63d[_0x28c5e4]={..._0x1c2002[_0x28c5e4],..._0x5e145a[_0x28c5e4]}:_0x40b63d[_0x28c5e4]=_0x5e145a[_0x28c5e4];}return _0x40b63d;}[_0x183474(0x12e)](_0x33e3cf){const _0x1cf77b=_0x183474;if(!this[_0x1cf77b(0xf9)]['session'][_0x1cf77b(0xdb)])return!![];const _0x54cd77=new Date(_0x33e3cf),_0x967318=this[_0x1cf77b(0x12c)](_0x54cd77)?-0x4:-0x5,_0x5909dd=_0x54cd77['getUTCHours'](),_0x33ed02=_0x54cd77['getUTCMinutes'](),_0x3d7ea0=(_0x5909dd+_0x967318+0x18)%0x18,{startHour:_0x1af91a,startMinute:_0x37f7e0,endHour:_0x37b0b2,endMinute:_0x42aeb8}=this['config'][_0x1cf77b(0x136)],_0x1bdffd=_0x3d7ea0*0x3c+_0x33ed02,_0xd28341=_0x1af91a*0x3c+_0x37f7e0,_0x18990e=_0x37b0b2*0x3c+_0x42aeb8;return _0x1bdffd>=_0xd28341&&_0x1bdffd<_0x18990e;}[_0x183474(0x12c)](_0x3b61fa){const _0x4e7f02=_0x183474,_0x498628=new Date(_0x3b61fa['getFullYear'](),0x0,0x1),_0x429d98=new Date(_0x3b61fa[_0x4e7f02(0x112)](),0x6,0x1),_0x1d1f0f=Math['max'](_0x498628['getTimezoneOffset'](),_0x429d98[_0x4e7f02(0x122)]());return _0x3b61fa[_0x4e7f02(0x122)]()<_0x1d1f0f;}[_0x183474(0xe1)](_0x2adcff,_0x2b81de=0.25,_0x2e9d01=0x5){const _0x45660b=_0x183474;this['tickSize']=_0x2b81de,this['tickValue']=_0x2e9d01,this['config'][_0x45660b(0xcc)]=_0x2b81de,this['config']['tickValue']=_0x2e9d01,this['barHistory']['set'](_0x2adcff,[]),this[_0x45660b(0x102)][_0x45660b(0xfc)](_0x2adcff,[]),this['liquidityZones'][_0x45660b(0xfc)](_0x2adcff,[]),this[_0x45660b(0xe7)]['set'](_0x2adcff,[]),this['currentBar'][_0x45660b(0xf5)](_0x2adcff),this['emit'](_0x45660b(0xc8),{'type':'info','message':_0x45660b(0x105)+_0x2adcff+':\x20tick='+_0x2b81de+_0x45660b(0x111)+_0x2e9d01+_0x45660b(0x139)}),this[_0x45660b(0x12a)](_0x45660b(0xc8),{'type':_0x45660b(0x141),'message':_0x45660b(0x140)+this['config']['execution'][_0x45660b(0xda)]+'t,\x20Target='+this[_0x45660b(0xf9)][_0x45660b(0x13c)][_0x45660b(0x146)]+'t,\x20BE='+this[_0x45660b(0xf9)]['execution'][_0x45660b(0x142)]+'t,\x20Trail='+this[_0x45660b(0xf9)]['execution'][_0x45660b(0xfd)]+'/'+this[_0x45660b(0xf9)]['execution']['trailDistanceTicks']});}['processTick'](_0xbe9b39){const _0x1f5b3e=_0x183474,{contractId:_0x4bb910,price:_0x4f2757,volume:_0x161cad,timestamp:_0x9eaa3a}=_0xbe9b39,_0x5b010b=_0x9eaa3a||Date[_0x1f5b3e(0x13f)](),_0x3358b6=_0x161cad||0x1;if(!this[_0x1f5b3e(0x12e)](_0x5b010b))return null;let _0x352786=this['currentBar'][_0x1f5b3e(0xe3)](_0x4bb910);const _0x1e8dc5=Math['floor'](_0x5b010b/this['barIntervalMs'])*this['barIntervalMs'];if(!_0x352786||_0x352786['startTime']!==_0x1e8dc5){if(_0x352786){const _0x5a6c07={'timestamp':_0x352786[_0x1f5b3e(0x12d)],'open':_0x352786[_0x1f5b3e(0x137)],'high':_0x352786[_0x1f5b3e(0xc3)],'low':_0x352786[_0x1f5b3e(0xc6)],'close':_0x352786[_0x1f5b3e(0x12b)],'volume':_0x352786['volume']},_0x2b885f=this['processBar'](_0x4bb910,_0x5a6c07);return this[_0x1f5b3e(0xd9)]['set'](_0x4bb910,{'startTime':_0x1e8dc5,'open':_0x4f2757,'high':_0x4f2757,'low':_0x4f2757,'close':_0x4f2757,'volume':_0x3358b6}),_0x2b885f;}else return this['currentBar'][_0x1f5b3e(0xfc)](_0x4bb910,{'startTime':_0x1e8dc5,'open':_0x4f2757,'high':_0x4f2757,'low':_0x4f2757,'close':_0x4f2757,'volume':_0x3358b6}),null;}else return _0x352786[_0x1f5b3e(0xc3)]=Math['max'](_0x352786['high'],_0x4f2757),_0x352786['low']=Math['min'](_0x352786['low'],_0x4f2757),_0x352786['close']=_0x4f2757,_0x352786['volume']+=_0x3358b6,null;}[_0x183474(0xd5)](_0x22080b){return this['processTick'](_0x22080b);}[_0x183474(0x13d)](_0x177772){const _0x18557b=_0x183474;return this['processTick']({'contractId':_0x177772['contractId']||_0x177772[_0x18557b(0xbb)],'price':_0x177772[_0x18557b(0x107)],'volume':_0x177772['size']||_0x177772['volume']||0x1,'timestamp':_0x177772[_0x18557b(0xf7)]||Date['now']()});}['processBar'](_0x3977b3,_0x4a411c){const _0x227711=_0x183474;let _0x25519b=this[_0x227711(0x11e)][_0x227711(0xe3)](_0x3977b3);!_0x25519b&&(this[_0x227711(0xe1)](_0x3977b3),_0x25519b=this[_0x227711(0x11e)][_0x227711(0xe3)](_0x3977b3));_0x25519b['push'](_0x4a411c);if(_0x25519b[_0x227711(0x123)]>0x1f4)_0x25519b[_0x227711(0x125)]();const _0x5bba1c=_0x25519b['length']-0x1;if(_0x25519b['length']<this['config'][_0x227711(0xcd)][_0x227711(0xe6)]*0x3)return null;const _0x420fbf=this['swingPoints']['get'](_0x3977b3)['length'];this[_0x227711(0xf3)](_0x3977b3,_0x25519b,_0x5bba1c);const _0x931204=this[_0x227711(0x102)][_0x227711(0xe3)](_0x3977b3);if(_0x931204['length']>_0x420fbf){const _0x144706=_0x931204[_0x931204['length']-0x1];this[_0x227711(0x12a)]('log',{'type':'debug','message':_0x227711(0xe4)+_0x144706[_0x227711(0x100)][_0x227711(0x10d)]()+'\x20@\x20'+_0x144706[_0x227711(0x107)][_0x227711(0x101)](0x2)+'\x20|\x20Total:\x20'+_0x931204[_0x227711(0x123)]});}const _0x3d72c8=this['liquidityZones'][_0x227711(0xe3)](_0x3977b3)[_0x227711(0x123)];this[_0x227711(0x138)](_0x3977b3,_0x5bba1c);const _0x48b8ba=this['liquidityZones']['get'](_0x3977b3);if(_0x48b8ba['length']>_0x3d72c8){const _0x9a4f93=_0x48b8ba[_0x48b8ba['length']-0x1];this['emit']('log',{'type':_0x227711(0xbe),'message':'[2B]\x20NEW\x20ZONE\x20'+_0x9a4f93['type']['toUpperCase']()+_0x227711(0xf2)+_0x9a4f93[_0x227711(0xd3)]()[_0x227711(0x101)](0x2)+_0x227711(0xea)+_0x48b8ba['length']});}const _0x34f389=this[_0x227711(0x130)](_0x3977b3,_0x25519b,_0x5bba1c);_0x34f389&&this['emit']('log',{'type':'debug','message':_0x227711(0x10b)+_0x34f389[_0x227711(0x14c)]+_0x227711(0x11b)+_0x34f389[_0x227711(0x13a)]+_0x227711(0xef)+_0x34f389['penetrationTicks']['toFixed'](0x1)+_0x227711(0xf4)+(_0x34f389[_0x227711(0x10f)]*0x64)[_0x227711(0x101)](0x0)+'%'});if(_0x34f389&&_0x34f389['isValid'])return this['_generateSignal'](_0x3977b3,_0x4a411c,_0x5bba1c,_0x34f389);return null;}[_0x183474(0xf3)](_0x4a995b,_0x1bc89c,_0x4833cc){const _0x3e5900=_0x183474,_0x43f547=this['config']['swing'][_0x3e5900(0xe6)],_0x43aebd=this[_0x3e5900(0xf9)][_0x3e5900(0xcd)]['minStrength'];if(_0x4833cc<_0x43f547*0x2)return;const _0x67c516=this['swingPoints']['get'](_0x4a995b),_0xb2cc55=_0x4833cc-_0x43f547,_0x2f6c0f=_0x1bc89c[_0xb2cc55];let _0x5e720f=!![],_0x381755=0x0;for(let _0x54a70c=_0xb2cc55-_0x43f547;_0x54a70c<=_0xb2cc55+_0x43f547;_0x54a70c++){if(_0x54a70c===_0xb2cc55||_0x54a70c<0x0||_0x54a70c>=_0x1bc89c[_0x3e5900(0x123)])continue;if(_0x1bc89c[_0x54a70c]['high']>=_0x2f6c0f[_0x3e5900(0xc3)]){_0x5e720f=![];break;}_0x381755++;}if(_0x5e720f&&_0x381755>=_0x43aebd){const _0x583636=_0x67c516[_0x3e5900(0xc0)](_0x147398=>_0x147398['barIndex']===_0xb2cc55&&_0x147398['type']===_0x3e5900(0xc3));!_0x583636&&_0x67c516['push'](new SwingPoint(_0x3e5900(0xc3),_0x2f6c0f['high'],_0xb2cc55,_0x2f6c0f[_0x3e5900(0xf7)],_0x381755));}let _0x4883ca=!![],_0x42e1d0=0x0;for(let _0x224db5=_0xb2cc55-_0x43f547;_0x224db5<=_0xb2cc55+_0x43f547;_0x224db5++){if(_0x224db5===_0xb2cc55||_0x224db5<0x0||_0x224db5>=_0x1bc89c['length'])continue;if(_0x1bc89c[_0x224db5]['low']<=_0x2f6c0f['low']){_0x4883ca=![];break;}_0x42e1d0++;}if(_0x4883ca&&_0x42e1d0>=_0x43aebd){const _0x2cc678=_0x67c516[_0x3e5900(0xc0)](_0x58ffa9=>_0x58ffa9['barIndex']===_0xb2cc55&&_0x58ffa9['type']===_0x3e5900(0xc6));!_0x2cc678&&_0x67c516['push'](new SwingPoint('low',_0x2f6c0f['low'],_0xb2cc55,_0x2f6c0f['timestamp'],_0x42e1d0));}const _0x28e4b8=this[_0x3e5900(0xf9)]['zone']['maxZoneAgeBars'];while(_0x67c516[_0x3e5900(0x123)]>0x0&&_0x67c516[0x0][_0x3e5900(0x11c)]<_0x4833cc-_0x28e4b8){_0x67c516[_0x3e5900(0x125)]();}}[_0x183474(0x138)](_0x38c13c,_0x3b5476){const _0x194197=_0x183474,_0x2f63f7=this['swingPoints']['get'](_0x38c13c),_0x584679=this['liquidityZones']['get'](_0x38c13c),_0x54d398=this['config']['zone'][_0x194197(0xdc)]*this[_0x194197(0xcc)],_0x50a32a=this[_0x194197(0xf9)][_0x194197(0xd8)]['maxZoneAgeBars'];for(let _0x2b9967=_0x584679[_0x194197(0x123)]-0x1;_0x2b9967>=0x0;_0x2b9967--){_0x3b5476-_0x584679[_0x2b9967]['barIndex']>_0x50a32a&&_0x584679['splice'](_0x2b9967,0x1);}for(const _0x20b283 of _0x2f63f7){let _0x4a01ed=null;for(const _0x57e4e8 of _0x584679){if(_0x57e4e8['containsPrice'](_0x20b283[_0x194197(0x107)],this[_0x194197(0xf9)]['zone']['clusterToleranceTicks'],this['tickSize'])){_0x4a01ed=_0x57e4e8;break;}}if(_0x4a01ed){_0x4a01ed['touches']++;if(_0x20b283[_0x194197(0x107)]>_0x4a01ed['priceHigh'])_0x4a01ed[_0x194197(0xb7)]=_0x20b283[_0x194197(0x107)];if(_0x20b283['price']<_0x4a01ed['priceLow'])_0x4a01ed[_0x194197(0xcf)]=_0x20b283['price'];_0x4a01ed['qualityScore']=Math['min'](0x1,0.3+_0x4a01ed['touches']*0.15);}else{const _0x57e59b=_0x20b283[_0x194197(0x100)]==='high'?ZoneType[_0x194197(0x12f)]:ZoneType[_0x194197(0xd2)],_0x55a5ef=new LiquidityZone(_0x57e59b,_0x20b283[_0x194197(0x107)]+_0x54d398/0x2,_0x20b283['price']-_0x54d398/0x2,_0x20b283[_0x194197(0xf7)],_0x20b283[_0x194197(0x11c)]);_0x55a5ef[_0x194197(0x10f)]=0.3+_0x20b283[_0x194197(0x148)]*0.1,_0x584679['push'](_0x55a5ef);}}}[_0x183474(0x130)](_0x20a56b,_0x3aae9e,_0x390300){const _0x5f49c4=_0x183474,_0x54fd84=this['liquidityZones'][_0x5f49c4(0xe3)](_0x20a56b),_0x32299c=_0x3aae9e[_0x390300],_0x323274=_0x32299c[_0x5f49c4(0x12b)],_0x54084e=this[_0x5f49c4(0xf9)]['sweep'],_0x4564a6=this['config']['zone'];for(const _0x25fcfa of _0x54fd84){if(_0x25fcfa[_0x5f49c4(0x10a)]>=0x0&&_0x390300-_0x25fcfa['lastUsedBarIndex']<_0x4564a6[_0x5f49c4(0x131)])continue;const _0x3f92e1=_0x25fcfa[_0x5f49c4(0xd3)](),_0x16d650=Math['abs'](_0x323274-_0x3f92e1)/this['tickSize'];if(_0x16d650>_0x4564a6[_0x5f49c4(0x144)])continue;const _0x5016eb=Math[_0x5f49c4(0xe9)](0x0,_0x390300-_0x54084e[_0x5f49c4(0x134)]*0x2);for(let _0x272a00=_0x5016eb;_0x272a00<_0x390300;_0x272a00++){const _0x411304=_0x3aae9e[_0x272a00];if(_0x25fcfa[_0x5f49c4(0x100)]===ZoneType[_0x5f49c4(0x12f)]){const _0x59b9f4=(_0x411304['high']-_0x25fcfa['priceHigh'])/this['tickSize'];if(_0x59b9f4>=_0x54084e['minPenetrationTicks']&&_0x59b9f4<=_0x54084e[_0x5f49c4(0xd1)]){if(_0x323274<_0x25fcfa['priceHigh']){const _0x553b90=_0x411304[_0x5f49c4(0xc3)]-_0x411304[_0x5f49c4(0xc6)],_0x4bd58b=Math[_0x5f49c4(0x127)](_0x411304[_0x5f49c4(0x12b)]-_0x411304['open']),_0x30930c=_0x553b90>0x0?_0x4bd58b/_0x553b90:0x0;if(_0x30930c>=_0x54084e['minBodyRatio']){const _0xa6607e=this['_getVolumeRatio'](_0x3aae9e,_0x272a00,0x14);if(_0xa6607e>=_0x54084e['minVolumeRatio']){const _0x231bd4=new SweepEvent(SweepType[_0x5f49c4(0xe8)],_0x25fcfa,_0x272a00,_0x272a00,_0x411304[_0x5f49c4(0xc3)]);_0x231bd4[_0x5f49c4(0x135)]=_0x390300,_0x231bd4[_0x5f49c4(0x113)]=_0x59b9f4,_0x231bd4[_0x5f49c4(0x10c)]=_0x390300-_0x272a00,_0x231bd4[_0x5f49c4(0xbf)]=_0xa6607e,_0x231bd4['qualityScore']=this['_scoreSweep'](_0x231bd4,_0x30930c),_0x231bd4['isValid']=_0x231bd4[_0x5f49c4(0x10f)]>=_0x54084e['minQualityScore'];if(_0x231bd4['isValid'])return _0x231bd4;}}}}}if(_0x25fcfa['type']===ZoneType[_0x5f49c4(0xd2)]){const _0x44b985=(_0x25fcfa[_0x5f49c4(0xcf)]-_0x411304['low'])/this[_0x5f49c4(0xcc)];if(_0x44b985>=_0x54084e[_0x5f49c4(0xff)]&&_0x44b985<=_0x54084e[_0x5f49c4(0xd1)]){if(_0x323274>_0x25fcfa['priceLow']){const _0x55e9b0=_0x411304[_0x5f49c4(0xc3)]-_0x411304['low'],_0x22210d=Math[_0x5f49c4(0x127)](_0x411304['close']-_0x411304[_0x5f49c4(0x137)]),_0x476b39=_0x55e9b0>0x0?_0x22210d/_0x55e9b0:0x0;if(_0x476b39>=_0x54084e['minBodyRatio']){const _0x5e3786=this[_0x5f49c4(0xe5)](_0x3aae9e,_0x272a00,0x14);if(_0x5e3786>=_0x54084e['minVolumeRatio']){const _0x1c8e66=new SweepEvent(SweepType[_0x5f49c4(0x129)],_0x25fcfa,_0x272a00,_0x272a00,_0x411304[_0x5f49c4(0xc6)]);_0x1c8e66['exitBarIndex']=_0x390300,_0x1c8e66[_0x5f49c4(0x113)]=_0x44b985,_0x1c8e66['durationBars']=_0x390300-_0x272a00,_0x1c8e66['volumeRatio']=_0x5e3786,_0x1c8e66['qualityScore']=this[_0x5f49c4(0x10e)](_0x1c8e66,_0x476b39),_0x1c8e66[_0x5f49c4(0x13a)]=_0x1c8e66[_0x5f49c4(0x10f)]>=_0x54084e['minQualityScore'];if(_0x1c8e66[_0x5f49c4(0x13a)])return _0x1c8e66;}}}}}}}return null;}['_getVolumeRatio'](_0x7831ab,_0x570a7d,_0x5f06b8){const _0x442402=_0x183474,_0x56af5c=Math[_0x442402(0xe9)](0x0,_0x570a7d-_0x5f06b8),_0x51ac8a=_0x7831ab['slice'](_0x56af5c,_0x570a7d);if(_0x51ac8a['length']===0x0)return 0x1;const _0x5ae545=_0x51ac8a[_0x442402(0xba)](_0x937266=>_0x937266[_0x442402(0x106)])['sort']((_0x170ed0,_0x27f300)=>_0x170ed0-_0x27f300),_0x260e90=Math[_0x442402(0x108)](_0x5ae545[_0x442402(0x123)]/0x2),_0x48b4bc=_0x5ae545[_0x260e90]||0x1;return _0x7831ab[_0x570a7d]['volume']/_0x48b4bc;}[_0x183474(0x10e)](_0x3025fc,_0x53f7bc){const _0x1ddc35=_0x183474;let _0x1801f0=0x0;const _0x2f9522=0x4,_0x3a126c=Math['abs'](_0x3025fc['penetrationTicks']-_0x2f9522);return _0x1801f0+=Math[_0x1ddc35(0xe9)](0x0,0.3-_0x3a126c*0.03),_0x1801f0+=Math[_0x1ddc35(0xe9)](0x0,0.25-_0x3025fc['durationBars']*0.05),_0x1801f0+=Math[_0x1ddc35(0xc9)](0.25,_0x3025fc['volumeRatio']*0.1),_0x1801f0+=Math[_0x1ddc35(0xc9)](0.2,_0x53f7bc*0.4),Math['min'](0x1,_0x1801f0);}[_0x183474(0xd0)](_0x51be2f,_0x40ff3f,_0xe0f10d,_0x32eaca){const _0x593a88=_0x183474;if(Date[_0x593a88(0x13f)]()-this[_0x593a88(0xe0)]<this[_0x593a88(0xf9)][_0x593a88(0x13c)]['cooldownMs'])return null;const _0x336686=this[_0x593a88(0xf9)]['execution'],_0x2f3793=_0x40ff3f[_0x593a88(0x12b)],_0x1cdc77=_0x32eaca[_0x593a88(0x14c)]===SweepType['HIGH_SWEEP']?_0x593a88(0xc7):'long';let _0x481f42,_0x2cfd8b,_0x4a4ca2,_0x2659bd;_0x1cdc77===_0x593a88(0x119)?(_0x481f42=_0x2f3793-_0x336686[_0x593a88(0xda)]*this[_0x593a88(0xcc)],_0x2cfd8b=_0x2f3793+_0x336686[_0x593a88(0x146)]*this[_0x593a88(0xcc)],_0x4a4ca2=_0x2f3793+_0x336686[_0x593a88(0x142)]*this[_0x593a88(0xcc)],_0x2659bd=_0x2f3793+_0x336686[_0x593a88(0xfd)]*this['tickSize']):(_0x481f42=_0x2f3793+_0x336686['stopTicks']*this['tickSize'],_0x2cfd8b=_0x2f3793-_0x336686['targetTicks']*this['tickSize'],_0x4a4ca2=_0x2f3793-_0x336686['breakevenTicks']*this[_0x593a88(0xcc)],_0x2659bd=_0x2f3793-_0x336686[_0x593a88(0xfd)]*this[_0x593a88(0xcc)]);const _0x1250f5=_0x336686[_0x593a88(0x146)]/_0x336686[_0x593a88(0xda)],_0x7dbf18=Math[_0x593a88(0xc9)](0x1,_0x32eaca[_0x593a88(0x10f)]*0.5+_0x32eaca[_0x593a88(0xd8)]['qualityScore']*0.3+(_0x32eaca[_0x593a88(0xbf)]>1.5?0.2:_0x32eaca[_0x593a88(0xbf)]*0.1));let _0x39b2f0=SignalStrength[_0x593a88(0xbc)];if(_0x7dbf18>=0.8)_0x39b2f0=SignalStrength[_0x593a88(0x114)];else{if(_0x7dbf18>=0.65)_0x39b2f0=SignalStrength['STRONG'];else{if(_0x7dbf18<0.5)_0x39b2f0=SignalStrength[_0x593a88(0x104)];}}const _0x5b3304=0.5+(_0x7dbf18-0.5)*0.4,_0x4b96de=_0x5b3304*Math['abs'](_0x2cfd8b-_0x2f3793)-(0x1-_0x5b3304)*Math[_0x593a88(0x127)](_0x2f3793-_0x481f42);_0x32eaca['zone'][_0x593a88(0x10a)]=_0xe0f10d,_0x32eaca[_0x593a88(0xd8)]['swept']=!![],_0x32eaca['zone'][_0x593a88(0xde)]=new Date(_0x40ff3f['timestamp']),this['lastSignalTime']=Date['now'](),this['stats']['signals']++;const _0x45a29b={'id':uuidv4(),'timestamp':Date[_0x593a88(0x13f)](),'symbol':_0x51be2f[_0x593a88(0xcb)]('.')[0x0]||_0x51be2f,'contractId':_0x51be2f,'side':_0x1cdc77===_0x593a88(0x119)?OrderSide[_0x593a88(0x11a)]:OrderSide[_0x593a88(0x120)],'direction':_0x1cdc77,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x39b2f0,'edge':_0x4b96de,'confidence':_0x7dbf18,'entry':_0x2f3793,'entryPrice':_0x2f3793,'stopLoss':_0x481f42,'takeProfit':_0x2cfd8b,'riskReward':_0x1250f5,'stopTicks':_0x336686['stopTicks'],'targetTicks':_0x336686[_0x593a88(0x146)],'breakevenTicks':_0x336686['breakevenTicks'],'trailTriggerTicks':_0x336686['trailTriggerTicks'],'trailDistanceTicks':_0x336686['trailDistanceTicks'],'beLevel':_0x4a4ca2,'trailTrigger':_0x2659bd,'sweepType':_0x32eaca[_0x593a88(0x14c)],'penetrationTicks':_0x32eaca[_0x593a88(0x113)],'sweepDurationBars':_0x32eaca['durationBars'],'sweepQuality':_0x32eaca[_0x593a88(0x10f)],'volumeRatio':_0x32eaca['volumeRatio'],'zoneType':_0x32eaca['zone'][_0x593a88(0x100)],'zoneLevel':_0x32eaca['zone']['getLevel'](),'zoneTouches':_0x32eaca[_0x593a88(0xd8)]['touches'],'zoneQuality':_0x32eaca['zone']['qualityScore'],'expires':Date[_0x593a88(0x13f)]()+0xea60};return this['emit'](_0x593a88(0xd6),{'side':_0x1cdc77===_0x593a88(0x119)?_0x593a88(0xdd):_0x593a88(0xb9),'action':_0x593a88(0x137),'reason':'2B\x20'+_0x32eaca['sweepType']+'\x20|\x20Pen:'+_0x32eaca[_0x593a88(0x113)]['toFixed'](0x1)+_0x593a88(0x14a)+_0x32eaca['volumeRatio']['toFixed'](0x1)+'x\x20|\x20Q:'+(_0x32eaca['qualityScore']*0x64)[_0x593a88(0x101)](0x0)+'%',..._0x45a29b}),this['emit']('log',{'type':'info','message':'[HQX-2B]\x20SIGNAL:\x20'+_0x1cdc77[_0x593a88(0x10d)]()+'\x20@\x20'+_0x2f3793[_0x593a88(0x101)](0x2)+'\x20|\x20'+_0x32eaca[_0x593a88(0x14c)]+_0x593a88(0x14b)+_0x32eaca['penetrationTicks']['toFixed'](0x1)+'t\x20Vol:'+_0x32eaca[_0x593a88(0xbf)]['toFixed'](0x1)+'x\x20|\x20Conf:'+(_0x7dbf18*0x64)[_0x593a88(0x101)](0x0)+'%'}),_0x45a29b;}['getAnalysisState'](_0x4f4fed,_0x17d1c9){const _0x1e3c2e=_0x183474,_0x4dcbd8=this[_0x1e3c2e(0x11e)]['get'](_0x4f4fed)||[],_0x14689b=this['liquidityZones'][_0x1e3c2e(0xe3)](_0x4f4fed)||[],_0x2065e8=this['swingPoints']['get'](_0x4f4fed)||[];if(_0x4dcbd8[_0x1e3c2e(0x123)]<0x5)return{'ready':![],'message':_0x1e3c2e(0x13b)+_0x4dcbd8['length']+'/5\x20bars'};const _0x5f152b=_0x14689b[_0x1e3c2e(0xba)](_0x3e5841=>({'zone':_0x3e5841,'distance':Math[_0x1e3c2e(0x127)](_0x17d1c9-_0x3e5841['getLevel']())}))['sort']((_0x472fc5,_0x1f8dbe)=>_0x472fc5[_0x1e3c2e(0xdf)]-_0x1f8dbe[_0x1e3c2e(0xdf)]),_0x371c94=_0x5f152b[_0x1e3c2e(0xc0)](_0x102ab5=>_0x102ab5['zone']['type']===ZoneType[_0x1e3c2e(0x12f)]),_0xbee416=_0x5f152b[_0x1e3c2e(0xc0)](_0x228c5c=>_0x228c5c['zone']['type']===ZoneType['SUPPORT']);return{'ready':!![],'barsProcessed':_0x4dcbd8[_0x1e3c2e(0x123)],'swingsDetected':_0x2065e8[_0x1e3c2e(0x123)],'activeZones':_0x14689b['length'],'nearestResistance':_0x371c94?_0x371c94[_0x1e3c2e(0xd8)][_0x1e3c2e(0xd3)]():null,'nearestSupport':_0xbee416?_0xbee416[_0x1e3c2e(0xd8)][_0x1e3c2e(0xd3)]():null,'stopTicks':this['config']['execution'][_0x1e3c2e(0xda)],'targetTicks':this['config'][_0x1e3c2e(0x13c)]['targetTicks'],'strategy':'HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)'};}['recordTradeResult'](_0x4dbb62){const _0x10e3f5=_0x183474;this[_0x10e3f5(0x121)][_0x10e3f5(0x133)]({'netPnl':_0x4dbb62,'timestamp':Date['now']()});if(this[_0x10e3f5(0x121)]['length']>0x64)this[_0x10e3f5(0x121)]['shift']();_0x4dbb62>0x0?this['stats']['wins']++:this[_0x10e3f5(0xc1)][_0x10e3f5(0x145)]++,this[_0x10e3f5(0xc1)][_0x10e3f5(0xeb)]++,this['stats'][_0x10e3f5(0x143)]+=_0x4dbb62,this[_0x10e3f5(0x12a)](_0x10e3f5(0xc8),{'type':_0x10e3f5(0xbe),'message':'[HQX-2B]\x20Trade\x20result:\x20'+(_0x4dbb62>0x0?'WIN':_0x10e3f5(0xec))+'\x20$'+_0x4dbb62['toFixed'](0x2)});}[_0x183474(0xfa)](_0x5820ea){const _0x4df593=_0x183474;return this[_0x4df593(0x11e)][_0x4df593(0xe3)](_0x5820ea)||[];}['getStats'](){return this['stats'];}['reset'](_0x3c4e85){const _0x7f9bcb=_0x183474;this[_0x7f9bcb(0x11e)]['set'](_0x3c4e85,[]),this[_0x7f9bcb(0x102)][_0x7f9bcb(0xfc)](_0x3c4e85,[]),this[_0x7f9bcb(0x13e)]['set'](_0x3c4e85,[]),this[_0x7f9bcb(0xe7)]['set'](_0x3c4e85,[]),this[_0x7f9bcb(0xd9)][_0x7f9bcb(0xf5)](_0x3c4e85),this['emit'](_0x7f9bcb(0xc8),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x3c4e85});}[_0x183474(0xed)](_0x1fffc4,_0x351c9d){const _0x3c77f7=_0x183474;if(!_0x351c9d||_0x351c9d['length']===0x0){this[_0x3c77f7(0x12a)]('log',{'type':_0x3c77f7(0xbe),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this[_0x3c77f7(0x11e)][_0x3c77f7(0x118)](_0x1fffc4)&&this[_0x3c77f7(0xe1)](_0x1fffc4);const _0x50f2de=[..._0x351c9d]['sort']((_0x3b69a4,_0x2d35d0)=>_0x3b69a4[_0x3c77f7(0xf7)]-_0x2d35d0[_0x3c77f7(0xf7)]);this[_0x3c77f7(0x12a)]('log',{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x50f2de['length']+'\x20historical\x20bars...'});let _0x350b6f=0x0;for(const _0x4880c6 of _0x50f2de){const _0x12ffe8=this['processBar'](_0x1fffc4,_0x4880c6);if(_0x12ffe8)_0x350b6f++;}const _0x14e32c=this[_0x3c77f7(0x11e)]['get'](_0x1fffc4)||[],_0x12344c=this['swingPoints'][_0x3c77f7(0xe3)](_0x1fffc4)||[],_0x3e039b=this[_0x3c77f7(0x13e)][_0x3c77f7(0xe3)](_0x1fffc4)||[];this[_0x3c77f7(0x12a)]('log',{'type':_0x3c77f7(0x141),'message':_0x3c77f7(0xc5)+_0x14e32c[_0x3c77f7(0x123)]+_0x3c77f7(0xf1)+_0x12344c[_0x3c77f7(0x123)]+'\x20swings,\x20'+_0x3e039b[_0x3c77f7(0x123)]+_0x3c77f7(0x110)}),_0x350b6f>0x0&&this[_0x3c77f7(0x12a)]('log',{'type':'debug','message':_0x3c77f7(0xf6)+_0x350b6f+_0x3c77f7(0xfe)}),this['lastSignalTime']=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x38bdaf={}){const _0x2dcd7a=_0x183474;super(),this['config']=_0x38bdaf,this['strategy']=new HQX2BLiquiditySweep(_0x38bdaf),this[_0x2dcd7a(0x109)]['on']('signal',_0x405b46=>this['emit']('signal',_0x405b46)),this[_0x2dcd7a(0x109)]['on']('log',_0x2a6106=>this['emit']('log',_0x2a6106));}['processTick'](_0x45b7b5){const _0x59da87=_0x183474;return this[_0x59da87(0x109)][_0x59da87(0xd7)](_0x45b7b5);}['onTick'](_0x33842f){return this['strategy']['onTick'](_0x33842f);}['onTrade'](_0x23dcda){const _0x10c336=_0x183474;return this['strategy'][_0x10c336(0x13d)](_0x23dcda);}[_0x183474(0x116)](_0x389b1e,_0x381e23){const _0x4fa113=_0x183474;return this[_0x4fa113(0x109)]['processBar'](_0x389b1e,_0x381e23);}['initialize'](_0x5ee17e,_0x107058,_0x51ecff){const _0x2c0844=_0x183474;return this['strategy'][_0x2c0844(0xe1)](_0x5ee17e,_0x107058,_0x51ecff);}[_0x183474(0x117)](_0x2e94cd,_0x3dc562){const _0x3806d9=_0x183474;return this['strategy'][_0x3806d9(0x117)](_0x2e94cd,_0x3dc562);}[_0x183474(0xee)](_0x16d9eb){const _0x32aa62=_0x183474;return this[_0x32aa62(0x109)]['recordTradeResult'](_0x16d9eb);}[_0x183474(0x128)](_0x32870d){const _0x456d6f=_0x183474;return this[_0x456d6f(0x109)]['reset'](_0x32870d);}['getStats'](){return this['strategy']['getStats']();}['getBarHistory'](_0x378e93){return this['strategy']['getBarHistory'](_0x378e93);}['preloadBars'](_0x31a9ec,_0x2f4948){const _0x58f029=_0x183474;return this[_0x58f029(0x109)][_0x58f029(0xed)](_0x31a9ec,_0x2f4948);}[_0x183474(0x103)](_0x4c4775){return null;}}module['exports']={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
1
+ const _0x42d110=_0x3be2;(function(_0x1e7907,_0x949076){const _0x59dfca=_0x3be2,_0xeb804b=_0x1e7907();while(!![]){try{const _0x5e7a71=-parseInt(_0x59dfca(0x23a))/0x1*(-parseInt(_0x59dfca(0x22c))/0x2)+parseInt(_0x59dfca(0x257))/0x3+parseInt(_0x59dfca(0x256))/0x4*(-parseInt(_0x59dfca(0x252))/0x5)+-parseInt(_0x59dfca(0x21a))/0x6+parseInt(_0x59dfca(0x1fb))/0x7*(-parseInt(_0x59dfca(0x221))/0x8)+-parseInt(_0x59dfca(0x245))/0x9+parseInt(_0x59dfca(0x227))/0xa;if(_0x5e7a71===_0x949076)break;else _0xeb804b['push'](_0xeb804b['shift']());}catch(_0x27abfa){_0xeb804b['push'](_0xeb804b['shift']());}}}(_0x1d4b,0x9270e));function _0x3be2(_0x1efabc,_0x16e272){_0x1efabc=_0x1efabc-0x1ce;const _0x1d4b2b=_0x1d4b();let _0x3be218=_0x1d4b2b[_0x1efabc];return _0x3be218;}const EventEmitter=require(_0x42d110(0x23b)),{v4:uuidv4}=require(_0x42d110(0x24e)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':_0x42d110(0x251)},ZoneType={'RESISTANCE':_0x42d110(0x233),'SUPPORT':_0x42d110(0x1f0)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.2,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':!![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x42d110(0x1f4)}};class SwingPoint{constructor(_0x9aeb87,_0x1b12eb,_0x25b7d8,_0x31277a,_0x40b9c6=0x1){const _0x4b8ffd=_0x42d110;this['type']=_0x9aeb87,this[_0x4b8ffd(0x25c)]=_0x1b12eb,this[_0x4b8ffd(0x1ef)]=_0x25b7d8,this['timestamp']=_0x31277a,this['strength']=_0x40b9c6;}}class LiquidityZone{constructor(_0x45ca8a,_0x19217b,_0x4e691f,_0x234adc,_0x386b06){const _0x58f61f=_0x42d110;this['id']=uuidv4(),this[_0x58f61f(0x220)]=_0x45ca8a,this[_0x58f61f(0x25b)]=_0x19217b,this[_0x58f61f(0x1df)]=_0x4e691f,this['createdAt']=_0x234adc,this['barIndex']=_0x386b06,this[_0x58f61f(0x230)]=0x1,this[_0x58f61f(0x23d)]=![],this[_0x58f61f(0x1d3)]=null,this['lastUsedBarIndex']=-0x3e7,this[_0x58f61f(0x1d4)]=0.5;}[_0x42d110(0x25e)](_0x5ae7d5,_0x28e0ef,_0x3a2d4e){const _0x544960=_0x28e0ef*_0x3a2d4e;return _0x5ae7d5>=this['priceLow']-_0x544960&&_0x5ae7d5<=this['priceHigh']+_0x544960;}['getLevel'](){const _0x95461b=_0x42d110;return(this[_0x95461b(0x25b)]+this['priceLow'])/0x2;}}class SweepEvent{constructor(_0x2141ee,_0x1daa13,_0x228bde,_0x1d1fe9,_0x453ed4){const _0x2c0998=_0x42d110;this[_0x2c0998(0x1ff)]=_0x2141ee,this[_0x2c0998(0x223)]=_0x1daa13,this['entryBarIndex']=_0x228bde,this[_0x2c0998(0x208)]=_0x1d1fe9,this['extremePrice']=_0x453ed4,this[_0x2c0998(0x1e5)]=null,this[_0x2c0998(0x1d0)]=![],this[_0x2c0998(0x1d4)]=0x0,this['penetrationTicks']=0x0,this[_0x2c0998(0x207)]=0x0,this[_0x2c0998(0x24a)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x14aa1e={}){const _0x2c41d9=_0x42d110;super(),this['config']=this[_0x2c41d9(0x1e9)](DEFAULT_CONFIG,_0x14aa1e),this['tickSize']=this[_0x2c41d9(0x22b)]['tickSize'],this['tickValue']=this[_0x2c41d9(0x22b)][_0x2c41d9(0x212)],this['barHistory']=new Map(),this[_0x2c41d9(0x1ee)]=new Map(),this['liquidityZones']=new Map(),this[_0x2c41d9(0x237)]=new Map(),this['currentBar']=new Map(),this['barIntervalMs']=0xea60,this['lastSignalTime']=0x0,this['startTime']=Date['now'](),this[_0x2c41d9(0x1f2)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this['recentTrades']=[];}['_mergeConfig'](_0x555779,_0x42191e){const _0x115b51=_0x42d110,_0x5d1ae0={..._0x555779};for(const _0x20505d in _0x42191e){typeof _0x42191e[_0x20505d]===_0x115b51(0x218)&&!Array[_0x115b51(0x241)](_0x42191e[_0x20505d])?_0x5d1ae0[_0x20505d]={..._0x555779[_0x20505d],..._0x42191e[_0x20505d]}:_0x5d1ae0[_0x20505d]=_0x42191e[_0x20505d];}return _0x5d1ae0;}['isWithinSession'](_0x3f5ec5){const _0x4c16cb=_0x42d110;if(!this[_0x4c16cb(0x22b)][_0x4c16cb(0x20e)][_0x4c16cb(0x1db)])return!![];const _0x4d524f=new Date(_0x3f5ec5),_0x1a7fc9=this['isDST'](_0x4d524f)?-0x4:-0x5,_0xfd4b53=_0x4d524f['getUTCHours'](),_0xd39bbe=_0x4d524f['getUTCMinutes'](),_0x72695b=(_0xfd4b53+_0x1a7fc9+0x18)%0x18,{startHour:_0x13c7b1,startMinute:_0x5fdf18,endHour:_0x58aed0,endMinute:_0x4c293c}=this['config'][_0x4c16cb(0x20e)],_0x116996=_0x72695b*0x3c+_0xd39bbe,_0x55fd7d=_0x13c7b1*0x3c+_0x5fdf18,_0x445507=_0x58aed0*0x3c+_0x4c293c;return _0x116996>=_0x55fd7d&&_0x116996<_0x445507;}['isDST'](_0x56bc1c){const _0x2d20b7=_0x42d110,_0x3796a=new Date(_0x56bc1c[_0x2d20b7(0x1cf)](),0x0,0x1),_0x1c1255=new Date(_0x56bc1c['getFullYear'](),0x6,0x1),_0x382784=Math[_0x2d20b7(0x1f6)](_0x3796a[_0x2d20b7(0x258)](),_0x1c1255['getTimezoneOffset']());return _0x56bc1c['getTimezoneOffset']()<_0x382784;}[_0x42d110(0x259)](_0x25c1c0,_0x73eb84=0.25,_0x21d975=0x5){const _0x17c80c=_0x42d110;this[_0x17c80c(0x20b)]=_0x73eb84,this[_0x17c80c(0x212)]=_0x21d975,this[_0x17c80c(0x22b)]['tickSize']=_0x73eb84,this[_0x17c80c(0x22b)][_0x17c80c(0x212)]=_0x21d975,this[_0x17c80c(0x214)]['set'](_0x25c1c0,[]),this[_0x17c80c(0x1ee)]['set'](_0x25c1c0,[]),this['liquidityZones']['set'](_0x25c1c0,[]),this['activeSweeps'][_0x17c80c(0x211)](_0x25c1c0,[]),this[_0x17c80c(0x228)]['delete'](_0x25c1c0),this['emit'](_0x17c80c(0x248),{'type':_0x17c80c(0x1dd),'message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x25c1c0+_0x17c80c(0x20f)+_0x73eb84+_0x17c80c(0x1fa)+_0x21d975+_0x17c80c(0x1e6)}),this['emit'](_0x17c80c(0x248),{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x17c80c(0x22b)]['execution']['stopTicks']+'t,\x20Target='+this['config'][_0x17c80c(0x1fd)]['targetTicks']+'t,\x20BE='+this[_0x17c80c(0x22b)]['execution'][_0x17c80c(0x22e)]+_0x17c80c(0x1dc)+this[_0x17c80c(0x22b)]['execution']['trailTriggerTicks']+'/'+this['config']['execution']['trailDistanceTicks']});}['processTick'](_0x448053){const _0x3625d6=_0x42d110,{contractId:_0x1829b5,price:_0x232540,volume:_0x182a0e,timestamp:_0x15d3de}=_0x448053,_0x5570c6=_0x15d3de||Date['now'](),_0x25c35e=_0x182a0e||0x1;if(!this['isWithinSession'](_0x5570c6))return null;let _0x52a8d2=this['currentBar']['get'](_0x1829b5);const _0x27d017=Math[_0x3625d6(0x1ea)](_0x5570c6/this[_0x3625d6(0x247)])*this['barIntervalMs'];if(!_0x52a8d2||_0x52a8d2[_0x3625d6(0x204)]!==_0x27d017){if(_0x52a8d2){const _0x2643e9={'timestamp':_0x52a8d2[_0x3625d6(0x204)],'open':_0x52a8d2['open'],'high':_0x52a8d2['high'],'low':_0x52a8d2[_0x3625d6(0x251)],'close':_0x52a8d2['close'],'volume':_0x52a8d2[_0x3625d6(0x1e8)]},_0x2dcab6=this['processBar'](_0x1829b5,_0x2643e9);return this[_0x3625d6(0x228)][_0x3625d6(0x211)](_0x1829b5,{'startTime':_0x27d017,'open':_0x232540,'high':_0x232540,'low':_0x232540,'close':_0x232540,'volume':_0x25c35e}),_0x2dcab6;}else return this['currentBar'][_0x3625d6(0x211)](_0x1829b5,{'startTime':_0x27d017,'open':_0x232540,'high':_0x232540,'low':_0x232540,'close':_0x232540,'volume':_0x25c35e}),null;}else return _0x52a8d2['high']=Math['max'](_0x52a8d2[_0x3625d6(0x249)],_0x232540),_0x52a8d2[_0x3625d6(0x251)]=Math[_0x3625d6(0x253)](_0x52a8d2['low'],_0x232540),_0x52a8d2[_0x3625d6(0x22d)]=_0x232540,_0x52a8d2[_0x3625d6(0x1e8)]+=_0x25c35e,null;}[_0x42d110(0x1e4)](_0x7c6e1f){const _0x1fbbc4=_0x42d110;return this[_0x1fbbc4(0x250)](_0x7c6e1f);}[_0x42d110(0x1e1)](_0x117959){const _0x1ce320=_0x42d110;return this['processTick']({'contractId':_0x117959['contractId']||_0x117959['symbol'],'price':_0x117959['price'],'volume':_0x117959['size']||_0x117959['volume']||0x1,'timestamp':_0x117959[_0x1ce320(0x1e3)]||Date[_0x1ce320(0x21f)]()});}[_0x42d110(0x1d2)](_0x15cf51,_0x1d966b){const _0x542b18=_0x42d110;let _0x301634=this[_0x542b18(0x214)]['get'](_0x15cf51);!_0x301634&&(this[_0x542b18(0x259)](_0x15cf51),_0x301634=this['barHistory']['get'](_0x15cf51));_0x301634[_0x542b18(0x1d7)](_0x1d966b);if(_0x301634['length']>0x1f4)_0x301634[_0x542b18(0x20d)]();const _0xc55f8=_0x301634['length']-0x1;if(_0x301634['length']<this['config'][_0x542b18(0x23f)][_0x542b18(0x1e0)]*0x3)return null;const _0x399170=this['swingPoints']['get'](_0x15cf51)[_0x542b18(0x1f5)];this[_0x542b18(0x215)](_0x15cf51,_0x301634,_0xc55f8);const _0x5145d1=this['swingPoints'][_0x542b18(0x231)](_0x15cf51);if(_0x5145d1['length']>_0x399170){const _0x360100=_0x5145d1[_0x5145d1[_0x542b18(0x1f5)]-0x1];this['emit'](_0x542b18(0x248),{'type':_0x542b18(0x255),'message':'[2B]\x20NEW\x20SWING\x20'+_0x360100['type']['toUpperCase']()+_0x542b18(0x25f)+_0x360100[_0x542b18(0x25c)][_0x542b18(0x224)](0x2)+_0x542b18(0x1ce)+_0x5145d1[_0x542b18(0x1f5)]});}const _0x19b44e=this[_0x542b18(0x21b)][_0x542b18(0x231)](_0x15cf51)[_0x542b18(0x1f5)];this[_0x542b18(0x225)](_0x15cf51,_0xc55f8);const _0x2489e2=this[_0x542b18(0x21b)][_0x542b18(0x231)](_0x15cf51);if(_0x2489e2['length']>_0x19b44e){const _0x443a0d=_0x2489e2[_0x2489e2[_0x542b18(0x1f5)]-0x1];this[_0x542b18(0x254)](_0x542b18(0x248),{'type':'debug','message':'[2B]\x20NEW\x20ZONE\x20'+_0x443a0d['type']['toUpperCase']()+'\x20@\x20'+_0x443a0d[_0x542b18(0x25a)]()[_0x542b18(0x224)](0x2)+'\x20|\x20Total:\x20'+_0x2489e2['length']});}const _0x296cf6=this['_detectSweep'](_0x15cf51,_0x301634,_0xc55f8);_0x296cf6&&this['emit'](_0x542b18(0x248),{'type':_0x542b18(0x255),'message':_0x542b18(0x1d1)+_0x296cf6['sweepType']+'\x20|\x20Valid:\x20'+_0x296cf6['isValid']+'\x20|\x20Pen:\x20'+_0x296cf6['penetrationTicks'][_0x542b18(0x224)](0x1)+'t\x20|\x20Q:\x20'+(_0x296cf6['qualityScore']*0x64)[_0x542b18(0x224)](0x0)+'%'});if(_0x296cf6&&_0x296cf6[_0x542b18(0x1d0)])return this[_0x542b18(0x1ed)](_0x15cf51,_0x1d966b,_0xc55f8,_0x296cf6);return null;}[_0x42d110(0x215)](_0x220488,_0x2190dc,_0x494445){const _0x545e2d=_0x42d110,_0x3c4a58=this[_0x545e2d(0x22b)][_0x545e2d(0x23f)]['lookbackBars'],_0x2dee00=this['config']['swing'][_0x545e2d(0x246)];if(_0x494445<_0x3c4a58*0x2)return;const _0x33bc03=this[_0x545e2d(0x1ee)]['get'](_0x220488),_0x288bb3=_0x494445-_0x3c4a58,_0x497486=_0x2190dc[_0x288bb3];let _0x47365f=!![],_0x299727=0x0;for(let _0x40ee2b=_0x288bb3-_0x3c4a58;_0x40ee2b<=_0x288bb3+_0x3c4a58;_0x40ee2b++){if(_0x40ee2b===_0x288bb3||_0x40ee2b<0x0||_0x40ee2b>=_0x2190dc[_0x545e2d(0x1f5)])continue;if(_0x2190dc[_0x40ee2b]['high']>=_0x497486[_0x545e2d(0x249)]){_0x47365f=![];break;}_0x299727++;}if(_0x47365f&&_0x299727>=_0x2dee00){const _0x1273f5=_0x33bc03['find'](_0x3661e6=>_0x3661e6['barIndex']===_0x288bb3&&_0x3661e6[_0x545e2d(0x220)]==='high');!_0x1273f5&&_0x33bc03['push'](new SwingPoint(_0x545e2d(0x249),_0x497486[_0x545e2d(0x249)],_0x288bb3,_0x497486[_0x545e2d(0x1e3)],_0x299727));}let _0x11fa2a=!![],_0x14a1f4=0x0;for(let _0xcca4a1=_0x288bb3-_0x3c4a58;_0xcca4a1<=_0x288bb3+_0x3c4a58;_0xcca4a1++){if(_0xcca4a1===_0x288bb3||_0xcca4a1<0x0||_0xcca4a1>=_0x2190dc[_0x545e2d(0x1f5)])continue;if(_0x2190dc[_0xcca4a1][_0x545e2d(0x251)]<=_0x497486['low']){_0x11fa2a=![];break;}_0x14a1f4++;}if(_0x11fa2a&&_0x14a1f4>=_0x2dee00){const _0x27c2c9=_0x33bc03[_0x545e2d(0x242)](_0x3e02d6=>_0x3e02d6[_0x545e2d(0x1ef)]===_0x288bb3&&_0x3e02d6['type']===_0x545e2d(0x251));!_0x27c2c9&&_0x33bc03['push'](new SwingPoint(_0x545e2d(0x251),_0x497486['low'],_0x288bb3,_0x497486[_0x545e2d(0x1e3)],_0x14a1f4));}const _0x467605=this['config']['zone']['maxZoneAgeBars'];while(_0x33bc03[_0x545e2d(0x1f5)]>0x0&&_0x33bc03[0x0][_0x545e2d(0x1ef)]<_0x494445-_0x467605){_0x33bc03[_0x545e2d(0x20d)]();}}[_0x42d110(0x225)](_0x44e915,_0x55ec53){const _0x586886=_0x42d110,_0x55ec79=this['swingPoints'][_0x586886(0x231)](_0x44e915),_0x40579e=this[_0x586886(0x21b)][_0x586886(0x231)](_0x44e915),_0x541ccd=this[_0x586886(0x22b)][_0x586886(0x223)][_0x586886(0x206)]*this[_0x586886(0x20b)],_0x560fdc=this['config']['zone'][_0x586886(0x1ec)];for(let _0xfb8bee=_0x40579e[_0x586886(0x1f5)]-0x1;_0xfb8bee>=0x0;_0xfb8bee--){_0x55ec53-_0x40579e[_0xfb8bee][_0x586886(0x1ef)]>_0x560fdc&&_0x40579e[_0x586886(0x21c)](_0xfb8bee,0x1);}for(const _0x20b1f of _0x55ec79){let _0x36372f=null;for(const _0x326f80 of _0x40579e){if(_0x326f80[_0x586886(0x25e)](_0x20b1f[_0x586886(0x25c)],this['config'][_0x586886(0x223)][_0x586886(0x206)],this[_0x586886(0x20b)])){_0x36372f=_0x326f80;break;}}if(_0x36372f){_0x36372f[_0x586886(0x230)]++;if(_0x20b1f['price']>_0x36372f[_0x586886(0x25b)])_0x36372f['priceHigh']=_0x20b1f['price'];if(_0x20b1f[_0x586886(0x25c)]<_0x36372f[_0x586886(0x1df)])_0x36372f['priceLow']=_0x20b1f['price'];_0x36372f[_0x586886(0x1d4)]=Math[_0x586886(0x253)](0x1,0.3+_0x36372f[_0x586886(0x230)]*0.15);}else{const _0xcb778=_0x20b1f[_0x586886(0x220)]===_0x586886(0x249)?ZoneType['RESISTANCE']:ZoneType[_0x586886(0x200)],_0xe237f4=new LiquidityZone(_0xcb778,_0x20b1f['price']+_0x541ccd/0x2,_0x20b1f[_0x586886(0x25c)]-_0x541ccd/0x2,_0x20b1f['timestamp'],_0x20b1f['barIndex']);_0xe237f4['qualityScore']=0.3+_0x20b1f[_0x586886(0x1fc)]*0.1,_0x40579e[_0x586886(0x1d7)](_0xe237f4);}}}['_detectSweep'](_0xdef82e,_0x5df310,_0x3fb2b8){const _0x878147=_0x42d110,_0x379184=this[_0x878147(0x21b)][_0x878147(0x231)](_0xdef82e),_0x401f0a=_0x5df310[_0x3fb2b8],_0x4cabc4=_0x401f0a[_0x878147(0x22d)],_0x327f4f=this['config']['sweep'],_0x786dc5=this['config'][_0x878147(0x223)];for(const _0x26d3de of _0x379184){if(_0x26d3de['lastUsedBarIndex']>=0x0&&_0x3fb2b8-_0x26d3de[_0x878147(0x21e)]<_0x786dc5['cooldownBars'])continue;const _0x1517f2=_0x26d3de[_0x878147(0x25a)](),_0x2a18a9=Math[_0x878147(0x23c)](_0x4cabc4-_0x1517f2)/this['tickSize'];if(_0x2a18a9>_0x786dc5['maxZoneDistanceTicks'])continue;const _0x1dc212=Math[_0x878147(0x1f6)](0x0,_0x3fb2b8-_0x327f4f[_0x878147(0x229)]*0x2);for(let _0x42f2c6=_0x1dc212;_0x42f2c6<_0x3fb2b8;_0x42f2c6++){const _0x4991a0=_0x5df310[_0x42f2c6];if(_0x26d3de[_0x878147(0x220)]===ZoneType[_0x878147(0x201)]){const _0x31b9f4=(_0x4991a0['high']-_0x26d3de['priceHigh'])/this['tickSize'];if(_0x31b9f4>=_0x327f4f[_0x878147(0x202)]&&_0x31b9f4<=_0x327f4f['maxPenetrationTicks']){if(_0x4cabc4<_0x26d3de['priceHigh']){const _0x171fb6=_0x4991a0['high']-_0x4991a0[_0x878147(0x251)],_0x1e542f=Math['abs'](_0x4991a0['close']-_0x4991a0['open']),_0x4d71e2=_0x171fb6>0x0?_0x1e542f/_0x171fb6:0x0;if(_0x4d71e2>=_0x327f4f[_0x878147(0x23e)]){const _0x2776a3=this['_getVolumeRatio'](_0x5df310,_0x42f2c6,0x14);if(_0x2776a3>=_0x327f4f['minVolumeRatio']){const _0x27dec0=new SweepEvent(SweepType['HIGH_SWEEP'],_0x26d3de,_0x42f2c6,_0x42f2c6,_0x4991a0['high']);_0x27dec0[_0x878147(0x1e5)]=_0x3fb2b8,_0x27dec0[_0x878147(0x213)]=_0x31b9f4,_0x27dec0['durationBars']=_0x3fb2b8-_0x42f2c6,_0x27dec0[_0x878147(0x24a)]=_0x2776a3,_0x27dec0['qualityScore']=this[_0x878147(0x226)](_0x27dec0,_0x4d71e2),_0x27dec0['isValid']=_0x27dec0['qualityScore']>=_0x327f4f['minQualityScore'];if(_0x27dec0[_0x878147(0x1d0)])return _0x27dec0;}}}}}if(_0x26d3de[_0x878147(0x220)]===ZoneType['SUPPORT']){const _0x15d249=(_0x26d3de[_0x878147(0x1df)]-_0x4991a0[_0x878147(0x251)])/this[_0x878147(0x20b)];if(_0x15d249>=_0x327f4f[_0x878147(0x202)]&&_0x15d249<=_0x327f4f[_0x878147(0x243)]){if(_0x4cabc4>_0x26d3de['priceLow']){const _0x5751ac=_0x4991a0['high']-_0x4991a0[_0x878147(0x251)],_0x9629d5=Math[_0x878147(0x23c)](_0x4991a0[_0x878147(0x22d)]-_0x4991a0['open']),_0x7765f3=_0x5751ac>0x0?_0x9629d5/_0x5751ac:0x0;if(_0x7765f3>=_0x327f4f['minBodyRatio']){const _0x31cc55=this[_0x878147(0x1da)](_0x5df310,_0x42f2c6,0x14);if(_0x31cc55>=_0x327f4f[_0x878147(0x217)]){const _0x2ad2e9=new SweepEvent(SweepType['LOW_SWEEP'],_0x26d3de,_0x42f2c6,_0x42f2c6,_0x4991a0['low']);_0x2ad2e9['exitBarIndex']=_0x3fb2b8,_0x2ad2e9[_0x878147(0x213)]=_0x15d249,_0x2ad2e9['durationBars']=_0x3fb2b8-_0x42f2c6,_0x2ad2e9['volumeRatio']=_0x31cc55,_0x2ad2e9['qualityScore']=this['_scoreSweep'](_0x2ad2e9,_0x7765f3),_0x2ad2e9['isValid']=_0x2ad2e9[_0x878147(0x1d4)]>=_0x327f4f[_0x878147(0x1f8)];if(_0x2ad2e9['isValid'])return _0x2ad2e9;}}}}}}}return null;}['_getVolumeRatio'](_0x91a6b5,_0x46d424,_0x2f5224){const _0x11031c=_0x42d110,_0x572087=Math['max'](0x0,_0x46d424-_0x2f5224),_0x2143ed=_0x91a6b5[_0x11031c(0x235)](_0x572087,_0x46d424);if(_0x2143ed['length']===0x0)return 0x1;const _0x4e95f0=_0x2143ed['map'](_0x17fc14=>_0x17fc14[_0x11031c(0x1e8)])['sort']((_0x18fb41,_0xbf54aa)=>_0x18fb41-_0xbf54aa),_0x40d2ac=Math[_0x11031c(0x1ea)](_0x4e95f0[_0x11031c(0x1f5)]/0x2),_0x221eda=_0x4e95f0[_0x40d2ac]||0x1;return _0x91a6b5[_0x46d424][_0x11031c(0x1e8)]/_0x221eda;}[_0x42d110(0x226)](_0x4aa676,_0x15183e){const _0x162738=_0x42d110;let _0x39dd8e=0x0;const _0x5cf36b=0x4,_0x3e4c42=Math['abs'](_0x4aa676['penetrationTicks']-_0x5cf36b);return _0x39dd8e+=Math['max'](0x0,0.3-_0x3e4c42*0.03),_0x39dd8e+=Math[_0x162738(0x1f6)](0x0,0.25-_0x4aa676[_0x162738(0x207)]*0.05),_0x39dd8e+=Math[_0x162738(0x253)](0.25,_0x4aa676[_0x162738(0x24a)]*0.1),_0x39dd8e+=Math[_0x162738(0x253)](0.2,_0x15183e*0.4),Math['min'](0x1,_0x39dd8e);}[_0x42d110(0x1ed)](_0x692715,_0x303d70,_0x36438c,_0x29df68){const _0x31813c=_0x42d110;if(Date['now']()-this['lastSignalTime']<this[_0x31813c(0x22b)][_0x31813c(0x1fd)][_0x31813c(0x219)])return null;const _0x506a13=this['config']['execution'],_0x48b6fd=_0x303d70['close'],_0x25e46c=_0x29df68['sweepType']===SweepType[_0x31813c(0x234)]?_0x31813c(0x20c):'long';let _0x5d0b27,_0x60f692,_0x3d77bb,_0xdc7dae;_0x25e46c==='long'?(_0x5d0b27=_0x48b6fd-_0x506a13[_0x31813c(0x1e2)]*this['tickSize'],_0x60f692=_0x48b6fd+_0x506a13['targetTicks']*this[_0x31813c(0x20b)],_0x3d77bb=_0x48b6fd+_0x506a13[_0x31813c(0x22e)]*this[_0x31813c(0x20b)],_0xdc7dae=_0x48b6fd+_0x506a13[_0x31813c(0x1eb)]*this[_0x31813c(0x20b)]):(_0x5d0b27=_0x48b6fd+_0x506a13['stopTicks']*this[_0x31813c(0x20b)],_0x60f692=_0x48b6fd-_0x506a13['targetTicks']*this['tickSize'],_0x3d77bb=_0x48b6fd-_0x506a13[_0x31813c(0x22e)]*this[_0x31813c(0x20b)],_0xdc7dae=_0x48b6fd-_0x506a13['trailTriggerTicks']*this['tickSize']);const _0xe6984c=_0x506a13[_0x31813c(0x20a)]/_0x506a13['stopTicks'],_0x445cca=Math['min'](0x1,_0x29df68[_0x31813c(0x1d4)]*0.5+_0x29df68[_0x31813c(0x223)]['qualityScore']*0.3+(_0x29df68['volumeRatio']>1.5?0.2:_0x29df68['volumeRatio']*0.1));let _0x4899fd=SignalStrength[_0x31813c(0x209)];if(_0x445cca>=0.8)_0x4899fd=SignalStrength['VERY_STRONG'];else{if(_0x445cca>=0.65)_0x4899fd=SignalStrength['STRONG'];else{if(_0x445cca<0.5)_0x4899fd=SignalStrength['WEAK'];}}const _0x4530e4=0.5+(_0x445cca-0.5)*0.4,_0x22d984=_0x4530e4*Math[_0x31813c(0x23c)](_0x60f692-_0x48b6fd)-(0x1-_0x4530e4)*Math[_0x31813c(0x23c)](_0x48b6fd-_0x5d0b27);_0x29df68[_0x31813c(0x223)]['lastUsedBarIndex']=_0x36438c,_0x29df68[_0x31813c(0x223)][_0x31813c(0x23d)]=!![],_0x29df68['zone'][_0x31813c(0x1d3)]=new Date(_0x303d70['timestamp']),this['lastSignalTime']=Date['now'](),this[_0x31813c(0x1f2)][_0x31813c(0x260)]++;const _0x35878b={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x692715['split']('.')[0x0]||_0x692715,'contractId':_0x692715,'side':_0x25e46c==='long'?OrderSide[_0x31813c(0x1d5)]:OrderSide[_0x31813c(0x1fe)],'direction':_0x25e46c,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x4899fd,'edge':_0x22d984,'confidence':_0x445cca,'entry':_0x48b6fd,'entryPrice':_0x48b6fd,'stopLoss':_0x5d0b27,'takeProfit':_0x60f692,'riskReward':_0xe6984c,'stopTicks':_0x506a13['stopTicks'],'targetTicks':_0x506a13[_0x31813c(0x20a)],'breakevenTicks':_0x506a13['breakevenTicks'],'trailTriggerTicks':_0x506a13['trailTriggerTicks'],'trailDistanceTicks':_0x506a13[_0x31813c(0x236)],'beLevel':_0x3d77bb,'trailTrigger':_0xdc7dae,'sweepType':_0x29df68[_0x31813c(0x1ff)],'penetrationTicks':_0x29df68['penetrationTicks'],'sweepDurationBars':_0x29df68['durationBars'],'sweepQuality':_0x29df68['qualityScore'],'volumeRatio':_0x29df68[_0x31813c(0x24a)],'zoneType':_0x29df68[_0x31813c(0x223)][_0x31813c(0x220)],'zoneLevel':_0x29df68['zone'][_0x31813c(0x25a)](),'zoneTouches':_0x29df68[_0x31813c(0x223)]['touches'],'zoneQuality':_0x29df68[_0x31813c(0x223)][_0x31813c(0x1d4)],'expires':Date['now']()+0xea60};return this[_0x31813c(0x254)]('signal',{'side':_0x25e46c==='long'?_0x31813c(0x1f7):_0x31813c(0x238),'action':'open','reason':'2B\x20'+_0x29df68[_0x31813c(0x1ff)]+'\x20|\x20Pen:'+_0x29df68[_0x31813c(0x213)]['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x29df68['volumeRatio']['toFixed'](0x1)+_0x31813c(0x239)+(_0x29df68[_0x31813c(0x1d4)]*0x64)[_0x31813c(0x224)](0x0)+'%',..._0x35878b}),this[_0x31813c(0x254)]('log',{'type':'info','message':_0x31813c(0x1d9)+_0x25e46c['toUpperCase']()+_0x31813c(0x25f)+_0x48b6fd['toFixed'](0x2)+'\x20|\x20'+_0x29df68[_0x31813c(0x1ff)]+'\x20|\x20Pen:'+_0x29df68['penetrationTicks'][_0x31813c(0x224)](0x1)+_0x31813c(0x24f)+_0x29df68[_0x31813c(0x24a)]['toFixed'](0x1)+'x\x20|\x20Conf:'+(_0x445cca*0x64)['toFixed'](0x0)+'%'}),_0x35878b;}[_0x42d110(0x1de)](_0x327145,_0x4731da){const _0x5831ae=_0x42d110,_0xb10131=this[_0x5831ae(0x214)][_0x5831ae(0x231)](_0x327145)||[],_0x30bde5=this[_0x5831ae(0x21b)]['get'](_0x327145)||[],_0x5eaca4=this[_0x5831ae(0x1ee)]['get'](_0x327145)||[];if(_0xb10131['length']<0x5)return{'ready':![],'message':'Collecting\x20data...\x20'+_0xb10131['length']+'/5\x20bars'};const _0x31e8da=_0x30bde5['map'](_0x24c4e9=>({'zone':_0x24c4e9,'distance':Math[_0x5831ae(0x23c)](_0x4731da-_0x24c4e9['getLevel']())}))['sort']((_0x1bf6df,_0x31b271)=>_0x1bf6df[_0x5831ae(0x21d)]-_0x31b271['distance']),_0x24e42b=_0x31e8da['find'](_0xfe43f1=>_0xfe43f1['zone'][_0x5831ae(0x220)]===ZoneType[_0x5831ae(0x201)]),_0x504b1c=_0x31e8da[_0x5831ae(0x242)](_0x283616=>_0x283616['zone']['type']===ZoneType[_0x5831ae(0x200)]);return{'ready':!![],'barsProcessed':_0xb10131[_0x5831ae(0x1f5)],'swingsDetected':_0x5eaca4['length'],'activeZones':_0x30bde5['length'],'nearestResistance':_0x24e42b?_0x24e42b[_0x5831ae(0x223)][_0x5831ae(0x25a)]():null,'nearestSupport':_0x504b1c?_0x504b1c['zone']['getLevel']():null,'stopTicks':this['config'][_0x5831ae(0x1fd)][_0x5831ae(0x1e2)],'targetTicks':this['config'][_0x5831ae(0x1fd)]['targetTicks'],'strategy':_0x5831ae(0x1d8)};}[_0x42d110(0x25d)](_0x8c320d){const _0x17b14f=_0x42d110;this['recentTrades']['push']({'netPnl':_0x8c320d,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this['recentTrades'][_0x17b14f(0x20d)]();_0x8c320d>0x0?this['stats']['wins']++:this[_0x17b14f(0x1f2)]['losses']++,this[_0x17b14f(0x1f2)][_0x17b14f(0x203)]++,this['stats']['pnl']+=_0x8c320d,this['emit']('log',{'type':_0x17b14f(0x255),'message':'[HQX-2B]\x20Trade\x20result:\x20'+(_0x8c320d>0x0?'WIN':'LOSS')+'\x20$'+_0x8c320d[_0x17b14f(0x224)](0x2)});}[_0x42d110(0x24b)](_0x3a3594){const _0x346f77=_0x42d110;return this[_0x346f77(0x214)][_0x346f77(0x231)](_0x3a3594)||[];}[_0x42d110(0x22f)](){return this['stats'];}['getHealthStatus'](_0x40a972){const _0x459b60=_0x42d110,_0x296fae=this[_0x459b60(0x214)][_0x459b60(0x231)](_0x40a972)||[],_0x4c3e16=this[_0x459b60(0x21b)]['get'](_0x40a972)||[],_0x1e1e6=this[_0x459b60(0x1ee)]['get'](_0x40a972)||[],_0x49cd28=this[_0x459b60(0x228)]['get'](_0x40a972),_0x5a4cd6=_0x296fae[_0x296fae['length']-0x1],_0x430a85=_0x5a4cd6?Date[_0x459b60(0x21f)]()-_0x5a4cd6[_0x459b60(0x1e3)]:null,_0x53ecf6=_0x4c3e16['filter'](_0x3bad53=>_0x3bad53['type']===ZoneType[_0x459b60(0x201)])['length'],_0x3da4f9=_0x4c3e16[_0x459b60(0x1f9)](_0x249fa7=>_0x249fa7['type']===ZoneType['SUPPORT'])['length'];return{'healthy':_0x296fae['length']>=0x5,'barsTotal':_0x296fae['length'],'barsLast5Min':_0x296fae[_0x459b60(0x1f9)](_0x3bf46c=>Date[_0x459b60(0x21f)]()-_0x3bf46c['timestamp']<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x1e1e6['length'],'zonesResistance':_0x53ecf6,'zonesSupport':_0x3da4f9,'zonesTotal':_0x4c3e16['length'],'currentBarTicks':_0x49cd28?_0x49cd28['tickCount']:0x0,'isAggregating':_0x49cd28&&_0x49cd28['tickCount']>0x0,'timeSinceLastBarMs':_0x430a85,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this[_0x459b60(0x22b)]['execution']['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date['now']())};}['reset'](_0x1268a2){const _0x747c54=_0x42d110;this[_0x747c54(0x214)]['set'](_0x1268a2,[]),this[_0x747c54(0x1ee)]['set'](_0x1268a2,[]),this['liquidityZones']['set'](_0x1268a2,[]),this['activeSweeps'][_0x747c54(0x211)](_0x1268a2,[]),this['currentBar'][_0x747c54(0x244)](_0x1268a2),this[_0x747c54(0x254)](_0x747c54(0x248),{'type':'info','message':_0x747c54(0x216)+_0x1268a2});}[_0x42d110(0x205)](_0x124293,_0x4300bd){const _0x3dbf5f=_0x42d110;if(!_0x4300bd||_0x4300bd['length']===0x0){this[_0x3dbf5f(0x254)](_0x3dbf5f(0x248),{'type':'debug','message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory'][_0x3dbf5f(0x1f1)](_0x124293)&&this[_0x3dbf5f(0x259)](_0x124293);const _0x34afda=[..._0x4300bd][_0x3dbf5f(0x24c)]((_0xda6fb7,_0x111e8c)=>_0xda6fb7[_0x3dbf5f(0x1e3)]-_0x111e8c['timestamp']);this[_0x3dbf5f(0x254)]('log',{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x34afda[_0x3dbf5f(0x1f5)]+_0x3dbf5f(0x210)});let _0x3cc4b9=0x0;for(const _0x2a24d0 of _0x34afda){const _0x4e066d=this[_0x3dbf5f(0x1d2)](_0x124293,_0x2a24d0);if(_0x4e066d)_0x3cc4b9++;}const _0x126fb5=this[_0x3dbf5f(0x214)][_0x3dbf5f(0x231)](_0x124293)||[],_0x3d9a13=this[_0x3dbf5f(0x1ee)][_0x3dbf5f(0x231)](_0x124293)||[],_0x167bc6=this[_0x3dbf5f(0x21b)][_0x3dbf5f(0x231)](_0x124293)||[];this[_0x3dbf5f(0x254)](_0x3dbf5f(0x248),{'type':'info','message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x126fb5[_0x3dbf5f(0x1f5)]+'\x20bars,\x20'+_0x3d9a13[_0x3dbf5f(0x1f5)]+_0x3dbf5f(0x1d6)+_0x167bc6['length']+_0x3dbf5f(0x24d)}),_0x3cc4b9>0x0&&this[_0x3dbf5f(0x254)](_0x3dbf5f(0x248),{'type':_0x3dbf5f(0x255),'message':_0x3dbf5f(0x1f3)+_0x3cc4b9+'\x20historical\x20signals\x20detected\x20(ignored)'}),this[_0x3dbf5f(0x1e7)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x346b57={}){const _0x2051b0=_0x42d110;super(),this[_0x2051b0(0x22b)]=_0x346b57,this[_0x2051b0(0x232)]=new HQX2BLiquiditySweep(_0x346b57),this['strategy']['on']('signal',_0x300e6e=>this['emit']('signal',_0x300e6e)),this[_0x2051b0(0x232)]['on'](_0x2051b0(0x248),_0x9cdab9=>this['emit'](_0x2051b0(0x248),_0x9cdab9));}[_0x42d110(0x250)](_0x20c752){return this['strategy']['processTick'](_0x20c752);}[_0x42d110(0x1e4)](_0x116fc5){return this['strategy']['onTick'](_0x116fc5);}['onTrade'](_0x47dbf6){const _0x2888f7=_0x42d110;return this[_0x2888f7(0x232)][_0x2888f7(0x1e1)](_0x47dbf6);}['processBar'](_0x317eab,_0x604ec7){return this['strategy']['processBar'](_0x317eab,_0x604ec7);}[_0x42d110(0x259)](_0xe0a442,_0x4a38c5,_0x3abb15){return this['strategy']['initialize'](_0xe0a442,_0x4a38c5,_0x3abb15);}['getAnalysisState'](_0x2d9353,_0x286950){const _0x731018=_0x42d110;return this[_0x731018(0x232)][_0x731018(0x1de)](_0x2d9353,_0x286950);}[_0x42d110(0x25d)](_0x4c04be){const _0xe52c3f=_0x42d110;return this['strategy'][_0xe52c3f(0x25d)](_0x4c04be);}['reset'](_0x36ef08){const _0x187f7e=_0x42d110;return this[_0x187f7e(0x232)][_0x187f7e(0x222)](_0x36ef08);}[_0x42d110(0x22f)](){const _0x41e25a=_0x42d110;return this['strategy'][_0x41e25a(0x22f)]();}[_0x42d110(0x24b)](_0x584ae){const _0x5b4b4f=_0x42d110;return this[_0x5b4b4f(0x232)]['getBarHistory'](_0x584ae);}[_0x42d110(0x205)](_0x1f88a7,_0x19d1b2){const _0x2956a8=_0x42d110;return this['strategy'][_0x2956a8(0x205)](_0x1f88a7,_0x19d1b2);}[_0x42d110(0x22a)](_0x4f5c6a){const _0xd52c29=_0x42d110;return this['strategy'][_0xd52c29(0x22a)](_0x4f5c6a);}[_0x42d110(0x240)](_0x2d9552){return null;}}function _0x1d4b(){const _0x2c55d4=['[HQX-2B]\x20','America/New_York','length','max','buy','minQualityScore','filter',',\x20value=','2737ZFlBTB','strength','execution','ASK','sweepType','SUPPORT','RESISTANCE','minPenetrationTicks','trades','startTime','preloadBars','clusterToleranceTicks','durationBars','extremeBarIndex','MODERATE','targetTicks','tickSize','short','shift','session',':\x20tick=','\x20historical\x20bars...','set','tickValue','penetrationTicks','barHistory','_detectSwings','[HQX-2B]\x20Reset\x20state\x20for\x20','minVolumeRatio','object','cooldownMs','1777194TEhowt','liquidityZones','splice','distance','lastUsedBarIndex','now','type','19736JJjqGN','reset','zone','toFixed','_updateZones','_scoreSweep','19095890MzkmJM','currentBar','maxDurationBars','getHealthStatus','config','1245382WiHmjj','close','breakevenTicks','getStats','touches','get','strategy','resistance','HIGH_SWEEP','slice','trailDistanceTicks','activeSweeps','sell','x\x20|\x20Q:','1jDFrqs','events','abs','swept','minBodyRatio','swing','generateSignal','isArray','find','maxPenetrationTicks','delete','10021392hImrbv','minStrength','barIntervalMs','log','high','volumeRatio','getBarHistory','sort','\x20zones','uuid','t\x20Vol:','processTick','low','55vTPwkt','min','emit','debug','253384ZrnUDP','3415896CKXZdB','getTimezoneOffset','initialize','getLevel','priceHigh','price','recordTradeResult','containsPrice','\x20@\x20','signals','\x20|\x20Total:\x20','getFullYear','isValid','[2B]\x20SWEEP\x20','processBar','sweptAt','qualityScore','BID','\x20swings,\x20','push','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','[HQX-2B]\x20SIGNAL:\x20','_getVolumeRatio','enabled','t,\x20Trail=','info','getAnalysisState','priceLow','lookbackBars','onTrade','stopTicks','timestamp','onTick','exitBarIndex',',\x20TF=1min','lastSignalTime','volume','_mergeConfig','floor','trailTriggerTicks','maxZoneAgeBars','_generateSignal','swingPoints','barIndex','support','has','stats'];_0x1d4b=function(){return _0x2c55d4;};return _0x1d4b();}module['exports']={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
@@ -1 +1 @@
1
- const _0x298fa1=_0x4d71;(function(_0xb763e,_0x23ea93){const _0xe488e6=_0x4d71,_0x75f137=_0xb763e();while(!![]){try{const _0x459ff3=parseInt(_0xe488e6(0xb9))/0x1+parseInt(_0xe488e6(0xe4))/0x2+-parseInt(_0xe488e6(0x7e))/0x3+parseInt(_0xe488e6(0xac))/0x4+parseInt(_0xe488e6(0xae))/0x5+parseInt(_0xe488e6(0x97))/0x6+parseInt(_0xe488e6(0xa9))/0x7*(-parseInt(_0xe488e6(0xc1))/0x8);if(_0x459ff3===_0x23ea93)break;else _0x75f137['push'](_0x75f137['shift']());}catch(_0x4f90d2){_0x75f137['push'](_0x75f137['shift']());}}}(_0x2969,0xdf54f));function _0x2969(){const _0x3b0a15=['errorCovariance','volumeBuffer','open','1697758pyCJbm','[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)','long','pow','baseTargetTicks',',\x20streak:\x20','set','[HQX-UltraScalping]\x20Reset\x20state\x20for\x20','\x20Regime:','volume','%\x20OFI:','zscore','emit','vpinToxicThreshold','vpin','%,\x20OFI=','426672nOAnzr','timestamp','WEAK','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','stopMultiplier','cooldownMs','getAnalysisState','shift','[HQX-UltraScalping]\x20Initialized\x20for\x20','push','reset','now','BID','_calculateATR','processBar','winStreak','exports','reduce','priceBuffer','vpinWindow','profitLockPct','_computeKyleLambda','buy','ofi','symbol','2042532xzuOKe','onTick','onTrade','atrHistory','ASK','\x20|\x20Z:','max','generateSignal','_computeOrderFlowImbalance','lastSignalTime','signal','slice','_applyKalmanFilter','kalmanProcessNoise','_computeVPIN','composite','stats','lossStreak','501235whsECe','_generateSignal','log','775136nAWSkm','recentTrades','5454865tLNpZj','high','tickSize','volatility','price','volatilityLookback','ofiLookback','zscoreThreshold','_computeZScore','uuid','kalmanStates','158243zXYuZu','strategy','get','processTick','\x20|\x20Conf:','toFixed','shouldExitByZScore','round','176jEMdDI','confidenceBonus','getModelValues','kalman','debug','_detectVolatilityRegime','tickValue','barHistory','%\x20Kyle:','zscoreExitThreshold',',\x20VPIN=','normal','abs','initialize','%,\x20cf=','sell','pnl','min','kalmanMeasurementNoise','low','signals','breakevenTicks','targetMultiplier','minConfidence','filter','length','baseStopTicks','recordTradeResult','info','close','getBarHistory','weights'];_0x2969=function(){return _0x3b0a15;};return _0x2969();}const EventEmitter=require('events'),{v4:uuidv4}=require(_0x298fa1(0xb7)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0x4d71(_0x40f151,_0x466d44){_0x40f151=_0x40f151-0x75;const _0x2969f4=_0x2969();let _0x4d717e=_0x2969f4[_0x40f151];return _0x4d717e;}class HQXUltraScalping extends EventEmitter{constructor(_0x192e78={}){const _0x2856a9=_0x298fa1;super(),this[_0x2856a9(0xb0)]=_0x192e78[_0x2856a9(0xb0)]||0.25,this[_0x2856a9(0xc7)]=_0x192e78[_0x2856a9(0xc7)]||0x5,this['zscoreEntryThreshold']=1.5,this[_0x2856a9(0xca)]=0.5,this['vpinWindow']=0x32,this['vpinToxicThreshold']=0.7,this[_0x2856a9(0xa4)]=0.01,this[_0x2856a9(0xd3)]=0.1,this[_0x2856a9(0xb3)]=0x64,this['ofiLookback']=0x14,this[_0x2856a9(0xdb)]=0x8,this[_0x2856a9(0xe8)]=0x10,this[_0x2856a9(0xd6)]=0x4,this[_0x2856a9(0x92)]=0.5,this[_0x2856a9(0xd8)]=0.55,this['weights']={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x2856a9(0xc8)]=new Map(),this['priceBuffer']=new Map(),this[_0x2856a9(0xe2)]=new Map(),this[_0x2856a9(0xb8)]=new Map(),this[_0x2856a9(0x9a)]=new Map(),this[_0x2856a9(0xad)]=[],this[_0x2856a9(0x8d)]=0x0,this[_0x2856a9(0xa8)]=0x0,this[_0x2856a9(0xa0)]=0x0,this[_0x2856a9(0x83)]=0x7530,this['minHoldTimeMs']=0x2710,this[_0x2856a9(0xa7)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x298fa1(0xce)](_0x2a7d9e,_0x18f9ca=0.25,_0x3a237b=0x5){const _0x46f47e=_0x298fa1;this['tickSize']=_0x18f9ca,this['tickValue']=_0x3a237b,this[_0x46f47e(0xc8)][_0x46f47e(0xea)](_0x2a7d9e,[]),this[_0x46f47e(0x90)][_0x46f47e(0xea)](_0x2a7d9e,[]),this['volumeBuffer'][_0x46f47e(0xea)](_0x2a7d9e,[]),this[_0x46f47e(0x9a)]['set'](_0x2a7d9e,[]),this['kalmanStates']['set'](_0x2a7d9e,{'estimate':0x0,'errorCovariance':0x1}),this[_0x46f47e(0x7a)](_0x46f47e(0xab),{'type':_0x46f47e(0xdd),'message':_0x46f47e(0x86)+_0x2a7d9e+':\x20tick='+_0x18f9ca+',\x20value='+_0x3a237b}),this[_0x46f47e(0x7a)](_0x46f47e(0xab),{'type':_0x46f47e(0xdd),'message':_0x46f47e(0xe5)});}[_0x298fa1(0xbc)](_0x75a72){const _0x19b342=_0x298fa1,{contractId:_0x234ccd,price:_0xe4536b,volume:_0x422b10,side:_0x8c8887,timestamp:_0x211f58}=_0x75a72,_0x2d2a3c={'timestamp':_0x211f58||Date['now'](),'open':_0xe4536b,'high':_0xe4536b,'low':_0xe4536b,'close':_0xe4536b,'volume':_0x422b10||0x1};return this[_0x19b342(0x8c)](_0x234ccd,_0x2d2a3c);}[_0x298fa1(0x98)](_0x27a9a7){return this['processTick'](_0x27a9a7);}[_0x298fa1(0x99)](_0xf04915){const _0x1fdf35=_0x298fa1;return this[_0x1fdf35(0xbc)]({'contractId':_0xf04915['contractId']||_0xf04915[_0x1fdf35(0x96)],'price':_0xf04915[_0x1fdf35(0xb2)],'volume':_0xf04915['size']||_0xf04915['volume']||0x1,'side':_0xf04915['side'],'timestamp':_0xf04915[_0x1fdf35(0x7f)]||Date[_0x1fdf35(0x89)]()});}['processBar'](_0x310c8f,_0x5973cf){const _0x392bae=_0x298fa1;let _0x24b9fa=this['barHistory']['get'](_0x310c8f);!_0x24b9fa&&(this[_0x392bae(0xce)](_0x310c8f),_0x24b9fa=this[_0x392bae(0xc8)]['get'](_0x310c8f));_0x24b9fa['push'](_0x5973cf);if(_0x24b9fa['length']>0x1f4)_0x24b9fa[_0x392bae(0x85)]();const _0x2ba701=this[_0x392bae(0x90)]['get'](_0x310c8f);_0x2ba701['push'](_0x5973cf['close']);if(_0x2ba701[_0x392bae(0xda)]>0xc8)_0x2ba701['shift']();const _0x5b4832=this[_0x392bae(0xe2)][_0x392bae(0xbb)](_0x310c8f),_0xb34526=_0x5973cf[_0x392bae(0xaf)]-_0x5973cf['low'];let _0x3afa9d=_0x5973cf['volume']*0.5,_0x5ee97a=_0x5973cf[_0x392bae(0x77)]*0.5;if(_0xb34526>0x0){const _0x5c4c51=(_0x5973cf[_0x392bae(0xde)]-_0x5973cf[_0x392bae(0xd4)])/_0xb34526;_0x3afa9d=_0x5973cf['volume']*_0x5c4c51,_0x5ee97a=_0x5973cf['volume']*(0x1-_0x5c4c51);}_0x5b4832['push']({'buy':_0x3afa9d,'sell':_0x5ee97a});if(_0x5b4832[_0x392bae(0xda)]>0x64)_0x5b4832['shift']();if(_0x24b9fa['length']<0x32)return null;const _0x202aa3=this[_0x392bae(0xb6)](_0x2ba701),_0x5bac3f=this['_computeVPIN'](_0x5b4832),_0x5cadcb=this[_0x392bae(0x93)](_0x24b9fa),_0x3a09a9=this[_0x392bae(0xa3)](_0x310c8f,_0x5973cf['close']),{regime:_0x82f34c,params:_0x5a4a5f}=this['_detectVolatilityRegime'](_0x310c8f,_0x24b9fa),_0x506d13=this['_computeOrderFlowImbalance'](_0x24b9fa);return this[_0x392bae(0xaa)](_0x310c8f,_0x5973cf['close'],_0x202aa3,_0x5bac3f,_0x5cadcb,_0x3a09a9,_0x82f34c,_0x5a4a5f,_0x506d13,_0x24b9fa);}[_0x298fa1(0xb6)](_0x599f4b,_0x1d9451=0x32){const _0x40044e=_0x298fa1;if(_0x599f4b['length']<_0x1d9451)return 0x0;const _0xf16f9a=_0x599f4b['slice'](-_0x1d9451),_0x5cd40d=_0xf16f9a[_0x40044e(0x8f)]((_0x2e8230,_0x327e08)=>_0x2e8230+_0x327e08,0x0)/_0x1d9451,_0x28b757=_0xf16f9a['reduce']((_0x44184c,_0x480ae9)=>_0x44184c+Math[_0x40044e(0xe7)](_0x480ae9-_0x5cd40d,0x2),0x0)/_0x1d9451,_0x39a33e=Math['sqrt'](_0x28b757);if(_0x39a33e<0.0001)return 0x0;const _0x202229=_0x599f4b[_0x599f4b['length']-0x1];return(_0x202229-_0x5cd40d)/_0x39a33e;}[_0x298fa1(0xa5)](_0xc89725){const _0x3e8d1b=_0x298fa1;if(_0xc89725['length']<this['vpinWindow'])return 0.5;const _0xa70e3e=_0xc89725['slice'](-this[_0x3e8d1b(0x91)]);let _0x2e0436=0x0,_0x30d6f7=0x0;for(const _0x2ce3b0 of _0xa70e3e){_0x2e0436+=_0x2ce3b0[_0x3e8d1b(0x94)],_0x30d6f7+=_0x2ce3b0['sell'];}const _0x3d2204=_0x2e0436+_0x30d6f7;if(_0x3d2204<0x1)return 0.5;return Math[_0x3e8d1b(0xcd)](_0x2e0436-_0x30d6f7)/_0x3d2204;}['_computeKyleLambda'](_0x43c979){const _0x3f9736=_0x298fa1;if(_0x43c979[_0x3f9736(0xda)]<0x14)return 0x0;const _0x1c258b=_0x43c979[_0x3f9736(0xa2)](-0x14),_0x87b4e9=[],_0x1ade78=[];for(let _0x191ba5=0x1;_0x191ba5<_0x1c258b[_0x3f9736(0xda)];_0x191ba5++){_0x87b4e9[_0x3f9736(0x87)](_0x1c258b[_0x191ba5]['close']-_0x1c258b[_0x191ba5-0x1][_0x3f9736(0xde)]),_0x1ade78['push'](_0x1c258b[_0x191ba5]['volume']);}const _0x4a8243=_0x87b4e9[_0x3f9736(0x8f)]((_0x2cbb19,_0x4b74d4)=>_0x2cbb19+_0x4b74d4,0x0)/_0x87b4e9[_0x3f9736(0xda)],_0x1a2db7=_0x1ade78['reduce']((_0xc0b666,_0x1a7254)=>_0xc0b666+_0x1a7254,0x0)/_0x1ade78[_0x3f9736(0xda)];let _0x50d4cb=0x0,_0x30ac5b=0x0;for(let _0x4c25b6=0x0;_0x4c25b6<_0x87b4e9[_0x3f9736(0xda)];_0x4c25b6++){_0x50d4cb+=(_0x87b4e9[_0x4c25b6]-_0x4a8243)*(_0x1ade78[_0x4c25b6]-_0x1a2db7),_0x30ac5b+=Math[_0x3f9736(0xe7)](_0x1ade78[_0x4c25b6]-_0x1a2db7,0x2);}_0x50d4cb/=_0x87b4e9[_0x3f9736(0xda)],_0x30ac5b/=_0x87b4e9['length'];if(_0x30ac5b<0.0001)return 0x0;return Math['abs'](_0x50d4cb/_0x30ac5b);}[_0x298fa1(0xa3)](_0x1545ef,_0x1c193a){const _0x2dcd63=_0x298fa1;let _0xe73f80=this[_0x2dcd63(0xb8)]['get'](_0x1545ef);if(!_0xe73f80)return _0xe73f80={'estimate':_0x1c193a,'errorCovariance':0x1},this['kalmanStates'][_0x2dcd63(0xea)](_0x1545ef,_0xe73f80),_0x1c193a;const _0x20bee6=_0xe73f80['estimate'],_0xf5da93=_0xe73f80['errorCovariance']+this['kalmanProcessNoise'],_0x340374=_0xf5da93/(_0xf5da93+this[_0x2dcd63(0xd3)]),_0x220ac3=_0x20bee6+_0x340374*(_0x1c193a-_0x20bee6),_0x274e89=(0x1-_0x340374)*_0xf5da93;return _0xe73f80['estimate']=_0x220ac3,_0xe73f80[_0x2dcd63(0xe1)]=_0x274e89,_0x220ac3;}[_0x298fa1(0xc6)](_0x5028d1,_0x521bc5){const _0x56134f=_0x298fa1,_0x12160a=this[_0x56134f(0x8b)](_0x521bc5),_0x26d488=_0x12160a/this['tickSize'];let _0x504ae4=this[_0x56134f(0x9a)]['get'](_0x5028d1);!_0x504ae4&&(_0x504ae4=[],this[_0x56134f(0x9a)][_0x56134f(0xea)](_0x5028d1,_0x504ae4));_0x504ae4['push'](_0x12160a);if(_0x504ae4['length']>0x1f4)_0x504ae4['shift']();let _0x2c1f80=0.5;_0x504ae4['length']>=0x14&&(_0x2c1f80=_0x504ae4[_0x56134f(0xd9)](_0x10185c=>_0x10185c<=_0x12160a)[_0x56134f(0xda)]/_0x504ae4[_0x56134f(0xda)]);let _0x2d081e,_0x166cbf;if(_0x2c1f80<0.25)_0x2d081e='low',_0x166cbf={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x2c1f80<0.75?(_0x2d081e='normal',_0x166cbf={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x2d081e=_0x56134f(0xaf),_0x166cbf={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x2d081e,'params':_0x166cbf};}['_calculateATR'](_0x5cbcbb,_0x27a526=0xe){const _0x98906=_0x298fa1;if(_0x5cbcbb[_0x98906(0xda)]<_0x27a526+0x1)return 2.5;const _0x190394=[];for(let _0x2213ec=_0x5cbcbb[_0x98906(0xda)]-_0x27a526;_0x2213ec<_0x5cbcbb['length'];_0x2213ec++){const _0x45d7ca=_0x5cbcbb[_0x2213ec],_0x5518ee=_0x5cbcbb[_0x2213ec-0x1][_0x98906(0xde)],_0x1d83f9=Math['max'](_0x45d7ca['high']-_0x45d7ca['low'],Math['abs'](_0x45d7ca[_0x98906(0xaf)]-_0x5518ee),Math[_0x98906(0xcd)](_0x45d7ca[_0x98906(0xd4)]-_0x5518ee));_0x190394['push'](_0x1d83f9);}return _0x190394['reduce']((_0x37271d,_0x1f2212)=>_0x37271d+_0x1f2212,0x0)/_0x190394[_0x98906(0xda)];}['_computeOrderFlowImbalance'](_0xf4fa9){const _0xb677e5=_0x298fa1;if(_0xf4fa9[_0xb677e5(0xda)]<this[_0xb677e5(0xb4)])return 0x0;const _0x2c11ae=_0xf4fa9['slice'](-this[_0xb677e5(0xb4)]);let _0x392b22=0x0,_0x3e646b=0x0;for(const _0x4c395a of _0x2c11ae){const _0x560384=_0x4c395a['high']-_0x4c395a['low'];if(_0x560384>0x0){const _0x149711=(_0x4c395a['close']-_0x4c395a[_0xb677e5(0xd4)])/_0x560384;_0x392b22+=_0x149711*_0x4c395a['volume'],_0x3e646b+=(0x1-_0x149711)*_0x4c395a['volume'];}}const _0x3d8ff9=_0x392b22+_0x3e646b;if(_0x3d8ff9<0x1)return 0x0;return(_0x392b22-_0x3e646b)/_0x3d8ff9;}[_0x298fa1(0xaa)](_0x2d07d2,_0x23c6d9,_0x1d32bc,_0x36378f,_0x3e1aea,_0x10d7d4,_0x53f99d,_0x196ab2,_0x132228,_0xe8e8a0){const _0x9e9f3e=_0x298fa1,_0x122c1d=Math['abs'](_0x1d32bc);if(_0x122c1d<_0x196ab2[_0x9e9f3e(0xb5)])return null;if(_0x36378f>this[_0x9e9f3e(0x7b)])return null;let _0x3c3b1c;if(_0x1d32bc<-_0x196ab2[_0x9e9f3e(0xb5)])_0x3c3b1c='long';else{if(_0x1d32bc>_0x196ab2['zscoreThreshold'])_0x3c3b1c='short';else return null;}const _0x2e34c1=_0x3c3b1c==='long'&&_0x132228>0.1||_0x3c3b1c==='short'&&_0x132228<-0.1,_0x239133=_0x23c6d9-_0x10d7d4,_0x5d3376=_0x3c3b1c==='long'&&_0x239133<0x0||_0x3c3b1c==='short'&&_0x239133>0x0,_0x353a72={'zscore':Math[_0x9e9f3e(0xd2)](0x1,_0x122c1d/0x4),'vpin':0x1-_0x36378f,'kyleLambda':_0x3e1aea>0.001?0.5:0.8,'kalman':_0x5d3376?0.8:0.4,'volatility':_0x53f99d===_0x9e9f3e(0xcc)?0.8:_0x53f99d==='low'?0.7:0.6,'ofi':_0x2e34c1?0.9:0.5,'composite':0x0};_0x353a72[_0x9e9f3e(0xa6)]=_0x353a72[_0x9e9f3e(0x79)]*this[_0x9e9f3e(0xe0)]['zscore']+_0x353a72[_0x9e9f3e(0x7c)]*this['weights']['vpin']+_0x353a72['kyleLambda']*this[_0x9e9f3e(0xe0)]['kyleLambda']+_0x353a72[_0x9e9f3e(0xc4)]*this[_0x9e9f3e(0xe0)][_0x9e9f3e(0xc4)]+_0x353a72[_0x9e9f3e(0xb1)]*this['weights'][_0x9e9f3e(0xb1)]+_0x353a72[_0x9e9f3e(0x95)]*this[_0x9e9f3e(0xe0)][_0x9e9f3e(0x95)];const _0x1f8037=Math['min'](0x1,_0x353a72['composite']+_0x196ab2[_0x9e9f3e(0xc2)]);if(_0x1f8037<this['minConfidence'])return null;if(Date[_0x9e9f3e(0x89)]()-this[_0x9e9f3e(0xa0)]<this['cooldownMs'])return null;const _0x51bb01=Math['round'](this[_0x9e9f3e(0xdb)]*_0x196ab2['stopMultiplier']),_0x23d7fd=Math['round'](this[_0x9e9f3e(0xe8)]*_0x196ab2[_0x9e9f3e(0xd7)]),_0x4cf666=Math[_0x9e9f3e(0x9d)](0x6,Math['min'](0xc,_0x51bb01)),_0x1d066d=Math['max'](_0x4cf666*1.5,Math[_0x9e9f3e(0xd2)](0x18,_0x23d7fd));let _0x2e020a,_0x56ae29,_0x3666d4,_0x48cee5;_0x3c3b1c===_0x9e9f3e(0xe6)?(_0x2e020a=_0x23c6d9-_0x4cf666*this['tickSize'],_0x56ae29=_0x23c6d9+_0x1d066d*this[_0x9e9f3e(0xb0)],_0x3666d4=_0x23c6d9+this['breakevenTicks']*this[_0x9e9f3e(0xb0)],_0x48cee5=_0x23c6d9+_0x1d066d*this[_0x9e9f3e(0x92)]*this[_0x9e9f3e(0xb0)]):(_0x2e020a=_0x23c6d9+_0x4cf666*this[_0x9e9f3e(0xb0)],_0x56ae29=_0x23c6d9-_0x1d066d*this['tickSize'],_0x3666d4=_0x23c6d9-this[_0x9e9f3e(0xd6)]*this[_0x9e9f3e(0xb0)],_0x48cee5=_0x23c6d9-_0x1d066d*this['profitLockPct']*this['tickSize']);const _0x49dc26=_0x1d066d/_0x4cf666,_0xbd9e2b=Math[_0x9e9f3e(0xc0)](_0x1d066d*0.5),_0x2f76ec=Math[_0x9e9f3e(0xc0)](_0x4cf666*0.4);let _0x440dc8=SignalStrength['MODERATE'];if(_0x1f8037>=0.85)_0x440dc8=SignalStrength['VERY_STRONG'];else{if(_0x1f8037>=0.75)_0x440dc8=SignalStrength['STRONG'];else{if(_0x1f8037<0.6)_0x440dc8=SignalStrength[_0x9e9f3e(0x80)];}}const _0x58371f=0.5+(_0x1f8037-0.5)*0.4,_0x6f82e1=_0x58371f*Math[_0x9e9f3e(0xcd)](_0x56ae29-_0x23c6d9)-(0x1-_0x58371f)*Math['abs'](_0x23c6d9-_0x2e020a);this[_0x9e9f3e(0xa0)]=Date[_0x9e9f3e(0x89)](),this['stats'][_0x9e9f3e(0xd5)]++;const _0x5efc46={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x2d07d2['split']('.')[0x0]||_0x2d07d2,'contractId':_0x2d07d2,'side':_0x3c3b1c===_0x9e9f3e(0xe6)?OrderSide[_0x9e9f3e(0x8a)]:OrderSide[_0x9e9f3e(0x9b)],'direction':_0x3c3b1c,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0x440dc8,'edge':_0x6f82e1,'confidence':_0x1f8037,'entry':_0x23c6d9,'entryPrice':_0x23c6d9,'stopLoss':_0x2e020a,'takeProfit':_0x56ae29,'riskReward':_0x49dc26,'stopTicks':_0x4cf666,'targetTicks':_0x1d066d,'trailTriggerTicks':_0xbd9e2b,'trailDistanceTicks':_0x2f76ec,'beBreakeven':_0x3666d4,'profitLockLevel':_0x48cee5,'zScore':_0x1d32bc,'zScoreExit':this[_0x9e9f3e(0xca)],'vpinValue':_0x36378f,'kyleLambda':_0x3e1aea,'kalmanEstimate':_0x10d7d4,'volatilityRegime':_0x53f99d,'ofiValue':_0x132228,'models':_0x353a72,'orderFlowConfirmed':_0x2e34c1,'kalmanConfirmed':_0x5d3376,'expires':Date[_0x9e9f3e(0x89)]()+0xea60};return this['emit'](_0x9e9f3e(0xa1),{'side':_0x3c3b1c===_0x9e9f3e(0xe6)?'buy':_0x9e9f3e(0xd0),'action':_0x9e9f3e(0xe3),'reason':'Z='+_0x1d32bc[_0x9e9f3e(0xbe)](0x2)+_0x9e9f3e(0xcb)+(_0x36378f*0x64)[_0x9e9f3e(0xbe)](0x0)+_0x9e9f3e(0x7d)+(_0x132228*0x64)[_0x9e9f3e(0xbe)](0x0)+_0x9e9f3e(0xcf)+(_0x1f8037*0x64)[_0x9e9f3e(0xbe)](0x0)+'%',..._0x5efc46}),this['emit'](_0x9e9f3e(0xab),{'type':_0x9e9f3e(0xdd),'message':'[HQX]\x20SIGNAL:\x20'+_0x3c3b1c['toUpperCase']()+'\x20@\x20'+_0x23c6d9['toFixed'](0x2)+_0x9e9f3e(0x9c)+_0x1d32bc['toFixed'](0x2)+'\x20VPIN:'+(_0x36378f*0x64)[_0x9e9f3e(0xbe)](0x0)+_0x9e9f3e(0x78)+(_0x132228*0x64)[_0x9e9f3e(0xbe)](0x0)+_0x9e9f3e(0xc9)+_0x3e1aea['toFixed'](0x5)+_0x9e9f3e(0x76)+_0x53f99d+_0x9e9f3e(0xbd)+(_0x1f8037*0x64)[_0x9e9f3e(0xbe)](0x0)+'%'}),_0x5efc46;}['shouldExitByZScore'](_0x3e86f6){const _0x269988=_0x298fa1,_0x58b1ef=this['priceBuffer']['get'](_0x3e86f6);if(!_0x58b1ef||_0x58b1ef['length']<0x32)return![];const _0xf3cb09=this[_0x269988(0xb6)](_0x58b1ef);return Math['abs'](_0xf3cb09)<this[_0x269988(0xca)];}['getModelValues'](_0xb584dd){const _0x2f2d4d=_0x298fa1,_0x1a5d6e=this['priceBuffer']['get'](_0xb584dd),_0x47e73c=this['volumeBuffer']['get'](_0xb584dd),_0x50accf=this[_0x2f2d4d(0xc8)][_0x2f2d4d(0xbb)](_0xb584dd);if(!_0x1a5d6e||!_0x47e73c||!_0x50accf||_0x50accf[_0x2f2d4d(0xda)]<0x32)return null;const _0x5806a5=this['_computeZScore'](_0x1a5d6e),_0x5a9d41=this[_0x2f2d4d(0xa5)](_0x47e73c),_0x2347cb=this['_computeKyleLambda'](_0x50accf),_0x5a23a7=this[_0x2f2d4d(0x9f)](_0x50accf);return{'zscore':Math['min'](0x1,Math[_0x2f2d4d(0xcd)](_0x5806a5)/0x4),'vpin':0x1-_0x5a9d41,'kyleLambda':_0x2347cb>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x2f2d4d(0xcd)](_0x5a23a7)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x5806a5,'vpin':_0x5a9d41,'kyleLambda':_0x2347cb,'ofi':_0x5a23a7}};}[_0x298fa1(0x84)](_0x1bf8f7,_0x55655e){const _0x3fe8d6=_0x298fa1,_0x4e5e8d=this[_0x3fe8d6(0xc8)]['get'](_0x1bf8f7)||[];if(_0x4e5e8d[_0x3fe8d6(0xda)]<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x4e5e8d['length']+'/50\x20bars'};const _0x1af3b5=this[_0x3fe8d6(0x90)][_0x3fe8d6(0xbb)](_0x1bf8f7)||[],_0x3eb4a0=this['volumeBuffer']['get'](_0x1bf8f7)||[],_0x16a0a8=this['_computeZScore'](_0x1af3b5),_0x2b1db3=this['_computeVPIN'](_0x3eb4a0),_0x5ec799=this['_computeOrderFlowImbalance'](_0x4e5e8d),_0x11b1b5=this['_computeKyleLambda'](_0x4e5e8d),{regime:_0x146015,params:_0x486863}=this[_0x3fe8d6(0xc6)](_0x1bf8f7,_0x4e5e8d);return{'ready':!![],'zScore':_0x16a0a8,'vpin':_0x2b1db3,'ofi':_0x5ec799,'kyleLambda':_0x11b1b5,'regime':_0x146015,'stopTicks':Math['round'](this['baseStopTicks']*_0x486863[_0x3fe8d6(0x82)]),'targetTicks':Math[_0x3fe8d6(0xc0)](this[_0x3fe8d6(0xe8)]*_0x486863['targetMultiplier']),'threshold':_0x486863['zscoreThreshold'],'barsProcessed':_0x4e5e8d[_0x3fe8d6(0xda)],'models':_0x3fe8d6(0x81)};}[_0x298fa1(0xdc)](_0x1c931f){const _0x56f1a5=_0x298fa1;this['recentTrades']['push']({'netPnl':_0x1c931f,'timestamp':Date[_0x56f1a5(0x89)]()});if(this['recentTrades'][_0x56f1a5(0xda)]>0x64)this[_0x56f1a5(0xad)][_0x56f1a5(0x85)]();_0x1c931f>0x0?(this['winStreak']++,this[_0x56f1a5(0xa8)]=0x0,this['stats']['wins']++):(this['lossStreak']++,this[_0x56f1a5(0x8d)]=0x0,this[_0x56f1a5(0xa7)]['losses']++),this['stats']['trades']++,this['stats'][_0x56f1a5(0xd1)]+=_0x1c931f,this[_0x56f1a5(0x7a)]('log',{'type':_0x56f1a5(0xc5),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x1c931f>0x0?'WIN':'LOSS')+'\x20$'+_0x1c931f[_0x56f1a5(0xbe)](0x2)+_0x56f1a5(0xe9)+(_0x1c931f>0x0?this[_0x56f1a5(0x8d)]:-this[_0x56f1a5(0xa8)])});}[_0x298fa1(0xdf)](_0x3fcec3){const _0x29ce0f=_0x298fa1;return this[_0x29ce0f(0xc8)][_0x29ce0f(0xbb)](_0x3fcec3)||[];}['getStats'](){return this['stats'];}['reset'](_0x53cbcf){const _0xfe221f=_0x298fa1;this[_0xfe221f(0xc8)][_0xfe221f(0xea)](_0x53cbcf,[]),this['priceBuffer']['set'](_0x53cbcf,[]),this['volumeBuffer']['set'](_0x53cbcf,[]),this[_0xfe221f(0x9a)]['set'](_0x53cbcf,[]),this['kalmanStates'][_0xfe221f(0xea)](_0x53cbcf,{'estimate':0x0,'errorCovariance':0x1}),this[_0xfe221f(0x7a)](_0xfe221f(0xab),{'type':'info','message':_0xfe221f(0x75)+_0x53cbcf});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x2ef0db={}){const _0x4a3c23=_0x298fa1;super(),this['config']=_0x2ef0db,this[_0x4a3c23(0xba)]=new HQXUltraScalping(_0x2ef0db),this[_0x4a3c23(0xba)]['on']('signal',_0x1a413f=>this[_0x4a3c23(0x7a)](_0x4a3c23(0xa1),_0x1a413f)),this['strategy']['on']('log',_0x480c46=>this[_0x4a3c23(0x7a)]('log',_0x480c46));}['processTick'](_0x19066b){return this['strategy']['processTick'](_0x19066b);}[_0x298fa1(0x98)](_0x579edd){return this['strategy']['onTick'](_0x579edd);}['onTrade'](_0xd0d6f7){const _0x3833ea=_0x298fa1;return this[_0x3833ea(0xba)][_0x3833ea(0x99)](_0xd0d6f7);}['processBar'](_0x4eb2ec,_0x49cf4f){const _0x2626ce=_0x298fa1;return this[_0x2626ce(0xba)][_0x2626ce(0x8c)](_0x4eb2ec,_0x49cf4f);}['initialize'](_0x5a0080,_0xe20f7,_0x13ca66){const _0x534152=_0x298fa1;return this[_0x534152(0xba)]['initialize'](_0x5a0080,_0xe20f7,_0x13ca66);}['getAnalysisState'](_0x5a00d1,_0x31c3a2){return this['strategy']['getAnalysisState'](_0x5a00d1,_0x31c3a2);}['recordTradeResult'](_0x2c4bd6){return this['strategy']['recordTradeResult'](_0x2c4bd6);}['reset'](_0x3ebc4d){const _0x1003fa=_0x298fa1;return this[_0x1003fa(0xba)][_0x1003fa(0x88)](_0x3ebc4d);}['getStats'](){const _0x18558c=_0x298fa1;return this[_0x18558c(0xba)]['getStats']();}['getBarHistory'](_0x26ba4a){const _0x40c268=_0x298fa1;return this[_0x40c268(0xba)]['getBarHistory'](_0x26ba4a);}[_0x298fa1(0xc3)](_0x4f61f2){const _0xf6446a=_0x298fa1;return this[_0xf6446a(0xba)][_0xf6446a(0xc3)](_0x4f61f2);}[_0x298fa1(0xbf)](_0x52c55d){const _0x357c7e=_0x298fa1;return this[_0x357c7e(0xba)][_0x357c7e(0xbf)](_0x52c55d);}[_0x298fa1(0x9e)](_0x1f1e80){return null;}}module[_0x298fa1(0x8e)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
1
+ const _0x25ec0c=_0x681d;function _0x1ce9(){const _0x591cb0=['WEAK','53200VgJmOL','reduce','6VRNGeR','trades','_calculateATR','vpinWindow','barHistory','max','_computeZScore','_generateSignal','estimate','onTrade','1713NlwPVu','toUpperCase','2874529FubOBY',':\x20tick=','zscoreEntryThreshold','/50\x20bars','strategy','getBarHistory','sqrt','atrHistory','kyleLambda','buy','breakevenTicks','generateSignal','[HQX]\x20Trade\x20result:\x20','zscoreExitThreshold','kalman','42518oTQpBD','get','short','open','emit','\x20@\x20','_computeOrderFlowImbalance','tickSize','stats','lastSignalTime','getStats','toFixed','winStreak','signal','zscoreThreshold','%,\x20OFI=','volumeBuffer','715772vlgJvY','confidenceBonus','abs','high','16LvQzXm','symbol','vpinToxicThreshold','ASK','weights','close','LOSS','recentTrades','12026840ZgJdoz','uuid','STRONG','\x20Regime:','_detectVolatilityRegime','volume','tickValue','onTick','processBar','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','processTick','[HQX-UltraScalping]\x20Initialized\x20for\x20','stopMultiplier','round','_computeVPIN','424UThnFM','\x20|\x20Conf:','long','reset','1960569dOqUUn','priceBuffer','vpin','profitLockPct','ofiLookback','_computeKyleLambda','min','kalmanMeasurementNoise','info','signals','set','shouldExitByZScore','recordTradeResult','push','filter','getAnalysisState','slice','baseStopTicks','baseTargetTicks','low','lossStreak','log','shift','length'];_0x1ce9=function(){return _0x591cb0;};return _0x1ce9();}(function(_0x3ecadb,_0x5aa991){const _0x145507=_0x681d,_0x4ab801=_0x3ecadb();while(!![]){try{const _0x1a76a7=-parseInt(_0x145507(0x14e))/0x1+parseInt(_0x145507(0x17a))/0x2*(parseInt(_0x145507(0x13d))/0x3)+-parseInt(_0x145507(0x15f))/0x4+-parseInt(_0x145507(0x131))/0x5+-parseInt(_0x145507(0x133))/0x6*(parseInt(_0x145507(0x13f))/0x7)+-parseInt(_0x145507(0x163))/0x8*(parseInt(_0x145507(0x118))/0x9)+parseInt(_0x145507(0x16b))/0xa;if(_0x1a76a7===_0x5aa991)break;else _0x4ab801['push'](_0x4ab801['shift']());}catch(_0x4f1393){_0x4ab801['push'](_0x4ab801['shift']());}}}(_0x1ce9,0x3be3a));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x25ec0c(0x16c)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0x681d(_0x13eb78,_0xc9ff03){_0x13eb78=_0x13eb78-0x118;const _0x1ce911=_0x1ce9();let _0x681d0c=_0x1ce911[_0x13eb78];return _0x681d0c;}class HQXUltraScalping extends EventEmitter{constructor(_0x24eb07={}){const _0x569675=_0x25ec0c;super(),this[_0x569675(0x155)]=_0x24eb07[_0x569675(0x155)]||0.25,this[_0x569675(0x171)]=_0x24eb07['tickValue']||0x5,this[_0x569675(0x141)]=1.5,this['zscoreExitThreshold']=0.5,this[_0x569675(0x136)]=0x32,this['vpinToxicThreshold']=0.7,this['kalmanProcessNoise']=0.01,this['kalmanMeasurementNoise']=0.1,this['volatilityLookback']=0x64,this['ofiLookback']=0x14,this['baseStopTicks']=0x8,this[_0x569675(0x12a)]=0x10,this['breakevenTicks']=0x4,this[_0x569675(0x11b)]=0.5,this['minConfidence']=0.55,this[_0x569675(0x167)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x569675(0x137)]=new Map(),this['priceBuffer']=new Map(),this[_0x569675(0x15e)]=new Map(),this['kalmanStates']=new Map(),this[_0x569675(0x146)]=new Map(),this[_0x569675(0x16a)]=[],this[_0x569675(0x15a)]=0x0,this[_0x569675(0x12c)]=0x0,this['lastSignalTime']=0x0,this['cooldownMs']=0x7530,this['minHoldTimeMs']=0x2710,this[_0x569675(0x156)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0xd388e8,_0x16d8cf=0.25,_0x138a3a=0x5){const _0x52a9ba=_0x25ec0c;this[_0x52a9ba(0x155)]=_0x16d8cf,this['tickValue']=_0x138a3a,this['barHistory']['set'](_0xd388e8,[]),this[_0x52a9ba(0x119)]['set'](_0xd388e8,[]),this['volumeBuffer'][_0x52a9ba(0x122)](_0xd388e8,[]),this[_0x52a9ba(0x146)][_0x52a9ba(0x122)](_0xd388e8,[]),this['kalmanStates']['set'](_0xd388e8,{'estimate':0x0,'errorCovariance':0x1}),this[_0x52a9ba(0x152)](_0x52a9ba(0x12d),{'type':_0x52a9ba(0x120),'message':_0x52a9ba(0x176)+_0xd388e8+_0x52a9ba(0x140)+_0x16d8cf+',\x20value='+_0x138a3a}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}[_0x25ec0c(0x175)](_0x564aca){const {contractId:_0x45b123,price:_0x167042,volume:_0x8c0e5d,side:_0xffe477,timestamp:_0x28a9d8}=_0x564aca,_0x5c0322={'timestamp':_0x28a9d8||Date['now'](),'open':_0x167042,'high':_0x167042,'low':_0x167042,'close':_0x167042,'volume':_0x8c0e5d||0x1};return this['processBar'](_0x45b123,_0x5c0322);}['onTick'](_0xc80be9){const _0xf652d9=_0x25ec0c;return this[_0xf652d9(0x175)](_0xc80be9);}[_0x25ec0c(0x13c)](_0x4fbdeb){const _0x250d38=_0x25ec0c;return this['processTick']({'contractId':_0x4fbdeb['contractId']||_0x4fbdeb[_0x250d38(0x164)],'price':_0x4fbdeb['price'],'volume':_0x4fbdeb['size']||_0x4fbdeb['volume']||0x1,'side':_0x4fbdeb['side'],'timestamp':_0x4fbdeb['timestamp']||Date['now']()});}['processBar'](_0x1442cf,_0x231c33){const _0x4a41d8=_0x25ec0c;let _0x532f3f=this['barHistory']['get'](_0x1442cf);!_0x532f3f&&(this['initialize'](_0x1442cf),_0x532f3f=this[_0x4a41d8(0x137)]['get'](_0x1442cf));_0x532f3f['push'](_0x231c33);if(_0x532f3f[_0x4a41d8(0x12f)]>0x1f4)_0x532f3f['shift']();const _0x54c1a3=this[_0x4a41d8(0x119)][_0x4a41d8(0x14f)](_0x1442cf);_0x54c1a3['push'](_0x231c33['close']);if(_0x54c1a3['length']>0xc8)_0x54c1a3[_0x4a41d8(0x12e)]();const _0x3e12c6=this[_0x4a41d8(0x15e)][_0x4a41d8(0x14f)](_0x1442cf),_0x20f9d8=_0x231c33[_0x4a41d8(0x162)]-_0x231c33[_0x4a41d8(0x12b)];let _0x4cce04=_0x231c33['volume']*0.5,_0xa5bffa=_0x231c33['volume']*0.5;if(_0x20f9d8>0x0){const _0x3c114e=(_0x231c33['close']-_0x231c33[_0x4a41d8(0x12b)])/_0x20f9d8;_0x4cce04=_0x231c33['volume']*_0x3c114e,_0xa5bffa=_0x231c33['volume']*(0x1-_0x3c114e);}_0x3e12c6[_0x4a41d8(0x125)]({'buy':_0x4cce04,'sell':_0xa5bffa});if(_0x3e12c6['length']>0x64)_0x3e12c6['shift']();if(_0x532f3f[_0x4a41d8(0x12f)]<0x32)return null;const _0x4a5788=this['_computeZScore'](_0x54c1a3),_0x4337d1=this['_computeVPIN'](_0x3e12c6),_0x5120e2=this[_0x4a41d8(0x11d)](_0x532f3f),_0x5cd1fc=this['_applyKalmanFilter'](_0x1442cf,_0x231c33['close']),{regime:_0x1e8732,params:_0x36dd63}=this[_0x4a41d8(0x16f)](_0x1442cf,_0x532f3f),_0x455254=this[_0x4a41d8(0x154)](_0x532f3f);return this[_0x4a41d8(0x13a)](_0x1442cf,_0x231c33[_0x4a41d8(0x168)],_0x4a5788,_0x4337d1,_0x5120e2,_0x5cd1fc,_0x1e8732,_0x36dd63,_0x455254,_0x532f3f);}['_computeZScore'](_0x56cc77,_0x44e30c=0x32){const _0x203b4e=_0x25ec0c;if(_0x56cc77['length']<_0x44e30c)return 0x0;const _0x1d8e30=_0x56cc77['slice'](-_0x44e30c),_0x36705a=_0x1d8e30[_0x203b4e(0x132)]((_0x333ff7,_0x3cf675)=>_0x333ff7+_0x3cf675,0x0)/_0x44e30c,_0x2de8f6=_0x1d8e30[_0x203b4e(0x132)]((_0x1f8c86,_0x27057b)=>_0x1f8c86+Math['pow'](_0x27057b-_0x36705a,0x2),0x0)/_0x44e30c,_0x2a63f3=Math[_0x203b4e(0x145)](_0x2de8f6);if(_0x2a63f3<0.0001)return 0x0;const _0x2a0b8c=_0x56cc77[_0x56cc77[_0x203b4e(0x12f)]-0x1];return(_0x2a0b8c-_0x36705a)/_0x2a63f3;}['_computeVPIN'](_0x2f67d7){const _0x1ee21a=_0x25ec0c;if(_0x2f67d7['length']<this[_0x1ee21a(0x136)])return 0.5;const _0x3920b3=_0x2f67d7['slice'](-this[_0x1ee21a(0x136)]);let _0x5e1231=0x0,_0x3057c5=0x0;for(const _0x1f11ed of _0x3920b3){_0x5e1231+=_0x1f11ed[_0x1ee21a(0x148)],_0x3057c5+=_0x1f11ed['sell'];}const _0x488ca2=_0x5e1231+_0x3057c5;if(_0x488ca2<0x1)return 0.5;return Math['abs'](_0x5e1231-_0x3057c5)/_0x488ca2;}['_computeKyleLambda'](_0x3e58e0){const _0x3c008a=_0x25ec0c;if(_0x3e58e0['length']<0x14)return 0x0;const _0x377e14=_0x3e58e0['slice'](-0x14),_0x383b9d=[],_0x41ee55=[];for(let _0x4417f7=0x1;_0x4417f7<_0x377e14['length'];_0x4417f7++){_0x383b9d['push'](_0x377e14[_0x4417f7][_0x3c008a(0x168)]-_0x377e14[_0x4417f7-0x1][_0x3c008a(0x168)]),_0x41ee55['push'](_0x377e14[_0x4417f7][_0x3c008a(0x170)]);}const _0x304307=_0x383b9d[_0x3c008a(0x132)]((_0x4a85d8,_0x4472f5)=>_0x4a85d8+_0x4472f5,0x0)/_0x383b9d['length'],_0x1b3832=_0x41ee55['reduce']((_0x5908ed,_0x3d50b3)=>_0x5908ed+_0x3d50b3,0x0)/_0x41ee55['length'];let _0x334ee2=0x0,_0x386c5e=0x0;for(let _0x41f00e=0x0;_0x41f00e<_0x383b9d[_0x3c008a(0x12f)];_0x41f00e++){_0x334ee2+=(_0x383b9d[_0x41f00e]-_0x304307)*(_0x41ee55[_0x41f00e]-_0x1b3832),_0x386c5e+=Math['pow'](_0x41ee55[_0x41f00e]-_0x1b3832,0x2);}_0x334ee2/=_0x383b9d['length'],_0x386c5e/=_0x383b9d['length'];if(_0x386c5e<0.0001)return 0x0;return Math['abs'](_0x334ee2/_0x386c5e);}['_applyKalmanFilter'](_0x2ba437,_0x55dc91){const _0x5e51c2=_0x25ec0c;let _0x5d6e15=this['kalmanStates']['get'](_0x2ba437);if(!_0x5d6e15)return _0x5d6e15={'estimate':_0x55dc91,'errorCovariance':0x1},this['kalmanStates']['set'](_0x2ba437,_0x5d6e15),_0x55dc91;const _0x326864=_0x5d6e15[_0x5e51c2(0x13b)],_0x63370d=_0x5d6e15['errorCovariance']+this['kalmanProcessNoise'],_0x2c0592=_0x63370d/(_0x63370d+this[_0x5e51c2(0x11f)]),_0x136516=_0x326864+_0x2c0592*(_0x55dc91-_0x326864),_0x288567=(0x1-_0x2c0592)*_0x63370d;return _0x5d6e15[_0x5e51c2(0x13b)]=_0x136516,_0x5d6e15['errorCovariance']=_0x288567,_0x136516;}[_0x25ec0c(0x16f)](_0x5e689e,_0x44afd7){const _0x3b5214=_0x25ec0c,_0x31ae07=this[_0x3b5214(0x135)](_0x44afd7),_0x144e0d=_0x31ae07/this['tickSize'];let _0x54ac70=this[_0x3b5214(0x146)][_0x3b5214(0x14f)](_0x5e689e);!_0x54ac70&&(_0x54ac70=[],this['atrHistory'][_0x3b5214(0x122)](_0x5e689e,_0x54ac70));_0x54ac70[_0x3b5214(0x125)](_0x31ae07);if(_0x54ac70['length']>0x1f4)_0x54ac70['shift']();let _0x60c15a=0.5;_0x54ac70['length']>=0x14&&(_0x60c15a=_0x54ac70[_0x3b5214(0x126)](_0x2c4acf=>_0x2c4acf<=_0x31ae07)['length']/_0x54ac70['length']);let _0x31775f,_0x136e93;if(_0x60c15a<0.25)_0x31775f='low',_0x136e93={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x60c15a<0.75?(_0x31775f='normal',_0x136e93={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x31775f='high',_0x136e93={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x31775f,'params':_0x136e93};}['_calculateATR'](_0x272d28,_0x26ea80=0xe){const _0x4764c5=_0x25ec0c;if(_0x272d28['length']<_0x26ea80+0x1)return 2.5;const _0x39e351=[];for(let _0x316356=_0x272d28['length']-_0x26ea80;_0x316356<_0x272d28['length'];_0x316356++){const _0x362b73=_0x272d28[_0x316356],_0x35bca5=_0x272d28[_0x316356-0x1]['close'],_0xc5c1d7=Math[_0x4764c5(0x138)](_0x362b73[_0x4764c5(0x162)]-_0x362b73[_0x4764c5(0x12b)],Math[_0x4764c5(0x161)](_0x362b73['high']-_0x35bca5),Math[_0x4764c5(0x161)](_0x362b73[_0x4764c5(0x12b)]-_0x35bca5));_0x39e351['push'](_0xc5c1d7);}return _0x39e351['reduce']((_0x547998,_0x26b7ed)=>_0x547998+_0x26b7ed,0x0)/_0x39e351[_0x4764c5(0x12f)];}['_computeOrderFlowImbalance'](_0x1cfd11){const _0x295658=_0x25ec0c;if(_0x1cfd11['length']<this[_0x295658(0x11c)])return 0x0;const _0x11857e=_0x1cfd11[_0x295658(0x128)](-this['ofiLookback']);let _0x428bb7=0x0,_0x288b9f=0x0;for(const _0x52f5ff of _0x11857e){const _0x3b8d71=_0x52f5ff[_0x295658(0x162)]-_0x52f5ff['low'];if(_0x3b8d71>0x0){const _0x37146f=(_0x52f5ff['close']-_0x52f5ff[_0x295658(0x12b)])/_0x3b8d71;_0x428bb7+=_0x37146f*_0x52f5ff[_0x295658(0x170)],_0x288b9f+=(0x1-_0x37146f)*_0x52f5ff[_0x295658(0x170)];}}const _0x577fff=_0x428bb7+_0x288b9f;if(_0x577fff<0x1)return 0x0;return(_0x428bb7-_0x288b9f)/_0x577fff;}[_0x25ec0c(0x13a)](_0x2a541f,_0x37bac3,_0x5362f8,_0x2fe4b8,_0x9084c0,_0x4a7a22,_0x5afb6d,_0x5c393b,_0x3ff8a2,_0x1987c4){const _0x210f1b=_0x25ec0c,_0xc36d49=Math[_0x210f1b(0x161)](_0x5362f8);if(_0xc36d49<_0x5c393b[_0x210f1b(0x15c)])return null;if(_0x2fe4b8>this[_0x210f1b(0x165)])return null;let _0x2cbd66;if(_0x5362f8<-_0x5c393b['zscoreThreshold'])_0x2cbd66=_0x210f1b(0x17c);else{if(_0x5362f8>_0x5c393b[_0x210f1b(0x15c)])_0x2cbd66=_0x210f1b(0x150);else return null;}const _0x2842c2=_0x2cbd66===_0x210f1b(0x17c)&&_0x3ff8a2>0.1||_0x2cbd66==='short'&&_0x3ff8a2<-0.1,_0x156f33=_0x37bac3-_0x4a7a22,_0x27a9ff=_0x2cbd66===_0x210f1b(0x17c)&&_0x156f33<0x0||_0x2cbd66===_0x210f1b(0x150)&&_0x156f33>0x0,_0xa70813={'zscore':Math[_0x210f1b(0x11e)](0x1,_0xc36d49/0x4),'vpin':0x1-_0x2fe4b8,'kyleLambda':_0x9084c0>0.001?0.5:0.8,'kalman':_0x27a9ff?0.8:0.4,'volatility':_0x5afb6d==='normal'?0.8:_0x5afb6d==='low'?0.7:0.6,'ofi':_0x2842c2?0.9:0.5,'composite':0x0};_0xa70813['composite']=_0xa70813['zscore']*this[_0x210f1b(0x167)]['zscore']+_0xa70813[_0x210f1b(0x11a)]*this['weights'][_0x210f1b(0x11a)]+_0xa70813[_0x210f1b(0x147)]*this[_0x210f1b(0x167)][_0x210f1b(0x147)]+_0xa70813['kalman']*this['weights'][_0x210f1b(0x14d)]+_0xa70813['volatility']*this[_0x210f1b(0x167)]['volatility']+_0xa70813['ofi']*this[_0x210f1b(0x167)]['ofi'];const _0xa1ae70=Math[_0x210f1b(0x11e)](0x1,_0xa70813['composite']+_0x5c393b[_0x210f1b(0x160)]);if(_0xa1ae70<this['minConfidence'])return null;if(Date['now']()-this[_0x210f1b(0x157)]<this['cooldownMs'])return null;const _0x1448bb=Math['round'](this[_0x210f1b(0x129)]*_0x5c393b['stopMultiplier']),_0x26ea75=Math[_0x210f1b(0x178)](this[_0x210f1b(0x12a)]*_0x5c393b['targetMultiplier']),_0x2c6a68=Math[_0x210f1b(0x138)](0x6,Math[_0x210f1b(0x11e)](0xc,_0x1448bb)),_0x2c9a8b=Math[_0x210f1b(0x138)](_0x2c6a68*1.5,Math[_0x210f1b(0x11e)](0x18,_0x26ea75));let _0x2e0b76,_0x32eca3,_0xb55e8f,_0x5b9b34;_0x2cbd66===_0x210f1b(0x17c)?(_0x2e0b76=_0x37bac3-_0x2c6a68*this[_0x210f1b(0x155)],_0x32eca3=_0x37bac3+_0x2c9a8b*this['tickSize'],_0xb55e8f=_0x37bac3+this[_0x210f1b(0x149)]*this['tickSize'],_0x5b9b34=_0x37bac3+_0x2c9a8b*this['profitLockPct']*this['tickSize']):(_0x2e0b76=_0x37bac3+_0x2c6a68*this[_0x210f1b(0x155)],_0x32eca3=_0x37bac3-_0x2c9a8b*this[_0x210f1b(0x155)],_0xb55e8f=_0x37bac3-this[_0x210f1b(0x149)]*this[_0x210f1b(0x155)],_0x5b9b34=_0x37bac3-_0x2c9a8b*this[_0x210f1b(0x11b)]*this['tickSize']);const _0x44e223=_0x2c9a8b/_0x2c6a68,_0x43d1c8=Math[_0x210f1b(0x178)](_0x2c9a8b*0.5),_0x2167b0=Math[_0x210f1b(0x178)](_0x2c6a68*0.4);let _0xbf3c45=SignalStrength['MODERATE'];if(_0xa1ae70>=0.85)_0xbf3c45=SignalStrength['VERY_STRONG'];else{if(_0xa1ae70>=0.75)_0xbf3c45=SignalStrength[_0x210f1b(0x16d)];else{if(_0xa1ae70<0.6)_0xbf3c45=SignalStrength[_0x210f1b(0x130)];}}const _0x104791=0.5+(_0xa1ae70-0.5)*0.4,_0x45900b=_0x104791*Math[_0x210f1b(0x161)](_0x32eca3-_0x37bac3)-(0x1-_0x104791)*Math['abs'](_0x37bac3-_0x2e0b76);this['lastSignalTime']=Date['now'](),this[_0x210f1b(0x156)][_0x210f1b(0x121)]++;const _0x1899ad={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x2a541f['split']('.')[0x0]||_0x2a541f,'contractId':_0x2a541f,'side':_0x2cbd66==='long'?OrderSide['BID']:OrderSide[_0x210f1b(0x166)],'direction':_0x2cbd66,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0xbf3c45,'edge':_0x45900b,'confidence':_0xa1ae70,'entry':_0x37bac3,'entryPrice':_0x37bac3,'stopLoss':_0x2e0b76,'takeProfit':_0x32eca3,'riskReward':_0x44e223,'stopTicks':_0x2c6a68,'targetTicks':_0x2c9a8b,'trailTriggerTicks':_0x43d1c8,'trailDistanceTicks':_0x2167b0,'beBreakeven':_0xb55e8f,'profitLockLevel':_0x5b9b34,'zScore':_0x5362f8,'zScoreExit':this[_0x210f1b(0x14c)],'vpinValue':_0x2fe4b8,'kyleLambda':_0x9084c0,'kalmanEstimate':_0x4a7a22,'volatilityRegime':_0x5afb6d,'ofiValue':_0x3ff8a2,'models':_0xa70813,'orderFlowConfirmed':_0x2842c2,'kalmanConfirmed':_0x27a9ff,'expires':Date['now']()+0xea60};return this[_0x210f1b(0x152)]('signal',{'side':_0x2cbd66==='long'?_0x210f1b(0x148):'sell','action':_0x210f1b(0x151),'reason':'Z='+_0x5362f8['toFixed'](0x2)+',\x20VPIN='+(_0x2fe4b8*0x64)['toFixed'](0x0)+_0x210f1b(0x15d)+(_0x3ff8a2*0x64)[_0x210f1b(0x159)](0x0)+'%,\x20cf='+(_0xa1ae70*0x64)[_0x210f1b(0x159)](0x0)+'%',..._0x1899ad}),this[_0x210f1b(0x152)](_0x210f1b(0x12d),{'type':_0x210f1b(0x120),'message':'[HQX]\x20SIGNAL:\x20'+_0x2cbd66[_0x210f1b(0x13e)]()+_0x210f1b(0x153)+_0x37bac3['toFixed'](0x2)+'\x20|\x20Z:'+_0x5362f8['toFixed'](0x2)+'\x20VPIN:'+(_0x2fe4b8*0x64)['toFixed'](0x0)+'%\x20OFI:'+(_0x3ff8a2*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x9084c0[_0x210f1b(0x159)](0x5)+_0x210f1b(0x16e)+_0x5afb6d+_0x210f1b(0x17b)+(_0xa1ae70*0x64)[_0x210f1b(0x159)](0x0)+'%'}),_0x1899ad;}['shouldExitByZScore'](_0x3cf5a0){const _0xaedc1f=_0x25ec0c,_0x6c2423=this[_0xaedc1f(0x119)][_0xaedc1f(0x14f)](_0x3cf5a0);if(!_0x6c2423||_0x6c2423['length']<0x32)return![];const _0x597b95=this[_0xaedc1f(0x139)](_0x6c2423);return Math[_0xaedc1f(0x161)](_0x597b95)<this[_0xaedc1f(0x14c)];}['getModelValues'](_0x34f955){const _0x1ac26c=_0x25ec0c,_0x4dbaa7=this[_0x1ac26c(0x119)]['get'](_0x34f955),_0x537d16=this[_0x1ac26c(0x15e)][_0x1ac26c(0x14f)](_0x34f955),_0x5dae22=this['barHistory'][_0x1ac26c(0x14f)](_0x34f955);if(!_0x4dbaa7||!_0x537d16||!_0x5dae22||_0x5dae22['length']<0x32)return null;const _0x5ad365=this['_computeZScore'](_0x4dbaa7),_0x480bb1=this['_computeVPIN'](_0x537d16),_0x398339=this[_0x1ac26c(0x11d)](_0x5dae22),_0x2a82cb=this['_computeOrderFlowImbalance'](_0x5dae22);return{'zscore':Math['min'](0x1,Math[_0x1ac26c(0x161)](_0x5ad365)/0x4),'vpin':0x1-_0x480bb1,'kyleLambda':_0x398339>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x2a82cb)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x5ad365,'vpin':_0x480bb1,'kyleLambda':_0x398339,'ofi':_0x2a82cb}};}[_0x25ec0c(0x127)](_0x868cfa,_0x45ed5c){const _0x3ed786=_0x25ec0c,_0x1135d8=this['barHistory'][_0x3ed786(0x14f)](_0x868cfa)||[];if(_0x1135d8['length']<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x1135d8['length']+_0x3ed786(0x142)};const _0x230ec9=this[_0x3ed786(0x119)]['get'](_0x868cfa)||[],_0x1d04ac=this[_0x3ed786(0x15e)]['get'](_0x868cfa)||[],_0x5d2f6c=this['_computeZScore'](_0x230ec9),_0x3d21c7=this[_0x3ed786(0x179)](_0x1d04ac),_0x552760=this[_0x3ed786(0x154)](_0x1135d8),_0xa93f48=this[_0x3ed786(0x11d)](_0x1135d8),{regime:_0x235004,params:_0x2dfb29}=this['_detectVolatilityRegime'](_0x868cfa,_0x1135d8);return{'ready':!![],'zScore':_0x5d2f6c,'vpin':_0x3d21c7,'ofi':_0x552760,'kyleLambda':_0xa93f48,'regime':_0x235004,'stopTicks':Math['round'](this[_0x3ed786(0x129)]*_0x2dfb29[_0x3ed786(0x177)]),'targetTicks':Math['round'](this['baseTargetTicks']*_0x2dfb29['targetMultiplier']),'threshold':_0x2dfb29['zscoreThreshold'],'barsProcessed':_0x1135d8[_0x3ed786(0x12f)],'models':_0x3ed786(0x174)};}['recordTradeResult'](_0x57c6fc){const _0x443d8e=_0x25ec0c;this[_0x443d8e(0x16a)][_0x443d8e(0x125)]({'netPnl':_0x57c6fc,'timestamp':Date['now']()});if(this[_0x443d8e(0x16a)]['length']>0x64)this['recentTrades'][_0x443d8e(0x12e)]();_0x57c6fc>0x0?(this[_0x443d8e(0x15a)]++,this[_0x443d8e(0x12c)]=0x0,this['stats']['wins']++):(this[_0x443d8e(0x12c)]++,this[_0x443d8e(0x15a)]=0x0,this[_0x443d8e(0x156)]['losses']++),this['stats'][_0x443d8e(0x134)]++,this['stats']['pnl']+=_0x57c6fc,this[_0x443d8e(0x152)]('log',{'type':'debug','message':_0x443d8e(0x14b)+(_0x57c6fc>0x0?'WIN':_0x443d8e(0x169))+'\x20$'+_0x57c6fc[_0x443d8e(0x159)](0x2)+',\x20streak:\x20'+(_0x57c6fc>0x0?this[_0x443d8e(0x15a)]:-this['lossStreak'])});}['getBarHistory'](_0x478bf3){const _0x5b5bf9=_0x25ec0c;return this[_0x5b5bf9(0x137)]['get'](_0x478bf3)||[];}[_0x25ec0c(0x158)](){return this['stats'];}['reset'](_0x15949e){const _0xd4e09f=_0x25ec0c;this['barHistory']['set'](_0x15949e,[]),this['priceBuffer']['set'](_0x15949e,[]),this[_0xd4e09f(0x15e)]['set'](_0x15949e,[]),this[_0xd4e09f(0x146)][_0xd4e09f(0x122)](_0x15949e,[]),this['kalmanStates']['set'](_0x15949e,{'estimate':0x0,'errorCovariance':0x1}),this[_0xd4e09f(0x152)]('log',{'type':_0xd4e09f(0x120),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x15949e});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x63f1c8={}){const _0x1a9473=_0x25ec0c;super(),this['config']=_0x63f1c8,this[_0x1a9473(0x143)]=new HQXUltraScalping(_0x63f1c8),this[_0x1a9473(0x143)]['on'](_0x1a9473(0x15b),_0x177427=>this[_0x1a9473(0x152)](_0x1a9473(0x15b),_0x177427)),this['strategy']['on'](_0x1a9473(0x12d),_0x3ae7e8=>this[_0x1a9473(0x152)]('log',_0x3ae7e8));}['processTick'](_0x15795e){const _0x230916=_0x25ec0c;return this[_0x230916(0x143)]['processTick'](_0x15795e);}['onTick'](_0x139ec2){const _0x32a3c2=_0x25ec0c;return this['strategy'][_0x32a3c2(0x172)](_0x139ec2);}['onTrade'](_0x260570){const _0x4a9f34=_0x25ec0c;return this[_0x4a9f34(0x143)][_0x4a9f34(0x13c)](_0x260570);}['processBar'](_0x517c9b,_0x4e2b5a){const _0x269f3d=_0x25ec0c;return this['strategy'][_0x269f3d(0x173)](_0x517c9b,_0x4e2b5a);}['initialize'](_0x5a3e4b,_0x4b240b,_0x43a10b){const _0x37d3d8=_0x25ec0c;return this[_0x37d3d8(0x143)]['initialize'](_0x5a3e4b,_0x4b240b,_0x43a10b);}['getAnalysisState'](_0x39e7f9,_0x4a7311){const _0x44c7c9=_0x25ec0c;return this[_0x44c7c9(0x143)]['getAnalysisState'](_0x39e7f9,_0x4a7311);}['recordTradeResult'](_0x3a8e0f){const _0x31841a=_0x25ec0c;return this[_0x31841a(0x143)][_0x31841a(0x124)](_0x3a8e0f);}[_0x25ec0c(0x17d)](_0x22890e){const _0x2bc4c5=_0x25ec0c;return this[_0x2bc4c5(0x143)][_0x2bc4c5(0x17d)](_0x22890e);}['getStats'](){return this['strategy']['getStats']();}[_0x25ec0c(0x144)](_0x2b734b){const _0x4039f4=_0x25ec0c;return this['strategy'][_0x4039f4(0x144)](_0x2b734b);}['getModelValues'](_0x4c7224){return this['strategy']['getModelValues'](_0x4c7224);}[_0x25ec0c(0x123)](_0x285148){const _0x2e749c=_0x25ec0c;return this[_0x2e749c(0x143)]['shouldExitByZScore'](_0x285148);}[_0x25ec0c(0x14a)](_0x5b2bb5){return null;}}module['exports']={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.95",
3
+ "version": "2.9.96",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -1,9 +1,6 @@
1
1
  /**
2
- * Algo Executor - Shared execution engine for all algo modes
3
- * Handles market data, signals, orders, and P&L tracking
4
- * Supports multi-agent AI supervision for signal optimization
2
+ * Algo Executor - Execution engine for algo modes with AI supervision
5
3
  */
6
-
7
4
  const readline = require('readline');
8
5
  const { AlgoUI, renderSessionSummary } = require('./ui');
9
6
  const { loadStrategy } = require('../../lib/m');
@@ -25,13 +22,11 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
25
22
  const { contracts, dailyTarget, maxRisk, showName } = config;
26
23
  const { supervisionConfig, subtitle } = options;
27
24
 
28
- // Load the selected strategy module dynamically
29
25
  const strategyId = strategyInfo?.id || 'ultra-scalping';
30
26
  const strategyName = strategyInfo?.name || 'HQX Scalping';
31
27
  const strategyModule = loadStrategy(strategyId);
32
28
  const StrategyClass = strategyModule.M1; // loadStrategy normalizes to M1
33
29
 
34
- // Initialize AI Supervision Engine if configured
35
30
  const supervisionEnabled = supervisionConfig?.supervisionEnabled && supervisionConfig?.agents?.length > 0;
36
31
  const supervisionEngine = supervisionEnabled ? new SupervisionEngine(supervisionConfig) : null;
37
32
 
@@ -73,23 +68,18 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
73
68
  let tickCount = 0;
74
69
  let lastBias = 'FLAT';
75
70
 
76
- // Context for AI supervision
77
71
  const aiContext = { recentTicks: [], recentSignals: [], recentTrades: [], maxTicks: 100 };
78
72
 
79
- // Initialize Strategy
80
73
  const strategy = new StrategyClass({ tickSize });
81
74
  strategy.initialize(contractId, tickSize);
82
75
 
83
- // Handle strategy debug logs
84
76
  strategy.on('log', (log) => {
85
77
  const type = log.type === 'debug' ? 'debug' : log.type === 'info' ? 'analysis' : 'system';
86
78
  ui.addLog(type, log.message);
87
79
  });
88
80
 
89
- // Initialize Market Data Feed (Rithmic TICKER_PLANT)
90
81
  const marketFeed = new MarketDataFeed();
91
82
 
92
- // Log startup
93
83
  ui.addLog('system', `Strategy: ${strategyName}${supervisionEnabled ? ' + AI' : ''}`);
94
84
  ui.addLog('system', `Account: ${accountName}`);
95
85
  ui.addLog('system', `Symbol: ${symbolName} | Qty: ${contracts}`);
@@ -100,7 +90,6 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
100
90
  }
101
91
  ui.addLog('system', 'Connecting to market data...');
102
92
 
103
- // Handle strategy signals
104
93
  strategy.on('signal', async (signal) => {
105
94
  const dir = signal.direction?.toUpperCase() || 'UNKNOWN';
106
95
  const signalLog = smartLogs.getSignalLog(dir, symbolCode, (signal.confidence || 0) * 100, strategyName);
@@ -214,7 +203,6 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
214
203
  pendingOrder = false;
215
204
  });
216
205
 
217
- // Handle market data ticks
218
206
  let lastPrice = null;
219
207
  let lastBid = null;
220
208
  let lastAsk = null;
@@ -225,7 +213,6 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
225
213
  let sellVolume = 0;
226
214
  let barCount = 0;
227
215
 
228
- // Track tick arrival times for latency estimation
229
216
  let lastTickTime = 0;
230
217
  let tickLatencies = [];
231
218
 
@@ -353,6 +340,14 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
353
340
  ui.addLog('analysis', `AI Supervision active: ${agentNames} (${status.availableAgents} agents monitoring)`);
354
341
  }
355
342
 
343
+ // Strategy health status every 2 minutes (confirms strategy is working)
344
+ if (currentSecond % 120 === 0 && strategy.getHealthStatus) {
345
+ const health = strategy.getHealthStatus(contractId);
346
+ const uptime = Math.floor(health.uptime / 60000);
347
+ const status = health.healthy ? 'OK' : 'WARMING';
348
+ ui.addLog('ready', `HEALTH: ${status} | Bars: ${health.barsTotal} | Zones: ${health.zonesTotal} (R:${health.zonesResistance}/S:${health.zonesSupport}) | Swings: ${health.swingsTotal} | Uptime: ${uptime}m`);
349
+ }
350
+
356
351
  // Reset volume counters
357
352
  buyVolume = 0;
358
353
  sellVolume = 0;
@@ -397,12 +392,9 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
397
392
  ui.addLog('connected', 'Market data connected');
398
393
  });
399
394
  marketFeed.on('subscribed', (symbol) => ui.addLog('system', `Subscribed: ${symbol}`));
400
- // Suppress debug logs - not needed in production
401
- // marketFeed.on('debug', (msg) => ui.addLog('debug', msg));
402
395
  marketFeed.on('error', (err) => ui.addLog('error', `Market: ${err.message}`));
403
396
  marketFeed.on('disconnected', () => { stats.connected = false; ui.addLog('error', 'Market disconnected'); });
404
397
 
405
- // Connect to market data (Rithmic TICKER_PLANT)
406
398
  try {
407
399
  const rithmicCredentials = service.getRithmicCredentials?.();
408
400
  if (!rithmicCredentials) {
@@ -432,7 +424,6 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
432
424
  ui.addLog('error', `Failed to connect: ${e.message}`);
433
425
  }
434
426
 
435
- // Poll P&L
436
427
  const pollPnL = async () => {
437
428
  try {
438
429
  const accountResult = await service.getTradingAccounts();
@@ -472,12 +463,10 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
472
463
  } catch (e) { /* silent */ }
473
464
  };
474
465
 
475
- // Start loops
476
466
  const refreshInterval = setInterval(() => { if (running) ui.render(stats); }, 250);
477
467
  const pnlInterval = setInterval(() => { if (running) pollPnL(); }, 2000);
478
468
  pollPnL();
479
469
 
480
- // Keyboard handler for exit (X or Ctrl+C)
481
470
  const setupKeyHandler = () => {
482
471
  if (!process.stdin.isTTY) return;
483
472
  readline.emitKeypressEvents(process.stdin);
@@ -489,10 +478,8 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
489
478
  };
490
479
  const cleanupKeys = setupKeyHandler();
491
480
 
492
- // Wait for stop signal
493
481
  await new Promise(resolve => { const check = setInterval(() => { if (!running) { clearInterval(check); resolve(); } }, 100); });
494
482
 
495
- // Cleanup
496
483
  clearInterval(refreshInterval);
497
484
  clearInterval(pnlInterval);
498
485
  await marketFeed.disconnect();
@@ -501,7 +488,6 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
501
488
  if (process.stdin.isTTY) process.stdin.setRawMode(false);
502
489
  process.stdin.resume();
503
490
 
504
- // Duration and summary
505
491
  const durationMs = Date.now() - stats.startTime;
506
492
  const h = Math.floor(durationMs / 3600000), m = Math.floor((durationMs % 3600000) / 60000), s = Math.floor((durationMs % 60000) / 1000);
507
493
  stats.duration = h > 0 ? `${h}h ${m}m ${s}s` : m > 0 ? `${m}m ${s}s` : `${s}s`;