hedgequantx 2.9.95 → 2.9.97

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 _0x3d7924=_0x4626;function _0x4626(_0xfbf665,_0x32d984){_0xfbf665=_0xfbf665-0x1f3;const _0x21f88a=_0x21f8();let _0x462670=_0x21f88a[_0xfbf665];return _0x462670;}(function(_0x319f2b,_0x2e9d1a){const _0x47639a=_0x4626,_0x247b75=_0x319f2b();while(!![]){try{const _0x3f6a1e=-parseInt(_0x47639a(0x20a))/0x1*(-parseInt(_0x47639a(0x281))/0x2)+-parseInt(_0x47639a(0x27b))/0x3+-parseInt(_0x47639a(0x23b))/0x4+parseInt(_0x47639a(0x273))/0x5*(parseInt(_0x47639a(0x279))/0x6)+parseInt(_0x47639a(0x24b))/0x7*(parseInt(_0x47639a(0x22d))/0x8)+-parseInt(_0x47639a(0x23e))/0x9+-parseInt(_0x47639a(0x23c))/0xa*(-parseInt(_0x47639a(0x265))/0xb);if(_0x3f6a1e===_0x2e9d1a)break;else _0x247b75['push'](_0x247b75['shift']());}catch(_0x3aafe6){_0x247b75['push'](_0x247b75['shift']());}}}(_0x21f8,0xb20de));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x3d7924(0x24c)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x3d7924(0x203),'LOW_SWEEP':_0x3d7924(0x276)},ZoneType={'RESISTANCE':'resistance','SUPPORT':'support'},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'}};function _0x21f8(){const _0x14996d=['[HQX-2B]\x20Preloading\x20','2uKRlon','BID','volume','LOSS','slice','initialize','barIntervalMs','startTime','maxDurationBars','lastSignalTime','_detectSwings','targetTicks','toUpperCase','preloadBars','containsPrice','signal','Collecting\x20data...\x20','abs','high','map','config','_getVolumeRatio','[HQX-2B]\x20SIGNAL:\x20','processBar','_generateSignal','271603CCQQUf','getUTCMinutes','onTick','isValid','log','entryBarIndex','getLevel','lookbackBars','contractId','minVolumeRatio','generateSignal','shift','qualityScore','[2B]\x20NEW\x20ZONE\x20','push','long','max','x\x20|\x20Q:','find','minQualityScore','_mergeConfig','pnl','priceHigh','has','HIGH_SWEEP','strategy','LOW_SWEEP','get','swing','strength','exports','currentBar','execution','\x20bars,\x20','info','2510176WNMWHM','close','set','createdAt','emit','min','/5\x20bars','exitBarIndex','stopTicks','\x20|\x20Pen:\x20','barHistory','\x20|\x20Pen:','now','filter','2326264kEZqOV','1290DtrZLd','getTimezoneOffset','6088428ssgQLy','breakevenTicks','lastUsedBarIndex','getUTCHours','getStats','stats','split','barIndex','\x20|\x20Total:\x20','size','recentTrades','isArray','type','14pPDJAM','uuid','processTick','durationBars','debug','open','[HQX-2B]\x20Preload\x20complete:\x20','swingPoints','_scoreSweep','minPenetrationTicks','extremePrice','RESISTANCE','tickValue','trailTriggerTicks','onTrade','swept','WIN','price','priceLow','t,\x20Trail=','penetrationTicks','reset','volumeRatio','recordTradeResult','activeSweeps','zone','65978kjfsfd','timestamp','t\x20|\x20Vol:','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','[HQX-2B]\x20Initialized\x20for\x20','touches','liquidityZones','tickSize','SUPPORT','toFixed','length','getBarHistory','sort','getAnalysisState','10pLbMMy','_updateZones','session','low',',\x20TF=1min','t\x20|\x20Q:\x20','3874620PosSEV','ASK','2931183AhIdyp','minBodyRatio','isWithinSession','\x20zones','isDST'];_0x21f8=function(){return _0x14996d;};return _0x21f8();}class SwingPoint{constructor(_0x29a20d,_0x15f606,_0x634ae5,_0x664cc6,_0x358ea4=0x1){const _0x1c3cbc=_0x3d7924;this[_0x1c3cbc(0x24a)]=_0x29a20d,this[_0x1c3cbc(0x25c)]=_0x15f606,this['barIndex']=_0x634ae5,this[_0x1c3cbc(0x266)]=_0x664cc6,this[_0x1c3cbc(0x227)]=_0x358ea4;}}class LiquidityZone{constructor(_0x4b7a19,_0x5f2f31,_0xb90f81,_0x1f0f7e,_0x5a74c9){const _0x405253=_0x3d7924;this['id']=uuidv4(),this[_0x405253(0x24a)]=_0x4b7a19,this[_0x405253(0x220)]=_0x5f2f31,this[_0x405253(0x25d)]=_0xb90f81,this[_0x405253(0x230)]=_0x1f0f7e,this['barIndex']=_0x5a74c9,this[_0x405253(0x26a)]=0x1,this[_0x405253(0x25a)]=![],this['sweptAt']=null,this[_0x405253(0x240)]=-0x3e7,this['qualityScore']=0.5;}['containsPrice'](_0x5c1d10,_0x43cd6a,_0x2e00f8){const _0x1eb7ad=_0x3d7924,_0x19f56b=_0x43cd6a*_0x2e00f8;return _0x5c1d10>=this[_0x1eb7ad(0x25d)]-_0x19f56b&&_0x5c1d10<=this[_0x1eb7ad(0x220)]+_0x19f56b;}[_0x3d7924(0x210)](){const _0x1312e5=_0x3d7924;return(this['priceHigh']+this[_0x1312e5(0x25d)])/0x2;}}class SweepEvent{constructor(_0x490e25,_0x88f12a,_0x4b197b,_0x1132c7,_0x72cdcd){const _0x3ae4b3=_0x3d7924;this['sweepType']=_0x490e25,this['zone']=_0x88f12a,this[_0x3ae4b3(0x20f)]=_0x4b197b,this['extremeBarIndex']=_0x1132c7,this[_0x3ae4b3(0x255)]=_0x72cdcd,this[_0x3ae4b3(0x234)]=null,this[_0x3ae4b3(0x20d)]=![],this['qualityScore']=0x0,this['penetrationTicks']=0x0,this[_0x3ae4b3(0x24e)]=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x34fbb2={}){const _0xd2f72e=_0x3d7924;super(),this['config']=this[_0xd2f72e(0x21e)](DEFAULT_CONFIG,_0x34fbb2),this['tickSize']=this['config']['tickSize'],this['tickValue']=this[_0xd2f72e(0x205)][_0xd2f72e(0x257)],this[_0xd2f72e(0x237)]=new Map(),this[_0xd2f72e(0x252)]=new Map(),this[_0xd2f72e(0x26b)]=new Map(),this['activeSweeps']=new Map(),this[_0xd2f72e(0x229)]=new Map(),this['barIntervalMs']=0xea60,this['lastSignalTime']=0x0,this[_0xd2f72e(0x1f8)]=Date[_0xd2f72e(0x239)](),this[_0xd2f72e(0x243)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0xd2f72e(0x248)]=[];}[_0x3d7924(0x21e)](_0x73119a,_0x1cea8e){const _0x24dbcc=_0x3d7924,_0x568651={..._0x73119a};for(const _0xb39f4e in _0x1cea8e){typeof _0x1cea8e[_0xb39f4e]==='object'&&!Array[_0x24dbcc(0x249)](_0x1cea8e[_0xb39f4e])?_0x568651[_0xb39f4e]={..._0x73119a[_0xb39f4e],..._0x1cea8e[_0xb39f4e]}:_0x568651[_0xb39f4e]=_0x1cea8e[_0xb39f4e];}return _0x568651;}[_0x3d7924(0x27d)](_0x3b115e){const _0xd73f32=_0x3d7924;if(!this['config']['session']['enabled'])return!![];const _0x30967b=new Date(_0x3b115e),_0x4ee2fe=this[_0xd73f32(0x27f)](_0x30967b)?-0x4:-0x5,_0x1e832f=_0x30967b[_0xd73f32(0x241)](),_0x43ff94=_0x30967b[_0xd73f32(0x20b)](),_0xc74026=(_0x1e832f+_0x4ee2fe+0x18)%0x18,{startHour:_0x1be5ed,startMinute:_0x1b564c,endHour:_0xe3617b,endMinute:_0x4b568a}=this[_0xd73f32(0x205)][_0xd73f32(0x275)],_0x538366=_0xc74026*0x3c+_0x43ff94,_0x425109=_0x1be5ed*0x3c+_0x1b564c,_0x204a51=_0xe3617b*0x3c+_0x4b568a;return _0x538366>=_0x425109&&_0x538366<_0x204a51;}['isDST'](_0x1ad1bc){const _0x52e159=_0x3d7924,_0x43d23f=new Date(_0x1ad1bc['getFullYear'](),0x0,0x1),_0x278b8d=new Date(_0x1ad1bc['getFullYear'](),0x6,0x1),_0x22be34=Math['max'](_0x43d23f[_0x52e159(0x23d)](),_0x278b8d['getTimezoneOffset']());return _0x1ad1bc['getTimezoneOffset']()<_0x22be34;}['initialize'](_0x183a87,_0x139c4a=0.25,_0x256bd9=0x5){const _0x5a73a9=_0x3d7924;this['tickSize']=_0x139c4a,this[_0x5a73a9(0x257)]=_0x256bd9,this[_0x5a73a9(0x205)][_0x5a73a9(0x26c)]=_0x139c4a,this[_0x5a73a9(0x205)][_0x5a73a9(0x257)]=_0x256bd9,this[_0x5a73a9(0x237)][_0x5a73a9(0x22f)](_0x183a87,[]),this['swingPoints']['set'](_0x183a87,[]),this[_0x5a73a9(0x26b)][_0x5a73a9(0x22f)](_0x183a87,[]),this['activeSweeps']['set'](_0x183a87,[]),this[_0x5a73a9(0x229)]['delete'](_0x183a87),this[_0x5a73a9(0x231)]('log',{'type':'info','message':_0x5a73a9(0x269)+_0x183a87+':\x20tick='+_0x139c4a+',\x20value='+_0x256bd9+_0x5a73a9(0x277)}),this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x5a73a9(0x205)][_0x5a73a9(0x22a)][_0x5a73a9(0x235)]+'t,\x20Target='+this[_0x5a73a9(0x205)][_0x5a73a9(0x22a)]['targetTicks']+'t,\x20BE='+this[_0x5a73a9(0x205)][_0x5a73a9(0x22a)][_0x5a73a9(0x23f)]+_0x5a73a9(0x25e)+this['config'][_0x5a73a9(0x22a)][_0x5a73a9(0x258)]+'/'+this['config']['execution']['trailDistanceTicks']});}[_0x3d7924(0x24d)](_0x278c94){const _0x272b98=_0x3d7924,{contractId:_0xc5b84d,price:_0x5cd3c7,volume:_0x3996b3,timestamp:_0x32412a}=_0x278c94,_0x2b659b=_0x32412a||Date[_0x272b98(0x239)](),_0x11811d=_0x3996b3||0x1;if(!this[_0x272b98(0x27d)](_0x2b659b))return null;let _0x2d9db2=this['currentBar']['get'](_0xc5b84d);const _0x2094be=Math['floor'](_0x2b659b/this[_0x272b98(0x1f7)])*this['barIntervalMs'];if(!_0x2d9db2||_0x2d9db2[_0x272b98(0x1f8)]!==_0x2094be){if(_0x2d9db2){const _0x4bcf22={'timestamp':_0x2d9db2[_0x272b98(0x1f8)],'open':_0x2d9db2['open'],'high':_0x2d9db2['high'],'low':_0x2d9db2['low'],'close':_0x2d9db2[_0x272b98(0x22e)],'volume':_0x2d9db2['volume']},_0x4c323f=this[_0x272b98(0x208)](_0xc5b84d,_0x4bcf22);return this['currentBar']['set'](_0xc5b84d,{'startTime':_0x2094be,'open':_0x5cd3c7,'high':_0x5cd3c7,'low':_0x5cd3c7,'close':_0x5cd3c7,'volume':_0x11811d}),_0x4c323f;}else return this['currentBar']['set'](_0xc5b84d,{'startTime':_0x2094be,'open':_0x5cd3c7,'high':_0x5cd3c7,'low':_0x5cd3c7,'close':_0x5cd3c7,'volume':_0x11811d}),null;}else return _0x2d9db2['high']=Math[_0x272b98(0x21a)](_0x2d9db2[_0x272b98(0x203)],_0x5cd3c7),_0x2d9db2['low']=Math['min'](_0x2d9db2[_0x272b98(0x276)],_0x5cd3c7),_0x2d9db2[_0x272b98(0x22e)]=_0x5cd3c7,_0x2d9db2[_0x272b98(0x1f3)]+=_0x11811d,null;}['onTick'](_0x899268){return this['processTick'](_0x899268);}[_0x3d7924(0x259)](_0x159421){const _0x57eb26=_0x3d7924;return this['processTick']({'contractId':_0x159421[_0x57eb26(0x212)]||_0x159421['symbol'],'price':_0x159421['price'],'volume':_0x159421[_0x57eb26(0x247)]||_0x159421['volume']||0x1,'timestamp':_0x159421['timestamp']||Date['now']()});}['processBar'](_0x140d09,_0x132d69){const _0x622998=_0x3d7924;let _0xcfdf1d=this['barHistory']['get'](_0x140d09);!_0xcfdf1d&&(this[_0x622998(0x1f6)](_0x140d09),_0xcfdf1d=this[_0x622998(0x237)][_0x622998(0x225)](_0x140d09));_0xcfdf1d['push'](_0x132d69);if(_0xcfdf1d['length']>0x1f4)_0xcfdf1d[_0x622998(0x215)]();const _0x20babe=_0xcfdf1d[_0x622998(0x26f)]-0x1;if(_0xcfdf1d['length']<this[_0x622998(0x205)]['swing']['lookbackBars']*0x3)return null;const _0x4b5a8a=this[_0x622998(0x252)][_0x622998(0x225)](_0x140d09)['length'];this[_0x622998(0x1fb)](_0x140d09,_0xcfdf1d,_0x20babe);const _0xc09007=this[_0x622998(0x252)]['get'](_0x140d09);if(_0xc09007[_0x622998(0x26f)]>_0x4b5a8a){const _0x297d32=_0xc09007[_0xc09007['length']-0x1];this[_0x622998(0x231)]('log',{'type':'debug','message':'[2B]\x20NEW\x20SWING\x20'+_0x297d32['type']['toUpperCase']()+'\x20@\x20'+_0x297d32['price']['toFixed'](0x2)+_0x622998(0x246)+_0xc09007[_0x622998(0x26f)]});}const _0x606643=this[_0x622998(0x26b)]['get'](_0x140d09)[_0x622998(0x26f)];this[_0x622998(0x274)](_0x140d09,_0x20babe);const _0x45a774=this['liquidityZones']['get'](_0x140d09);if(_0x45a774['length']>_0x606643){const _0x2f38da=_0x45a774[_0x45a774['length']-0x1];this[_0x622998(0x231)]('log',{'type':_0x622998(0x24f),'message':_0x622998(0x217)+_0x2f38da[_0x622998(0x24a)]['toUpperCase']()+'\x20@\x20'+_0x2f38da['getLevel']()[_0x622998(0x26e)](0x2)+'\x20|\x20Total:\x20'+_0x45a774[_0x622998(0x26f)]});}const _0x3470da=this['_detectSweep'](_0x140d09,_0xcfdf1d,_0x20babe);_0x3470da&&this[_0x622998(0x231)]('log',{'type':'debug','message':'[2B]\x20SWEEP\x20'+_0x3470da['sweepType']+'\x20|\x20Valid:\x20'+_0x3470da[_0x622998(0x20d)]+_0x622998(0x236)+_0x3470da[_0x622998(0x25f)]['toFixed'](0x1)+_0x622998(0x278)+(_0x3470da['qualityScore']*0x64)[_0x622998(0x26e)](0x0)+'%'});if(_0x3470da&&_0x3470da['isValid'])return this[_0x622998(0x209)](_0x140d09,_0x132d69,_0x20babe,_0x3470da);return null;}['_detectSwings'](_0x87607c,_0x31a98b,_0x5087d8){const _0x53e82f=_0x3d7924,_0x4109ca=this['config']['swing'][_0x53e82f(0x211)],_0x27fc8a=this['config'][_0x53e82f(0x226)]['minStrength'];if(_0x5087d8<_0x4109ca*0x2)return;const _0x3ede85=this['swingPoints'][_0x53e82f(0x225)](_0x87607c),_0x3625bd=_0x5087d8-_0x4109ca,_0x122cc5=_0x31a98b[_0x3625bd];let _0x95b538=!![],_0x45dc2e=0x0;for(let _0x197be8=_0x3625bd-_0x4109ca;_0x197be8<=_0x3625bd+_0x4109ca;_0x197be8++){if(_0x197be8===_0x3625bd||_0x197be8<0x0||_0x197be8>=_0x31a98b['length'])continue;if(_0x31a98b[_0x197be8]['high']>=_0x122cc5['high']){_0x95b538=![];break;}_0x45dc2e++;}if(_0x95b538&&_0x45dc2e>=_0x27fc8a){const _0x1d0cab=_0x3ede85[_0x53e82f(0x21c)](_0x241b00=>_0x241b00[_0x53e82f(0x245)]===_0x3625bd&&_0x241b00[_0x53e82f(0x24a)]==='high');!_0x1d0cab&&_0x3ede85[_0x53e82f(0x218)](new SwingPoint(_0x53e82f(0x203),_0x122cc5['high'],_0x3625bd,_0x122cc5['timestamp'],_0x45dc2e));}let _0x7c8314=!![],_0x4280d9=0x0;for(let _0x167a04=_0x3625bd-_0x4109ca;_0x167a04<=_0x3625bd+_0x4109ca;_0x167a04++){if(_0x167a04===_0x3625bd||_0x167a04<0x0||_0x167a04>=_0x31a98b[_0x53e82f(0x26f)])continue;if(_0x31a98b[_0x167a04]['low']<=_0x122cc5['low']){_0x7c8314=![];break;}_0x4280d9++;}if(_0x7c8314&&_0x4280d9>=_0x27fc8a){const _0x1e9d05=_0x3ede85[_0x53e82f(0x21c)](_0xb0d07a=>_0xb0d07a['barIndex']===_0x3625bd&&_0xb0d07a[_0x53e82f(0x24a)]==='low');!_0x1e9d05&&_0x3ede85['push'](new SwingPoint(_0x53e82f(0x276),_0x122cc5[_0x53e82f(0x276)],_0x3625bd,_0x122cc5[_0x53e82f(0x266)],_0x4280d9));}const _0x8a4635=this['config']['zone']['maxZoneAgeBars'];while(_0x3ede85['length']>0x0&&_0x3ede85[0x0][_0x53e82f(0x245)]<_0x5087d8-_0x8a4635){_0x3ede85[_0x53e82f(0x215)]();}}[_0x3d7924(0x274)](_0x19831d,_0x3ac3d5){const _0x223186=_0x3d7924,_0x231f1f=this['swingPoints'][_0x223186(0x225)](_0x19831d),_0x55a82d=this['liquidityZones'][_0x223186(0x225)](_0x19831d),_0x55b3e0=this['config']['zone']['clusterToleranceTicks']*this[_0x223186(0x26c)],_0x47a17e=this[_0x223186(0x205)]['zone']['maxZoneAgeBars'];for(let _0x19e92e=_0x55a82d[_0x223186(0x26f)]-0x1;_0x19e92e>=0x0;_0x19e92e--){_0x3ac3d5-_0x55a82d[_0x19e92e][_0x223186(0x245)]>_0x47a17e&&_0x55a82d['splice'](_0x19e92e,0x1);}for(const _0x163b14 of _0x231f1f){let _0x4f5685=null;for(const _0xc007e6 of _0x55a82d){if(_0xc007e6[_0x223186(0x1ff)](_0x163b14['price'],this[_0x223186(0x205)][_0x223186(0x264)]['clusterToleranceTicks'],this['tickSize'])){_0x4f5685=_0xc007e6;break;}}if(_0x4f5685){_0x4f5685['touches']++;if(_0x163b14['price']>_0x4f5685['priceHigh'])_0x4f5685[_0x223186(0x220)]=_0x163b14[_0x223186(0x25c)];if(_0x163b14[_0x223186(0x25c)]<_0x4f5685['priceLow'])_0x4f5685['priceLow']=_0x163b14['price'];_0x4f5685[_0x223186(0x216)]=Math[_0x223186(0x232)](0x1,0.3+_0x4f5685[_0x223186(0x26a)]*0.15);}else{const _0xcb9a91=_0x163b14[_0x223186(0x24a)]==='high'?ZoneType['RESISTANCE']:ZoneType[_0x223186(0x26d)],_0x1645a2=new LiquidityZone(_0xcb9a91,_0x163b14[_0x223186(0x25c)]+_0x55b3e0/0x2,_0x163b14[_0x223186(0x25c)]-_0x55b3e0/0x2,_0x163b14[_0x223186(0x266)],_0x163b14['barIndex']);_0x1645a2['qualityScore']=0.3+_0x163b14[_0x223186(0x227)]*0.1,_0x55a82d['push'](_0x1645a2);}}}['_detectSweep'](_0x3fdc4d,_0x5eec33,_0x32e7a4){const _0x3b54c2=_0x3d7924,_0x89ab93=this[_0x3b54c2(0x26b)][_0x3b54c2(0x225)](_0x3fdc4d),_0x454661=_0x5eec33[_0x32e7a4],_0x53437b=_0x454661[_0x3b54c2(0x22e)],_0x21300a=this['config']['sweep'],_0x3b545b=this['config']['zone'];for(const _0x175f08 of _0x89ab93){if(_0x175f08['lastUsedBarIndex']>=0x0&&_0x32e7a4-_0x175f08['lastUsedBarIndex']<_0x3b545b['cooldownBars'])continue;const _0x3ef434=_0x175f08[_0x3b54c2(0x210)](),_0x111a40=Math['abs'](_0x53437b-_0x3ef434)/this['tickSize'];if(_0x111a40>_0x3b545b['maxZoneDistanceTicks'])continue;const _0x4b337a=Math[_0x3b54c2(0x21a)](0x0,_0x32e7a4-_0x21300a[_0x3b54c2(0x1f9)]*0x2);for(let _0x2a1ed4=_0x4b337a;_0x2a1ed4<_0x32e7a4;_0x2a1ed4++){const _0x717ef1=_0x5eec33[_0x2a1ed4];if(_0x175f08['type']===ZoneType[_0x3b54c2(0x256)]){const _0x253cfc=(_0x717ef1['high']-_0x175f08[_0x3b54c2(0x220)])/this['tickSize'];if(_0x253cfc>=_0x21300a[_0x3b54c2(0x254)]&&_0x253cfc<=_0x21300a['maxPenetrationTicks']){if(_0x53437b<_0x175f08[_0x3b54c2(0x220)]){const _0x5244e9=_0x717ef1[_0x3b54c2(0x203)]-_0x717ef1['low'],_0x570d32=Math[_0x3b54c2(0x202)](_0x717ef1[_0x3b54c2(0x22e)]-_0x717ef1['open']),_0x19f657=_0x5244e9>0x0?_0x570d32/_0x5244e9:0x0;if(_0x19f657>=_0x21300a['minBodyRatio']){const _0x101de7=this['_getVolumeRatio'](_0x5eec33,_0x2a1ed4,0x14);if(_0x101de7>=_0x21300a['minVolumeRatio']){const _0x9fbffe=new SweepEvent(SweepType[_0x3b54c2(0x222)],_0x175f08,_0x2a1ed4,_0x2a1ed4,_0x717ef1['high']);_0x9fbffe[_0x3b54c2(0x234)]=_0x32e7a4,_0x9fbffe['penetrationTicks']=_0x253cfc,_0x9fbffe[_0x3b54c2(0x24e)]=_0x32e7a4-_0x2a1ed4,_0x9fbffe['volumeRatio']=_0x101de7,_0x9fbffe[_0x3b54c2(0x216)]=this[_0x3b54c2(0x253)](_0x9fbffe,_0x19f657),_0x9fbffe[_0x3b54c2(0x20d)]=_0x9fbffe['qualityScore']>=_0x21300a[_0x3b54c2(0x21d)];if(_0x9fbffe['isValid'])return _0x9fbffe;}}}}}if(_0x175f08[_0x3b54c2(0x24a)]===ZoneType['SUPPORT']){const _0x14ba75=(_0x175f08[_0x3b54c2(0x25d)]-_0x717ef1[_0x3b54c2(0x276)])/this['tickSize'];if(_0x14ba75>=_0x21300a[_0x3b54c2(0x254)]&&_0x14ba75<=_0x21300a['maxPenetrationTicks']){if(_0x53437b>_0x175f08[_0x3b54c2(0x25d)]){const _0x5d9a73=_0x717ef1['high']-_0x717ef1['low'],_0x2fdff3=Math['abs'](_0x717ef1[_0x3b54c2(0x22e)]-_0x717ef1['open']),_0xb5a9b4=_0x5d9a73>0x0?_0x2fdff3/_0x5d9a73:0x0;if(_0xb5a9b4>=_0x21300a[_0x3b54c2(0x27c)]){const _0x28c85a=this[_0x3b54c2(0x206)](_0x5eec33,_0x2a1ed4,0x14);if(_0x28c85a>=_0x21300a[_0x3b54c2(0x213)]){const _0x7307ba=new SweepEvent(SweepType[_0x3b54c2(0x224)],_0x175f08,_0x2a1ed4,_0x2a1ed4,_0x717ef1[_0x3b54c2(0x276)]);_0x7307ba['exitBarIndex']=_0x32e7a4,_0x7307ba[_0x3b54c2(0x25f)]=_0x14ba75,_0x7307ba[_0x3b54c2(0x24e)]=_0x32e7a4-_0x2a1ed4,_0x7307ba['volumeRatio']=_0x28c85a,_0x7307ba['qualityScore']=this[_0x3b54c2(0x253)](_0x7307ba,_0xb5a9b4),_0x7307ba['isValid']=_0x7307ba[_0x3b54c2(0x216)]>=_0x21300a['minQualityScore'];if(_0x7307ba['isValid'])return _0x7307ba;}}}}}}}return null;}['_getVolumeRatio'](_0x4eb594,_0x4d53e5,_0x3800df){const _0x19baed=_0x3d7924,_0x3898f4=Math['max'](0x0,_0x4d53e5-_0x3800df),_0x417e81=_0x4eb594[_0x19baed(0x1f5)](_0x3898f4,_0x4d53e5);if(_0x417e81['length']===0x0)return 0x1;const _0x549a07=_0x417e81[_0x19baed(0x204)](_0x3500a1=>_0x3500a1[_0x19baed(0x1f3)])[_0x19baed(0x271)]((_0x379816,_0x5cbde1)=>_0x379816-_0x5cbde1),_0x3885d2=Math['floor'](_0x549a07['length']/0x2),_0x575910=_0x549a07[_0x3885d2]||0x1;return _0x4eb594[_0x4d53e5]['volume']/_0x575910;}['_scoreSweep'](_0x29e67f,_0x195844){const _0x39bc2a=_0x3d7924;let _0x2c783f=0x0;const _0x2c3b47=0x4,_0x70e057=Math[_0x39bc2a(0x202)](_0x29e67f['penetrationTicks']-_0x2c3b47);return _0x2c783f+=Math['max'](0x0,0.3-_0x70e057*0.03),_0x2c783f+=Math[_0x39bc2a(0x21a)](0x0,0.25-_0x29e67f['durationBars']*0.05),_0x2c783f+=Math[_0x39bc2a(0x232)](0.25,_0x29e67f[_0x39bc2a(0x261)]*0.1),_0x2c783f+=Math[_0x39bc2a(0x232)](0.2,_0x195844*0.4),Math['min'](0x1,_0x2c783f);}['_generateSignal'](_0x3caef0,_0x444054,_0x536d9e,_0x23eb72){const _0x3e2a42=_0x3d7924;if(Date['now']()-this['lastSignalTime']<this['config']['execution']['cooldownMs'])return null;const _0x1788ab=this[_0x3e2a42(0x205)][_0x3e2a42(0x22a)],_0x1a8a55=_0x444054['close'],_0x4a593a=_0x23eb72['sweepType']===SweepType['HIGH_SWEEP']?'short':_0x3e2a42(0x219);let _0x3bd2e3,_0x480b9a,_0x5cb047,_0x6186f7;_0x4a593a==='long'?(_0x3bd2e3=_0x1a8a55-_0x1788ab['stopTicks']*this[_0x3e2a42(0x26c)],_0x480b9a=_0x1a8a55+_0x1788ab[_0x3e2a42(0x1fc)]*this['tickSize'],_0x5cb047=_0x1a8a55+_0x1788ab[_0x3e2a42(0x23f)]*this[_0x3e2a42(0x26c)],_0x6186f7=_0x1a8a55+_0x1788ab[_0x3e2a42(0x258)]*this['tickSize']):(_0x3bd2e3=_0x1a8a55+_0x1788ab['stopTicks']*this[_0x3e2a42(0x26c)],_0x480b9a=_0x1a8a55-_0x1788ab[_0x3e2a42(0x1fc)]*this['tickSize'],_0x5cb047=_0x1a8a55-_0x1788ab[_0x3e2a42(0x23f)]*this['tickSize'],_0x6186f7=_0x1a8a55-_0x1788ab['trailTriggerTicks']*this[_0x3e2a42(0x26c)]);const _0x40eaab=_0x1788ab[_0x3e2a42(0x1fc)]/_0x1788ab['stopTicks'],_0x9b44ba=Math['min'](0x1,_0x23eb72['qualityScore']*0.5+_0x23eb72[_0x3e2a42(0x264)]['qualityScore']*0.3+(_0x23eb72[_0x3e2a42(0x261)]>1.5?0.2:_0x23eb72[_0x3e2a42(0x261)]*0.1));let _0xe70668=SignalStrength['MODERATE'];if(_0x9b44ba>=0.8)_0xe70668=SignalStrength['VERY_STRONG'];else{if(_0x9b44ba>=0.65)_0xe70668=SignalStrength['STRONG'];else{if(_0x9b44ba<0.5)_0xe70668=SignalStrength['WEAK'];}}const _0x3442a9=0.5+(_0x9b44ba-0.5)*0.4,_0x48369d=_0x3442a9*Math[_0x3e2a42(0x202)](_0x480b9a-_0x1a8a55)-(0x1-_0x3442a9)*Math['abs'](_0x1a8a55-_0x3bd2e3);_0x23eb72['zone']['lastUsedBarIndex']=_0x536d9e,_0x23eb72['zone']['swept']=!![],_0x23eb72['zone']['sweptAt']=new Date(_0x444054['timestamp']),this[_0x3e2a42(0x1fa)]=Date['now'](),this[_0x3e2a42(0x243)]['signals']++;const _0x1ba67b={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x3caef0[_0x3e2a42(0x244)]('.')[0x0]||_0x3caef0,'contractId':_0x3caef0,'side':_0x4a593a===_0x3e2a42(0x219)?OrderSide[_0x3e2a42(0x282)]:OrderSide[_0x3e2a42(0x27a)],'direction':_0x4a593a,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0xe70668,'edge':_0x48369d,'confidence':_0x9b44ba,'entry':_0x1a8a55,'entryPrice':_0x1a8a55,'stopLoss':_0x3bd2e3,'takeProfit':_0x480b9a,'riskReward':_0x40eaab,'stopTicks':_0x1788ab[_0x3e2a42(0x235)],'targetTicks':_0x1788ab['targetTicks'],'breakevenTicks':_0x1788ab['breakevenTicks'],'trailTriggerTicks':_0x1788ab['trailTriggerTicks'],'trailDistanceTicks':_0x1788ab['trailDistanceTicks'],'beLevel':_0x5cb047,'trailTrigger':_0x6186f7,'sweepType':_0x23eb72['sweepType'],'penetrationTicks':_0x23eb72[_0x3e2a42(0x25f)],'sweepDurationBars':_0x23eb72['durationBars'],'sweepQuality':_0x23eb72['qualityScore'],'volumeRatio':_0x23eb72['volumeRatio'],'zoneType':_0x23eb72['zone'][_0x3e2a42(0x24a)],'zoneLevel':_0x23eb72[_0x3e2a42(0x264)][_0x3e2a42(0x210)](),'zoneTouches':_0x23eb72['zone'][_0x3e2a42(0x26a)],'zoneQuality':_0x23eb72[_0x3e2a42(0x264)][_0x3e2a42(0x216)],'expires':Date['now']()+0xea60};return this['emit'](_0x3e2a42(0x200),{'side':_0x4a593a===_0x3e2a42(0x219)?'buy':'sell','action':_0x3e2a42(0x250),'reason':'2B\x20'+_0x23eb72['sweepType']+'\x20|\x20Pen:'+_0x23eb72[_0x3e2a42(0x25f)]['toFixed'](0x1)+_0x3e2a42(0x267)+_0x23eb72[_0x3e2a42(0x261)]['toFixed'](0x1)+_0x3e2a42(0x21b)+(_0x23eb72['qualityScore']*0x64)['toFixed'](0x0)+'%',..._0x1ba67b}),this[_0x3e2a42(0x231)]('log',{'type':'info','message':_0x3e2a42(0x207)+_0x4a593a[_0x3e2a42(0x1fd)]()+'\x20@\x20'+_0x1a8a55[_0x3e2a42(0x26e)](0x2)+'\x20|\x20'+_0x23eb72['sweepType']+_0x3e2a42(0x238)+_0x23eb72['penetrationTicks']['toFixed'](0x1)+'t\x20Vol:'+_0x23eb72['volumeRatio'][_0x3e2a42(0x26e)](0x1)+'x\x20|\x20Conf:'+(_0x9b44ba*0x64)[_0x3e2a42(0x26e)](0x0)+'%'}),_0x1ba67b;}[_0x3d7924(0x272)](_0xc9f9c6,_0xebbfdd){const _0x15553c=_0x3d7924,_0x38ba27=this['barHistory']['get'](_0xc9f9c6)||[],_0x1a17dc=this['liquidityZones']['get'](_0xc9f9c6)||[],_0x51506a=this[_0x15553c(0x252)][_0x15553c(0x225)](_0xc9f9c6)||[];if(_0x38ba27[_0x15553c(0x26f)]<0x5)return{'ready':![],'message':_0x15553c(0x201)+_0x38ba27[_0x15553c(0x26f)]+_0x15553c(0x233)};const _0xad9e94=_0x1a17dc['map'](_0x19b540=>({'zone':_0x19b540,'distance':Math[_0x15553c(0x202)](_0xebbfdd-_0x19b540['getLevel']())}))[_0x15553c(0x271)]((_0x117f16,_0x56b291)=>_0x117f16['distance']-_0x56b291['distance']),_0x19674b=_0xad9e94['find'](_0x468fc7=>_0x468fc7[_0x15553c(0x264)][_0x15553c(0x24a)]===ZoneType['RESISTANCE']),_0x54626d=_0xad9e94[_0x15553c(0x21c)](_0x2775e4=>_0x2775e4['zone']['type']===ZoneType[_0x15553c(0x26d)]);return{'ready':!![],'barsProcessed':_0x38ba27['length'],'swingsDetected':_0x51506a[_0x15553c(0x26f)],'activeZones':_0x1a17dc[_0x15553c(0x26f)],'nearestResistance':_0x19674b?_0x19674b['zone'][_0x15553c(0x210)]():null,'nearestSupport':_0x54626d?_0x54626d[_0x15553c(0x264)]['getLevel']():null,'stopTicks':this[_0x15553c(0x205)]['execution']['stopTicks'],'targetTicks':this['config']['execution'][_0x15553c(0x1fc)],'strategy':_0x15553c(0x268)};}[_0x3d7924(0x262)](_0xc2c40b){const _0x1f2505=_0x3d7924;this['recentTrades']['push']({'netPnl':_0xc2c40b,'timestamp':Date['now']()});if(this['recentTrades'][_0x1f2505(0x26f)]>0x64)this['recentTrades']['shift']();_0xc2c40b>0x0?this[_0x1f2505(0x243)]['wins']++:this[_0x1f2505(0x243)]['losses']++,this[_0x1f2505(0x243)]['trades']++,this['stats'][_0x1f2505(0x21f)]+=_0xc2c40b,this['emit']('log',{'type':_0x1f2505(0x24f),'message':'[HQX-2B]\x20Trade\x20result:\x20'+(_0xc2c40b>0x0?_0x1f2505(0x25b):_0x1f2505(0x1f4))+'\x20$'+_0xc2c40b[_0x1f2505(0x26e)](0x2)});}['getBarHistory'](_0x55d933){const _0x4fbcdd=_0x3d7924;return this[_0x4fbcdd(0x237)][_0x4fbcdd(0x225)](_0x55d933)||[];}[_0x3d7924(0x242)](){return this['stats'];}['getHealthStatus'](_0x4200da){const _0xdd3982=_0x3d7924,_0x1b27a4=this[_0xdd3982(0x237)]['get'](_0x4200da)||[],_0x5b625d=this['liquidityZones']['get'](_0x4200da)||[],_0x45c2f6=this[_0xdd3982(0x252)]['get'](_0x4200da)||[],_0x1de156=this[_0xdd3982(0x229)]['get'](_0x4200da),_0xe4af89=_0x1b27a4[_0x1b27a4[_0xdd3982(0x26f)]-0x1],_0x7f9f77=_0xe4af89?Date['now']()-_0xe4af89[_0xdd3982(0x266)]:null,_0x5e34e1=_0x5b625d['filter'](_0x1d49c7=>_0x1d49c7['type']===ZoneType[_0xdd3982(0x256)])['length'],_0xb1fc30=_0x5b625d['filter'](_0x21ed23=>_0x21ed23[_0xdd3982(0x24a)]===ZoneType[_0xdd3982(0x26d)])[_0xdd3982(0x26f)];return{'healthy':_0x1b27a4['length']>=0x5,'barsTotal':_0x1b27a4[_0xdd3982(0x26f)],'barsLast5Min':_0x1b27a4[_0xdd3982(0x23a)](_0x537a8f=>Date['now']()-_0x537a8f[_0xdd3982(0x266)]<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x45c2f6['length'],'zonesResistance':_0x5e34e1,'zonesSupport':_0xb1fc30,'zonesTotal':_0x5b625d[_0xdd3982(0x26f)],'currentBarTicks':_0x1de156?_0x1de156['tickCount']:0x0,'isAggregating':_0x1de156&&_0x1de156['tickCount']>0x0,'timeSinceLastBarMs':_0x7f9f77,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this['config']['execution']['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date['now']())};}['reset'](_0x3aa84c){const _0x217c43=_0x3d7924;this['barHistory']['set'](_0x3aa84c,[]),this[_0x217c43(0x252)]['set'](_0x3aa84c,[]),this[_0x217c43(0x26b)][_0x217c43(0x22f)](_0x3aa84c,[]),this[_0x217c43(0x263)][_0x217c43(0x22f)](_0x3aa84c,[]),this[_0x217c43(0x229)]['delete'](_0x3aa84c),this['emit'](_0x217c43(0x20e),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x3aa84c});}[_0x3d7924(0x1fe)](_0x440120,_0x7a9923){const _0x42800c=_0x3d7924;if(!_0x7a9923||_0x7a9923[_0x42800c(0x26f)]===0x0){this['emit']('log',{'type':_0x42800c(0x24f),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory'][_0x42800c(0x221)](_0x440120)&&this[_0x42800c(0x1f6)](_0x440120);const _0x4e9ecc=[..._0x7a9923]['sort']((_0x181efe,_0x5c899c)=>_0x181efe[_0x42800c(0x266)]-_0x5c899c['timestamp']);this[_0x42800c(0x231)](_0x42800c(0x20e),{'type':'info','message':_0x42800c(0x280)+_0x4e9ecc[_0x42800c(0x26f)]+'\x20historical\x20bars...'});let _0x5d1609=0x0;for(const _0x48b240 of _0x4e9ecc){const _0x1d5d0c=this['processBar'](_0x440120,_0x48b240);if(_0x1d5d0c)_0x5d1609++;}const _0x39f4b3=this[_0x42800c(0x237)][_0x42800c(0x225)](_0x440120)||[],_0x5e17d3=this[_0x42800c(0x252)]['get'](_0x440120)||[],_0xb24c77=this['liquidityZones'][_0x42800c(0x225)](_0x440120)||[];this[_0x42800c(0x231)]('log',{'type':_0x42800c(0x22c),'message':_0x42800c(0x251)+_0x39f4b3[_0x42800c(0x26f)]+_0x42800c(0x22b)+_0x5e17d3['length']+'\x20swings,\x20'+_0xb24c77['length']+_0x42800c(0x27e)}),_0x5d1609>0x0&&this['emit']('log',{'type':_0x42800c(0x24f),'message':'[HQX-2B]\x20'+_0x5d1609+'\x20historical\x20signals\x20detected\x20(ignored)'}),this['lastSignalTime']=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x280e9c={}){const _0x11f21c=_0x3d7924;super(),this[_0x11f21c(0x205)]=_0x280e9c,this[_0x11f21c(0x223)]=new HQX2BLiquiditySweep(_0x280e9c),this['strategy']['on'](_0x11f21c(0x200),_0xd6531c=>this[_0x11f21c(0x231)](_0x11f21c(0x200),_0xd6531c)),this['strategy']['on']('log',_0x43f95c=>this['emit'](_0x11f21c(0x20e),_0x43f95c));}['processTick'](_0x40c417){const _0x553c10=_0x3d7924;return this[_0x553c10(0x223)][_0x553c10(0x24d)](_0x40c417);}[_0x3d7924(0x20c)](_0x23fbe8){return this['strategy']['onTick'](_0x23fbe8);}[_0x3d7924(0x259)](_0xd31c0d){const _0x506b8e=_0x3d7924;return this[_0x506b8e(0x223)][_0x506b8e(0x259)](_0xd31c0d);}['processBar'](_0x4b2d78,_0x4246dc){return this['strategy']['processBar'](_0x4b2d78,_0x4246dc);}[_0x3d7924(0x1f6)](_0x96c374,_0x455bf0,_0x5d35f2){const _0x71dca=_0x3d7924;return this[_0x71dca(0x223)]['initialize'](_0x96c374,_0x455bf0,_0x5d35f2);}[_0x3d7924(0x272)](_0x4dbcb8,_0x2d1dc9){const _0x5ad33d=_0x3d7924;return this[_0x5ad33d(0x223)]['getAnalysisState'](_0x4dbcb8,_0x2d1dc9);}['recordTradeResult'](_0xef89f1){const _0x7894f4=_0x3d7924;return this['strategy'][_0x7894f4(0x262)](_0xef89f1);}['reset'](_0x59fd6e){const _0x1deaf8=_0x3d7924;return this[_0x1deaf8(0x223)][_0x1deaf8(0x260)](_0x59fd6e);}['getStats'](){const _0x44e84f=_0x3d7924;return this[_0x44e84f(0x223)][_0x44e84f(0x242)]();}[_0x3d7924(0x270)](_0x443311){const _0x432de5=_0x3d7924;return this[_0x432de5(0x223)]['getBarHistory'](_0x443311);}['preloadBars'](_0x5994b8,_0xb2ede2){const _0x2489f5=_0x3d7924;return this[_0x2489f5(0x223)][_0x2489f5(0x1fe)](_0x5994b8,_0xb2ede2);}['getHealthStatus'](_0x3649e1){const _0x594169=_0x3d7924;return this[_0x594169(0x223)]['getHealthStatus'](_0x3649e1);}[_0x3d7924(0x214)](_0x5e113b){return null;}}module[_0x3d7924(0x228)]={'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 _0x5307f6=_0x4af8;(function(_0xb1459d,_0x379df9){const _0x8a42d7=_0x4af8,_0x28071f=_0xb1459d();while(!![]){try{const _0x360662=parseInt(_0x8a42d7(0x133))/0x1*(parseInt(_0x8a42d7(0x153))/0x2)+parseInt(_0x8a42d7(0x161))/0x3+-parseInt(_0x8a42d7(0x14f))/0x4*(-parseInt(_0x8a42d7(0x144))/0x5)+-parseInt(_0x8a42d7(0x16a))/0x6*(-parseInt(_0x8a42d7(0x165))/0x7)+-parseInt(_0x8a42d7(0x132))/0x8+parseInt(_0x8a42d7(0x159))/0x9+-parseInt(_0x8a42d7(0x126))/0xa;if(_0x360662===_0x379df9)break;else _0x28071f['push'](_0x28071f['shift']());}catch(_0x4c356f){_0x28071f['push'](_0x28071f['shift']());}}}(_0x4e4a,0x8303d));const EventEmitter=require(_0x5307f6(0x138)),{v4:uuidv4}=require(_0x5307f6(0x14e)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0x4af8(_0x12d8ea,_0x27df78){_0x12d8ea=_0x12d8ea-0x10b;const _0x4e4a05=_0x4e4a();let _0x4af858=_0x4e4a05[_0x12d8ea];return _0x4af858;}class HQXUltraScalping extends EventEmitter{constructor(_0x720157={}){const _0xe38a83=_0x5307f6;super(),this[_0xe38a83(0x15d)]=_0x720157[_0xe38a83(0x15d)]||0.25,this[_0xe38a83(0x154)]=_0x720157['tickValue']||0x5,this[_0xe38a83(0x110)]=1.5,this['zscoreExitThreshold']=0.5,this['vpinWindow']=0x32,this[_0xe38a83(0x119)]=0.7,this['kalmanProcessNoise']=0.01,this[_0xe38a83(0x124)]=0.1,this['volatilityLookback']=0x64,this[_0xe38a83(0x17c)]=0x14,this[_0xe38a83(0x146)]=0x8,this['baseTargetTicks']=0x10,this[_0xe38a83(0x123)]=0x4,this['profitLockPct']=0.5,this['minConfidence']=0.55,this['weights']={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0xe38a83(0x12e)]=new Map(),this['priceBuffer']=new Map(),this[_0xe38a83(0x167)]=new Map(),this['kalmanStates']=new Map(),this[_0xe38a83(0x12c)]=new Map(),this[_0xe38a83(0x120)]=[],this['winStreak']=0x0,this[_0xe38a83(0x11a)]=0x0,this[_0xe38a83(0x11f)]=0x0,this[_0xe38a83(0x16d)]=0x7530,this[_0xe38a83(0x10c)]=0x2710,this[_0xe38a83(0x15f)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0x38e34a,_0x44febc=0.25,_0x5a3ad1=0x5){const _0x8396ec=_0x5307f6;this[_0x8396ec(0x15d)]=_0x44febc,this[_0x8396ec(0x154)]=_0x5a3ad1,this['barHistory']['set'](_0x38e34a,[]),this['priceBuffer']['set'](_0x38e34a,[]),this[_0x8396ec(0x167)]['set'](_0x38e34a,[]),this['atrHistory'][_0x8396ec(0x127)](_0x38e34a,[]),this[_0x8396ec(0x13f)][_0x8396ec(0x127)](_0x38e34a,{'estimate':0x0,'errorCovariance':0x1}),this[_0x8396ec(0x166)](_0x8396ec(0x13c),{'type':'info','message':_0x8396ec(0x172)+_0x38e34a+':\x20tick='+_0x44febc+_0x8396ec(0x163)+_0x5a3ad1}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}[_0x5307f6(0x141)](_0x5b75c9){const _0x4c8fee=_0x5307f6,{contractId:_0x3b3020,price:_0x1a16a4,volume:_0x504855,side:_0x47ae08,timestamp:_0x4f5776}=_0x5b75c9,_0x52836f={'timestamp':_0x4f5776||Date[_0x4c8fee(0x13d)](),'open':_0x1a16a4,'high':_0x1a16a4,'low':_0x1a16a4,'close':_0x1a16a4,'volume':_0x504855||0x1};return this[_0x4c8fee(0x174)](_0x3b3020,_0x52836f);}['onTick'](_0x583ff3){return this['processTick'](_0x583ff3);}[_0x5307f6(0x13e)](_0x1ce7d6){const _0x5c9064=_0x5307f6;return this['processTick']({'contractId':_0x1ce7d6[_0x5c9064(0x14d)]||_0x1ce7d6['symbol'],'price':_0x1ce7d6[_0x5c9064(0x149)],'volume':_0x1ce7d6['size']||_0x1ce7d6['volume']||0x1,'side':_0x1ce7d6[_0x5c9064(0x11d)],'timestamp':_0x1ce7d6[_0x5c9064(0x17a)]||Date['now']()});}['processBar'](_0x279a62,_0x2b4416){const _0x275d1d=_0x5307f6;let _0x540d2b=this[_0x275d1d(0x12e)][_0x275d1d(0x11b)](_0x279a62);!_0x540d2b&&(this['initialize'](_0x279a62),_0x540d2b=this['barHistory']['get'](_0x279a62));_0x540d2b[_0x275d1d(0x175)](_0x2b4416);if(_0x540d2b['length']>0x1f4)_0x540d2b[_0x275d1d(0x15b)]();const _0x1a44d3=this[_0x275d1d(0x10d)]['get'](_0x279a62);_0x1a44d3['push'](_0x2b4416['close']);if(_0x1a44d3['length']>0xc8)_0x1a44d3[_0x275d1d(0x15b)]();const _0x3cd31d=this['volumeBuffer']['get'](_0x279a62),_0x52481a=_0x2b4416['high']-_0x2b4416['low'];let _0x21a256=_0x2b4416['volume']*0.5,_0xcb4705=_0x2b4416[_0x275d1d(0x16c)]*0.5;if(_0x52481a>0x0){const _0x27f327=(_0x2b4416['close']-_0x2b4416['low'])/_0x52481a;_0x21a256=_0x2b4416[_0x275d1d(0x16c)]*_0x27f327,_0xcb4705=_0x2b4416['volume']*(0x1-_0x27f327);}_0x3cd31d['push']({'buy':_0x21a256,'sell':_0xcb4705});if(_0x3cd31d[_0x275d1d(0x17b)]>0x64)_0x3cd31d[_0x275d1d(0x15b)]();if(_0x540d2b[_0x275d1d(0x17b)]<0x32)return null;const _0x27f1c8=this[_0x275d1d(0x160)](_0x1a44d3),_0x214fda=this[_0x275d1d(0x135)](_0x3cd31d),_0x1151ec=this[_0x275d1d(0x164)](_0x540d2b),_0x3b47fd=this[_0x275d1d(0x176)](_0x279a62,_0x2b4416[_0x275d1d(0x177)]),{regime:_0x305dba,params:_0x4f4ed6}=this[_0x275d1d(0x117)](_0x279a62,_0x540d2b),_0x4414e2=this['_computeOrderFlowImbalance'](_0x540d2b);return this[_0x275d1d(0x17e)](_0x279a62,_0x2b4416['close'],_0x27f1c8,_0x214fda,_0x1151ec,_0x3b47fd,_0x305dba,_0x4f4ed6,_0x4414e2,_0x540d2b);}[_0x5307f6(0x160)](_0x57a3c4,_0x44bdc=0x32){const _0x6adc66=_0x5307f6;if(_0x57a3c4[_0x6adc66(0x17b)]<_0x44bdc)return 0x0;const _0x5a67c1=_0x57a3c4[_0x6adc66(0x113)](-_0x44bdc),_0x526e73=_0x5a67c1[_0x6adc66(0x14a)]((_0x42d6ce,_0xadb9be)=>_0x42d6ce+_0xadb9be,0x0)/_0x44bdc,_0x57cb3d=_0x5a67c1[_0x6adc66(0x14a)]((_0x1a49c7,_0x108497)=>_0x1a49c7+Math['pow'](_0x108497-_0x526e73,0x2),0x0)/_0x44bdc,_0x2d39bf=Math['sqrt'](_0x57cb3d);if(_0x2d39bf<0.0001)return 0x0;const _0x42ee48=_0x57a3c4[_0x57a3c4[_0x6adc66(0x17b)]-0x1];return(_0x42ee48-_0x526e73)/_0x2d39bf;}['_computeVPIN'](_0x318b95){const _0x4254ad=_0x5307f6;if(_0x318b95[_0x4254ad(0x17b)]<this['vpinWindow'])return 0.5;const _0x9a0915=_0x318b95['slice'](-this[_0x4254ad(0x15c)]);let _0x545647=0x0,_0x3f6d8d=0x0;for(const _0x299932 of _0x9a0915){_0x545647+=_0x299932['buy'],_0x3f6d8d+=_0x299932['sell'];}const _0x45e6fe=_0x545647+_0x3f6d8d;if(_0x45e6fe<0x1)return 0.5;return Math[_0x4254ad(0x125)](_0x545647-_0x3f6d8d)/_0x45e6fe;}['_computeKyleLambda'](_0x4d17f0){const _0x4febed=_0x5307f6;if(_0x4d17f0[_0x4febed(0x17b)]<0x14)return 0x0;const _0x1a9eb7=_0x4d17f0['slice'](-0x14),_0x1a261b=[],_0x5dfe43=[];for(let _0x75a17=0x1;_0x75a17<_0x1a9eb7[_0x4febed(0x17b)];_0x75a17++){_0x1a261b[_0x4febed(0x175)](_0x1a9eb7[_0x75a17][_0x4febed(0x177)]-_0x1a9eb7[_0x75a17-0x1][_0x4febed(0x177)]),_0x5dfe43['push'](_0x1a9eb7[_0x75a17]['volume']);}const _0x531b35=_0x1a261b['reduce']((_0x598d8d,_0x4abf94)=>_0x598d8d+_0x4abf94,0x0)/_0x1a261b[_0x4febed(0x17b)],_0x3c02cd=_0x5dfe43[_0x4febed(0x14a)]((_0x7f1771,_0x58eabf)=>_0x7f1771+_0x58eabf,0x0)/_0x5dfe43['length'];let _0x27eda6=0x0,_0x360ac8=0x0;for(let _0x15358b=0x0;_0x15358b<_0x1a261b[_0x4febed(0x17b)];_0x15358b++){_0x27eda6+=(_0x1a261b[_0x15358b]-_0x531b35)*(_0x5dfe43[_0x15358b]-_0x3c02cd),_0x360ac8+=Math[_0x4febed(0x10f)](_0x5dfe43[_0x15358b]-_0x3c02cd,0x2);}_0x27eda6/=_0x1a261b['length'],_0x360ac8/=_0x1a261b['length'];if(_0x360ac8<0.0001)return 0x0;return Math['abs'](_0x27eda6/_0x360ac8);}[_0x5307f6(0x176)](_0x3c4e82,_0x3efb4b){const _0x59b99f=_0x5307f6;let _0x5c1e25=this['kalmanStates'][_0x59b99f(0x11b)](_0x3c4e82);if(!_0x5c1e25)return _0x5c1e25={'estimate':_0x3efb4b,'errorCovariance':0x1},this['kalmanStates'][_0x59b99f(0x127)](_0x3c4e82,_0x5c1e25),_0x3efb4b;const _0x298c07=_0x5c1e25[_0x59b99f(0x14b)],_0x1de2b9=_0x5c1e25[_0x59b99f(0x156)]+this['kalmanProcessNoise'],_0x38da72=_0x1de2b9/(_0x1de2b9+this[_0x59b99f(0x124)]),_0x5bfe4a=_0x298c07+_0x38da72*(_0x3efb4b-_0x298c07),_0x23bbf7=(0x1-_0x38da72)*_0x1de2b9;return _0x5c1e25['estimate']=_0x5bfe4a,_0x5c1e25[_0x59b99f(0x156)]=_0x23bbf7,_0x5bfe4a;}[_0x5307f6(0x117)](_0x5b6c9f,_0x104ec6){const _0x4c8059=_0x5307f6,_0x160e7f=this[_0x4c8059(0x112)](_0x104ec6),_0x5cd8a0=_0x160e7f/this[_0x4c8059(0x15d)];let _0x2a66fc=this['atrHistory'][_0x4c8059(0x11b)](_0x5b6c9f);!_0x2a66fc&&(_0x2a66fc=[],this['atrHistory'][_0x4c8059(0x127)](_0x5b6c9f,_0x2a66fc));_0x2a66fc[_0x4c8059(0x175)](_0x160e7f);if(_0x2a66fc['length']>0x1f4)_0x2a66fc[_0x4c8059(0x15b)]();let _0xb7ea2d=0.5;_0x2a66fc['length']>=0x14&&(_0xb7ea2d=_0x2a66fc['filter'](_0x9f904c=>_0x9f904c<=_0x160e7f)[_0x4c8059(0x17b)]/_0x2a66fc['length']);let _0x4a07ec,_0xb44148;if(_0xb7ea2d<0.25)_0x4a07ec=_0x4c8059(0x168),_0xb44148={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0xb7ea2d<0.75?(_0x4a07ec='normal',_0xb44148={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x4a07ec=_0x4c8059(0x10e),_0xb44148={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x4a07ec,'params':_0xb44148};}[_0x5307f6(0x112)](_0x4e1fef,_0x18bfee=0xe){const _0x56c386=_0x5307f6;if(_0x4e1fef[_0x56c386(0x17b)]<_0x18bfee+0x1)return 2.5;const _0x528fd0=[];for(let _0xe01baf=_0x4e1fef['length']-_0x18bfee;_0xe01baf<_0x4e1fef[_0x56c386(0x17b)];_0xe01baf++){const _0x5ecbe1=_0x4e1fef[_0xe01baf],_0x46e377=_0x4e1fef[_0xe01baf-0x1]['close'],_0x41ee6a=Math[_0x56c386(0x152)](_0x5ecbe1['high']-_0x5ecbe1['low'],Math[_0x56c386(0x125)](_0x5ecbe1['high']-_0x46e377),Math[_0x56c386(0x125)](_0x5ecbe1['low']-_0x46e377));_0x528fd0['push'](_0x41ee6a);}return _0x528fd0[_0x56c386(0x14a)]((_0x4a7dd3,_0x78050b)=>_0x4a7dd3+_0x78050b,0x0)/_0x528fd0['length'];}['_computeOrderFlowImbalance'](_0x56d9de){const _0x57f0e0=_0x5307f6;if(_0x56d9de[_0x57f0e0(0x17b)]<this['ofiLookback'])return 0x0;const _0x2b1103=_0x56d9de[_0x57f0e0(0x113)](-this[_0x57f0e0(0x17c)]);let _0x3be5eb=0x0,_0x5b1918=0x0;for(const _0x5191eb of _0x2b1103){const _0x2b20e7=_0x5191eb[_0x57f0e0(0x10e)]-_0x5191eb[_0x57f0e0(0x168)];if(_0x2b20e7>0x0){const _0x53ba1d=(_0x5191eb[_0x57f0e0(0x177)]-_0x5191eb['low'])/_0x2b20e7;_0x3be5eb+=_0x53ba1d*_0x5191eb[_0x57f0e0(0x16c)],_0x5b1918+=(0x1-_0x53ba1d)*_0x5191eb[_0x57f0e0(0x16c)];}}const _0x319a31=_0x3be5eb+_0x5b1918;if(_0x319a31<0x1)return 0x0;return(_0x3be5eb-_0x5b1918)/_0x319a31;}['_generateSignal'](_0x1426e3,_0x41a107,_0x429573,_0x6a6303,_0x513c55,_0x5c7beb,_0x598c72,_0x468c2b,_0x33cd7c,_0x33597d){const _0x131336=_0x5307f6,_0x1a2632=Math[_0x131336(0x125)](_0x429573);if(_0x1a2632<_0x468c2b[_0x131336(0x158)])return null;if(_0x6a6303>this['vpinToxicThreshold'])return null;let _0x3a1c27;if(_0x429573<-_0x468c2b[_0x131336(0x158)])_0x3a1c27=_0x131336(0x14c);else{if(_0x429573>_0x468c2b[_0x131336(0x158)])_0x3a1c27=_0x131336(0x128);else return null;}const _0x3c9906=_0x3a1c27==='long'&&_0x33cd7c>0.1||_0x3a1c27===_0x131336(0x128)&&_0x33cd7c<-0.1,_0x3248fb=_0x41a107-_0x5c7beb,_0x26e901=_0x3a1c27==='long'&&_0x3248fb<0x0||_0x3a1c27===_0x131336(0x128)&&_0x3248fb>0x0,_0x5486fd={'zscore':Math[_0x131336(0x145)](0x1,_0x1a2632/0x4),'vpin':0x1-_0x6a6303,'kyleLambda':_0x513c55>0.001?0.5:0.8,'kalman':_0x26e901?0.8:0.4,'volatility':_0x598c72==='normal'?0.8:_0x598c72==='low'?0.7:0.6,'ofi':_0x3c9906?0.9:0.5,'composite':0x0};_0x5486fd['composite']=_0x5486fd['zscore']*this['weights']['zscore']+_0x5486fd['vpin']*this['weights']['vpin']+_0x5486fd['kyleLambda']*this[_0x131336(0x16e)][_0x131336(0x10b)]+_0x5486fd[_0x131336(0x122)]*this['weights']['kalman']+_0x5486fd['volatility']*this['weights']['volatility']+_0x5486fd[_0x131336(0x147)]*this[_0x131336(0x16e)][_0x131336(0x147)];const _0x61bb38=Math['min'](0x1,_0x5486fd['composite']+_0x468c2b['confidenceBonus']);if(_0x61bb38<this[_0x131336(0x151)])return null;if(Date['now']()-this[_0x131336(0x11f)]<this['cooldownMs'])return null;const _0x738a14=Math['round'](this['baseStopTicks']*_0x468c2b[_0x131336(0x148)]),_0x4e0130=Math['round'](this[_0x131336(0x142)]*_0x468c2b['targetMultiplier']),_0x46f457=Math[_0x131336(0x152)](0x6,Math['min'](0xc,_0x738a14)),_0x48a075=Math[_0x131336(0x152)](_0x46f457*1.5,Math[_0x131336(0x145)](0x18,_0x4e0130));let _0x394bf8,_0x4c05de,_0xc6b03b,_0x1371b5;_0x3a1c27===_0x131336(0x14c)?(_0x394bf8=_0x41a107-_0x46f457*this['tickSize'],_0x4c05de=_0x41a107+_0x48a075*this['tickSize'],_0xc6b03b=_0x41a107+this[_0x131336(0x123)]*this[_0x131336(0x15d)],_0x1371b5=_0x41a107+_0x48a075*this[_0x131336(0x16f)]*this['tickSize']):(_0x394bf8=_0x41a107+_0x46f457*this['tickSize'],_0x4c05de=_0x41a107-_0x48a075*this[_0x131336(0x15d)],_0xc6b03b=_0x41a107-this['breakevenTicks']*this[_0x131336(0x15d)],_0x1371b5=_0x41a107-_0x48a075*this['profitLockPct']*this[_0x131336(0x15d)]);const _0x38a428=_0x48a075/_0x46f457,_0x58328d=Math[_0x131336(0x15a)](_0x48a075*0.5),_0x34e905=Math['round'](_0x46f457*0.4);let _0x3faee0=SignalStrength['MODERATE'];if(_0x61bb38>=0.85)_0x3faee0=SignalStrength[_0x131336(0x12d)];else{if(_0x61bb38>=0.75)_0x3faee0=SignalStrength[_0x131336(0x13b)];else{if(_0x61bb38<0.6)_0x3faee0=SignalStrength['WEAK'];}}const _0x54f76f=0.5+(_0x61bb38-0.5)*0.4,_0x591f1b=_0x54f76f*Math[_0x131336(0x125)](_0x4c05de-_0x41a107)-(0x1-_0x54f76f)*Math[_0x131336(0x125)](_0x41a107-_0x394bf8);this['lastSignalTime']=Date[_0x131336(0x13d)](),this['stats']['signals']++;const _0x365879={'id':uuidv4(),'timestamp':Date[_0x131336(0x13d)](),'symbol':_0x1426e3['split']('.')[0x0]||_0x1426e3,'contractId':_0x1426e3,'side':_0x3a1c27==='long'?OrderSide[_0x131336(0x11e)]:OrderSide[_0x131336(0x115)],'direction':_0x3a1c27,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0x3faee0,'edge':_0x591f1b,'confidence':_0x61bb38,'entry':_0x41a107,'entryPrice':_0x41a107,'stopLoss':_0x394bf8,'takeProfit':_0x4c05de,'riskReward':_0x38a428,'stopTicks':_0x46f457,'targetTicks':_0x48a075,'trailTriggerTicks':_0x58328d,'trailDistanceTicks':_0x34e905,'beBreakeven':_0xc6b03b,'profitLockLevel':_0x1371b5,'zScore':_0x429573,'zScoreExit':this['zscoreExitThreshold'],'vpinValue':_0x6a6303,'kyleLambda':_0x513c55,'kalmanEstimate':_0x5c7beb,'volatilityRegime':_0x598c72,'ofiValue':_0x33cd7c,'models':_0x5486fd,'orderFlowConfirmed':_0x3c9906,'kalmanConfirmed':_0x26e901,'expires':Date['now']()+0xea60};return this[_0x131336(0x166)](_0x131336(0x13a),{'side':_0x3a1c27===_0x131336(0x14c)?'buy':_0x131336(0x170),'action':_0x131336(0x130),'reason':'Z='+_0x429573['toFixed'](0x2)+_0x131336(0x15e)+(_0x6a6303*0x64)['toFixed'](0x0)+_0x131336(0x12f)+(_0x33cd7c*0x64)['toFixed'](0x0)+_0x131336(0x139)+(_0x61bb38*0x64)['toFixed'](0x0)+'%',..._0x365879}),this[_0x131336(0x166)](_0x131336(0x13c),{'type':_0x131336(0x134),'message':'[HQX]\x20SIGNAL:\x20'+_0x3a1c27[_0x131336(0x136)]()+'\x20@\x20'+_0x41a107['toFixed'](0x2)+'\x20|\x20Z:'+_0x429573[_0x131336(0x131)](0x2)+_0x131336(0x179)+(_0x6a6303*0x64)['toFixed'](0x0)+'%\x20OFI:'+(_0x33cd7c*0x64)[_0x131336(0x131)](0x0)+'%\x20Kyle:'+_0x513c55[_0x131336(0x131)](0x5)+'\x20Regime:'+_0x598c72+_0x131336(0x118)+(_0x61bb38*0x64)[_0x131336(0x131)](0x0)+'%'}),_0x365879;}['shouldExitByZScore'](_0x55e742){const _0x131886=_0x5307f6,_0x5800ea=this[_0x131886(0x10d)]['get'](_0x55e742);if(!_0x5800ea||_0x5800ea['length']<0x32)return![];const _0x4f0021=this[_0x131886(0x160)](_0x5800ea);return Math['abs'](_0x4f0021)<this['zscoreExitThreshold'];}[_0x5307f6(0x17d)](_0x48a51b){const _0x5b27df=_0x5307f6,_0x4a56fd=this['priceBuffer'][_0x5b27df(0x11b)](_0x48a51b),_0x156739=this[_0x5b27df(0x167)]['get'](_0x48a51b),_0x1439b9=this[_0x5b27df(0x12e)]['get'](_0x48a51b);if(!_0x4a56fd||!_0x156739||!_0x1439b9||_0x1439b9['length']<0x32)return null;const _0x1a338e=this['_computeZScore'](_0x4a56fd),_0x1764ba=this['_computeVPIN'](_0x156739),_0x586b7e=this[_0x5b27df(0x164)](_0x1439b9),_0x138267=this[_0x5b27df(0x11c)](_0x1439b9);return{'zscore':Math[_0x5b27df(0x145)](0x1,Math['abs'](_0x1a338e)/0x4),'vpin':0x1-_0x1764ba,'kyleLambda':_0x586b7e>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x5b27df(0x125)](_0x138267)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x1a338e,'vpin':_0x1764ba,'kyleLambda':_0x586b7e,'ofi':_0x138267}};}['getAnalysisState'](_0x373261,_0x58f6cd){const _0x26f820=_0x5307f6,_0x306b45=this['barHistory'][_0x26f820(0x11b)](_0x373261)||[];if(_0x306b45['length']<0x32)return{'ready':![],'message':_0x26f820(0x173)+_0x306b45[_0x26f820(0x17b)]+_0x26f820(0x114)};const _0x27ae67=this['priceBuffer'][_0x26f820(0x11b)](_0x373261)||[],_0x3ae8d9=this['volumeBuffer']['get'](_0x373261)||[],_0x4fcaa7=this['_computeZScore'](_0x27ae67),_0x47bc64=this['_computeVPIN'](_0x3ae8d9),_0x49105d=this['_computeOrderFlowImbalance'](_0x306b45),_0x59d7f4=this['_computeKyleLambda'](_0x306b45),{regime:_0x2eb87f,params:_0x44ca9f}=this[_0x26f820(0x117)](_0x373261,_0x306b45);return{'ready':!![],'zScore':_0x4fcaa7,'vpin':_0x47bc64,'ofi':_0x49105d,'kyleLambda':_0x59d7f4,'regime':_0x2eb87f,'stopTicks':Math['round'](this[_0x26f820(0x146)]*_0x44ca9f[_0x26f820(0x148)]),'targetTicks':Math['round'](this['baseTargetTicks']*_0x44ca9f[_0x26f820(0x162)]),'threshold':_0x44ca9f[_0x26f820(0x158)],'barsProcessed':_0x306b45[_0x26f820(0x17b)],'models':_0x26f820(0x12b)};}[_0x5307f6(0x169)](_0x57e4c7){const _0x12ac0e=_0x5307f6;this[_0x12ac0e(0x120)][_0x12ac0e(0x175)]({'netPnl':_0x57e4c7,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this[_0x12ac0e(0x120)][_0x12ac0e(0x15b)]();_0x57e4c7>0x0?(this['winStreak']++,this['lossStreak']=0x0,this[_0x12ac0e(0x15f)][_0x12ac0e(0x116)]++):(this[_0x12ac0e(0x11a)]++,this['winStreak']=0x0,this['stats']['losses']++),this[_0x12ac0e(0x15f)]['trades']++,this['stats']['pnl']+=_0x57e4c7,this['emit']('log',{'type':_0x12ac0e(0x12a),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x57e4c7>0x0?_0x12ac0e(0x171):_0x12ac0e(0x150))+'\x20$'+_0x57e4c7[_0x12ac0e(0x131)](0x2)+_0x12ac0e(0x16b)+(_0x57e4c7>0x0?this[_0x12ac0e(0x155)]:-this[_0x12ac0e(0x11a)])});}[_0x5307f6(0x111)](_0x2d110e){const _0x4edacd=_0x5307f6;return this[_0x4edacd(0x12e)][_0x4edacd(0x11b)](_0x2d110e)||[];}['getStats'](){const _0x3ca1b7=_0x5307f6;return this[_0x3ca1b7(0x15f)];}['reset'](_0x3af889){const _0x99c4bf=_0x5307f6;this[_0x99c4bf(0x12e)][_0x99c4bf(0x127)](_0x3af889,[]),this['priceBuffer']['set'](_0x3af889,[]),this[_0x99c4bf(0x167)][_0x99c4bf(0x127)](_0x3af889,[]),this['atrHistory'][_0x99c4bf(0x127)](_0x3af889,[]),this[_0x99c4bf(0x13f)][_0x99c4bf(0x127)](_0x3af889,{'estimate':0x0,'errorCovariance':0x1}),this[_0x99c4bf(0x166)](_0x99c4bf(0x13c),{'type':_0x99c4bf(0x134),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x3af889});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x52695f={}){const _0x263cfc=_0x5307f6;super(),this['config']=_0x52695f,this['strategy']=new HQXUltraScalping(_0x52695f),this['strategy']['on']('signal',_0x58c7b3=>this['emit']('signal',_0x58c7b3)),this[_0x263cfc(0x157)]['on'](_0x263cfc(0x13c),_0x3b913c=>this[_0x263cfc(0x166)](_0x263cfc(0x13c),_0x3b913c));}[_0x5307f6(0x141)](_0xedcb97){const _0x3f6f67=_0x5307f6;return this['strategy'][_0x3f6f67(0x141)](_0xedcb97);}['onTick'](_0x3b7c69){const _0x586370=_0x5307f6;return this[_0x586370(0x157)]['onTick'](_0x3b7c69);}['onTrade'](_0x1a13bf){const _0x661527=_0x5307f6;return this[_0x661527(0x157)]['onTrade'](_0x1a13bf);}[_0x5307f6(0x174)](_0x1a416d,_0x3751b2){const _0x45b340=_0x5307f6;return this[_0x45b340(0x157)]['processBar'](_0x1a416d,_0x3751b2);}['initialize'](_0x2d4ba8,_0x334655,_0x3b6ed1){return this['strategy']['initialize'](_0x2d4ba8,_0x334655,_0x3b6ed1);}[_0x5307f6(0x178)](_0x33baf8,_0x13030a){const _0x1e4bb7=_0x5307f6;return this['strategy'][_0x1e4bb7(0x178)](_0x33baf8,_0x13030a);}[_0x5307f6(0x169)](_0x325780){const _0x4766a1=_0x5307f6;return this[_0x4766a1(0x157)][_0x4766a1(0x169)](_0x325780);}[_0x5307f6(0x140)](_0x56b1f0){const _0x36796f=_0x5307f6;return this[_0x36796f(0x157)][_0x36796f(0x140)](_0x56b1f0);}[_0x5307f6(0x121)](){const _0xe67fdb=_0x5307f6;return this[_0xe67fdb(0x157)][_0xe67fdb(0x121)]();}[_0x5307f6(0x111)](_0x1a6db8){const _0x21be09=_0x5307f6;return this[_0x21be09(0x157)][_0x21be09(0x111)](_0x1a6db8);}['getModelValues'](_0x114be5){const _0x3fd5be=_0x5307f6;return this['strategy'][_0x3fd5be(0x17d)](_0x114be5);}[_0x5307f6(0x137)](_0x428627){return this['strategy']['shouldExitByZScore'](_0x428627);}[_0x5307f6(0x129)](_0x2d9d55){return null;}}function _0x4e4a(){const _0x156e2f=['exports','772150QRVvUr','min','baseStopTicks','ofi','stopMultiplier','price','reduce','estimate','long','contractId','uuid','8ZJmOhm','LOSS','minConfidence','max','99790VfeiRK','tickValue','winStreak','errorCovariance','strategy','zscoreThreshold','6303780kAquiR','round','shift','vpinWindow','tickSize',',\x20VPIN=','stats','_computeZScore','1591323ddDvht','targetMultiplier',',\x20value=','_computeKyleLambda','498169gRXSbO','emit','volumeBuffer','low','recordTradeResult','66MsRjPK',',\x20streak:\x20','volume','cooldownMs','weights','profitLockPct','sell','WIN','[HQX-UltraScalping]\x20Initialized\x20for\x20','Collecting\x20data...\x20','processBar','push','_applyKalmanFilter','close','getAnalysisState','\x20VPIN:','timestamp','length','ofiLookback','getModelValues','_generateSignal','kyleLambda','minHoldTimeMs','priceBuffer','high','pow','zscoreEntryThreshold','getBarHistory','_calculateATR','slice','/50\x20bars','ASK','wins','_detectVolatilityRegime','\x20|\x20Conf:','vpinToxicThreshold','lossStreak','get','_computeOrderFlowImbalance','side','BID','lastSignalTime','recentTrades','getStats','kalman','breakevenTicks','kalmanMeasurementNoise','abs','24485260nIqwjl','set','short','generateSignal','debug','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','atrHistory','VERY_STRONG','barHistory','%,\x20OFI=','open','toFixed','2283200jNdzfb','19FoJAnB','info','_computeVPIN','toUpperCase','shouldExitByZScore','events','%,\x20cf=','signal','STRONG','log','now','onTrade','kalmanStates','reset','processTick','baseTargetTicks'];_0x4e4a=function(){return _0x156e2f;};return _0x4e4a();}module[_0x5307f6(0x143)]={'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.97",
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`;