hedgequantx 2.9.130 → 2.9.132

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 _0x36ddf1=_0x4576;(function(_0x4667dd,_0x241d80){const _0x2a93c1=_0x4576,_0x8020ac=_0x4667dd();while(!![]){try{const _0x56b998=-parseInt(_0x2a93c1(0x261))/0x1*(parseInt(_0x2a93c1(0x1e6))/0x2)+parseInt(_0x2a93c1(0x26f))/0x3*(parseInt(_0x2a93c1(0x1f4))/0x4)+parseInt(_0x2a93c1(0x258))/0x5*(parseInt(_0x2a93c1(0x237))/0x6)+-parseInt(_0x2a93c1(0x263))/0x7+parseInt(_0x2a93c1(0x21d))/0x8+-parseInt(_0x2a93c1(0x21c))/0x9*(parseInt(_0x2a93c1(0x1f2))/0xa)+parseInt(_0x2a93c1(0x25f))/0xb;if(_0x56b998===_0x241d80)break;else _0x8020ac['push'](_0x8020ac['shift']());}catch(_0x590f10){_0x8020ac['push'](_0x8020ac['shift']());}}}(_0x230d,0x1c412));const EventEmitter=require(_0x36ddf1(0x230)),{v4:uuidv4}=require(_0x36ddf1(0x249)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x36ddf1(0x274),'LOW_SWEEP':_0x36ddf1(0x236)},ZoneType={'RESISTANCE':'resistance','SUPPORT':_0x36ddf1(0x25e)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x3,'minStrength':0x2,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x4,'minTouches':0x2,'maxZoneAgeBars':0xc8,'maxZoneDistanceTicks':0x28,'cooldownBars':0xa},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x8,'maxDurationBars':0x5,'minQualityScore':0.25,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x2710,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x36ddf1(0x204)}};function _0x4576(_0x3d947b,_0x317c88){_0x3d947b=_0x3d947b-0x1de;const _0x230ddb=_0x230d();let _0x457641=_0x230ddb[_0x3d947b];return _0x457641;}function _0x230d(){const _0x4f6bd6=['generateSignal','toUpperCase','config','volume','get','[2B]\x20SWEEP\x20','trailTriggerTicks','\x20historical\x20signals\x20detected\x20(ignored)','t\x20|\x20Q:\x20','maxDurationBars','10ItpTCb','execution','4NmUbsF','emit','map','preloadBars','liquidityZones','isWithinSession','lookbackBars','activeSweeps','[HQX-2B]\x20Reset\x20state\x20for\x20','processTick','_mergeConfig','tickSize','t,\x20Trail=','penetrationTicks','strength','max','America/New_York','MODERATE','sort','getFullYear','trailDistanceTicks','tickValue','find','Collecting\x20data...\x20','x\x20|\x20Conf:','cooldownMs','stats','getHealthStatus','slice','session','durationBars','swing','shift','[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload','stopTicks','WEAK','priceLow','initialize','minQualityScore','getAnalysisState','457956MfgYDW','266520lKzKym','barIndex','[BAR]\x20#','debug','filter','VERY_STRONG','\x20@\x20','onTrade','min','x\x20|\x20Q:','currentBar','close','clusterToleranceTicks','type','splice','log','has','delete','onTick','events','lastUsedBarIndex','exitBarIndex','strategy','sweepType','\x20|\x20','low','54336fPThCu','startTime',',\x20value=','\x20|\x20Pen:\x20','signal','_generateSignal','qualityScore','targetTicks','getTimezoneOffset','lastSignalTime','length','_getVolumeRatio','[HQX-2B]\x20Trade\x20result:\x20','RESISTANCE','[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20(','[2B]\x20NEW\x20SWING\x20','isDST','containsPrice','uuid','timestamp','open','pnl','symbol','t,\x20BE=','swept','now','swingPoints','t,\x20Target=','/5\x20bars','2B\x20','getLevel','losses','\x20bars,\x20','65SrafdF','set','processBar',',\x20TF=1min','getStats','[HQX-2B]\x20','support','320485XeWFQx','barHistory','1SxceAZ','entryBarIndex','543403UKXeNl','tickCount','info','long','breakevenTicks','isValid','[HQX-2B]\x20Initialized\x20for\x20','_detectSweep','recordTradeResult','distance','volumeRatio','_tickCount','677199DAmbJe','priceHigh','[HQX-2B]\x20SIGNAL:\x20','zone','toFixed','high','HQX_2B_LIQUIDITY_SWEEP','\x20|\x20O:','_detectSwings','[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)','\x20L:','reset','\x20|\x20Pen:','touches','push','STRONG','\x20H:','LOSS','abs','SUPPORT','price','323336SIGKZv','getUTCHours'];_0x230d=function(){return _0x4f6bd6;};return _0x230d();}class SwingPoint{constructor(_0x1592ba,_0x18ce55,_0x13968e,_0x599da0,_0x26d882=0x1){const _0x6c76ab=_0x36ddf1;this[_0x6c76ab(0x22a)]=_0x1592ba,this['price']=_0x18ce55,this['barIndex']=_0x13968e,this[_0x6c76ab(0x24a)]=_0x599da0,this[_0x6c76ab(0x202)]=_0x26d882;}}class LiquidityZone{constructor(_0x2fd87e,_0x2163c8,_0x483e43,_0x35364a,_0x4224fa){const _0x5cbe91=_0x36ddf1;this['id']=uuidv4(),this['type']=_0x2fd87e,this['priceHigh']=_0x2163c8,this['priceLow']=_0x483e43,this['createdAt']=_0x35364a,this[_0x5cbe91(0x21e)]=_0x4224fa,this[_0x5cbe91(0x1de)]=0x1,this[_0x5cbe91(0x24f)]=![],this['sweptAt']=null,this['lastUsedBarIndex']=-0x3e7,this[_0x5cbe91(0x23d)]=0.5;}[_0x36ddf1(0x248)](_0x2b9b49,_0x21d562,_0x3dc3c1){const _0x2e573c=_0x21d562*_0x3dc3c1;return _0x2b9b49>=this['priceLow']-_0x2e573c&&_0x2b9b49<=this['priceHigh']+_0x2e573c;}[_0x36ddf1(0x255)](){return(this['priceHigh']+this['priceLow'])/0x2;}}class SweepEvent{constructor(_0x3b5055,_0x23fbc6,_0x21fec3,_0x4f2661,_0x4e5440){const _0x505b10=_0x36ddf1;this[_0x505b10(0x234)]=_0x3b5055,this['zone']=_0x23fbc6,this[_0x505b10(0x262)]=_0x21fec3,this['extremeBarIndex']=_0x4f2661,this['extremePrice']=_0x4e5440,this[_0x505b10(0x232)]=null,this[_0x505b10(0x268)]=![],this[_0x505b10(0x23d)]=0x0,this[_0x505b10(0x201)]=0x0,this['durationBars']=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x4abce8={}){const _0x65a5e4=_0x36ddf1;super(),this['config']=this['_mergeConfig'](DEFAULT_CONFIG,_0x4abce8),this['tickSize']=this[_0x65a5e4(0x1ea)]['tickSize'],this[_0x65a5e4(0x209)]=this['config'][_0x65a5e4(0x209)],this['barHistory']=new Map(),this[_0x65a5e4(0x251)]=new Map(),this['liquidityZones']=new Map(),this[_0x65a5e4(0x1fb)]=new Map(),this[_0x65a5e4(0x227)]=new Map(),this['barIntervalMs']=0xea60,this[_0x65a5e4(0x240)]=0x0,this['startTime']=Date[_0x65a5e4(0x250)](),this[_0x65a5e4(0x20e)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this['recentTrades']=[];}[_0x36ddf1(0x1fe)](_0x206f21,_0x472c07){const _0x2a86ca={..._0x206f21};for(const _0x91349c in _0x472c07){typeof _0x472c07[_0x91349c]==='object'&&!Array['isArray'](_0x472c07[_0x91349c])?_0x2a86ca[_0x91349c]={..._0x206f21[_0x91349c],..._0x472c07[_0x91349c]}:_0x2a86ca[_0x91349c]=_0x472c07[_0x91349c];}return _0x2a86ca;}[_0x36ddf1(0x1f9)](_0x17c4a5){const _0x206111=_0x36ddf1;if(!this[_0x206111(0x1ea)][_0x206111(0x211)]['enabled'])return!![];const _0x502016=new Date(_0x17c4a5),_0xa8a993=this[_0x206111(0x247)](_0x502016)?-0x4:-0x5,_0x1f96e4=_0x502016[_0x206111(0x1e7)](),_0x909cfc=_0x502016['getUTCMinutes'](),_0x1ab837=(_0x1f96e4+_0xa8a993+0x18)%0x18,{startHour:_0x450aac,startMinute:_0x260644,endHour:_0x2a8d3d,endMinute:_0x59048a}=this[_0x206111(0x1ea)][_0x206111(0x211)],_0x232832=_0x1ab837*0x3c+_0x909cfc,_0x155cfc=_0x450aac*0x3c+_0x260644,_0x1c4ffa=_0x2a8d3d*0x3c+_0x59048a;return _0x232832>=_0x155cfc&&_0x232832<_0x1c4ffa;}[_0x36ddf1(0x247)](_0x28b300){const _0x5045b3=_0x36ddf1,_0x4c51f6=new Date(_0x28b300[_0x5045b3(0x207)](),0x0,0x1),_0x17e49a=new Date(_0x28b300[_0x5045b3(0x207)](),0x6,0x1),_0x11430b=Math['max'](_0x4c51f6['getTimezoneOffset'](),_0x17e49a[_0x5045b3(0x23f)]());return _0x28b300['getTimezoneOffset']()<_0x11430b;}['initialize'](_0x232340,_0xc84093=0.25,_0x376ba4=0x5){const _0x5c4475=_0x36ddf1;this[_0x5c4475(0x1ff)]=_0xc84093,this['tickValue']=_0x376ba4,this['config'][_0x5c4475(0x1ff)]=_0xc84093,this[_0x5c4475(0x1ea)][_0x5c4475(0x209)]=_0x376ba4,this[_0x5c4475(0x260)]['set'](_0x232340,[]),this['swingPoints'][_0x5c4475(0x259)](_0x232340,[]),this[_0x5c4475(0x1f8)]['set'](_0x232340,[]),this[_0x5c4475(0x1fb)][_0x5c4475(0x259)](_0x232340,[]),this[_0x5c4475(0x227)]['delete'](_0x232340),this['emit']('log',{'type':_0x5c4475(0x265),'message':_0x5c4475(0x269)+_0x232340+':\x20tick='+_0xc84093+_0x5c4475(0x239)+_0x376ba4+_0x5c4475(0x25b)}),this[_0x5c4475(0x1f5)](_0x5c4475(0x22c),{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x5c4475(0x1ea)]['execution']['stopTicks']+_0x5c4475(0x252)+this['config']['execution'][_0x5c4475(0x23e)]+_0x5c4475(0x24e)+this[_0x5c4475(0x1ea)][_0x5c4475(0x1f3)]['breakevenTicks']+_0x5c4475(0x200)+this[_0x5c4475(0x1ea)]['execution'][_0x5c4475(0x1ee)]+'/'+this[_0x5c4475(0x1ea)][_0x5c4475(0x1f3)][_0x5c4475(0x208)]});}['processTick'](_0x35a37d){const _0x485dd7=_0x36ddf1,{contractId:_0x1a85ba,price:_0x455f16,volume:_0xc87232,timestamp:_0x479d32}=_0x35a37d,_0x27dd0c=_0x479d32||Date['now'](),_0xbddd5=_0xc87232||0x1;if(!this['isWithinSession'](_0x27dd0c))return null;if(!this[_0x485dd7(0x26e)])this['_tickCount']=0x0;this['_tickCount']++;let _0x5c15d8=this['currentBar'][_0x485dd7(0x1ec)](_0x1a85ba);const _0x36cf1c=Math['floor'](_0x27dd0c/this['barIntervalMs'])*this['barIntervalMs'];if(!_0x5c15d8||_0x5c15d8[_0x485dd7(0x238)]!==_0x36cf1c){if(_0x5c15d8){const _0x12bce8={'timestamp':_0x5c15d8[_0x485dd7(0x238)],'open':_0x5c15d8[_0x485dd7(0x24b)],'high':_0x5c15d8[_0x485dd7(0x274)],'low':_0x5c15d8['low'],'close':_0x5c15d8['close'],'volume':_0x5c15d8[_0x485dd7(0x1eb)]},_0x4c8496=this[_0x485dd7(0x260)][_0x485dd7(0x1ec)](_0x1a85ba)||[];this[_0x485dd7(0x1f5)]('log',{'type':'debug','message':_0x485dd7(0x21f)+(_0x4c8496['length']+0x1)+'\x20closed\x20@\x20'+_0x12bce8[_0x485dd7(0x228)]['toFixed'](0x2)+_0x485dd7(0x276)+_0x12bce8['open'][_0x485dd7(0x273)](0x2)+_0x485dd7(0x1e1)+_0x12bce8['high']['toFixed'](0x2)+_0x485dd7(0x279)+_0x12bce8[_0x485dd7(0x236)]['toFixed'](0x2)+'\x20Vol:'+_0x12bce8['volume']});const _0x26bec2=this['processBar'](_0x1a85ba,_0x12bce8);return this['currentBar']['set'](_0x1a85ba,{'startTime':_0x36cf1c,'open':_0x455f16,'high':_0x455f16,'low':_0x455f16,'close':_0x455f16,'volume':_0xbddd5}),_0x26bec2;}else return this[_0x485dd7(0x227)]['set'](_0x1a85ba,{'startTime':_0x36cf1c,'open':_0x455f16,'high':_0x455f16,'low':_0x455f16,'close':_0x455f16,'volume':_0xbddd5}),null;}else return _0x5c15d8['high']=Math['max'](_0x5c15d8[_0x485dd7(0x274)],_0x455f16),_0x5c15d8['low']=Math[_0x485dd7(0x225)](_0x5c15d8[_0x485dd7(0x236)],_0x455f16),_0x5c15d8['close']=_0x455f16,_0x5c15d8['volume']+=_0xbddd5,null;}[_0x36ddf1(0x22f)](_0x188f41){return this['processTick'](_0x188f41);}[_0x36ddf1(0x224)](_0x3f92b7){const _0x39a433=_0x36ddf1;return this['processTick']({'contractId':_0x3f92b7['contractId']||_0x3f92b7[_0x39a433(0x24d)],'price':_0x3f92b7[_0x39a433(0x1e5)],'volume':_0x3f92b7['size']||_0x3f92b7[_0x39a433(0x1eb)]||0x1,'timestamp':_0x3f92b7[_0x39a433(0x24a)]||Date[_0x39a433(0x250)]()});}['processBar'](_0x10f571,_0x19c591){const _0xbab4ef=_0x36ddf1;let _0x1735f7=this[_0xbab4ef(0x260)]['get'](_0x10f571);!_0x1735f7&&(this[_0xbab4ef(0x219)](_0x10f571),_0x1735f7=this['barHistory'][_0xbab4ef(0x1ec)](_0x10f571));_0x1735f7['push'](_0x19c591);if(_0x1735f7[_0xbab4ef(0x241)]>0x1f4)_0x1735f7['shift']();const _0x22c9a6=_0x1735f7[_0xbab4ef(0x241)]-0x1;if(_0x1735f7[_0xbab4ef(0x241)]<this[_0xbab4ef(0x1ea)]['swing'][_0xbab4ef(0x1fa)]*0x3)return null;const _0x56ef7d=this['swingPoints'][_0xbab4ef(0x1ec)](_0x10f571)[_0xbab4ef(0x241)];this['_detectSwings'](_0x10f571,_0x1735f7,_0x22c9a6);const _0x51339b=this[_0xbab4ef(0x251)]['get'](_0x10f571);if(_0x51339b['length']>_0x56ef7d){const _0xe007f4=_0x51339b[_0x51339b[_0xbab4ef(0x241)]-0x1];this['emit']('log',{'type':_0xbab4ef(0x220),'message':_0xbab4ef(0x246)+_0xe007f4['type'][_0xbab4ef(0x1e9)]()+'\x20@\x20'+_0xe007f4['price'][_0xbab4ef(0x273)](0x2)+'\x20|\x20Total:\x20'+_0x51339b['length']});}const _0x194f86=this[_0xbab4ef(0x26a)](_0x10f571,_0x1735f7,_0x22c9a6);_0x194f86&&this['emit'](_0xbab4ef(0x22c),{'type':'debug','message':_0xbab4ef(0x1ed)+_0x194f86[_0xbab4ef(0x234)]+'\x20|\x20Valid:\x20'+_0x194f86['isValid']+_0xbab4ef(0x23a)+_0x194f86['penetrationTicks']['toFixed'](0x1)+_0xbab4ef(0x1f0)+(_0x194f86['qualityScore']*0x64)['toFixed'](0x0)+'%'});const _0x4254f1=this[_0xbab4ef(0x1f8)][_0xbab4ef(0x1ec)](_0x10f571)['length'];this['_updateZones'](_0x10f571,_0x22c9a6);const _0x8a8b40=this[_0xbab4ef(0x1f8)]['get'](_0x10f571);if(_0x8a8b40[_0xbab4ef(0x241)]>_0x4254f1){const _0x55fd7e=_0x8a8b40[_0x8a8b40[_0xbab4ef(0x241)]-0x1];this['emit'](_0xbab4ef(0x22c),{'type':_0xbab4ef(0x220),'message':'[2B]\x20NEW\x20ZONE\x20'+_0x55fd7e['type'][_0xbab4ef(0x1e9)]()+_0xbab4ef(0x223)+_0x55fd7e[_0xbab4ef(0x255)]()['toFixed'](0x2)+'\x20|\x20Total:\x20'+_0x8a8b40[_0xbab4ef(0x241)]});}if(_0x194f86&&_0x194f86['isValid']){this[_0xbab4ef(0x1f5)](_0xbab4ef(0x22c),{'type':_0xbab4ef(0x220),'message':'[2B]\x20Calling\x20_generateSignal\x20for\x20'+_0x194f86[_0xbab4ef(0x234)]+'\x20sweep...'});const _0x5814ba=this[_0xbab4ef(0x23c)](_0x10f571,_0x19c591,_0x22c9a6,_0x194f86);return!_0x5814ba&&this[_0xbab4ef(0x1f5)](_0xbab4ef(0x22c),{'type':_0xbab4ef(0x220),'message':_0xbab4ef(0x278)}),_0x5814ba;}return null;}[_0x36ddf1(0x277)](_0x78b766,_0x5db3ee,_0x32d5c7){const _0x9fa81f=_0x36ddf1,_0x525c44=this['config'][_0x9fa81f(0x213)][_0x9fa81f(0x1fa)],_0x584abe=this[_0x9fa81f(0x1ea)]['swing']['minStrength'];if(_0x32d5c7<_0x525c44*0x2)return;const _0x4fe685=this[_0x9fa81f(0x251)][_0x9fa81f(0x1ec)](_0x78b766),_0x480bdd=_0x32d5c7-_0x525c44,_0x335fc2=_0x5db3ee[_0x480bdd];let _0xb35463=!![],_0x20cf3b=0x0;for(let _0x2fee22=_0x480bdd-_0x525c44;_0x2fee22<=_0x480bdd+_0x525c44;_0x2fee22++){if(_0x2fee22===_0x480bdd||_0x2fee22<0x0||_0x2fee22>=_0x5db3ee['length'])continue;if(_0x5db3ee[_0x2fee22]['high']>=_0x335fc2['high']){_0xb35463=![];break;}_0x20cf3b++;}if(_0xb35463&&_0x20cf3b>=_0x584abe){const _0x159325=_0x4fe685[_0x9fa81f(0x20a)](_0x420d7e=>_0x420d7e['barIndex']===_0x480bdd&&_0x420d7e[_0x9fa81f(0x22a)]===_0x9fa81f(0x274));!_0x159325&&_0x4fe685[_0x9fa81f(0x1df)](new SwingPoint('high',_0x335fc2[_0x9fa81f(0x274)],_0x480bdd,_0x335fc2[_0x9fa81f(0x24a)],_0x20cf3b));}let _0x3a2af4=!![],_0x452c3b=0x0;for(let _0x4188f3=_0x480bdd-_0x525c44;_0x4188f3<=_0x480bdd+_0x525c44;_0x4188f3++){if(_0x4188f3===_0x480bdd||_0x4188f3<0x0||_0x4188f3>=_0x5db3ee[_0x9fa81f(0x241)])continue;if(_0x5db3ee[_0x4188f3]['low']<=_0x335fc2[_0x9fa81f(0x236)]){_0x3a2af4=![];break;}_0x452c3b++;}if(_0x3a2af4&&_0x452c3b>=_0x584abe){const _0x13f0f2=_0x4fe685['find'](_0xe856e4=>_0xe856e4[_0x9fa81f(0x21e)]===_0x480bdd&&_0xe856e4['type']===_0x9fa81f(0x236));!_0x13f0f2&&_0x4fe685['push'](new SwingPoint(_0x9fa81f(0x236),_0x335fc2['low'],_0x480bdd,_0x335fc2[_0x9fa81f(0x24a)],_0x452c3b));}const _0x4dddf1=this['config']['zone']['maxZoneAgeBars'];while(_0x4fe685['length']>0x0&&_0x4fe685[0x0]['barIndex']<_0x32d5c7-_0x4dddf1){_0x4fe685[_0x9fa81f(0x214)]();}}['_updateZones'](_0x321e1c,_0x415a65){const _0x5405c4=_0x36ddf1,_0x3c5d3d=this[_0x5405c4(0x251)][_0x5405c4(0x1ec)](_0x321e1c),_0x335dda=this[_0x5405c4(0x1f8)]['get'](_0x321e1c),_0x2af153=this[_0x5405c4(0x1ea)][_0x5405c4(0x272)][_0x5405c4(0x229)]*this['tickSize'],_0x528fc6=this[_0x5405c4(0x1ea)][_0x5405c4(0x272)]['maxZoneAgeBars'];for(let _0x26f5bc=_0x335dda['length']-0x1;_0x26f5bc>=0x0;_0x26f5bc--){_0x415a65-_0x335dda[_0x26f5bc]['barIndex']>_0x528fc6&&_0x335dda[_0x5405c4(0x22b)](_0x26f5bc,0x1);}for(const _0x581ea5 of _0x3c5d3d){let _0x1d7eac=null;for(const _0x23e60c of _0x335dda){if(_0x23e60c[_0x5405c4(0x248)](_0x581ea5['price'],this[_0x5405c4(0x1ea)]['zone']['clusterToleranceTicks'],this['tickSize'])){_0x1d7eac=_0x23e60c;break;}}if(_0x1d7eac){_0x1d7eac[_0x5405c4(0x1de)]++;if(_0x581ea5['price']>_0x1d7eac[_0x5405c4(0x270)])_0x1d7eac['priceHigh']=_0x581ea5[_0x5405c4(0x1e5)];if(_0x581ea5[_0x5405c4(0x1e5)]<_0x1d7eac['priceLow'])_0x1d7eac[_0x5405c4(0x218)]=_0x581ea5[_0x5405c4(0x1e5)];_0x1d7eac['qualityScore']=Math[_0x5405c4(0x225)](0x1,0.3+_0x1d7eac['touches']*0.15);}else{const _0x4902fd=_0x581ea5[_0x5405c4(0x22a)]===_0x5405c4(0x274)?ZoneType['RESISTANCE']:ZoneType[_0x5405c4(0x1e4)],_0x4844d9=new LiquidityZone(_0x4902fd,_0x581ea5[_0x5405c4(0x1e5)]+_0x2af153/0x2,_0x581ea5[_0x5405c4(0x1e5)]-_0x2af153/0x2,_0x581ea5['timestamp'],_0x581ea5['barIndex']);_0x4844d9[_0x5405c4(0x23d)]=0.3+_0x581ea5['strength']*0.1,_0x335dda[_0x5405c4(0x1df)](_0x4844d9);}}}[_0x36ddf1(0x26a)](_0x3c6e08,_0x48e185,_0x344941){const _0x7c8711=_0x36ddf1,_0xe8b7fd=this[_0x7c8711(0x1f8)][_0x7c8711(0x1ec)](_0x3c6e08),_0x2559ae=_0x48e185[_0x344941],_0x45effa=_0x2559ae[_0x7c8711(0x228)],_0x1032f8=this[_0x7c8711(0x1ea)]['sweep'],_0x53ed14=this[_0x7c8711(0x1ea)]['zone'];for(const _0x4cdfcd of _0xe8b7fd){if(_0x4cdfcd[_0x7c8711(0x231)]>=0x0&&_0x344941-_0x4cdfcd['lastUsedBarIndex']<_0x53ed14['cooldownBars'])continue;const _0x178fd1=_0x4cdfcd['getLevel'](),_0x4570ab=Math[_0x7c8711(0x1e3)](_0x45effa-_0x178fd1)/this['tickSize'];if(_0x4570ab>_0x53ed14['maxZoneDistanceTicks'])continue;const _0x5e7be3=Math['max'](0x0,_0x344941-_0x1032f8[_0x7c8711(0x1f1)]*0x2);for(let _0x5aea88=_0x5e7be3;_0x5aea88<_0x344941;_0x5aea88++){const _0x167864=_0x48e185[_0x5aea88];if(_0x4cdfcd[_0x7c8711(0x22a)]===ZoneType['RESISTANCE']){const _0x18770a=(_0x167864['high']-_0x4cdfcd[_0x7c8711(0x270)])/this[_0x7c8711(0x1ff)];if(_0x18770a>=_0x1032f8['minPenetrationTicks']&&_0x18770a<=_0x1032f8['maxPenetrationTicks']){const _0xa2914d=Math[_0x7c8711(0x225)](_0x4cdfcd['priceHigh'],_0x4cdfcd[_0x7c8711(0x270)]+_0x18770a*this['tickSize']);if(_0x45effa<_0xa2914d+this['tickSize']*0x2){const _0x25dfce=_0x167864[_0x7c8711(0x274)]-_0x167864['low'],_0x28ddde=Math[_0x7c8711(0x1e3)](_0x167864['close']-_0x167864[_0x7c8711(0x24b)]),_0x35201c=_0x25dfce>0x0?_0x28ddde/_0x25dfce:0x0;if(_0x35201c>=_0x1032f8['minBodyRatio']){const _0x4fb85f=this[_0x7c8711(0x242)](_0x48e185,_0x5aea88,0x14);if(_0x4fb85f>=_0x1032f8['minVolumeRatio']){const _0x3bf922=new SweepEvent(SweepType['HIGH_SWEEP'],_0x4cdfcd,_0x5aea88,_0x5aea88,_0x167864['high']);_0x3bf922[_0x7c8711(0x232)]=_0x344941,_0x3bf922['penetrationTicks']=_0x18770a,_0x3bf922[_0x7c8711(0x212)]=_0x344941-_0x5aea88,_0x3bf922['volumeRatio']=_0x4fb85f,_0x3bf922[_0x7c8711(0x23d)]=this['_scoreSweep'](_0x3bf922,_0x35201c),_0x3bf922[_0x7c8711(0x268)]=_0x3bf922[_0x7c8711(0x23d)]>=_0x1032f8[_0x7c8711(0x21a)];if(_0x3bf922[_0x7c8711(0x268)])return _0x3bf922;}}}}}if(_0x4cdfcd['type']===ZoneType['SUPPORT']){const _0x57eb26=(_0x4cdfcd['priceLow']-_0x167864[_0x7c8711(0x236)])/this[_0x7c8711(0x1ff)];if(_0x57eb26>=_0x1032f8['minPenetrationTicks']&&_0x57eb26<=_0x1032f8['maxPenetrationTicks']){const _0x28d892=Math[_0x7c8711(0x203)](_0x4cdfcd['priceLow'],_0x4cdfcd[_0x7c8711(0x218)]-_0x57eb26*this['tickSize']);if(_0x45effa>_0x28d892-this['tickSize']*0x2){const _0x232040=_0x167864[_0x7c8711(0x274)]-_0x167864['low'],_0x58afbb=Math['abs'](_0x167864[_0x7c8711(0x228)]-_0x167864['open']),_0x2f322d=_0x232040>0x0?_0x58afbb/_0x232040:0x0;if(_0x2f322d>=_0x1032f8['minBodyRatio']){const _0x517977=this['_getVolumeRatio'](_0x48e185,_0x5aea88,0x14);if(_0x517977>=_0x1032f8['minVolumeRatio']){const _0x1ee2fa=new SweepEvent(SweepType['LOW_SWEEP'],_0x4cdfcd,_0x5aea88,_0x5aea88,_0x167864['low']);_0x1ee2fa['exitBarIndex']=_0x344941,_0x1ee2fa['penetrationTicks']=_0x57eb26,_0x1ee2fa[_0x7c8711(0x212)]=_0x344941-_0x5aea88,_0x1ee2fa[_0x7c8711(0x26d)]=_0x517977,_0x1ee2fa['qualityScore']=this['_scoreSweep'](_0x1ee2fa,_0x2f322d),_0x1ee2fa['isValid']=_0x1ee2fa['qualityScore']>=_0x1032f8[_0x7c8711(0x21a)];if(_0x1ee2fa[_0x7c8711(0x268)])return _0x1ee2fa;}}}}}}}return null;}[_0x36ddf1(0x242)](_0x2d006d,_0x361cbb,_0x22f879){const _0x20f00d=_0x36ddf1,_0x1f559a=Math[_0x20f00d(0x203)](0x0,_0x361cbb-_0x22f879),_0x2ddc6b=_0x2d006d[_0x20f00d(0x210)](_0x1f559a,_0x361cbb);if(_0x2ddc6b[_0x20f00d(0x241)]===0x0)return 0x1;const _0xdfe7da=_0x2ddc6b[_0x20f00d(0x1f6)](_0x1e5afa=>_0x1e5afa['volume'])[_0x20f00d(0x206)]((_0x422586,_0x48ff7f)=>_0x422586-_0x48ff7f),_0x4cfbe3=Math['floor'](_0xdfe7da[_0x20f00d(0x241)]/0x2),_0xc42bb9=_0xdfe7da[_0x4cfbe3]||0x1;return _0x2d006d[_0x361cbb][_0x20f00d(0x1eb)]/_0xc42bb9;}['_scoreSweep'](_0x1b1637,_0x571dde){const _0x28c084=_0x36ddf1;let _0x53f10c=0x0;const _0x2dd071=0x4,_0x2ff25b=Math['abs'](_0x1b1637['penetrationTicks']-_0x2dd071);return _0x53f10c+=Math['max'](0x0,0.3-_0x2ff25b*0.03),_0x53f10c+=Math['max'](0x0,0.25-_0x1b1637['durationBars']*0.05),_0x53f10c+=Math[_0x28c084(0x225)](0.25,_0x1b1637[_0x28c084(0x26d)]*0.1),_0x53f10c+=Math['min'](0.2,_0x571dde*0.4),Math[_0x28c084(0x225)](0x1,_0x53f10c);}[_0x36ddf1(0x23c)](_0x3d4107,_0x15c0b4,_0xf10647,_0x3d3948){const _0x51db38=_0x36ddf1,_0x306bc5=Date[_0x51db38(0x250)]()-this[_0x51db38(0x240)];if(_0x306bc5<this[_0x51db38(0x1ea)]['execution']['cooldownMs'])return this[_0x51db38(0x1f5)]('log',{'type':'debug','message':_0x51db38(0x245)+(_0x306bc5/0x3e8)[_0x51db38(0x273)](0x1)+'s\x20<\x20'+this[_0x51db38(0x1ea)]['execution']['cooldownMs']/0x3e8+'s)'}),null;const _0x18b075=this['config'][_0x51db38(0x1f3)],_0x37c8c2=_0x15c0b4[_0x51db38(0x228)],_0x18dd03=_0x3d3948['sweepType']===SweepType['HIGH_SWEEP']?'short':'long';let _0x2b23d9,_0x2252c8,_0x3d66f0,_0x38d382;_0x18dd03===_0x51db38(0x266)?(_0x2b23d9=_0x37c8c2-_0x18b075['stopTicks']*this['tickSize'],_0x2252c8=_0x37c8c2+_0x18b075['targetTicks']*this[_0x51db38(0x1ff)],_0x3d66f0=_0x37c8c2+_0x18b075[_0x51db38(0x267)]*this[_0x51db38(0x1ff)],_0x38d382=_0x37c8c2+_0x18b075['trailTriggerTicks']*this['tickSize']):(_0x2b23d9=_0x37c8c2+_0x18b075[_0x51db38(0x216)]*this[_0x51db38(0x1ff)],_0x2252c8=_0x37c8c2-_0x18b075[_0x51db38(0x23e)]*this['tickSize'],_0x3d66f0=_0x37c8c2-_0x18b075['breakevenTicks']*this['tickSize'],_0x38d382=_0x37c8c2-_0x18b075['trailTriggerTicks']*this['tickSize']);const _0x373efb=_0x18b075['targetTicks']/_0x18b075[_0x51db38(0x216)],_0x5d887b=Math['min'](0x1,_0x3d3948['qualityScore']*0.5+_0x3d3948[_0x51db38(0x272)]['qualityScore']*0.3+(_0x3d3948[_0x51db38(0x26d)]>1.5?0.2:_0x3d3948['volumeRatio']*0.1));let _0x3aafda=SignalStrength[_0x51db38(0x205)];if(_0x5d887b>=0.8)_0x3aafda=SignalStrength[_0x51db38(0x222)];else{if(_0x5d887b>=0.65)_0x3aafda=SignalStrength[_0x51db38(0x1e0)];else{if(_0x5d887b<0.5)_0x3aafda=SignalStrength[_0x51db38(0x217)];}}const _0x1d5804=0.5+(_0x5d887b-0.5)*0.4,_0x4efbca=_0x1d5804*Math['abs'](_0x2252c8-_0x37c8c2)-(0x1-_0x1d5804)*Math['abs'](_0x37c8c2-_0x2b23d9);_0x3d3948['zone'][_0x51db38(0x231)]=_0xf10647,_0x3d3948['zone']['swept']=!![],_0x3d3948[_0x51db38(0x272)]['sweptAt']=new Date(_0x15c0b4['timestamp']),this[_0x51db38(0x240)]=Date[_0x51db38(0x250)](),this[_0x51db38(0x20e)]['signals']++;const _0x2b2417={'id':uuidv4(),'timestamp':Date[_0x51db38(0x250)](),'symbol':_0x3d4107['split']('.')[0x0]||_0x3d4107,'contractId':_0x3d4107,'side':_0x18dd03===_0x51db38(0x266)?OrderSide['BID']:OrderSide['ASK'],'direction':_0x18dd03,'strategy':_0x51db38(0x275),'strength':_0x3aafda,'edge':_0x4efbca,'confidence':_0x5d887b,'entry':_0x37c8c2,'entryPrice':_0x37c8c2,'stopLoss':_0x2b23d9,'takeProfit':_0x2252c8,'riskReward':_0x373efb,'stopTicks':_0x18b075[_0x51db38(0x216)],'targetTicks':_0x18b075['targetTicks'],'breakevenTicks':_0x18b075[_0x51db38(0x267)],'trailTriggerTicks':_0x18b075['trailTriggerTicks'],'trailDistanceTicks':_0x18b075['trailDistanceTicks'],'beLevel':_0x3d66f0,'trailTrigger':_0x38d382,'sweepType':_0x3d3948['sweepType'],'penetrationTicks':_0x3d3948['penetrationTicks'],'sweepDurationBars':_0x3d3948[_0x51db38(0x212)],'sweepQuality':_0x3d3948['qualityScore'],'volumeRatio':_0x3d3948[_0x51db38(0x26d)],'zoneType':_0x3d3948[_0x51db38(0x272)]['type'],'zoneLevel':_0x3d3948[_0x51db38(0x272)]['getLevel'](),'zoneTouches':_0x3d3948['zone']['touches'],'zoneQuality':_0x3d3948[_0x51db38(0x272)][_0x51db38(0x23d)],'expires':Date[_0x51db38(0x250)]()+0xea60};return this[_0x51db38(0x1f5)](_0x51db38(0x23b),{'side':_0x18dd03==='long'?'buy':'sell','action':'open','reason':_0x51db38(0x254)+_0x3d3948[_0x51db38(0x234)]+_0x51db38(0x27b)+_0x3d3948['penetrationTicks'][_0x51db38(0x273)](0x1)+'t\x20|\x20Vol:'+_0x3d3948[_0x51db38(0x26d)][_0x51db38(0x273)](0x1)+_0x51db38(0x226)+(_0x3d3948[_0x51db38(0x23d)]*0x64)['toFixed'](0x0)+'%',..._0x2b2417}),this['emit']('log',{'type':'info','message':_0x51db38(0x271)+_0x18dd03['toUpperCase']()+_0x51db38(0x223)+_0x37c8c2[_0x51db38(0x273)](0x2)+_0x51db38(0x235)+_0x3d3948['sweepType']+_0x51db38(0x27b)+_0x3d3948[_0x51db38(0x201)]['toFixed'](0x1)+'t\x20Vol:'+_0x3d3948[_0x51db38(0x26d)][_0x51db38(0x273)](0x1)+_0x51db38(0x20c)+(_0x5d887b*0x64)[_0x51db38(0x273)](0x0)+'%'}),_0x2b2417;}['getAnalysisState'](_0x420729,_0x276313){const _0x1aae9c=_0x36ddf1,_0x5dc236=this[_0x1aae9c(0x260)]['get'](_0x420729)||[],_0x2989d8=this['liquidityZones']['get'](_0x420729)||[],_0x189868=this['swingPoints']['get'](_0x420729)||[];if(_0x5dc236['length']<0x5)return{'ready':![],'message':_0x1aae9c(0x20b)+_0x5dc236[_0x1aae9c(0x241)]+_0x1aae9c(0x253)};const _0x56d7cb=_0x2989d8['map'](_0x1ee02c=>({'zone':_0x1ee02c,'distance':Math['abs'](_0x276313-_0x1ee02c['getLevel']())}))['sort']((_0x46d4a9,_0x3b4c6e)=>_0x46d4a9['distance']-_0x3b4c6e[_0x1aae9c(0x26c)]),_0x43f4f3=_0x56d7cb[_0x1aae9c(0x20a)](_0x527ae9=>_0x527ae9[_0x1aae9c(0x272)][_0x1aae9c(0x22a)]===ZoneType[_0x1aae9c(0x244)]),_0x23124d=_0x56d7cb[_0x1aae9c(0x20a)](_0x19cecd=>_0x19cecd[_0x1aae9c(0x272)][_0x1aae9c(0x22a)]===ZoneType[_0x1aae9c(0x1e4)]);return{'ready':!![],'barsProcessed':_0x5dc236[_0x1aae9c(0x241)],'swingsDetected':_0x189868['length'],'activeZones':_0x2989d8[_0x1aae9c(0x241)],'nearestResistance':_0x43f4f3?_0x43f4f3[_0x1aae9c(0x272)]['getLevel']():null,'nearestSupport':_0x23124d?_0x23124d['zone'][_0x1aae9c(0x255)]():null,'stopTicks':this['config']['execution']['stopTicks'],'targetTicks':this['config']['execution']['targetTicks'],'strategy':'HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)'};}['recordTradeResult'](_0x4ed9d5){const _0x1a4eb4=_0x36ddf1;this['recentTrades'][_0x1a4eb4(0x1df)]({'netPnl':_0x4ed9d5,'timestamp':Date[_0x1a4eb4(0x250)]()});if(this['recentTrades'][_0x1a4eb4(0x241)]>0x64)this['recentTrades']['shift']();_0x4ed9d5>0x0?this[_0x1a4eb4(0x20e)]['wins']++:this[_0x1a4eb4(0x20e)][_0x1a4eb4(0x256)]++,this['stats']['trades']++,this[_0x1a4eb4(0x20e)][_0x1a4eb4(0x24c)]+=_0x4ed9d5,this[_0x1a4eb4(0x1f5)]('log',{'type':'debug','message':_0x1a4eb4(0x243)+(_0x4ed9d5>0x0?'WIN':_0x1a4eb4(0x1e2))+'\x20$'+_0x4ed9d5['toFixed'](0x2)});}['getBarHistory'](_0x513644){const _0x52eb9d=_0x36ddf1;return this[_0x52eb9d(0x260)][_0x52eb9d(0x1ec)](_0x513644)||[];}[_0x36ddf1(0x25c)](){return this['stats'];}[_0x36ddf1(0x20f)](_0x4f81ae){const _0x58b3ff=_0x36ddf1,_0xd5b309=this[_0x58b3ff(0x260)][_0x58b3ff(0x1ec)](_0x4f81ae)||[],_0x31b166=this['liquidityZones']['get'](_0x4f81ae)||[],_0x4b0f99=this['swingPoints']['get'](_0x4f81ae)||[],_0x1dec20=this[_0x58b3ff(0x227)][_0x58b3ff(0x1ec)](_0x4f81ae),_0x427ec4=_0xd5b309[_0xd5b309[_0x58b3ff(0x241)]-0x1],_0x4751fd=_0x427ec4?Date[_0x58b3ff(0x250)]()-_0x427ec4[_0x58b3ff(0x24a)]:null,_0x5a043d=_0x31b166[_0x58b3ff(0x221)](_0x470244=>_0x470244[_0x58b3ff(0x22a)]===ZoneType['RESISTANCE'])['length'],_0x4f8cea=_0x31b166[_0x58b3ff(0x221)](_0x7b171=>_0x7b171['type']===ZoneType[_0x58b3ff(0x1e4)])[_0x58b3ff(0x241)];return{'healthy':_0xd5b309['length']>=0x5,'barsTotal':_0xd5b309['length'],'barsLast5Min':_0xd5b309[_0x58b3ff(0x221)](_0x3778a0=>Date['now']()-_0x3778a0[_0x58b3ff(0x24a)]<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x4b0f99['length'],'zonesResistance':_0x5a043d,'zonesSupport':_0x4f8cea,'zonesTotal':_0x31b166[_0x58b3ff(0x241)],'currentBarTicks':_0x1dec20?_0x1dec20[_0x58b3ff(0x264)]:0x0,'isAggregating':_0x1dec20&&_0x1dec20['tickCount']>0x0,'timeSinceLastBarMs':_0x4751fd,'lastSignalTime':this[_0x58b3ff(0x240)],'signalCooldownMs':this['config']['execution'][_0x58b3ff(0x20d)],'uptime':Date['now']()-(this['startTime']||Date['now']())};}['reset'](_0x41f9dd){const _0x117fe9=_0x36ddf1;this[_0x117fe9(0x260)][_0x117fe9(0x259)](_0x41f9dd,[]),this['swingPoints']['set'](_0x41f9dd,[]),this['liquidityZones'][_0x117fe9(0x259)](_0x41f9dd,[]),this['activeSweeps']['set'](_0x41f9dd,[]),this[_0x117fe9(0x227)][_0x117fe9(0x22e)](_0x41f9dd),this[_0x117fe9(0x1f5)](_0x117fe9(0x22c),{'type':'info','message':_0x117fe9(0x1fc)+_0x41f9dd});}[_0x36ddf1(0x1f7)](_0x5cd986,_0x5ecb4e){const _0x5eb30b=_0x36ddf1;if(!_0x5ecb4e||_0x5ecb4e[_0x5eb30b(0x241)]===0x0){this[_0x5eb30b(0x1f5)](_0x5eb30b(0x22c),{'type':'debug','message':_0x5eb30b(0x215)});return;}!this[_0x5eb30b(0x260)][_0x5eb30b(0x22d)](_0x5cd986)&&this['initialize'](_0x5cd986);const _0x2f49df=[..._0x5ecb4e]['sort']((_0x3d791d,_0x88c9ea)=>_0x3d791d[_0x5eb30b(0x24a)]-_0x88c9ea[_0x5eb30b(0x24a)]);this[_0x5eb30b(0x1f5)]('log',{'type':_0x5eb30b(0x265),'message':'[HQX-2B]\x20Preloading\x20'+_0x2f49df['length']+'\x20historical\x20bars...'});let _0x14ee06=0x0;for(const _0x32107e of _0x2f49df){const _0x255aa5=this['processBar'](_0x5cd986,_0x32107e);if(_0x255aa5)_0x14ee06++;}const _0x2e26fd=this[_0x5eb30b(0x260)]['get'](_0x5cd986)||[],_0x4a2ec1=this[_0x5eb30b(0x251)][_0x5eb30b(0x1ec)](_0x5cd986)||[],_0x33c17c=this[_0x5eb30b(0x1f8)][_0x5eb30b(0x1ec)](_0x5cd986)||[];this[_0x5eb30b(0x1f5)](_0x5eb30b(0x22c),{'type':_0x5eb30b(0x265),'message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x2e26fd[_0x5eb30b(0x241)]+_0x5eb30b(0x257)+_0x4a2ec1['length']+'\x20swings,\x20'+_0x33c17c[_0x5eb30b(0x241)]+'\x20zones'}),_0x14ee06>0x0&&this['emit']('log',{'type':_0x5eb30b(0x220),'message':_0x5eb30b(0x25d)+_0x14ee06+_0x5eb30b(0x1ef)}),this[_0x5eb30b(0x240)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x97e940={}){const _0x1b5dc5=_0x36ddf1;super(),this[_0x1b5dc5(0x1ea)]=_0x97e940,this['strategy']=new HQX2BLiquiditySweep(_0x97e940),this[_0x1b5dc5(0x233)]['on']('signal',_0x1d8d38=>this[_0x1b5dc5(0x1f5)](_0x1b5dc5(0x23b),_0x1d8d38)),this['strategy']['on']('log',_0x12076c=>this[_0x1b5dc5(0x1f5)]('log',_0x12076c));}['processTick'](_0x508e60){const _0x28d934=_0x36ddf1;return this[_0x28d934(0x233)][_0x28d934(0x1fd)](_0x508e60);}[_0x36ddf1(0x22f)](_0x3ade14){const _0x950acd=_0x36ddf1;return this['strategy'][_0x950acd(0x22f)](_0x3ade14);}[_0x36ddf1(0x224)](_0x5c3cfb){const _0x471ed1=_0x36ddf1;return this[_0x471ed1(0x233)]['onTrade'](_0x5c3cfb);}[_0x36ddf1(0x25a)](_0x1d97ab,_0x23a447){const _0x5d85a5=_0x36ddf1;return this[_0x5d85a5(0x233)]['processBar'](_0x1d97ab,_0x23a447);}[_0x36ddf1(0x219)](_0x1a9ad6,_0x59d07b,_0x41d268){const _0x2eb6b4=_0x36ddf1;return this[_0x2eb6b4(0x233)][_0x2eb6b4(0x219)](_0x1a9ad6,_0x59d07b,_0x41d268);}['getAnalysisState'](_0x3a0dbb,_0x373dbb){const _0x30b2d5=_0x36ddf1;return this[_0x30b2d5(0x233)][_0x30b2d5(0x21b)](_0x3a0dbb,_0x373dbb);}['recordTradeResult'](_0x500053){const _0x37b72b=_0x36ddf1;return this['strategy'][_0x37b72b(0x26b)](_0x500053);}[_0x36ddf1(0x27a)](_0x54fb20){const _0x294bb6=_0x36ddf1;return this[_0x294bb6(0x233)][_0x294bb6(0x27a)](_0x54fb20);}['getStats'](){const _0x4f7afc=_0x36ddf1;return this['strategy'][_0x4f7afc(0x25c)]();}['getBarHistory'](_0x2cfd7d){return this['strategy']['getBarHistory'](_0x2cfd7d);}[_0x36ddf1(0x1f7)](_0x2f1a9a,_0x316a0b){return this['strategy']['preloadBars'](_0x2f1a9a,_0x316a0b);}['getHealthStatus'](_0x5441d6){const _0x1b6e7c=_0x36ddf1;return this[_0x1b6e7c(0x233)]['getHealthStatus'](_0x5441d6);}[_0x36ddf1(0x1e8)](_0x41baeb){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 _0x325534=_0x308d;function _0x458a(){const _0x135827=['trailTriggerTicks','volume','LOW_SWEEP','strength','type','[HQX-2B]\x20Params:\x20Stop=','onTrade','lastSignalTime','emit','breakevenTicks','toUpperCase','now','\x20historical\x20bars...','MODERATE','getTimezoneOffset','[HQX-2B]\x20Trade\x20result:\x20','80PoUNPP','symbol','priceHigh','VERY_STRONG','_getVolumeRatio','initialize','high','short','LOSS','_scoreSweep','stopTicks','[2B]\x20NEW\x20SWING\x20','getLevel','strategy','isWithinSession','maxDurationBars','getStats','onTick','open','1786hzXrvl','t,\x20Target=','barHistory','sweepType','barIndex','100oidmXU','toFixed','maxPenetrationTicks','clusterToleranceTicks','losses','delete','minBodyRatio','_updateZones','config','Collecting\x20data...\x20','t\x20|\x20Q:\x20','getAnalysisState','swing','processTick','max','isValid','set','isDST','activeSweeps','filter','getBarHistory','containsPrice','swingPoints','min','2172291QAHcXe','\x20bars,\x20','1563426waWEEZ','price','extremePrice','push','map','info','\x20historical\x20signals\x20detected\x20(ignored)','getHealthStatus','RESISTANCE','distance','events','[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20(','get','length','debug','\x20swings,\x20','trailDistanceTicks','SUPPORT','durationBars','\x20|\x20Total:\x20','size','\x20|\x20Pen:','exports','recentTrades','lastUsedBarIndex','minPenetrationTicks','has','createdAt','714aydevi','3701248hltWzf','\x20@\x20','qualityScore','stats','[HQX-2B]\x20','\x20closed\x20@\x20','getFullYear','exitBarIndex','penetrationTicks','x\x20|\x20Conf:','enabled','reset','\x20|\x20O:','[BAR]\x20#','timestamp','7667244fpRZbM',',\x20TF=1min','cooldownMs','currentBar','buy','entryBarIndex','execution','111235MXKzJW','[HQX-2B]\x20Initialized\x20for\x20','barIntervalMs','liquidityZones','log','low','_mergeConfig','\x20zones','minStrength','43590wUbTks','HIGH_SWEEP','split','preloadBars','562LuBumE','zone','\x20|\x20Pen:\x20','isArray','tickValue','swept','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','sort','shift','abs','\x20Vol:','startTime','_tickCount','targetTicks','session','splice','\x20|\x20Valid:\x20','close','recordTradeResult','tickSize','minVolumeRatio','contractId','\x20|\x20H:','long','signal','t,\x20Trail=','priceLow','\x20|\x20Bar\x20','processBar','\x20|\x20',',\x20value=','volumeRatio'];_0x458a=function(){return _0x135827;};return _0x458a();}(function(_0x4cba4c,_0x5bafd1){const _0x20086d=_0x308d,_0xae3ec0=_0x4cba4c();while(!![]){try{const _0x39a617=parseInt(_0x20086d(0xf5))/0x1*(parseInt(_0x20086d(0xb2))/0x2)+parseInt(_0x20086d(0x114))/0x3+parseInt(_0x20086d(0xe2))/0x4*(parseInt(_0x20086d(0xa5))/0x5)+-parseInt(_0x20086d(0xae))/0x6*(-parseInt(_0x20086d(0x130))/0x7)+-parseInt(_0x20086d(0x131))/0x8+parseInt(_0x20086d(0x9e))/0x9+parseInt(_0x20086d(0xfa))/0xa*(-parseInt(_0x20086d(0x112))/0xb);if(_0x39a617===_0x5bafd1)break;else _0xae3ec0['push'](_0xae3ec0['shift']());}catch(_0x5d7031){_0xae3ec0['push'](_0xae3ec0['shift']());}}}(_0x458a,0x98344));function _0x308d(_0x1d34d0,_0x3ce471){_0x1d34d0=_0x1d34d0-0x98;const _0x458ad8=_0x458a();let _0x308dc4=_0x458ad8[_0x1d34d0];return _0x308dc4;}const EventEmitter=require(_0x325534(0x11e)),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x325534(0xe8),'LOW_SWEEP':_0x325534(0xaa)},ZoneType={'RESISTANCE':'resistance','SUPPORT':'support'},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x2,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x6,'minTouches':0x1,'maxZoneAgeBars':0xc8,'maxZoneDistanceTicks':0x3c,'cooldownBars':0x5},'sweep':{'minPenetrationTicks':0.25,'maxPenetrationTicks':0xc,'maxDurationBars':0x3,'minQualityScore':0.15,'minVolumeRatio':0.3,'minBodyRatio':0.05},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x2710,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':'America/New_York'}};class SwingPoint{constructor(_0x209a3a,_0x10be40,_0x4e3471,_0x278125,_0x73c79f=0x1){const _0xcada4c=_0x325534;this['type']=_0x209a3a,this['price']=_0x10be40,this[_0xcada4c(0xf9)]=_0x4e3471,this['timestamp']=_0x278125,this['strength']=_0x73c79f;}}class LiquidityZone{constructor(_0x22bc94,_0x4d8634,_0x5ca1c5,_0x1b646b,_0x4eeedf){const _0x270b3e=_0x325534;this['id']=uuidv4(),this[_0x270b3e(0xd6)]=_0x22bc94,this['priceHigh']=_0x4d8634,this['priceLow']=_0x5ca1c5,this[_0x270b3e(0x12f)]=_0x1b646b,this[_0x270b3e(0xf9)]=_0x4eeedf,this['touches']=0x1,this[_0x270b3e(0xb7)]=![],this['sweptAt']=null,this['lastUsedBarIndex']=-0x3e7,this['qualityScore']=0.5;}['containsPrice'](_0x321fd9,_0x39d734,_0x1baff3){const _0x234d0e=_0x39d734*_0x1baff3;return _0x321fd9>=this['priceLow']-_0x234d0e&&_0x321fd9<=this['priceHigh']+_0x234d0e;}['getLevel'](){const _0x419978=_0x325534;return(this['priceHigh']+this[_0x419978(0xcc)])/0x2;}}class SweepEvent{constructor(_0x5a946e,_0xe6d476,_0x40b2e1,_0x1f7ada,_0x301a65){const _0x5a8e6b=_0x325534;this[_0x5a8e6b(0xf8)]=_0x5a946e,this[_0x5a8e6b(0xb3)]=_0xe6d476,this[_0x5a8e6b(0xa3)]=_0x40b2e1,this['extremeBarIndex']=_0x1f7ada,this[_0x5a8e6b(0x116)]=_0x301a65,this[_0x5a8e6b(0x138)]=null,this[_0x5a8e6b(0x109)]=![],this[_0x5a8e6b(0x133)]=0x0,this[_0x5a8e6b(0x139)]=0x0,this['durationBars']=0x0,this[_0x5a8e6b(0xd1)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x4e18be={}){const _0x235b93=_0x325534;super(),this['config']=this[_0x235b93(0xab)](DEFAULT_CONFIG,_0x4e18be),this[_0x235b93(0xc5)]=this[_0x235b93(0x102)][_0x235b93(0xc5)],this[_0x235b93(0xb6)]=this['config']['tickValue'],this[_0x235b93(0xf7)]=new Map(),this['swingPoints']=new Map(),this[_0x235b93(0xa8)]=new Map(),this[_0x235b93(0x10c)]=new Map(),this['currentBar']=new Map(),this[_0x235b93(0xa7)]=0xea60,this[_0x235b93(0xd9)]=0x0,this[_0x235b93(0xbd)]=Date['now'](),this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x235b93(0x12b)]=[];}[_0x325534(0xab)](_0x192878,_0x25f1c3){const _0x2fdb05=_0x325534,_0x4822e3={..._0x192878};for(const _0xa346f3 in _0x25f1c3){typeof _0x25f1c3[_0xa346f3]==='object'&&!Array[_0x2fdb05(0xb5)](_0x25f1c3[_0xa346f3])?_0x4822e3[_0xa346f3]={..._0x192878[_0xa346f3],..._0x25f1c3[_0xa346f3]}:_0x4822e3[_0xa346f3]=_0x25f1c3[_0xa346f3];}return _0x4822e3;}[_0x325534(0xf0)](_0x2eba64){const _0x1de0bb=_0x325534;if(!this[_0x1de0bb(0x102)][_0x1de0bb(0xc0)][_0x1de0bb(0x99)])return!![];const _0x399bb1=new Date(_0x2eba64),_0x3189d9=this[_0x1de0bb(0x10b)](_0x399bb1)?-0x4:-0x5,_0x153277=_0x399bb1['getUTCHours'](),_0x21b0d4=_0x399bb1['getUTCMinutes'](),_0x3c2f63=(_0x153277+_0x3189d9+0x18)%0x18,{startHour:_0x2aebdb,startMinute:_0x40ef55,endHour:_0x2ca589,endMinute:_0x5559c4}=this['config']['session'],_0x4e0185=_0x3c2f63*0x3c+_0x21b0d4,_0x151b5a=_0x2aebdb*0x3c+_0x40ef55,_0x2396eb=_0x2ca589*0x3c+_0x5559c4;return _0x4e0185>=_0x151b5a&&_0x4e0185<_0x2396eb;}[_0x325534(0x10b)](_0x205910){const _0x3e44d4=_0x325534,_0x5361b4=new Date(_0x205910[_0x3e44d4(0x137)](),0x0,0x1),_0x46c4f2=new Date(_0x205910['getFullYear'](),0x6,0x1),_0x1cff37=Math[_0x3e44d4(0x108)](_0x5361b4[_0x3e44d4(0xe0)](),_0x46c4f2[_0x3e44d4(0xe0)]());return _0x205910[_0x3e44d4(0xe0)]()<_0x1cff37;}['initialize'](_0x6ed6fd,_0x4df0ea=0.25,_0x2d172a=0x5){const _0x1b4635=_0x325534;this[_0x1b4635(0xc5)]=_0x4df0ea,this[_0x1b4635(0xb6)]=_0x2d172a,this['config'][_0x1b4635(0xc5)]=_0x4df0ea,this['config'][_0x1b4635(0xb6)]=_0x2d172a,this[_0x1b4635(0xf7)]['set'](_0x6ed6fd,[]),this[_0x1b4635(0x110)]['set'](_0x6ed6fd,[]),this['liquidityZones'][_0x1b4635(0x10a)](_0x6ed6fd,[]),this['activeSweeps']['set'](_0x6ed6fd,[]),this[_0x1b4635(0xa1)]['delete'](_0x6ed6fd),this[_0x1b4635(0xda)](_0x1b4635(0xa9),{'type':'info','message':_0x1b4635(0xa6)+_0x6ed6fd+':\x20tick='+_0x4df0ea+_0x1b4635(0xd0)+_0x2d172a+_0x1b4635(0x9f)}),this[_0x1b4635(0xda)](_0x1b4635(0xa9),{'type':'info','message':_0x1b4635(0xd7)+this['config'][_0x1b4635(0xa4)][_0x1b4635(0xec)]+_0x1b4635(0xf6)+this['config'][_0x1b4635(0xa4)]['targetTicks']+'t,\x20BE='+this['config']['execution']['breakevenTicks']+_0x1b4635(0xcb)+this['config'][_0x1b4635(0xa4)]['trailTriggerTicks']+'/'+this[_0x1b4635(0x102)][_0x1b4635(0xa4)][_0x1b4635(0x124)]});}[_0x325534(0x107)](_0x4691a0){const _0x32c57d=_0x325534,{contractId:_0x1edd94,price:_0x403520,volume:_0x5cde77,timestamp:_0x166e80}=_0x4691a0,_0x39f8c0=_0x166e80||Date[_0x32c57d(0xdd)](),_0x3e7178=_0x5cde77||0x1;if(!this['isWithinSession'](_0x39f8c0))return null;if(!this[_0x32c57d(0xbe)])this[_0x32c57d(0xbe)]=0x0;this[_0x32c57d(0xbe)]++;let _0xd983d7=this['currentBar'][_0x32c57d(0x120)](_0x1edd94);const _0x364715=Math['floor'](_0x39f8c0/this[_0x32c57d(0xa7)])*this['barIntervalMs'];if(!_0xd983d7||_0xd983d7['startTime']!==_0x364715){if(_0xd983d7){const _0x33d8ce={'timestamp':_0xd983d7[_0x32c57d(0xbd)],'open':_0xd983d7[_0x32c57d(0xf4)],'high':_0xd983d7['high'],'low':_0xd983d7[_0x32c57d(0xaa)],'close':_0xd983d7[_0x32c57d(0xc3)],'volume':_0xd983d7[_0x32c57d(0xd3)]},_0x22e17e=this['barHistory']['get'](_0x1edd94)||[];this[_0x32c57d(0xda)](_0x32c57d(0xa9),{'type':_0x32c57d(0x122),'message':_0x32c57d(0x9c)+(_0x22e17e[_0x32c57d(0x121)]+0x1)+_0x32c57d(0x136)+_0x33d8ce[_0x32c57d(0xc3)][_0x32c57d(0xfb)](0x2)+_0x32c57d(0x9b)+_0x33d8ce['open'][_0x32c57d(0xfb)](0x2)+'\x20H:'+_0x33d8ce['high'][_0x32c57d(0xfb)](0x2)+'\x20L:'+_0x33d8ce[_0x32c57d(0xaa)][_0x32c57d(0xfb)](0x2)+_0x32c57d(0xbc)+_0x33d8ce['volume']});const _0x240546=this['processBar'](_0x1edd94,_0x33d8ce);return this['currentBar'][_0x32c57d(0x10a)](_0x1edd94,{'startTime':_0x364715,'open':_0x403520,'high':_0x403520,'low':_0x403520,'close':_0x403520,'volume':_0x3e7178}),_0x240546;}else return this[_0x32c57d(0xa1)][_0x32c57d(0x10a)](_0x1edd94,{'startTime':_0x364715,'open':_0x403520,'high':_0x403520,'low':_0x403520,'close':_0x403520,'volume':_0x3e7178}),null;}else return _0xd983d7[_0x32c57d(0xe8)]=Math[_0x32c57d(0x108)](_0xd983d7['high'],_0x403520),_0xd983d7['low']=Math['min'](_0xd983d7[_0x32c57d(0xaa)],_0x403520),_0xd983d7[_0x32c57d(0xc3)]=_0x403520,_0xd983d7[_0x32c57d(0xd3)]+=_0x3e7178,null;}[_0x325534(0xf3)](_0x4fc6a7){const _0x3bfe5e=_0x325534;return this[_0x3bfe5e(0x107)](_0x4fc6a7);}[_0x325534(0xd8)](_0x5c5ae3){const _0x6d103=_0x325534;return this[_0x6d103(0x107)]({'contractId':_0x5c5ae3[_0x6d103(0xc7)]||_0x5c5ae3[_0x6d103(0xe3)],'price':_0x5c5ae3['price'],'volume':_0x5c5ae3[_0x6d103(0x128)]||_0x5c5ae3[_0x6d103(0xd3)]||0x1,'timestamp':_0x5c5ae3['timestamp']||Date['now']()});}['processBar'](_0x36d1d9,_0x81c06c){const _0x4b3ecf=_0x325534;let _0x2552b6=this['barHistory'][_0x4b3ecf(0x120)](_0x36d1d9);!_0x2552b6&&(this[_0x4b3ecf(0xe7)](_0x36d1d9),_0x2552b6=this[_0x4b3ecf(0xf7)][_0x4b3ecf(0x120)](_0x36d1d9));_0x2552b6[_0x4b3ecf(0x117)](_0x81c06c);if(_0x2552b6[_0x4b3ecf(0x121)]>0x1f4)_0x2552b6[_0x4b3ecf(0xba)]();const _0x28f329=_0x2552b6['length']-0x1;if(_0x2552b6[_0x4b3ecf(0x121)]<this[_0x4b3ecf(0x102)][_0x4b3ecf(0x106)]['lookbackBars']*0x3)return null;const _0x19678d=this['swingPoints'][_0x4b3ecf(0x120)](_0x36d1d9)[_0x4b3ecf(0x121)];this['_detectSwings'](_0x36d1d9,_0x2552b6,_0x28f329);const _0x140e76=this['swingPoints']['get'](_0x36d1d9);if(_0x140e76['length']>_0x19678d){const _0x482760=_0x140e76[_0x140e76['length']-0x1];this['emit']('log',{'type':'debug','message':_0x4b3ecf(0xed)+_0x482760[_0x4b3ecf(0xd6)]['toUpperCase']()+_0x4b3ecf(0x132)+_0x482760[_0x4b3ecf(0x115)][_0x4b3ecf(0xfb)](0x2)+_0x4b3ecf(0x127)+_0x140e76['length']});}const _0x134d9b=this['_detectSweep'](_0x36d1d9,_0x2552b6,_0x28f329);_0x134d9b&&this['emit'](_0x4b3ecf(0xa9),{'type':'debug','message':'[2B]\x20SWEEP\x20'+_0x134d9b['sweepType']+_0x4b3ecf(0xc2)+_0x134d9b[_0x4b3ecf(0x109)]+_0x4b3ecf(0xb4)+_0x134d9b[_0x4b3ecf(0x139)]['toFixed'](0x1)+_0x4b3ecf(0x104)+(_0x134d9b[_0x4b3ecf(0x133)]*0x64)['toFixed'](0x0)+'%'});const _0x142917=this[_0x4b3ecf(0xa8)]['get'](_0x36d1d9)[_0x4b3ecf(0x121)];this[_0x4b3ecf(0x101)](_0x36d1d9,_0x28f329);const _0x2b00ad=this['liquidityZones']['get'](_0x36d1d9);if(_0x2b00ad['length']>_0x142917){const _0x5d62ad=_0x2b00ad[_0x2b00ad[_0x4b3ecf(0x121)]-0x1];this[_0x4b3ecf(0xda)](_0x4b3ecf(0xa9),{'type':_0x4b3ecf(0x122),'message':'[2B]\x20NEW\x20ZONE\x20'+_0x5d62ad[_0x4b3ecf(0xd6)][_0x4b3ecf(0xdc)]()+'\x20@\x20'+_0x5d62ad[_0x4b3ecf(0xee)]()['toFixed'](0x2)+'\x20|\x20Total:\x20'+_0x2b00ad[_0x4b3ecf(0x121)]});}if(_0x134d9b&&_0x134d9b[_0x4b3ecf(0x109)]){this['emit']('log',{'type':'debug','message':'[2B]\x20Calling\x20_generateSignal\x20for\x20'+_0x134d9b[_0x4b3ecf(0xf8)]+'\x20sweep...'});const _0x460a38=this['_generateSignal'](_0x36d1d9,_0x81c06c,_0x28f329,_0x134d9b);return!_0x460a38&&this[_0x4b3ecf(0xda)](_0x4b3ecf(0xa9),{'type':'debug','message':'[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)'}),_0x460a38;}return null;}['_detectSwings'](_0x3352dd,_0x4352e6,_0x261c82){const _0xa27a06=_0x325534,_0x4b1004=this['config'][_0xa27a06(0x106)]['lookbackBars'],_0x1c182f=this['config'][_0xa27a06(0x106)][_0xa27a06(0xad)];if(_0x261c82<_0x4b1004*0x2)return;const _0x2b8d73=this[_0xa27a06(0x110)]['get'](_0x3352dd),_0x813756=_0x261c82-_0x4b1004,_0x47d72f=_0x4352e6[_0x813756];_0x261c82%0x5===0x0&&this[_0xa27a06(0xda)]('log',{'type':_0xa27a06(0x122),'message':'[SWING]\x20Checking\x20pivot\x20at\x20bar\x20'+_0x813756+_0xa27a06(0xc8)+_0x47d72f['high']['toFixed'](0x2)+'\x20L:'+_0x47d72f[_0xa27a06(0xaa)][_0xa27a06(0xfb)](0x2)+'\x20|\x20Total\x20swings:\x20'+_0x2b8d73['length']});let _0xd121b6=!![],_0x25dfa4=0x0;for(let _0x53f5ac=_0x813756-_0x4b1004;_0x53f5ac<=_0x813756+_0x4b1004;_0x53f5ac++){if(_0x53f5ac===_0x813756||_0x53f5ac<0x0||_0x53f5ac>=_0x4352e6['length'])continue;if(_0x4352e6[_0x53f5ac][_0xa27a06(0xe8)]>=_0x47d72f[_0xa27a06(0xe8)]){_0xd121b6=![];break;}_0x25dfa4++;}if(_0xd121b6&&_0x25dfa4>=_0x1c182f){const _0x1c82b0=_0x2b8d73['find'](_0xa3381a=>_0xa3381a[_0xa27a06(0xf9)]===_0x813756&&_0xa3381a['type']===_0xa27a06(0xe8));!_0x1c82b0&&(_0x2b8d73['push'](new SwingPoint('high',_0x47d72f['high'],_0x813756,_0x47d72f['timestamp'],_0x25dfa4)),this[_0xa27a06(0xda)](_0xa27a06(0xa9),{'type':_0xa27a06(0x122),'message':'[SWING]\x20NEW\x20HIGH\x20@\x20'+_0x47d72f['high'][_0xa27a06(0xfb)](0x2)+_0xa27a06(0xcd)+_0x813756+'\x20|\x20Strength:\x20'+_0x25dfa4}));}let _0x4091c8=!![],_0x4ccdf6=0x0;for(let _0x5b6490=_0x813756-_0x4b1004;_0x5b6490<=_0x813756+_0x4b1004;_0x5b6490++){if(_0x5b6490===_0x813756||_0x5b6490<0x0||_0x5b6490>=_0x4352e6['length'])continue;if(_0x4352e6[_0x5b6490]['low']<=_0x47d72f['low']){_0x4091c8=![];break;}_0x4ccdf6++;}if(_0x4091c8&&_0x4ccdf6>=_0x1c182f){const _0x4e1bbc=_0x2b8d73['find'](_0x165c6a=>_0x165c6a['barIndex']===_0x813756&&_0x165c6a[_0xa27a06(0xd6)]==='low');!_0x4e1bbc&&(_0x2b8d73['push'](new SwingPoint(_0xa27a06(0xaa),_0x47d72f['low'],_0x813756,_0x47d72f['timestamp'],_0x4ccdf6)),this['emit'](_0xa27a06(0xa9),{'type':'debug','message':'[SWING]\x20NEW\x20LOW\x20@\x20'+_0x47d72f['low']['toFixed'](0x2)+'\x20|\x20Bar\x20'+_0x813756+'\x20|\x20Strength:\x20'+_0x4ccdf6}));}const _0x402858=this['config']['zone']['maxZoneAgeBars'];while(_0x2b8d73['length']>0x0&&_0x2b8d73[0x0][_0xa27a06(0xf9)]<_0x261c82-_0x402858){_0x2b8d73['shift']();}}[_0x325534(0x101)](_0x149871,_0x2fcdaa){const _0x34673f=_0x325534,_0x2cc478=this['swingPoints'][_0x34673f(0x120)](_0x149871),_0x267f93=this['liquidityZones'][_0x34673f(0x120)](_0x149871),_0x43f227=this[_0x34673f(0x102)][_0x34673f(0xb3)]['clusterToleranceTicks']*this[_0x34673f(0xc5)],_0x58b24e=this[_0x34673f(0x102)][_0x34673f(0xb3)]['maxZoneAgeBars'];for(let _0x453fa1=_0x267f93['length']-0x1;_0x453fa1>=0x0;_0x453fa1--){_0x2fcdaa-_0x267f93[_0x453fa1]['barIndex']>_0x58b24e&&_0x267f93[_0x34673f(0xc1)](_0x453fa1,0x1);}for(const _0x3beb56 of _0x2cc478){let _0x4592ad=null;for(const _0x87bc70 of _0x267f93){if(_0x87bc70[_0x34673f(0x10f)](_0x3beb56[_0x34673f(0x115)],this['config'][_0x34673f(0xb3)][_0x34673f(0xfd)],this[_0x34673f(0xc5)])){_0x4592ad=_0x87bc70;break;}}if(_0x4592ad){_0x4592ad['touches']++;if(_0x3beb56['price']>_0x4592ad[_0x34673f(0xe4)])_0x4592ad['priceHigh']=_0x3beb56[_0x34673f(0x115)];if(_0x3beb56['price']<_0x4592ad[_0x34673f(0xcc)])_0x4592ad[_0x34673f(0xcc)]=_0x3beb56[_0x34673f(0x115)];_0x4592ad['qualityScore']=Math[_0x34673f(0x111)](0x1,0.3+_0x4592ad['touches']*0.15);}else{const _0x3777dc=_0x3beb56[_0x34673f(0xd6)]===_0x34673f(0xe8)?ZoneType['RESISTANCE']:ZoneType[_0x34673f(0x125)],_0x12753a=new LiquidityZone(_0x3777dc,_0x3beb56[_0x34673f(0x115)]+_0x43f227/0x2,_0x3beb56[_0x34673f(0x115)]-_0x43f227/0x2,_0x3beb56[_0x34673f(0x9d)],_0x3beb56['barIndex']);_0x12753a['qualityScore']=0.3+_0x3beb56[_0x34673f(0xd5)]*0.1,_0x267f93['push'](_0x12753a);}}}['_detectSweep'](_0x569806,_0x10afdd,_0x5a314f){const _0x411b7b=_0x325534,_0x4d5605=this[_0x411b7b(0xa8)]['get'](_0x569806),_0x3c9006=_0x10afdd[_0x5a314f],_0x4185c7=_0x3c9006[_0x411b7b(0xc3)],_0x52df7c=this['config']['sweep'],_0x3fdae0=this[_0x411b7b(0x102)][_0x411b7b(0xb3)];for(const _0x438117 of _0x4d5605){if(_0x438117[_0x411b7b(0x12c)]>=0x0&&_0x5a314f-_0x438117[_0x411b7b(0x12c)]<_0x3fdae0['cooldownBars'])continue;const _0x17dd89=_0x438117[_0x411b7b(0xee)](),_0x10f7d9=Math[_0x411b7b(0xbb)](_0x4185c7-_0x17dd89)/this[_0x411b7b(0xc5)];if(_0x10f7d9>_0x3fdae0['maxZoneDistanceTicks'])continue;const _0x3bfd19=Math[_0x411b7b(0x108)](0x0,_0x5a314f-_0x52df7c[_0x411b7b(0xf1)]*0x2);for(let _0x5229b8=_0x3bfd19;_0x5229b8<_0x5a314f;_0x5229b8++){const _0x5d40c9=_0x10afdd[_0x5229b8];if(_0x438117['type']===ZoneType[_0x411b7b(0x11c)]){const _0x109ba9=(_0x5d40c9['high']-_0x438117[_0x411b7b(0xe4)])/this[_0x411b7b(0xc5)];if(_0x109ba9>=_0x52df7c['minPenetrationTicks']&&_0x109ba9<=_0x52df7c[_0x411b7b(0xfc)]){const _0x28d8b4=Math[_0x411b7b(0x111)](_0x438117[_0x411b7b(0xe4)],_0x438117[_0x411b7b(0xe4)]+_0x109ba9*this['tickSize']);if(_0x4185c7<_0x28d8b4+this['tickSize']*0x2){const _0x533df8=_0x5d40c9[_0x411b7b(0xe8)]-_0x5d40c9[_0x411b7b(0xaa)],_0x5a9038=Math['abs'](_0x5d40c9[_0x411b7b(0xc3)]-_0x5d40c9[_0x411b7b(0xf4)]),_0x3830d7=_0x533df8>0x0?_0x5a9038/_0x533df8:0x0;if(_0x3830d7>=_0x52df7c[_0x411b7b(0x100)]){const _0x12fa01=this[_0x411b7b(0xe6)](_0x10afdd,_0x5229b8,0x14);if(_0x12fa01>=_0x52df7c[_0x411b7b(0xc6)]){const _0x4fbf0f=new SweepEvent(SweepType[_0x411b7b(0xaf)],_0x438117,_0x5229b8,_0x5229b8,_0x5d40c9[_0x411b7b(0xe8)]);_0x4fbf0f['exitBarIndex']=_0x5a314f,_0x4fbf0f[_0x411b7b(0x139)]=_0x109ba9,_0x4fbf0f['durationBars']=_0x5a314f-_0x5229b8,_0x4fbf0f['volumeRatio']=_0x12fa01,_0x4fbf0f[_0x411b7b(0x133)]=this[_0x411b7b(0xeb)](_0x4fbf0f,_0x3830d7),_0x4fbf0f[_0x411b7b(0x109)]=_0x4fbf0f['qualityScore']>=_0x52df7c['minQualityScore'];if(_0x4fbf0f[_0x411b7b(0x109)])return _0x4fbf0f;}}}}}if(_0x438117[_0x411b7b(0xd6)]===ZoneType['SUPPORT']){const _0x19689a=(_0x438117['priceLow']-_0x5d40c9[_0x411b7b(0xaa)])/this[_0x411b7b(0xc5)];if(_0x19689a>=_0x52df7c[_0x411b7b(0x12d)]&&_0x19689a<=_0x52df7c['maxPenetrationTicks']){const _0x2a61af=Math['max'](_0x438117['priceLow'],_0x438117[_0x411b7b(0xcc)]-_0x19689a*this['tickSize']);if(_0x4185c7>_0x2a61af-this['tickSize']*0x2){const _0x34dc1f=_0x5d40c9['high']-_0x5d40c9[_0x411b7b(0xaa)],_0xccffee=Math['abs'](_0x5d40c9[_0x411b7b(0xc3)]-_0x5d40c9[_0x411b7b(0xf4)]),_0x57beed=_0x34dc1f>0x0?_0xccffee/_0x34dc1f:0x0;if(_0x57beed>=_0x52df7c[_0x411b7b(0x100)]){const _0x145aa3=this['_getVolumeRatio'](_0x10afdd,_0x5229b8,0x14);if(_0x145aa3>=_0x52df7c['minVolumeRatio']){const _0x9d8590=new SweepEvent(SweepType[_0x411b7b(0xd4)],_0x438117,_0x5229b8,_0x5229b8,_0x5d40c9[_0x411b7b(0xaa)]);_0x9d8590[_0x411b7b(0x138)]=_0x5a314f,_0x9d8590['penetrationTicks']=_0x19689a,_0x9d8590[_0x411b7b(0x126)]=_0x5a314f-_0x5229b8,_0x9d8590['volumeRatio']=_0x145aa3,_0x9d8590[_0x411b7b(0x133)]=this[_0x411b7b(0xeb)](_0x9d8590,_0x57beed),_0x9d8590['isValid']=_0x9d8590[_0x411b7b(0x133)]>=_0x52df7c['minQualityScore'];if(_0x9d8590[_0x411b7b(0x109)])return _0x9d8590;}}}}}}}return null;}[_0x325534(0xe6)](_0x4025d9,_0x51497f,_0x5d0021){const _0x54c5cf=_0x325534,_0x4ace2c=Math[_0x54c5cf(0x108)](0x0,_0x51497f-_0x5d0021),_0x1cf267=_0x4025d9['slice'](_0x4ace2c,_0x51497f);if(_0x1cf267['length']===0x0)return 0x1;const _0x3125cb=_0x1cf267[_0x54c5cf(0x118)](_0x54554d=>_0x54554d[_0x54c5cf(0xd3)])[_0x54c5cf(0xb9)]((_0xcf6dd3,_0x1efa56)=>_0xcf6dd3-_0x1efa56),_0x11d446=Math['floor'](_0x3125cb[_0x54c5cf(0x121)]/0x2),_0x3189b6=_0x3125cb[_0x11d446]||0x1;return _0x4025d9[_0x51497f]['volume']/_0x3189b6;}[_0x325534(0xeb)](_0x2f55b4,_0x32dc57){const _0x278521=_0x325534;let _0x5a9c53=0x0;const _0xfe5abe=0x4,_0x540105=Math[_0x278521(0xbb)](_0x2f55b4['penetrationTicks']-_0xfe5abe);return _0x5a9c53+=Math[_0x278521(0x108)](0x0,0.3-_0x540105*0.03),_0x5a9c53+=Math[_0x278521(0x108)](0x0,0.25-_0x2f55b4['durationBars']*0.05),_0x5a9c53+=Math['min'](0.25,_0x2f55b4['volumeRatio']*0.1),_0x5a9c53+=Math['min'](0.2,_0x32dc57*0.4),Math['min'](0x1,_0x5a9c53);}['_generateSignal'](_0x41ae03,_0x5b42fc,_0x3bf308,_0x36d1c0){const _0x5d2b67=_0x325534,_0x3f05b5=Date[_0x5d2b67(0xdd)]()-this['lastSignalTime'];if(_0x3f05b5<this['config'][_0x5d2b67(0xa4)]['cooldownMs'])return this['emit'](_0x5d2b67(0xa9),{'type':'debug','message':_0x5d2b67(0x11f)+(_0x3f05b5/0x3e8)['toFixed'](0x1)+'s\x20<\x20'+this['config'][_0x5d2b67(0xa4)][_0x5d2b67(0xa0)]/0x3e8+'s)'}),null;const _0x4955f9=this[_0x5d2b67(0x102)]['execution'],_0x1f426b=_0x5b42fc['close'],_0x100aa0=_0x36d1c0['sweepType']===SweepType['HIGH_SWEEP']?_0x5d2b67(0xe9):_0x5d2b67(0xc9);let _0x2861ee,_0x35e125,_0x38561e,_0x4bdd6a;_0x100aa0==='long'?(_0x2861ee=_0x1f426b-_0x4955f9[_0x5d2b67(0xec)]*this['tickSize'],_0x35e125=_0x1f426b+_0x4955f9['targetTicks']*this[_0x5d2b67(0xc5)],_0x38561e=_0x1f426b+_0x4955f9[_0x5d2b67(0xdb)]*this[_0x5d2b67(0xc5)],_0x4bdd6a=_0x1f426b+_0x4955f9['trailTriggerTicks']*this['tickSize']):(_0x2861ee=_0x1f426b+_0x4955f9[_0x5d2b67(0xec)]*this[_0x5d2b67(0xc5)],_0x35e125=_0x1f426b-_0x4955f9['targetTicks']*this[_0x5d2b67(0xc5)],_0x38561e=_0x1f426b-_0x4955f9[_0x5d2b67(0xdb)]*this[_0x5d2b67(0xc5)],_0x4bdd6a=_0x1f426b-_0x4955f9[_0x5d2b67(0xd2)]*this[_0x5d2b67(0xc5)]);const _0x2621ca=_0x4955f9['targetTicks']/_0x4955f9[_0x5d2b67(0xec)],_0x4e713d=Math[_0x5d2b67(0x111)](0x1,_0x36d1c0['qualityScore']*0.5+_0x36d1c0['zone']['qualityScore']*0.3+(_0x36d1c0['volumeRatio']>1.5?0.2:_0x36d1c0['volumeRatio']*0.1));let _0x567d21=SignalStrength[_0x5d2b67(0xdf)];if(_0x4e713d>=0.8)_0x567d21=SignalStrength[_0x5d2b67(0xe5)];else{if(_0x4e713d>=0.65)_0x567d21=SignalStrength['STRONG'];else{if(_0x4e713d<0.5)_0x567d21=SignalStrength['WEAK'];}}const _0x2c5256=0.5+(_0x4e713d-0.5)*0.4,_0x19cf9a=_0x2c5256*Math[_0x5d2b67(0xbb)](_0x35e125-_0x1f426b)-(0x1-_0x2c5256)*Math['abs'](_0x1f426b-_0x2861ee);_0x36d1c0[_0x5d2b67(0xb3)][_0x5d2b67(0x12c)]=_0x3bf308,_0x36d1c0['zone']['swept']=!![],_0x36d1c0[_0x5d2b67(0xb3)]['sweptAt']=new Date(_0x5b42fc[_0x5d2b67(0x9d)]),this['lastSignalTime']=Date['now'](),this[_0x5d2b67(0x134)]['signals']++;const _0x21bd98={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x41ae03[_0x5d2b67(0xb0)]('.')[0x0]||_0x41ae03,'contractId':_0x41ae03,'side':_0x100aa0==='long'?OrderSide['BID']:OrderSide['ASK'],'direction':_0x100aa0,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x567d21,'edge':_0x19cf9a,'confidence':_0x4e713d,'entry':_0x1f426b,'entryPrice':_0x1f426b,'stopLoss':_0x2861ee,'takeProfit':_0x35e125,'riskReward':_0x2621ca,'stopTicks':_0x4955f9[_0x5d2b67(0xec)],'targetTicks':_0x4955f9[_0x5d2b67(0xbf)],'breakevenTicks':_0x4955f9[_0x5d2b67(0xdb)],'trailTriggerTicks':_0x4955f9['trailTriggerTicks'],'trailDistanceTicks':_0x4955f9['trailDistanceTicks'],'beLevel':_0x38561e,'trailTrigger':_0x4bdd6a,'sweepType':_0x36d1c0[_0x5d2b67(0xf8)],'penetrationTicks':_0x36d1c0['penetrationTicks'],'sweepDurationBars':_0x36d1c0['durationBars'],'sweepQuality':_0x36d1c0['qualityScore'],'volumeRatio':_0x36d1c0['volumeRatio'],'zoneType':_0x36d1c0['zone'][_0x5d2b67(0xd6)],'zoneLevel':_0x36d1c0[_0x5d2b67(0xb3)]['getLevel'](),'zoneTouches':_0x36d1c0[_0x5d2b67(0xb3)]['touches'],'zoneQuality':_0x36d1c0[_0x5d2b67(0xb3)][_0x5d2b67(0x133)],'expires':Date['now']()+0xea60};return this[_0x5d2b67(0xda)](_0x5d2b67(0xca),{'side':_0x100aa0===_0x5d2b67(0xc9)?_0x5d2b67(0xa2):'sell','action':_0x5d2b67(0xf4),'reason':'2B\x20'+_0x36d1c0['sweepType']+'\x20|\x20Pen:'+_0x36d1c0[_0x5d2b67(0x139)]['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x36d1c0[_0x5d2b67(0xd1)][_0x5d2b67(0xfb)](0x1)+'x\x20|\x20Q:'+(_0x36d1c0['qualityScore']*0x64)['toFixed'](0x0)+'%',..._0x21bd98}),this[_0x5d2b67(0xda)](_0x5d2b67(0xa9),{'type':'info','message':'[HQX-2B]\x20SIGNAL:\x20'+_0x100aa0['toUpperCase']()+'\x20@\x20'+_0x1f426b['toFixed'](0x2)+_0x5d2b67(0xcf)+_0x36d1c0[_0x5d2b67(0xf8)]+_0x5d2b67(0x129)+_0x36d1c0['penetrationTicks'][_0x5d2b67(0xfb)](0x1)+'t\x20Vol:'+_0x36d1c0['volumeRatio']['toFixed'](0x1)+_0x5d2b67(0x98)+(_0x4e713d*0x64)['toFixed'](0x0)+'%'}),_0x21bd98;}[_0x325534(0x105)](_0x547907,_0x6e492e){const _0x5471b9=_0x325534,_0x473af6=this['barHistory']['get'](_0x547907)||[],_0x3df5c3=this['liquidityZones'][_0x5471b9(0x120)](_0x547907)||[],_0xb3a105=this['swingPoints']['get'](_0x547907)||[];if(_0x473af6[_0x5471b9(0x121)]<0x3)return{'ready':![],'message':_0x5471b9(0x103)+_0x473af6[_0x5471b9(0x121)]+'/3\x20bars'};const _0xcc2703=_0x3df5c3['map'](_0x16e3d8=>({'zone':_0x16e3d8,'distance':Math['abs'](_0x6e492e-_0x16e3d8['getLevel']())}))[_0x5471b9(0xb9)]((_0x4c9114,_0x3bd713)=>_0x4c9114['distance']-_0x3bd713[_0x5471b9(0x11d)]),_0x2cda5a=_0xcc2703['find'](_0x4964b2=>_0x4964b2[_0x5471b9(0xb3)][_0x5471b9(0xd6)]===ZoneType['RESISTANCE']),_0x3b6222=_0xcc2703['find'](_0x2a5e22=>_0x2a5e22['zone']['type']===ZoneType['SUPPORT']);return{'ready':!![],'barsProcessed':_0x473af6['length'],'swingsDetected':_0xb3a105[_0x5471b9(0x121)],'activeZones':_0x3df5c3['length'],'nearestResistance':_0x2cda5a?_0x2cda5a['zone']['getLevel']():null,'nearestSupport':_0x3b6222?_0x3b6222['zone']['getLevel']():null,'stopTicks':this[_0x5471b9(0x102)]['execution']['stopTicks'],'targetTicks':this[_0x5471b9(0x102)]['execution']['targetTicks'],'strategy':_0x5471b9(0xb8)};}[_0x325534(0xc4)](_0x36d10f){const _0x319a75=_0x325534;this[_0x319a75(0x12b)][_0x319a75(0x117)]({'netPnl':_0x36d10f,'timestamp':Date[_0x319a75(0xdd)]()});if(this['recentTrades'][_0x319a75(0x121)]>0x64)this['recentTrades']['shift']();_0x36d10f>0x0?this[_0x319a75(0x134)]['wins']++:this['stats'][_0x319a75(0xfe)]++,this['stats']['trades']++,this['stats']['pnl']+=_0x36d10f,this['emit'](_0x319a75(0xa9),{'type':'debug','message':_0x319a75(0xe1)+(_0x36d10f>0x0?'WIN':_0x319a75(0xea))+'\x20$'+_0x36d10f['toFixed'](0x2)});}[_0x325534(0x10e)](_0x29640c){const _0xb10092=_0x325534;return this[_0xb10092(0xf7)][_0xb10092(0x120)](_0x29640c)||[];}['getStats'](){const _0x4211e2=_0x325534;return this[_0x4211e2(0x134)];}['getHealthStatus'](_0x5a8f90){const _0x359f64=_0x325534,_0x4ef6be=this[_0x359f64(0xf7)][_0x359f64(0x120)](_0x5a8f90)||[],_0x36a55d=this[_0x359f64(0xa8)][_0x359f64(0x120)](_0x5a8f90)||[],_0x1f548c=this[_0x359f64(0x110)]['get'](_0x5a8f90)||[],_0x16e62b=this[_0x359f64(0xa1)]['get'](_0x5a8f90),_0x3e6da2=_0x4ef6be[_0x4ef6be[_0x359f64(0x121)]-0x1],_0x31ddce=_0x3e6da2?Date['now']()-_0x3e6da2['timestamp']:null,_0x1219e3=_0x36a55d['filter'](_0x3b640b=>_0x3b640b['type']===ZoneType['RESISTANCE'])['length'],_0x40103d=_0x36a55d[_0x359f64(0x10d)](_0x3087a0=>_0x3087a0['type']===ZoneType[_0x359f64(0x125)])[_0x359f64(0x121)];return{'healthy':_0x4ef6be['length']>=0x5,'barsTotal':_0x4ef6be['length'],'barsLast5Min':_0x4ef6be[_0x359f64(0x10d)](_0x55e09a=>Date['now']()-_0x55e09a[_0x359f64(0x9d)]<0x5*0x3c*0x3e8)[_0x359f64(0x121)],'swingsTotal':_0x1f548c['length'],'zonesResistance':_0x1219e3,'zonesSupport':_0x40103d,'zonesTotal':_0x36a55d['length'],'currentBarTicks':_0x16e62b?_0x16e62b['tickCount']:0x0,'isAggregating':_0x16e62b&&_0x16e62b['tickCount']>0x0,'timeSinceLastBarMs':_0x31ddce,'lastSignalTime':this[_0x359f64(0xd9)],'signalCooldownMs':this[_0x359f64(0x102)]['execution']['cooldownMs'],'uptime':Date['now']()-(this[_0x359f64(0xbd)]||Date['now']())};}['reset'](_0x55f4c1){const _0x2ffb76=_0x325534;this[_0x2ffb76(0xf7)][_0x2ffb76(0x10a)](_0x55f4c1,[]),this['swingPoints']['set'](_0x55f4c1,[]),this[_0x2ffb76(0xa8)]['set'](_0x55f4c1,[]),this[_0x2ffb76(0x10c)][_0x2ffb76(0x10a)](_0x55f4c1,[]),this[_0x2ffb76(0xa1)][_0x2ffb76(0xff)](_0x55f4c1),this[_0x2ffb76(0xda)](_0x2ffb76(0xa9),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x55f4c1});}[_0x325534(0xb1)](_0x4a1fbd,_0x3adb26){const _0x5e3fdd=_0x325534;if(!_0x3adb26||_0x3adb26[_0x5e3fdd(0x121)]===0x0){this[_0x5e3fdd(0xda)]('log',{'type':'debug','message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory'][_0x5e3fdd(0x12e)](_0x4a1fbd)&&this['initialize'](_0x4a1fbd);const _0x3a0d19=[..._0x3adb26][_0x5e3fdd(0xb9)]((_0x2cc5c9,_0x12f3f5)=>_0x2cc5c9[_0x5e3fdd(0x9d)]-_0x12f3f5[_0x5e3fdd(0x9d)]);this['emit'](_0x5e3fdd(0xa9),{'type':_0x5e3fdd(0x119),'message':'[HQX-2B]\x20Preloading\x20'+_0x3a0d19[_0x5e3fdd(0x121)]+_0x5e3fdd(0xde)});let _0x138c10=0x0;for(const _0x406f6b of _0x3a0d19){const _0x7742ea=this[_0x5e3fdd(0xce)](_0x4a1fbd,_0x406f6b);if(_0x7742ea)_0x138c10++;}const _0x50d4ad=this['barHistory'][_0x5e3fdd(0x120)](_0x4a1fbd)||[],_0x5bf6c4=this['swingPoints']['get'](_0x4a1fbd)||[],_0x2584b7=this['liquidityZones']['get'](_0x4a1fbd)||[];this[_0x5e3fdd(0xda)]('log',{'type':'info','message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x50d4ad['length']+_0x5e3fdd(0x113)+_0x5bf6c4['length']+_0x5e3fdd(0x123)+_0x2584b7[_0x5e3fdd(0x121)]+_0x5e3fdd(0xac)}),_0x138c10>0x0&&this[_0x5e3fdd(0xda)]('log',{'type':'debug','message':_0x5e3fdd(0x135)+_0x138c10+_0x5e3fdd(0x11a)}),this[_0x5e3fdd(0xd9)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x86b111={}){const _0x4e13bd=_0x325534;super(),this[_0x4e13bd(0x102)]=_0x86b111,this['strategy']=new HQX2BLiquiditySweep(_0x86b111),this['strategy']['on']('signal',_0x2cafe4=>this['emit']('signal',_0x2cafe4)),this['strategy']['on'](_0x4e13bd(0xa9),_0x4f1fd6=>this['emit']('log',_0x4f1fd6));}[_0x325534(0x107)](_0x3381cb){return this['strategy']['processTick'](_0x3381cb);}[_0x325534(0xf3)](_0xfc5468){const _0x4a9c91=_0x325534;return this[_0x4a9c91(0xef)]['onTick'](_0xfc5468);}[_0x325534(0xd8)](_0xf835c1){const _0x5ceaa3=_0x325534;return this['strategy'][_0x5ceaa3(0xd8)](_0xf835c1);}[_0x325534(0xce)](_0x4dc798,_0x2979fb){const _0x4f364e=_0x325534;return this['strategy'][_0x4f364e(0xce)](_0x4dc798,_0x2979fb);}[_0x325534(0xe7)](_0x4a4a7e,_0x199f01,_0x2c4233){const _0x229614=_0x325534;return this[_0x229614(0xef)][_0x229614(0xe7)](_0x4a4a7e,_0x199f01,_0x2c4233);}['getAnalysisState'](_0x25a629,_0x346c94){const _0x147dd8=_0x325534;return this[_0x147dd8(0xef)][_0x147dd8(0x105)](_0x25a629,_0x346c94);}[_0x325534(0xc4)](_0x10b600){const _0x4a436e=_0x325534;return this['strategy'][_0x4a436e(0xc4)](_0x10b600);}[_0x325534(0x9a)](_0x280d61){const _0x360ec0=_0x325534;return this[_0x360ec0(0xef)]['reset'](_0x280d61);}['getStats'](){const _0x3f5b4b=_0x325534;return this['strategy'][_0x3f5b4b(0xf2)]();}[_0x325534(0x10e)](_0x4aec03){const _0x20b85d=_0x325534;return this['strategy'][_0x20b85d(0x10e)](_0x4aec03);}[_0x325534(0xb1)](_0x521b97,_0x623b2a){const _0x5c52b3=_0x325534;return this['strategy'][_0x5c52b3(0xb1)](_0x521b97,_0x623b2a);}[_0x325534(0x11b)](_0x2a470f){const _0x115e1b=_0x325534;return this[_0x115e1b(0xef)]['getHealthStatus'](_0x2a470f);}['generateSignal'](_0x47b147){return null;}}module[_0x325534(0x12a)]={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
@@ -1 +1 @@
1
- function _0x3345(_0x56629d,_0x322f3d){_0x56629d=_0x56629d-0x66;const _0x174987=_0x1749();let _0x33452d=_0x174987[_0x56629d];return _0x33452d;}function _0x1749(){const _0x1a5cc1=['stats','filter','low','kalman','getAnalysisState','round','getBarHistory','zscoreThreshold','getStats','/50\x20bars','breakevenTicks','long','3754849HJrzQG','signal','symbol','_computeKyleLambda','recordTradeResult','exports','2283596BrBbVD','get','recentTrades','8IvRMqH','_computeZScore','onTrade','4900508ddAIRv','baseTargetTicks','tickSize','info','VERY_STRONG','\x20|\x20Z:','timestamp',',\x20value=','processTick','shift','slice','confidenceBonus','volumeBuffer','vpin','tickValue','push','_detectVolatilityRegime','22597452BnaAGL','close','volatility','set','HQX_ULTRA_SCALPING_6MODELS','shouldExitByZScore','volume','LOSS','generateSignal','ofi','errorCovariance','186557gzHayF','max','reset','vpinWindow','minConfidence','WIN','price','composite','log','abs','_computeVPIN','\x20@\x20','kalmanMeasurementNoise','buy','kalmanProcessNoise','5IljWaD','strategy','atrHistory','pow','minHoldTimeMs','side','length','barHistory','pnl','lossStreak','reduce','%,\x20OFI=','estimate','kalmanStates','7764024allXzL','weights','high','zscoreExitThreshold','priceBuffer','STRONG','open','37374tZlrfZ','uuid','processBar','_generateSignal','zscore','[HQX]\x20SIGNAL:\x20','toFixed','cooldownMs','normal','min','onTick','now','signals','emit','toUpperCase','winStreak','initialize','[HQX-UltraScalping]\x20Reset\x20state\x20for\x20','profitLockPct'];_0x1749=function(){return _0x1a5cc1;};return _0x1749();}const _0x4ef43a=_0x3345;(function(_0x4dc972,_0xabcca7){const _0x4a3fc9=_0x3345,_0x48b6f6=_0x4dc972();while(!![]){try{const _0x451fe6=parseInt(_0x4a3fc9(0x97))/0x1+parseInt(_0x4a3fc9(0x75))/0x2+-parseInt(_0x4a3fc9(0xbb))/0x3+parseInt(_0x4a3fc9(0x7b))/0x4*(parseInt(_0x4a3fc9(0xa6))/0x5)+parseInt(_0x4a3fc9(0xb4))/0x6+-parseInt(_0x4a3fc9(0x6f))/0x7+parseInt(_0x4a3fc9(0x78))/0x8*(-parseInt(_0x4a3fc9(0x8c))/0x9);if(_0x451fe6===_0xabcca7)break;else _0x48b6f6['push'](_0x48b6f6['shift']());}catch(_0x5a2b14){_0x48b6f6['push'](_0x48b6f6['shift']());}}}(_0x1749,0xc0551));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x4ef43a(0xbc)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x4ad112={}){const _0x284b93=_0x4ef43a;super(),this[_0x284b93(0x7d)]=_0x4ad112['tickSize']||0.25,this[_0x284b93(0x89)]=_0x4ad112[_0x284b93(0x89)]||0x5,this['zscoreEntryThreshold']=1.5,this[_0x284b93(0xb7)]=0.5,this['vpinWindow']=0x32,this['vpinToxicThreshold']=0.7,this[_0x284b93(0xa5)]=0.01,this[_0x284b93(0xa3)]=0.1,this['volatilityLookback']=0x64,this['ofiLookback']=0x14,this['baseStopTicks']=0x8,this['baseTargetTicks']=0x10,this['breakevenTicks']=0x4,this[_0x284b93(0xcd)]=0.5,this[_0x284b93(0x9b)]=0.55,this['weights']={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x284b93(0xad)]=new Map(),this[_0x284b93(0xb8)]=new Map(),this['volumeBuffer']=new Map(),this['kalmanStates']=new Map(),this[_0x284b93(0xa8)]=new Map(),this['recentTrades']=[],this[_0x284b93(0xca)]=0x0,this['lossStreak']=0x0,this['lastSignalTime']=0x0,this[_0x284b93(0xc2)]=0x7530,this[_0x284b93(0xaa)]=0x2710,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0x53ddf5,_0x92cc51=0.25,_0x527d53=0x5){const _0x38d11e=_0x4ef43a;this[_0x38d11e(0x7d)]=_0x92cc51,this['tickValue']=_0x527d53,this[_0x38d11e(0xad)]['set'](_0x53ddf5,[]),this['priceBuffer']['set'](_0x53ddf5,[]),this['volumeBuffer']['set'](_0x53ddf5,[]),this[_0x38d11e(0xa8)][_0x38d11e(0x8f)](_0x53ddf5,[]),this['kalmanStates']['set'](_0x53ddf5,{'estimate':0x0,'errorCovariance':0x1}),this[_0x38d11e(0xc8)](_0x38d11e(0x9f),{'type':_0x38d11e(0x7e),'message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x53ddf5+':\x20tick='+_0x92cc51+_0x38d11e(0x82)+_0x527d53}),this['emit'](_0x38d11e(0x9f),{'type':_0x38d11e(0x7e),'message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}[_0x4ef43a(0x83)](_0x56ae0a){const _0x2c5c98=_0x4ef43a,{contractId:_0x4eb987,price:_0x2048f5,volume:_0x4b4e07,side:_0x1f44d4,timestamp:_0x4dc3b8}=_0x56ae0a,_0x4a137b={'timestamp':_0x4dc3b8||Date[_0x2c5c98(0xc6)](),'open':_0x2048f5,'high':_0x2048f5,'low':_0x2048f5,'close':_0x2048f5,'volume':_0x4b4e07||0x1};return this['processBar'](_0x4eb987,_0x4a137b);}[_0x4ef43a(0xc5)](_0x221c55){const _0x5cefb9=_0x4ef43a;return this[_0x5cefb9(0x83)](_0x221c55);}[_0x4ef43a(0x7a)](_0xda68b6){const _0x197f2c=_0x4ef43a;return this[_0x197f2c(0x83)]({'contractId':_0xda68b6['contractId']||_0xda68b6[_0x197f2c(0x71)],'price':_0xda68b6[_0x197f2c(0x9d)],'volume':_0xda68b6['size']||_0xda68b6['volume']||0x1,'side':_0xda68b6[_0x197f2c(0xab)],'timestamp':_0xda68b6[_0x197f2c(0x81)]||Date['now']()});}[_0x4ef43a(0xbd)](_0x4c94cb,_0x30f1b3){const _0xaafdc5=_0x4ef43a;let _0x1c8cb0=this['barHistory'][_0xaafdc5(0x76)](_0x4c94cb);!_0x1c8cb0&&(this[_0xaafdc5(0xcb)](_0x4c94cb),_0x1c8cb0=this[_0xaafdc5(0xad)][_0xaafdc5(0x76)](_0x4c94cb));_0x1c8cb0[_0xaafdc5(0x8a)](_0x30f1b3);if(_0x1c8cb0[_0xaafdc5(0xac)]>0x1f4)_0x1c8cb0['shift']();const _0x4ad596=this[_0xaafdc5(0xb8)][_0xaafdc5(0x76)](_0x4c94cb);_0x4ad596[_0xaafdc5(0x8a)](_0x30f1b3[_0xaafdc5(0x8d)]);if(_0x4ad596[_0xaafdc5(0xac)]>0xc8)_0x4ad596[_0xaafdc5(0x84)]();const _0x42c94b=this[_0xaafdc5(0x87)][_0xaafdc5(0x76)](_0x4c94cb),_0x558fed=_0x30f1b3[_0xaafdc5(0xb6)]-_0x30f1b3[_0xaafdc5(0xd0)];let _0x2e9b86=_0x30f1b3[_0xaafdc5(0x92)]*0.5,_0x3dd352=_0x30f1b3[_0xaafdc5(0x92)]*0.5;if(_0x558fed>0x0){const _0xd8c0b5=(_0x30f1b3[_0xaafdc5(0x8d)]-_0x30f1b3['low'])/_0x558fed;_0x2e9b86=_0x30f1b3[_0xaafdc5(0x92)]*_0xd8c0b5,_0x3dd352=_0x30f1b3[_0xaafdc5(0x92)]*(0x1-_0xd8c0b5);}_0x42c94b[_0xaafdc5(0x8a)]({'buy':_0x2e9b86,'sell':_0x3dd352});if(_0x42c94b[_0xaafdc5(0xac)]>0x64)_0x42c94b['shift']();if(_0x1c8cb0[_0xaafdc5(0xac)]<0x32)return null;const _0x552d05=this[_0xaafdc5(0x79)](_0x4ad596),_0x20d691=this[_0xaafdc5(0xa1)](_0x42c94b),_0xf28454=this['_computeKyleLambda'](_0x1c8cb0),_0x53b925=this['_applyKalmanFilter'](_0x4c94cb,_0x30f1b3[_0xaafdc5(0x8d)]),{regime:_0x48fe4f,params:_0x55fc9d}=this['_detectVolatilityRegime'](_0x4c94cb,_0x1c8cb0),_0x18dfd1=this['_computeOrderFlowImbalance'](_0x1c8cb0);return this[_0xaafdc5(0xbe)](_0x4c94cb,_0x30f1b3[_0xaafdc5(0x8d)],_0x552d05,_0x20d691,_0xf28454,_0x53b925,_0x48fe4f,_0x55fc9d,_0x18dfd1,_0x1c8cb0);}[_0x4ef43a(0x79)](_0xbbb256,_0x3162b7=0x32){const _0x1bbc6e=_0x4ef43a;if(_0xbbb256[_0x1bbc6e(0xac)]<_0x3162b7)return 0x0;const _0x2ae192=_0xbbb256['slice'](-_0x3162b7),_0xedab8=_0x2ae192['reduce']((_0x291c86,_0xef5c39)=>_0x291c86+_0xef5c39,0x0)/_0x3162b7,_0x208c69=_0x2ae192[_0x1bbc6e(0xb0)]((_0x2523f8,_0x398dd7)=>_0x2523f8+Math['pow'](_0x398dd7-_0xedab8,0x2),0x0)/_0x3162b7,_0x36a76d=Math['sqrt'](_0x208c69);if(_0x36a76d<0.0001)return 0x0;const _0x3baeca=_0xbbb256[_0xbbb256[_0x1bbc6e(0xac)]-0x1];return(_0x3baeca-_0xedab8)/_0x36a76d;}[_0x4ef43a(0xa1)](_0x2b1b43){const _0x4a4f3b=_0x4ef43a;if(_0x2b1b43['length']<this[_0x4a4f3b(0x9a)])return 0.5;const _0x21cc6d=_0x2b1b43['slice'](-this['vpinWindow']);let _0x1411b6=0x0,_0x447808=0x0;for(const _0x5b7299 of _0x21cc6d){_0x1411b6+=_0x5b7299[_0x4a4f3b(0xa4)],_0x447808+=_0x5b7299['sell'];}const _0x25879f=_0x1411b6+_0x447808;if(_0x25879f<0x1)return 0.5;return Math['abs'](_0x1411b6-_0x447808)/_0x25879f;}[_0x4ef43a(0x72)](_0x27a809){const _0x1c39de=_0x4ef43a;if(_0x27a809['length']<0x14)return 0x0;const _0x12be04=_0x27a809['slice'](-0x14),_0x40daf5=[],_0x337ef1=[];for(let _0x571c4c=0x1;_0x571c4c<_0x12be04['length'];_0x571c4c++){_0x40daf5['push'](_0x12be04[_0x571c4c]['close']-_0x12be04[_0x571c4c-0x1]['close']),_0x337ef1['push'](_0x12be04[_0x571c4c]['volume']);}const _0x58aaf9=_0x40daf5[_0x1c39de(0xb0)]((_0x16c838,_0x24e596)=>_0x16c838+_0x24e596,0x0)/_0x40daf5[_0x1c39de(0xac)],_0x4e1dc9=_0x337ef1[_0x1c39de(0xb0)]((_0x317d87,_0x46ee99)=>_0x317d87+_0x46ee99,0x0)/_0x337ef1[_0x1c39de(0xac)];let _0x111030=0x0,_0x2cca54=0x0;for(let _0x5789f5=0x0;_0x5789f5<_0x40daf5['length'];_0x5789f5++){_0x111030+=(_0x40daf5[_0x5789f5]-_0x58aaf9)*(_0x337ef1[_0x5789f5]-_0x4e1dc9),_0x2cca54+=Math[_0x1c39de(0xa9)](_0x337ef1[_0x5789f5]-_0x4e1dc9,0x2);}_0x111030/=_0x40daf5[_0x1c39de(0xac)],_0x2cca54/=_0x40daf5[_0x1c39de(0xac)];if(_0x2cca54<0.0001)return 0x0;return Math['abs'](_0x111030/_0x2cca54);}['_applyKalmanFilter'](_0x5cd40c,_0x2625a8){const _0x46c4fb=_0x4ef43a;let _0x56c246=this['kalmanStates'][_0x46c4fb(0x76)](_0x5cd40c);if(!_0x56c246)return _0x56c246={'estimate':_0x2625a8,'errorCovariance':0x1},this[_0x46c4fb(0xb3)]['set'](_0x5cd40c,_0x56c246),_0x2625a8;const _0x412093=_0x56c246['estimate'],_0x4320a2=_0x56c246['errorCovariance']+this[_0x46c4fb(0xa5)],_0x55b2b8=_0x4320a2/(_0x4320a2+this['kalmanMeasurementNoise']),_0x42e39a=_0x412093+_0x55b2b8*(_0x2625a8-_0x412093),_0x447455=(0x1-_0x55b2b8)*_0x4320a2;return _0x56c246[_0x46c4fb(0xb2)]=_0x42e39a,_0x56c246[_0x46c4fb(0x96)]=_0x447455,_0x42e39a;}[_0x4ef43a(0x8b)](_0x3f3eac,_0x2b9300){const _0x40ecee=_0x4ef43a,_0x5e925e=this['_calculateATR'](_0x2b9300),_0x2056e9=_0x5e925e/this['tickSize'];let _0x240aae=this[_0x40ecee(0xa8)]['get'](_0x3f3eac);!_0x240aae&&(_0x240aae=[],this[_0x40ecee(0xa8)]['set'](_0x3f3eac,_0x240aae));_0x240aae[_0x40ecee(0x8a)](_0x5e925e);if(_0x240aae[_0x40ecee(0xac)]>0x1f4)_0x240aae['shift']();let _0x5d3642=0.5;_0x240aae['length']>=0x14&&(_0x5d3642=_0x240aae[_0x40ecee(0xcf)](_0x4be640=>_0x4be640<=_0x5e925e)[_0x40ecee(0xac)]/_0x240aae[_0x40ecee(0xac)]);let _0x42ef13,_0x597f99;if(_0x5d3642<0.25)_0x42ef13=_0x40ecee(0xd0),_0x597f99={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x5d3642<0.75?(_0x42ef13=_0x40ecee(0xc3),_0x597f99={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x42ef13='high',_0x597f99={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x42ef13,'params':_0x597f99};}['_calculateATR'](_0x1162c2,_0x3ca5fd=0xe){const _0x31b723=_0x4ef43a;if(_0x1162c2['length']<_0x3ca5fd+0x1)return 2.5;const _0x25010f=[];for(let _0x14cc6a=_0x1162c2[_0x31b723(0xac)]-_0x3ca5fd;_0x14cc6a<_0x1162c2['length'];_0x14cc6a++){const _0x48867e=_0x1162c2[_0x14cc6a],_0x340a50=_0x1162c2[_0x14cc6a-0x1]['close'],_0x506341=Math['max'](_0x48867e['high']-_0x48867e['low'],Math[_0x31b723(0xa0)](_0x48867e[_0x31b723(0xb6)]-_0x340a50),Math[_0x31b723(0xa0)](_0x48867e['low']-_0x340a50));_0x25010f['push'](_0x506341);}return _0x25010f[_0x31b723(0xb0)]((_0x392c99,_0x4ee4d6)=>_0x392c99+_0x4ee4d6,0x0)/_0x25010f[_0x31b723(0xac)];}['_computeOrderFlowImbalance'](_0x37f53c){const _0x334246=_0x4ef43a;if(_0x37f53c[_0x334246(0xac)]<this['ofiLookback'])return 0x0;const _0x16427c=_0x37f53c[_0x334246(0x85)](-this['ofiLookback']);let _0x4a7638=0x0,_0x4a1973=0x0;for(const _0x3fdc64 of _0x16427c){const _0xeac481=_0x3fdc64[_0x334246(0xb6)]-_0x3fdc64[_0x334246(0xd0)];if(_0xeac481>0x0){const _0x23490d=(_0x3fdc64['close']-_0x3fdc64['low'])/_0xeac481;_0x4a7638+=_0x23490d*_0x3fdc64['volume'],_0x4a1973+=(0x1-_0x23490d)*_0x3fdc64[_0x334246(0x92)];}}const _0x33dc50=_0x4a7638+_0x4a1973;if(_0x33dc50<0x1)return 0x0;return(_0x4a7638-_0x4a1973)/_0x33dc50;}['_generateSignal'](_0x4359a6,_0x277d7f,_0x30e87a,_0x5a94e3,_0x2fe327,_0x9f43fb,_0x50cfb3,_0xf27a12,_0x5c808d,_0x24e541){const _0x599819=_0x4ef43a,_0x27ddc4=Math[_0x599819(0xa0)](_0x30e87a);if(_0x27ddc4<_0xf27a12['zscoreThreshold'])return null;if(_0x5a94e3>this['vpinToxicThreshold'])return null;let _0x27a2de;if(_0x30e87a<-_0xf27a12[_0x599819(0x6a)])_0x27a2de='long';else{if(_0x30e87a>_0xf27a12[_0x599819(0x6a)])_0x27a2de='short';else return null;}const _0x575132=_0x27a2de===_0x599819(0x6e)&&_0x5c808d>0.1||_0x27a2de==='short'&&_0x5c808d<-0.1,_0x574ea2=_0x277d7f-_0x9f43fb,_0x39c00d=_0x27a2de==='long'&&_0x574ea2<0x0||_0x27a2de==='short'&&_0x574ea2>0x0,_0x17d6d5={'zscore':Math[_0x599819(0xc4)](0x1,_0x27ddc4/0x4),'vpin':0x1-_0x5a94e3,'kyleLambda':_0x2fe327>0.001?0.5:0.8,'kalman':_0x39c00d?0.8:0.4,'volatility':_0x50cfb3===_0x599819(0xc3)?0.8:_0x50cfb3==='low'?0.7:0.6,'ofi':_0x575132?0.9:0.5,'composite':0x0};_0x17d6d5[_0x599819(0x9e)]=_0x17d6d5['zscore']*this['weights'][_0x599819(0xbf)]+_0x17d6d5[_0x599819(0x88)]*this['weights'][_0x599819(0x88)]+_0x17d6d5['kyleLambda']*this['weights']['kyleLambda']+_0x17d6d5[_0x599819(0x66)]*this['weights']['kalman']+_0x17d6d5['volatility']*this[_0x599819(0xb5)][_0x599819(0x8e)]+_0x17d6d5['ofi']*this[_0x599819(0xb5)][_0x599819(0x95)];const _0x2c2e0b=Math[_0x599819(0xc4)](0x1,_0x17d6d5[_0x599819(0x9e)]+_0xf27a12[_0x599819(0x86)]);if(_0x2c2e0b<this['minConfidence'])return null;if(Date[_0x599819(0xc6)]()-this['lastSignalTime']<this['cooldownMs'])return null;const _0x3b0e0d=Math[_0x599819(0x68)](this['baseStopTicks']*_0xf27a12['stopMultiplier']),_0x134055=Math[_0x599819(0x68)](this[_0x599819(0x7c)]*_0xf27a12['targetMultiplier']),_0x4b1088=Math[_0x599819(0x98)](0x6,Math['min'](0xc,_0x3b0e0d)),_0x3cc662=Math['max'](_0x4b1088*1.5,Math['min'](0x18,_0x134055));let _0x9a9a31,_0x577126,_0x469ecc,_0x3571f9;_0x27a2de==='long'?(_0x9a9a31=_0x277d7f-_0x4b1088*this[_0x599819(0x7d)],_0x577126=_0x277d7f+_0x3cc662*this[_0x599819(0x7d)],_0x469ecc=_0x277d7f+this[_0x599819(0x6d)]*this['tickSize'],_0x3571f9=_0x277d7f+_0x3cc662*this['profitLockPct']*this[_0x599819(0x7d)]):(_0x9a9a31=_0x277d7f+_0x4b1088*this['tickSize'],_0x577126=_0x277d7f-_0x3cc662*this['tickSize'],_0x469ecc=_0x277d7f-this['breakevenTicks']*this['tickSize'],_0x3571f9=_0x277d7f-_0x3cc662*this['profitLockPct']*this['tickSize']);const _0x5dd24d=_0x3cc662/_0x4b1088,_0x2ef93d=Math[_0x599819(0x68)](_0x3cc662*0.5),_0x9abe1d=Math[_0x599819(0x68)](_0x4b1088*0.4);let _0x44dbd2=SignalStrength['MODERATE'];if(_0x2c2e0b>=0.85)_0x44dbd2=SignalStrength[_0x599819(0x7f)];else{if(_0x2c2e0b>=0.75)_0x44dbd2=SignalStrength[_0x599819(0xb9)];else{if(_0x2c2e0b<0.6)_0x44dbd2=SignalStrength['WEAK'];}}const _0x11baa1=0.5+(_0x2c2e0b-0.5)*0.4,_0x389b0d=_0x11baa1*Math[_0x599819(0xa0)](_0x577126-_0x277d7f)-(0x1-_0x11baa1)*Math[_0x599819(0xa0)](_0x277d7f-_0x9a9a31);this['lastSignalTime']=Date['now'](),this['stats'][_0x599819(0xc7)]++;const _0x53adc9={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x4359a6['split']('.')[0x0]||_0x4359a6,'contractId':_0x4359a6,'side':_0x27a2de===_0x599819(0x6e)?OrderSide['BID']:OrderSide['ASK'],'direction':_0x27a2de,'strategy':_0x599819(0x90),'strength':_0x44dbd2,'edge':_0x389b0d,'confidence':_0x2c2e0b,'entry':_0x277d7f,'entryPrice':_0x277d7f,'stopLoss':_0x9a9a31,'takeProfit':_0x577126,'riskReward':_0x5dd24d,'stopTicks':_0x4b1088,'targetTicks':_0x3cc662,'trailTriggerTicks':_0x2ef93d,'trailDistanceTicks':_0x9abe1d,'beBreakeven':_0x469ecc,'profitLockLevel':_0x3571f9,'zScore':_0x30e87a,'zScoreExit':this[_0x599819(0xb7)],'vpinValue':_0x5a94e3,'kyleLambda':_0x2fe327,'kalmanEstimate':_0x9f43fb,'volatilityRegime':_0x50cfb3,'ofiValue':_0x5c808d,'models':_0x17d6d5,'orderFlowConfirmed':_0x575132,'kalmanConfirmed':_0x39c00d,'expires':Date['now']()+0xea60};return this['emit']('signal',{'side':_0x27a2de==='long'?_0x599819(0xa4):'sell','action':_0x599819(0xba),'reason':'Z='+_0x30e87a[_0x599819(0xc1)](0x2)+',\x20VPIN='+(_0x5a94e3*0x64)['toFixed'](0x0)+_0x599819(0xb1)+(_0x5c808d*0x64)['toFixed'](0x0)+'%,\x20cf='+(_0x2c2e0b*0x64)['toFixed'](0x0)+'%',..._0x53adc9}),this[_0x599819(0xc8)](_0x599819(0x9f),{'type':'info','message':_0x599819(0xc0)+_0x27a2de[_0x599819(0xc9)]()+_0x599819(0xa2)+_0x277d7f['toFixed'](0x2)+_0x599819(0x80)+_0x30e87a[_0x599819(0xc1)](0x2)+'\x20VPIN:'+(_0x5a94e3*0x64)[_0x599819(0xc1)](0x0)+'%\x20OFI:'+(_0x5c808d*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x2fe327['toFixed'](0x5)+'\x20Regime:'+_0x50cfb3+'\x20|\x20Conf:'+(_0x2c2e0b*0x64)[_0x599819(0xc1)](0x0)+'%'}),_0x53adc9;}[_0x4ef43a(0x91)](_0x26cd1c){const _0x5ee9d0=_0x4ef43a,_0x3abdd7=this['priceBuffer']['get'](_0x26cd1c);if(!_0x3abdd7||_0x3abdd7[_0x5ee9d0(0xac)]<0x32)return![];const _0x5234f1=this['_computeZScore'](_0x3abdd7);return Math[_0x5ee9d0(0xa0)](_0x5234f1)<this[_0x5ee9d0(0xb7)];}['getModelValues'](_0x100ad6){const _0x72c1a9=_0x4ef43a,_0x498e03=this['priceBuffer']['get'](_0x100ad6),_0x1df52e=this[_0x72c1a9(0x87)]['get'](_0x100ad6),_0x2fcdbb=this[_0x72c1a9(0xad)]['get'](_0x100ad6);if(!_0x498e03||!_0x1df52e||!_0x2fcdbb||_0x2fcdbb[_0x72c1a9(0xac)]<0x32)return null;const _0x58a68a=this[_0x72c1a9(0x79)](_0x498e03),_0x92f79f=this['_computeVPIN'](_0x1df52e),_0x40de93=this['_computeKyleLambda'](_0x2fcdbb),_0x2f710b=this['_computeOrderFlowImbalance'](_0x2fcdbb);return{'zscore':Math[_0x72c1a9(0xc4)](0x1,Math['abs'](_0x58a68a)/0x4),'vpin':0x1-_0x92f79f,'kyleLambda':_0x40de93>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x2f710b)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x58a68a,'vpin':_0x92f79f,'kyleLambda':_0x40de93,'ofi':_0x2f710b}};}['getAnalysisState'](_0x4ce2b0,_0x316d29){const _0x5a30cd=_0x4ef43a,_0x4d69d4=this['barHistory'][_0x5a30cd(0x76)](_0x4ce2b0)||[];if(_0x4d69d4[_0x5a30cd(0xac)]<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x4d69d4[_0x5a30cd(0xac)]+_0x5a30cd(0x6c)};const _0x1ca627=this[_0x5a30cd(0xb8)][_0x5a30cd(0x76)](_0x4ce2b0)||[],_0x21297c=this['volumeBuffer']['get'](_0x4ce2b0)||[],_0x95eb25=this['_computeZScore'](_0x1ca627),_0x592c7b=this[_0x5a30cd(0xa1)](_0x21297c),_0x509d43=this['_computeOrderFlowImbalance'](_0x4d69d4),_0x4985ff=this[_0x5a30cd(0x72)](_0x4d69d4),{regime:_0x85649c,params:_0x481443}=this[_0x5a30cd(0x8b)](_0x4ce2b0,_0x4d69d4);return{'ready':!![],'zScore':_0x95eb25,'vpin':_0x592c7b,'ofi':_0x509d43,'kyleLambda':_0x4985ff,'regime':_0x85649c,'stopTicks':Math[_0x5a30cd(0x68)](this['baseStopTicks']*_0x481443['stopMultiplier']),'targetTicks':Math[_0x5a30cd(0x68)](this[_0x5a30cd(0x7c)]*_0x481443['targetMultiplier']),'threshold':_0x481443[_0x5a30cd(0x6a)],'barsProcessed':_0x4d69d4[_0x5a30cd(0xac)],'models':'6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)'};}[_0x4ef43a(0x73)](_0x4697d4){const _0x5aed51=_0x4ef43a;this[_0x5aed51(0x77)][_0x5aed51(0x8a)]({'netPnl':_0x4697d4,'timestamp':Date[_0x5aed51(0xc6)]()});if(this[_0x5aed51(0x77)][_0x5aed51(0xac)]>0x64)this[_0x5aed51(0x77)]['shift']();_0x4697d4>0x0?(this[_0x5aed51(0xca)]++,this[_0x5aed51(0xaf)]=0x0,this[_0x5aed51(0xce)]['wins']++):(this[_0x5aed51(0xaf)]++,this['winStreak']=0x0,this['stats']['losses']++),this['stats']['trades']++,this[_0x5aed51(0xce)][_0x5aed51(0xae)]+=_0x4697d4,this[_0x5aed51(0xc8)]('log',{'type':'debug','message':'[HQX]\x20Trade\x20result:\x20'+(_0x4697d4>0x0?_0x5aed51(0x9c):_0x5aed51(0x93))+'\x20$'+_0x4697d4['toFixed'](0x2)+',\x20streak:\x20'+(_0x4697d4>0x0?this[_0x5aed51(0xca)]:-this['lossStreak'])});}[_0x4ef43a(0x69)](_0x2ce69e){const _0x2d6ea3=_0x4ef43a;return this['barHistory'][_0x2d6ea3(0x76)](_0x2ce69e)||[];}['getStats'](){return this['stats'];}[_0x4ef43a(0x99)](_0x41adc0){const _0x183b0d=_0x4ef43a;this[_0x183b0d(0xad)][_0x183b0d(0x8f)](_0x41adc0,[]),this['priceBuffer'][_0x183b0d(0x8f)](_0x41adc0,[]),this['volumeBuffer'][_0x183b0d(0x8f)](_0x41adc0,[]),this['atrHistory'][_0x183b0d(0x8f)](_0x41adc0,[]),this['kalmanStates'][_0x183b0d(0x8f)](_0x41adc0,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':_0x183b0d(0x7e),'message':_0x183b0d(0xcc)+_0x41adc0});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x46e0c0={}){const _0xd0678e=_0x4ef43a;super(),this['config']=_0x46e0c0,this[_0xd0678e(0xa7)]=new HQXUltraScalping(_0x46e0c0),this['strategy']['on']('signal',_0x474537=>this[_0xd0678e(0xc8)](_0xd0678e(0x70),_0x474537)),this['strategy']['on']('log',_0x70e918=>this[_0xd0678e(0xc8)](_0xd0678e(0x9f),_0x70e918));}['processTick'](_0x3efffa){const _0x313177=_0x4ef43a;return this['strategy'][_0x313177(0x83)](_0x3efffa);}[_0x4ef43a(0xc5)](_0x3f7186){const _0x31dc6c=_0x4ef43a;return this[_0x31dc6c(0xa7)]['onTick'](_0x3f7186);}['onTrade'](_0x975762){const _0x661b68=_0x4ef43a;return this[_0x661b68(0xa7)][_0x661b68(0x7a)](_0x975762);}['processBar'](_0x696d58,_0x22131b){const _0x492215=_0x4ef43a;return this[_0x492215(0xa7)][_0x492215(0xbd)](_0x696d58,_0x22131b);}['initialize'](_0x2857f7,_0x150854,_0x5351a2){const _0x725959=_0x4ef43a;return this[_0x725959(0xa7)]['initialize'](_0x2857f7,_0x150854,_0x5351a2);}[_0x4ef43a(0x67)](_0x1237ca,_0x387bc3){const _0x5ad357=_0x4ef43a;return this['strategy'][_0x5ad357(0x67)](_0x1237ca,_0x387bc3);}[_0x4ef43a(0x73)](_0x2e2f31){const _0x3a74bf=_0x4ef43a;return this[_0x3a74bf(0xa7)]['recordTradeResult'](_0x2e2f31);}[_0x4ef43a(0x99)](_0x4e01ef){const _0x450d1e=_0x4ef43a;return this['strategy'][_0x450d1e(0x99)](_0x4e01ef);}[_0x4ef43a(0x6b)](){const _0x325341=_0x4ef43a;return this[_0x325341(0xa7)]['getStats']();}[_0x4ef43a(0x69)](_0x21a9b2){return this['strategy']['getBarHistory'](_0x21a9b2);}['getModelValues'](_0x47590e){return this['strategy']['getModelValues'](_0x47590e);}[_0x4ef43a(0x91)](_0x50e997){const _0x13b852=_0x4ef43a;return this[_0x13b852(0xa7)]['shouldExitByZScore'](_0x50e997);}[_0x4ef43a(0x94)](_0x32664f){return null;}}module[_0x4ef43a(0x74)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
1
+ const _0x2023a7=_0x41d2;(function(_0xe58ba7,_0x259ef7){const _0x25cf42=_0x41d2,_0x57ee1f=_0xe58ba7();while(!![]){try{const _0x416926=-parseInt(_0x25cf42(0x12d))/0x1+-parseInt(_0x25cf42(0x138))/0x2+-parseInt(_0x25cf42(0xe7))/0x3*(-parseInt(_0x25cf42(0x150))/0x4)+parseInt(_0x25cf42(0x144))/0x5+parseInt(_0x25cf42(0x132))/0x6*(-parseInt(_0x25cf42(0x125))/0x7)+-parseInt(_0x25cf42(0x111))/0x8+-parseInt(_0x25cf42(0x131))/0x9*(-parseInt(_0x25cf42(0x12b))/0xa);if(_0x416926===_0x259ef7)break;else _0x57ee1f['push'](_0x57ee1f['shift']());}catch(_0x16eb56){_0x57ee1f['push'](_0x57ee1f['shift']());}}}(_0x2bdc,0x5bd86));const EventEmitter=require(_0x2023a7(0x10f)),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x3b427a={}){const _0x20a631=_0x2023a7;super(),this['tickSize']=_0x3b427a['tickSize']||0.25,this[_0x20a631(0x129)]=_0x3b427a[_0x20a631(0x129)]||0x5,this[_0x20a631(0x102)]=1.5,this['zscoreExitThreshold']=0.5,this['vpinWindow']=0x32,this['vpinToxicThreshold']=0.7,this[_0x20a631(0x121)]=0.01,this['kalmanMeasurementNoise']=0.1,this[_0x20a631(0xe5)]=0x64,this[_0x20a631(0x14d)]=0x14,this['baseStopTicks']=0x8,this['baseTargetTicks']=0x10,this['breakevenTicks']=0x4,this[_0x20a631(0x13c)]=0.5,this[_0x20a631(0x120)]=0.55,this[_0x20a631(0x127)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x20a631(0xfe)]=new Map(),this[_0x20a631(0x115)]=new Map(),this['volumeBuffer']=new Map(),this['kalmanStates']=new Map(),this['atrHistory']=new Map(),this[_0x20a631(0x105)]=[],this[_0x20a631(0x13e)]=0x0,this['lossStreak']=0x0,this[_0x20a631(0xe3)]=0x0,this['cooldownMs']=0x7530,this[_0x20a631(0xe6)]=0x2710,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0x18a03d,_0x1da83b=0.25,_0x41c908=0x5){const _0x56a49b=_0x2023a7;this[_0x56a49b(0x124)]=_0x1da83b,this[_0x56a49b(0x129)]=_0x41c908,this[_0x56a49b(0xfe)]['set'](_0x18a03d,[]),this[_0x56a49b(0x115)][_0x56a49b(0x126)](_0x18a03d,[]),this['volumeBuffer']['set'](_0x18a03d,[]),this['atrHistory'][_0x56a49b(0x126)](_0x18a03d,[]),this[_0x56a49b(0x10e)][_0x56a49b(0x126)](_0x18a03d,{'estimate':0x0,'errorCovariance':0x1}),this[_0x56a49b(0xea)](_0x56a49b(0x147),{'type':_0x56a49b(0x128),'message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x18a03d+_0x56a49b(0x10a)+_0x1da83b+_0x56a49b(0xfd)+_0x41c908}),this['emit']('log',{'type':_0x56a49b(0x128),'message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}[_0x2023a7(0xe4)](_0x3f133a){const _0x5de93b=_0x2023a7,{contractId:_0x3e303f,price:_0x344888,volume:_0x39befb,side:_0x14f1b6,timestamp:_0x405942}=_0x3f133a,_0x30ec10={'timestamp':_0x405942||Date[_0x5de93b(0x156)](),'open':_0x344888,'high':_0x344888,'low':_0x344888,'close':_0x344888,'volume':_0x39befb||0x1};return this['processBar'](_0x3e303f,_0x30ec10);}['onTick'](_0x27e1fa){return this['processTick'](_0x27e1fa);}['onTrade'](_0x4d60d6){const _0x37ea35=_0x2023a7;return this[_0x37ea35(0xe4)]({'contractId':_0x4d60d6[_0x37ea35(0x13a)]||_0x4d60d6['symbol'],'price':_0x4d60d6[_0x37ea35(0x13d)],'volume':_0x4d60d6['size']||_0x4d60d6['volume']||0x1,'side':_0x4d60d6['side'],'timestamp':_0x4d60d6[_0x37ea35(0x113)]||Date['now']()});}['processBar'](_0x571956,_0xa5b7a3){const _0x2df866=_0x2023a7;let _0x527b8d=this[_0x2df866(0xfe)][_0x2df866(0xf0)](_0x571956);!_0x527b8d&&(this[_0x2df866(0xf2)](_0x571956),_0x527b8d=this[_0x2df866(0xfe)]['get'](_0x571956));_0x527b8d[_0x2df866(0x140)](_0xa5b7a3);if(_0x527b8d['length']>0x1f4)_0x527b8d['shift']();const _0x122fde=this[_0x2df866(0x115)]['get'](_0x571956);_0x122fde[_0x2df866(0x140)](_0xa5b7a3['close']);if(_0x122fde[_0x2df866(0x110)]>0xc8)_0x122fde[_0x2df866(0x10b)]();const _0xeda77c=this[_0x2df866(0xec)][_0x2df866(0xf0)](_0x571956),_0x46a912=_0xa5b7a3[_0x2df866(0x14c)]-_0xa5b7a3[_0x2df866(0x12a)];let _0x3ace07=_0xa5b7a3[_0x2df866(0x157)]*0.5,_0x2767fd=_0xa5b7a3[_0x2df866(0x157)]*0.5;if(_0x46a912>0x0){const _0x42c1e4=(_0xa5b7a3['close']-_0xa5b7a3[_0x2df866(0x12a)])/_0x46a912;_0x3ace07=_0xa5b7a3[_0x2df866(0x157)]*_0x42c1e4,_0x2767fd=_0xa5b7a3[_0x2df866(0x157)]*(0x1-_0x42c1e4);}_0xeda77c[_0x2df866(0x140)]({'buy':_0x3ace07,'sell':_0x2767fd});if(_0xeda77c['length']>0x64)_0xeda77c[_0x2df866(0x10b)]();if(_0x527b8d[_0x2df866(0x110)]<0x32)return null;const _0x22aff5=this['_computeZScore'](_0x122fde),_0x5a89c6=this[_0x2df866(0x155)](_0xeda77c),_0x5408bd=this['_computeKyleLambda'](_0x527b8d),_0x2a4a7f=this['_applyKalmanFilter'](_0x571956,_0xa5b7a3['close']),{regime:_0x413d16,params:_0x59c837}=this[_0x2df866(0x142)](_0x571956,_0x527b8d),_0x424377=this['_computeOrderFlowImbalance'](_0x527b8d);return this[_0x2df866(0xee)](_0x571956,_0xa5b7a3['close'],_0x22aff5,_0x5a89c6,_0x5408bd,_0x2a4a7f,_0x413d16,_0x59c837,_0x424377,_0x527b8d);}['_computeZScore'](_0x3594f9,_0x1987c2=0x32){const _0x595351=_0x2023a7;if(_0x3594f9['length']<_0x1987c2)return 0x0;const _0x57c16b=_0x3594f9[_0x595351(0xfa)](-_0x1987c2),_0x13ead0=_0x57c16b[_0x595351(0x10c)]((_0x504c6f,_0x4ea2dc)=>_0x504c6f+_0x4ea2dc,0x0)/_0x1987c2,_0x1e9866=_0x57c16b['reduce']((_0x54947a,_0x2e0032)=>_0x54947a+Math[_0x595351(0x12c)](_0x2e0032-_0x13ead0,0x2),0x0)/_0x1987c2,_0x21f5db=Math['sqrt'](_0x1e9866);if(_0x21f5db<0.0001)return 0x0;const _0x11a339=_0x3594f9[_0x3594f9[_0x595351(0x110)]-0x1];return(_0x11a339-_0x13ead0)/_0x21f5db;}['_computeVPIN'](_0x54ce35){const _0x24f0b3=_0x2023a7;if(_0x54ce35['length']<this['vpinWindow'])return 0.5;const _0x3a0cbb=_0x54ce35[_0x24f0b3(0xfa)](-this[_0x24f0b3(0xf1)]);let _0x477d71=0x0,_0x58b0c5=0x0;for(const _0x4904d6 of _0x3a0cbb){_0x477d71+=_0x4904d6[_0x24f0b3(0x13b)],_0x58b0c5+=_0x4904d6['sell'];}const _0x323518=_0x477d71+_0x58b0c5;if(_0x323518<0x1)return 0.5;return Math[_0x24f0b3(0xf9)](_0x477d71-_0x58b0c5)/_0x323518;}['_computeKyleLambda'](_0x32b91e){const _0x4fcb29=_0x2023a7;if(_0x32b91e[_0x4fcb29(0x110)]<0x14)return 0x0;const _0x4725fd=_0x32b91e['slice'](-0x14),_0x13f172=[],_0x349eb8=[];for(let _0x236424=0x1;_0x236424<_0x4725fd[_0x4fcb29(0x110)];_0x236424++){_0x13f172['push'](_0x4725fd[_0x236424][_0x4fcb29(0x11f)]-_0x4725fd[_0x236424-0x1]['close']),_0x349eb8[_0x4fcb29(0x140)](_0x4725fd[_0x236424]['volume']);}const _0x8f81df=_0x13f172['reduce']((_0x12ef9f,_0x3daef1)=>_0x12ef9f+_0x3daef1,0x0)/_0x13f172['length'],_0x31063e=_0x349eb8['reduce']((_0x47659b,_0x44048f)=>_0x47659b+_0x44048f,0x0)/_0x349eb8['length'];let _0x17bba6=0x0,_0x4864f7=0x0;for(let _0x198f64=0x0;_0x198f64<_0x13f172['length'];_0x198f64++){_0x17bba6+=(_0x13f172[_0x198f64]-_0x8f81df)*(_0x349eb8[_0x198f64]-_0x31063e),_0x4864f7+=Math[_0x4fcb29(0x12c)](_0x349eb8[_0x198f64]-_0x31063e,0x2);}_0x17bba6/=_0x13f172['length'],_0x4864f7/=_0x13f172['length'];if(_0x4864f7<0.0001)return 0x0;return Math['abs'](_0x17bba6/_0x4864f7);}[_0x2023a7(0x107)](_0xb60e1b,_0xda3591){const _0x9197d9=_0x2023a7;let _0x53d719=this[_0x9197d9(0x10e)][_0x9197d9(0xf0)](_0xb60e1b);if(!_0x53d719)return _0x53d719={'estimate':_0xda3591,'errorCovariance':0x1},this[_0x9197d9(0x10e)][_0x9197d9(0x126)](_0xb60e1b,_0x53d719),_0xda3591;const _0x2c6290=_0x53d719[_0x9197d9(0x136)],_0x243402=_0x53d719['errorCovariance']+this['kalmanProcessNoise'],_0x19b234=_0x243402/(_0x243402+this[_0x9197d9(0x14f)]),_0x5bd76f=_0x2c6290+_0x19b234*(_0xda3591-_0x2c6290),_0xa004b7=(0x1-_0x19b234)*_0x243402;return _0x53d719[_0x9197d9(0x136)]=_0x5bd76f,_0x53d719['errorCovariance']=_0xa004b7,_0x5bd76f;}['_detectVolatilityRegime'](_0x2b638a,_0x1f48bd){const _0x4817fd=_0x2023a7,_0x513335=this[_0x4817fd(0x119)](_0x1f48bd),_0x34d306=_0x513335/this['tickSize'];let _0x479683=this[_0x4817fd(0xf3)]['get'](_0x2b638a);!_0x479683&&(_0x479683=[],this[_0x4817fd(0xf3)][_0x4817fd(0x126)](_0x2b638a,_0x479683));_0x479683['push'](_0x513335);if(_0x479683[_0x4817fd(0x110)]>0x1f4)_0x479683[_0x4817fd(0x10b)]();let _0x1cce76=0.5;_0x479683['length']>=0x14&&(_0x1cce76=_0x479683['filter'](_0x3a3f72=>_0x3a3f72<=_0x513335)['length']/_0x479683[_0x4817fd(0x110)]);let _0x53ce01,_0x12e374;if(_0x1cce76<0.25)_0x53ce01='low',_0x12e374={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x1cce76<0.75?(_0x53ce01='normal',_0x12e374={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x53ce01='high',_0x12e374={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x53ce01,'params':_0x12e374};}['_calculateATR'](_0x513292,_0xb442dd=0xe){const _0x4a7779=_0x2023a7;if(_0x513292['length']<_0xb442dd+0x1)return 2.5;const _0x2a02fb=[];for(let _0x572d11=_0x513292[_0x4a7779(0x110)]-_0xb442dd;_0x572d11<_0x513292[_0x4a7779(0x110)];_0x572d11++){const _0x1acc7d=_0x513292[_0x572d11],_0x4f0707=_0x513292[_0x572d11-0x1][_0x4a7779(0x11f)],_0x52051a=Math[_0x4a7779(0x106)](_0x1acc7d['high']-_0x1acc7d['low'],Math[_0x4a7779(0xf9)](_0x1acc7d[_0x4a7779(0x14c)]-_0x4f0707),Math[_0x4a7779(0xf9)](_0x1acc7d['low']-_0x4f0707));_0x2a02fb['push'](_0x52051a);}return _0x2a02fb[_0x4a7779(0x10c)]((_0x5b377f,_0x580a4e)=>_0x5b377f+_0x580a4e,0x0)/_0x2a02fb['length'];}[_0x2023a7(0x158)](_0x4bb32b){const _0x1ee37b=_0x2023a7;if(_0x4bb32b['length']<this['ofiLookback'])return 0x0;const _0x1b396c=_0x4bb32b[_0x1ee37b(0xfa)](-this[_0x1ee37b(0x14d)]);let _0x30305d=0x0,_0x272570=0x0;for(const _0x3df72b of _0x1b396c){const _0x57fbe7=_0x3df72b['high']-_0x3df72b[_0x1ee37b(0x12a)];if(_0x57fbe7>0x0){const _0x296e40=(_0x3df72b[_0x1ee37b(0x11f)]-_0x3df72b[_0x1ee37b(0x12a)])/_0x57fbe7;_0x30305d+=_0x296e40*_0x3df72b[_0x1ee37b(0x157)],_0x272570+=(0x1-_0x296e40)*_0x3df72b['volume'];}}const _0x176b28=_0x30305d+_0x272570;if(_0x176b28<0x1)return 0x0;return(_0x30305d-_0x272570)/_0x176b28;}['_generateSignal'](_0x4fb3e9,_0x220cf5,_0x1e6ccf,_0x2bbeb5,_0x2b682d,_0x47bba5,_0x509952,_0x1249e1,_0x266d29,_0x11237c){const _0x2d195d=_0x2023a7,_0x18789e=Math[_0x2d195d(0xf9)](_0x1e6ccf);if(_0x18789e<_0x1249e1[_0x2d195d(0x14a)])return null;if(_0x2bbeb5>this[_0x2d195d(0xe9)])return null;let _0x22d619;if(_0x1e6ccf<-_0x1249e1[_0x2d195d(0x14a)])_0x22d619=_0x2d195d(0x139);else{if(_0x1e6ccf>_0x1249e1['zscoreThreshold'])_0x22d619=_0x2d195d(0x101);else return null;}const _0x5c3459=_0x22d619===_0x2d195d(0x139)&&_0x266d29>0.1||_0x22d619==='short'&&_0x266d29<-0.1,_0x571e21=_0x220cf5-_0x47bba5,_0x2ae862=_0x22d619===_0x2d195d(0x139)&&_0x571e21<0x0||_0x22d619==='short'&&_0x571e21>0x0,_0x2d7efd={'zscore':Math['min'](0x1,_0x18789e/0x4),'vpin':0x1-_0x2bbeb5,'kyleLambda':_0x2b682d>0.001?0.5:0.8,'kalman':_0x2ae862?0.8:0.4,'volatility':_0x509952===_0x2d195d(0x11b)?0.8:_0x509952==='low'?0.7:0.6,'ofi':_0x5c3459?0.9:0.5,'composite':0x0};_0x2d7efd[_0x2d195d(0x14e)]=_0x2d7efd['zscore']*this['weights']['zscore']+_0x2d7efd['vpin']*this['weights'][_0x2d195d(0x152)]+_0x2d7efd['kyleLambda']*this[_0x2d195d(0x127)]['kyleLambda']+_0x2d7efd[_0x2d195d(0xf4)]*this[_0x2d195d(0x127)][_0x2d195d(0xf4)]+_0x2d7efd[_0x2d195d(0x145)]*this['weights'][_0x2d195d(0x145)]+_0x2d7efd['ofi']*this[_0x2d195d(0x127)]['ofi'];const _0x27f4fa=Math[_0x2d195d(0x12e)](0x1,_0x2d7efd[_0x2d195d(0x14e)]+_0x1249e1['confidenceBonus']);if(_0x27f4fa<this['minConfidence'])return null;if(Date[_0x2d195d(0x156)]()-this[_0x2d195d(0xe3)]<this[_0x2d195d(0x143)])return null;const _0x10e5ae=Math['round'](this['baseStopTicks']*_0x1249e1['stopMultiplier']),_0x10c48e=Math[_0x2d195d(0xf8)](this['baseTargetTicks']*_0x1249e1[_0x2d195d(0x117)]),_0x3713e8=Math[_0x2d195d(0x106)](0x6,Math[_0x2d195d(0x12e)](0xc,_0x10e5ae)),_0x1c5aec=Math[_0x2d195d(0x106)](_0x3713e8*1.5,Math[_0x2d195d(0x12e)](0x18,_0x10c48e));let _0x59030b,_0x2670c0,_0x1219df,_0x36f57f;_0x22d619===_0x2d195d(0x139)?(_0x59030b=_0x220cf5-_0x3713e8*this['tickSize'],_0x2670c0=_0x220cf5+_0x1c5aec*this[_0x2d195d(0x124)],_0x1219df=_0x220cf5+this[_0x2d195d(0x114)]*this['tickSize'],_0x36f57f=_0x220cf5+_0x1c5aec*this[_0x2d195d(0x13c)]*this['tickSize']):(_0x59030b=_0x220cf5+_0x3713e8*this['tickSize'],_0x2670c0=_0x220cf5-_0x1c5aec*this['tickSize'],_0x1219df=_0x220cf5-this[_0x2d195d(0x114)]*this['tickSize'],_0x36f57f=_0x220cf5-_0x1c5aec*this['profitLockPct']*this['tickSize']);const _0x3452f2=_0x1c5aec/_0x3713e8,_0x4d1e88=Math[_0x2d195d(0xf8)](_0x1c5aec*0.5),_0x5b6191=Math[_0x2d195d(0xf8)](_0x3713e8*0.4);let _0x41df5f=SignalStrength['MODERATE'];if(_0x27f4fa>=0.85)_0x41df5f=SignalStrength[_0x2d195d(0x141)];else{if(_0x27f4fa>=0.75)_0x41df5f=SignalStrength[_0x2d195d(0xe8)];else{if(_0x27f4fa<0.6)_0x41df5f=SignalStrength['WEAK'];}}const _0xb5601=0.5+(_0x27f4fa-0.5)*0.4,_0x1274ea=_0xb5601*Math[_0x2d195d(0xf9)](_0x2670c0-_0x220cf5)-(0x1-_0xb5601)*Math[_0x2d195d(0xf9)](_0x220cf5-_0x59030b);this['lastSignalTime']=Date[_0x2d195d(0x156)](),this['stats'][_0x2d195d(0x146)]++;const _0x5e288c={'id':uuidv4(),'timestamp':Date[_0x2d195d(0x156)](),'symbol':_0x4fb3e9[_0x2d195d(0x153)]('.')[0x0]||_0x4fb3e9,'contractId':_0x4fb3e9,'side':_0x22d619===_0x2d195d(0x139)?OrderSide[_0x2d195d(0x159)]:OrderSide['ASK'],'direction':_0x22d619,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0x41df5f,'edge':_0x1274ea,'confidence':_0x27f4fa,'entry':_0x220cf5,'entryPrice':_0x220cf5,'stopLoss':_0x59030b,'takeProfit':_0x2670c0,'riskReward':_0x3452f2,'stopTicks':_0x3713e8,'targetTicks':_0x1c5aec,'trailTriggerTicks':_0x4d1e88,'trailDistanceTicks':_0x5b6191,'beBreakeven':_0x1219df,'profitLockLevel':_0x36f57f,'zScore':_0x1e6ccf,'zScoreExit':this[_0x2d195d(0x13f)],'vpinValue':_0x2bbeb5,'kyleLambda':_0x2b682d,'kalmanEstimate':_0x47bba5,'volatilityRegime':_0x509952,'ofiValue':_0x266d29,'models':_0x2d7efd,'orderFlowConfirmed':_0x5c3459,'kalmanConfirmed':_0x2ae862,'expires':Date[_0x2d195d(0x156)]()+0xea60};return this[_0x2d195d(0xea)](_0x2d195d(0x109),{'side':_0x22d619==='long'?_0x2d195d(0x13b):'sell','action':_0x2d195d(0x11d),'reason':'Z='+_0x1e6ccf[_0x2d195d(0x122)](0x2)+_0x2d195d(0x116)+(_0x2bbeb5*0x64)[_0x2d195d(0x122)](0x0)+'%,\x20OFI='+(_0x266d29*0x64)['toFixed'](0x0)+_0x2d195d(0x135)+(_0x27f4fa*0x64)[_0x2d195d(0x122)](0x0)+'%',..._0x5e288c}),this[_0x2d195d(0xea)]('log',{'type':_0x2d195d(0x128),'message':'[HQX]\x20SIGNAL:\x20'+_0x22d619[_0x2d195d(0x100)]()+_0x2d195d(0x103)+_0x220cf5['toFixed'](0x2)+_0x2d195d(0x134)+_0x1e6ccf[_0x2d195d(0x122)](0x2)+_0x2d195d(0xef)+(_0x2bbeb5*0x64)[_0x2d195d(0x122)](0x0)+'%\x20OFI:'+(_0x266d29*0x64)[_0x2d195d(0x122)](0x0)+'%\x20Kyle:'+_0x2b682d['toFixed'](0x5)+_0x2d195d(0xf5)+_0x509952+'\x20|\x20Conf:'+(_0x27f4fa*0x64)[_0x2d195d(0x122)](0x0)+'%'}),_0x5e288c;}['shouldExitByZScore'](_0x467e1c){const _0x2f512b=_0x2023a7,_0xd7b508=this['priceBuffer']['get'](_0x467e1c);if(!_0xd7b508||_0xd7b508['length']<0x32)return![];const _0x31187d=this['_computeZScore'](_0xd7b508);return Math[_0x2f512b(0xf9)](_0x31187d)<this[_0x2f512b(0x13f)];}[_0x2023a7(0x137)](_0x26d0f0){const _0x57597c=_0x2023a7,_0x5b7349=this[_0x57597c(0x115)]['get'](_0x26d0f0),_0x4df43c=this[_0x57597c(0xec)][_0x57597c(0xf0)](_0x26d0f0),_0x177c00=this['barHistory']['get'](_0x26d0f0);if(!_0x5b7349||!_0x4df43c||!_0x177c00||_0x177c00[_0x57597c(0x110)]<0x32)return null;const _0x78496f=this['_computeZScore'](_0x5b7349),_0xc6f03=this[_0x57597c(0x155)](_0x4df43c),_0x2b2f40=this['_computeKyleLambda'](_0x177c00),_0x113dfb=this['_computeOrderFlowImbalance'](_0x177c00);return{'zscore':Math['min'](0x1,Math[_0x57597c(0xf9)](_0x78496f)/0x4),'vpin':0x1-_0xc6f03,'kyleLambda':_0x2b2f40>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x113dfb)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x78496f,'vpin':_0xc6f03,'kyleLambda':_0x2b2f40,'ofi':_0x113dfb}};}[_0x2023a7(0x154)](_0x2f0855,_0x1a7ead){const _0x17090b=_0x2023a7,_0x191da4=this[_0x17090b(0xfe)]['get'](_0x2f0855)||[];if(_0x191da4['length']<0x32)return{'ready':![],'message':_0x17090b(0x118)+_0x191da4[_0x17090b(0x110)]+_0x17090b(0xfc)};const _0x4fb90f=this[_0x17090b(0x115)][_0x17090b(0xf0)](_0x2f0855)||[],_0x467441=this['volumeBuffer']['get'](_0x2f0855)||[],_0x319965=this[_0x17090b(0x123)](_0x4fb90f),_0x561a96=this[_0x17090b(0x155)](_0x467441),_0x11f4d7=this['_computeOrderFlowImbalance'](_0x191da4),_0x54d4f2=this['_computeKyleLambda'](_0x191da4),{regime:_0xa1f46b,params:_0x177a6a}=this['_detectVolatilityRegime'](_0x2f0855,_0x191da4);return{'ready':!![],'zScore':_0x319965,'vpin':_0x561a96,'ofi':_0x11f4d7,'kyleLambda':_0x54d4f2,'regime':_0xa1f46b,'stopTicks':Math['round'](this[_0x17090b(0xeb)]*_0x177a6a['stopMultiplier']),'targetTicks':Math['round'](this[_0x17090b(0xf7)]*_0x177a6a[_0x17090b(0x117)]),'threshold':_0x177a6a['zscoreThreshold'],'barsProcessed':_0x191da4['length'],'models':'6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)'};}[_0x2023a7(0x149)](_0x43cdea){const _0x5ef64f=_0x2023a7;this[_0x5ef64f(0x105)]['push']({'netPnl':_0x43cdea,'timestamp':Date['now']()});if(this[_0x5ef64f(0x105)]['length']>0x64)this['recentTrades'][_0x5ef64f(0x10b)]();_0x43cdea>0x0?(this[_0x5ef64f(0x13e)]++,this[_0x5ef64f(0x148)]=0x0,this[_0x5ef64f(0xff)][_0x5ef64f(0x10d)]++):(this[_0x5ef64f(0x148)]++,this['winStreak']=0x0,this[_0x5ef64f(0xff)][_0x5ef64f(0x130)]++),this[_0x5ef64f(0xff)][_0x5ef64f(0x112)]++,this[_0x5ef64f(0xff)][_0x5ef64f(0xed)]+=_0x43cdea,this['emit']('log',{'type':_0x5ef64f(0x14b),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x43cdea>0x0?_0x5ef64f(0x11a):'LOSS')+'\x20$'+_0x43cdea[_0x5ef64f(0x122)](0x2)+_0x5ef64f(0x11c)+(_0x43cdea>0x0?this['winStreak']:-this[_0x5ef64f(0x148)])});}['getBarHistory'](_0x5dc5c1){const _0x2732db=_0x2023a7;return this[_0x2732db(0xfe)]['get'](_0x5dc5c1)||[];}['getStats'](){const _0x32cc1d=_0x2023a7;return this[_0x32cc1d(0xff)];}['reset'](_0x24ac37){const _0x5724c6=_0x2023a7;this[_0x5724c6(0xfe)]['set'](_0x24ac37,[]),this[_0x5724c6(0x115)][_0x5724c6(0x126)](_0x24ac37,[]),this['volumeBuffer'][_0x5724c6(0x126)](_0x24ac37,[]),this['atrHistory'][_0x5724c6(0x126)](_0x24ac37,[]),this[_0x5724c6(0x10e)][_0x5724c6(0x126)](_0x24ac37,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x24ac37});}}function _0x41d2(_0x4e3bf3,_0x54ae4b){_0x4e3bf3=_0x4e3bf3-0xe3;const _0x2bdca3=_0x2bdc();let _0x41d2c8=_0x2bdca3[_0x4e3bf3];return _0x41d2c8;}class UltraScalpingStrategy extends EventEmitter{constructor(_0x2ab4f8={}){const _0x47e567=_0x2023a7;super(),this['config']=_0x2ab4f8,this['strategy']=new HQXUltraScalping(_0x2ab4f8),this[_0x47e567(0x11e)]['on'](_0x47e567(0x109),_0x48c2b3=>this['emit'](_0x47e567(0x109),_0x48c2b3)),this['strategy']['on'](_0x47e567(0x147),_0x46b484=>this['emit'](_0x47e567(0x147),_0x46b484));}['processTick'](_0x3e479e){const _0x58cb92=_0x2023a7;return this[_0x58cb92(0x11e)][_0x58cb92(0xe4)](_0x3e479e);}['onTick'](_0x2f555f){const _0x35af9a=_0x2023a7;return this['strategy'][_0x35af9a(0x12f)](_0x2f555f);}['onTrade'](_0x376a4a){const _0x2e2a24=_0x2023a7;return this['strategy'][_0x2e2a24(0xfb)](_0x376a4a);}['processBar'](_0x22066c,_0x543350){const _0x428d8e=_0x2023a7;return this[_0x428d8e(0x11e)][_0x428d8e(0x151)](_0x22066c,_0x543350);}['initialize'](_0x13e7d7,_0x46cda3,_0x5cec6e){return this['strategy']['initialize'](_0x13e7d7,_0x46cda3,_0x5cec6e);}['getAnalysisState'](_0x490eae,_0x1afc25){const _0x45b1d9=_0x2023a7;return this[_0x45b1d9(0x11e)][_0x45b1d9(0x154)](_0x490eae,_0x1afc25);}[_0x2023a7(0x149)](_0x5bec52){return this['strategy']['recordTradeResult'](_0x5bec52);}['reset'](_0x114e79){const _0x348766=_0x2023a7;return this['strategy'][_0x348766(0x133)](_0x114e79);}['getStats'](){const _0xbee9fa=_0x2023a7;return this[_0xbee9fa(0x11e)][_0xbee9fa(0x104)]();}['getBarHistory'](_0x3d707){const _0x4abef7=_0x2023a7;return this['strategy'][_0x4abef7(0xf6)](_0x3d707);}[_0x2023a7(0x137)](_0x5abeab){const _0x4a9ebf=_0x2023a7;return this['strategy'][_0x4a9ebf(0x137)](_0x5abeab);}[_0x2023a7(0x108)](_0x3cda40){const _0x2d1cc8=_0x2023a7;return this[_0x2d1cc8(0x11e)][_0x2d1cc8(0x108)](_0x3cda40);}['generateSignal'](_0x2383b9){return null;}}module['exports']={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};function _0x2bdc(){const _0x3417c4=['volatilityLookback','minHoldTimeMs','711tIExVh','STRONG','vpinToxicThreshold','emit','baseStopTicks','volumeBuffer','pnl','_generateSignal','\x20VPIN:','get','vpinWindow','initialize','atrHistory','kalman','\x20Regime:','getBarHistory','baseTargetTicks','round','abs','slice','onTrade','/50\x20bars',',\x20value=','barHistory','stats','toUpperCase','short','zscoreEntryThreshold','\x20@\x20','getStats','recentTrades','max','_applyKalmanFilter','shouldExitByZScore','signal',':\x20tick=','shift','reduce','wins','kalmanStates','events','length','355624SKrifv','trades','timestamp','breakevenTicks','priceBuffer',',\x20VPIN=','targetMultiplier','Collecting\x20data...\x20','_calculateATR','WIN','normal',',\x20streak:\x20','open','strategy','close','minConfidence','kalmanProcessNoise','toFixed','_computeZScore','tickSize','819FnLiWe','set','weights','info','tickValue','low','329230hMpPZm','pow','131875ZFWxEm','min','onTick','losses','90pUOBeK','5154WkNrmG','reset','\x20|\x20Z:','%,\x20cf=','estimate','getModelValues','947906AFLwKx','long','contractId','buy','profitLockPct','price','winStreak','zscoreExitThreshold','push','VERY_STRONG','_detectVolatilityRegime','cooldownMs','465755ICaoUP','volatility','signals','log','lossStreak','recordTradeResult','zscoreThreshold','debug','high','ofiLookback','composite','kalmanMeasurementNoise','11892lLuCUM','processBar','vpin','split','getAnalysisState','_computeVPIN','now','volume','_computeOrderFlowImbalance','BID','lastSignalTime','processTick'];_0x2bdc=function(){return _0x3417c4;};return _0x2bdc();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.130",
3
+ "version": "2.9.132",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -395,11 +395,22 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
395
395
  await marketFeed.connect(rithmicCredentials);
396
396
  await marketFeed.subscribe(symbolCode, contract.exchange || 'CME');
397
397
 
398
- // HQX-2B strategy warmup message
399
- // Note: HISTORY_PLANT returns limited ticks (10k max = ~1 second of data)
400
- // which is not enough for 1-min bar aggregation. Strategy warms up with live data.
401
- if (strategyId === 'hqx-2b') {
402
- ui.addLog('system', 'HQX-2B warming up - needs ~3 min for first signals...');
398
+ // Load historical bars for instant warmup
399
+ if (strategy.preloadBars) {
400
+ ui.addLog('system', 'Loading historical data...');
401
+ try {
402
+ const histBars = await marketFeed.getHistoricalBars(symbolCode, contract.exchange || 'CME', 30);
403
+ if (histBars && histBars.length > 0) {
404
+ strategy.preloadBars(contractId, histBars);
405
+ ui.addLog('system', `Loaded ${histBars.length} historical bars - ready to trade!`);
406
+ sessionLogger.log('HISTORY', `Preloaded ${histBars.length} bars`);
407
+ } else {
408
+ ui.addLog('system', 'No history available - warming up with live data...');
409
+ }
410
+ } catch (histErr) {
411
+ ui.addLog('system', `History load failed: ${histErr.message} - using live data`);
412
+ sessionLogger.log('HISTORY', `Failed: ${histErr.message}`);
413
+ }
403
414
  }
404
415
  } catch (e) {
405
416
  ui.addLog('error', `Failed to connect: ${e.message}`);