hedgequantx 2.9.130 → 2.9.131

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
+ function _0x3c3f(){const _0x46117a=['lastSignalTime','getFullYear','\x20historical\x20bars...','tickValue','_updateZones','maxZoneAgeBars','tickSize','isValid','signals','SUPPORT','length','enabled','t,\x20Trail=','getStats','recentTrades','symbol','_getVolumeRatio','x\x20|\x20Conf:','close','exitBarIndex','low',':\x20tick=','_tickCount','barHistory','entryBarIndex','priceLow','priceHigh','processBar','minBodyRatio','onTick','activeSweeps','\x20@\x20','long','emit','liquidityZones','\x20closed\x20@\x20','clusterToleranceTicks','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','America/New_York','s\x20<\x20','trailDistanceTicks','\x20H:','isArray','uuid','cooldownBars','open','signal','get','barIndex','stats','contractId','getLevel','resistance','durationBars','filter','config','preloadBars','\x20|\x20O:','x\x20|\x20Q:','t,\x20Target=','[2B]\x20NEW\x20SWING\x20','minPenetrationTicks','\x20|\x20Bar\x20','maxDurationBars','price','type','BID','toUpperCase','_detectSwings','shift','short','3402636llhlyn','\x20|\x20Valid:\x20','min','penetrationTicks','now','wins','swept','HIGH_SWEEP','\x20zones','stopTicks','timestamp','sweepType','size','breakevenTicks','qualityScore','2B\x20','[SWING]\x20NEW\x20HIGH\x20@\x20','_mergeConfig','\x20|\x20Total:\x20','t,\x20BE=','extremePrice','set','find','10737041vgMdXj','high','[2B]\x20SWEEP\x20','\x20|\x20Pen:','floor','support','\x20swings,\x20','lookbackBars','info','reset','MODERATE','log','[SWING]\x20NEW\x20LOW\x20@\x20','[HQX-2B]\x20Initialized\x20for\x20','session','minStrength','26162992hJuefX','54HXgmBP','volume','[HQX-2B]\x20Reset\x20state\x20for\x20','sort','abs','[HQX-2B]\x20Trade\x20result:\x20','execution','68438ysmZZa','\x20L:','getBarHistory','push','lastUsedBarIndex','323357hZOlZD','trailTriggerTicks','targetTicks','_scoreSweep','swing','swingPoints','7839295fiKrBO','[BAR]\x20#','startTime','volumeRatio','LOW_SWEEP','touches','[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)','toFixed','debug','getTimezoneOffset','currentBar','minVolumeRatio','_detectSweep','\x20historical\x20signals\x20detected\x20(ignored)','barIntervalMs','WIN','Collecting\x20data...\x20','53204MyKQeC','distance','zone','strategy','processTick','getHealthStatus','max','strength','RESISTANCE','[2B]\x20NEW\x20ZONE\x20'];_0x3c3f=function(){return _0x46117a;};return _0x3c3f();}function _0x21a1(_0x212681,_0xebdd1f){_0x212681=_0x212681-0x134;const _0x3c3f23=_0x3c3f();let _0x21a1d7=_0x3c3f23[_0x212681];return _0x21a1d7;}const _0x2b7f26=_0x21a1;(function(_0x34201e,_0x46ebca){const _0x3608db=_0x21a1,_0x2b8f76=_0x34201e();while(!![]){try{const _0x52ce90=parseInt(_0x3608db(0x160))/0x1+parseInt(_0x3608db(0x15b))/0x2+-parseInt(_0x3608db(0x154))/0x3*(-parseInt(_0x3608db(0x177))/0x4)+parseInt(_0x3608db(0x166))/0x5+parseInt(_0x3608db(0x1c8))/0x6+parseInt(_0x3608db(0x143))/0x7+-parseInt(_0x3608db(0x153))/0x8;if(_0x52ce90===_0x46ebca)break;else _0x2b8f76['push'](_0x2b8f76['shift']());}catch(_0x4935c9){_0x2b8f76['push'](_0x2b8f76['shift']());}}}(_0x3c3f,0xf3078));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x2b7f26(0x1ac)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':_0x2b7f26(0x195)},ZoneType={'RESISTANCE':_0x2b7f26(0x1b5),'SUPPORT':_0x2b7f26(0x148)},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':_0x2b7f26(0x1a7)}};class SwingPoint{constructor(_0xf0e236,_0x4f7e3a,_0x35704e,_0x179ee7,_0x3b2e8a=0x1){const _0x43a524=_0x2b7f26;this[_0x43a524(0x1c2)]=_0xf0e236,this['price']=_0x4f7e3a,this[_0x43a524(0x1b1)]=_0x35704e,this[_0x43a524(0x136)]=_0x179ee7,this['strength']=_0x3b2e8a;}}class LiquidityZone{constructor(_0x49e7e9,_0x1262c8,_0x1e3e37,_0x466614,_0xbae350){const _0x31182c=_0x2b7f26;this['id']=uuidv4(),this[_0x31182c(0x1c2)]=_0x49e7e9,this['priceHigh']=_0x1262c8,this['priceLow']=_0x1e3e37,this['createdAt']=_0x466614,this[_0x31182c(0x1b1)]=_0xbae350,this['touches']=0x1,this['swept']=![],this['sweptAt']=null,this['lastUsedBarIndex']=-0x3e7,this['qualityScore']=0.5;}['containsPrice'](_0x23d7f5,_0x1b2ec0,_0x2c2dd0){const _0xba3b4e=_0x2b7f26,_0x135abd=_0x1b2ec0*_0x2c2dd0;return _0x23d7f5>=this['priceLow']-_0x135abd&&_0x23d7f5<=this[_0xba3b4e(0x19b)]+_0x135abd;}['getLevel'](){const _0x3a5acc=_0x2b7f26;return(this[_0x3a5acc(0x19b)]+this[_0x3a5acc(0x19a)])/0x2;}}class SweepEvent{constructor(_0x53015d,_0x1812a1,_0x4cb18e,_0x9d3d34,_0x22a75d){const _0x3d52cb=_0x2b7f26;this[_0x3d52cb(0x137)]=_0x53015d,this[_0x3d52cb(0x179)]=_0x1812a1,this[_0x3d52cb(0x199)]=_0x4cb18e,this['extremeBarIndex']=_0x9d3d34,this[_0x3d52cb(0x140)]=_0x22a75d,this[_0x3d52cb(0x194)]=null,this[_0x3d52cb(0x188)]=![],this['qualityScore']=0x0,this['penetrationTicks']=0x0,this['durationBars']=0x0,this[_0x3d52cb(0x169)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x4e94a6={}){const _0x4414f4=_0x2b7f26;super(),this[_0x4414f4(0x1b8)]=this[_0x4414f4(0x13d)](DEFAULT_CONFIG,_0x4e94a6),this[_0x4414f4(0x187)]=this['config']['tickSize'],this['tickValue']=this[_0x4414f4(0x1b8)][_0x4414f4(0x184)],this['barHistory']=new Map(),this[_0x4414f4(0x165)]=new Map(),this[_0x4414f4(0x1a3)]=new Map(),this['activeSweeps']=new Map(),this['currentBar']=new Map(),this[_0x4414f4(0x174)]=0xea60,this['lastSignalTime']=0x0,this[_0x4414f4(0x168)]=Date['now'](),this[_0x4414f4(0x1b2)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x4414f4(0x18f)]=[];}['_mergeConfig'](_0x533215,_0x2b1aa7){const _0x35336f=_0x2b7f26,_0x3a939b={..._0x533215};for(const _0x4442a7 in _0x2b1aa7){typeof _0x2b1aa7[_0x4442a7]==='object'&&!Array[_0x35336f(0x1ab)](_0x2b1aa7[_0x4442a7])?_0x3a939b[_0x4442a7]={..._0x533215[_0x4442a7],..._0x2b1aa7[_0x4442a7]}:_0x3a939b[_0x4442a7]=_0x2b1aa7[_0x4442a7];}return _0x3a939b;}['isWithinSession'](_0x67c104){const _0x20325a=_0x2b7f26;if(!this['config'][_0x20325a(0x151)][_0x20325a(0x18c)])return!![];const _0x5d4431=new Date(_0x67c104),_0x5024f3=this['isDST'](_0x5d4431)?-0x4:-0x5,_0x49dd08=_0x5d4431['getUTCHours'](),_0x1e0bf6=_0x5d4431['getUTCMinutes'](),_0x4e6dd3=(_0x49dd08+_0x5024f3+0x18)%0x18,{startHour:_0x1d30ba,startMinute:_0x371c1c,endHour:_0x35ddc2,endMinute:_0x667736}=this[_0x20325a(0x1b8)][_0x20325a(0x151)],_0x1f1875=_0x4e6dd3*0x3c+_0x1e0bf6,_0x3ab779=_0x1d30ba*0x3c+_0x371c1c,_0x37a76b=_0x35ddc2*0x3c+_0x667736;return _0x1f1875>=_0x3ab779&&_0x1f1875<_0x37a76b;}['isDST'](_0x3849b9){const _0x986235=_0x2b7f26,_0x386a1a=new Date(_0x3849b9[_0x986235(0x182)](),0x0,0x1),_0x2ab044=new Date(_0x3849b9[_0x986235(0x182)](),0x6,0x1),_0x5f132d=Math['max'](_0x386a1a[_0x986235(0x16f)](),_0x2ab044[_0x986235(0x16f)]());return _0x3849b9['getTimezoneOffset']()<_0x5f132d;}['initialize'](_0x5b49f2,_0x1e887d=0.25,_0x1a1603=0x5){const _0x584914=_0x2b7f26;this['tickSize']=_0x1e887d,this['tickValue']=_0x1a1603,this[_0x584914(0x1b8)]['tickSize']=_0x1e887d,this['config'][_0x584914(0x184)]=_0x1a1603,this[_0x584914(0x198)][_0x584914(0x141)](_0x5b49f2,[]),this['swingPoints']['set'](_0x5b49f2,[]),this['liquidityZones']['set'](_0x5b49f2,[]),this[_0x584914(0x19f)]['set'](_0x5b49f2,[]),this[_0x584914(0x170)]['delete'](_0x5b49f2),this['emit']('log',{'type':'info','message':_0x584914(0x150)+_0x5b49f2+_0x584914(0x196)+_0x1e887d+',\x20value='+_0x1a1603+',\x20TF=1min'}),this[_0x584914(0x1a2)](_0x584914(0x14e),{'type':_0x584914(0x14b),'message':'[HQX-2B]\x20Params:\x20Stop='+this['config']['execution']['stopTicks']+_0x584914(0x1bc)+this['config'][_0x584914(0x15a)][_0x584914(0x162)]+_0x584914(0x13f)+this['config'][_0x584914(0x15a)][_0x584914(0x139)]+_0x584914(0x18d)+this['config'][_0x584914(0x15a)][_0x584914(0x161)]+'/'+this['config'][_0x584914(0x15a)][_0x584914(0x1a9)]});}[_0x2b7f26(0x17b)](_0x15adae){const _0x492a22=_0x2b7f26,{contractId:_0xd91c87,price:_0x470291,volume:_0x56b393,timestamp:_0xf8c6c5}=_0x15adae,_0x41511c=_0xf8c6c5||Date[_0x492a22(0x1cc)](),_0x1bf693=_0x56b393||0x1;if(!this['isWithinSession'](_0x41511c))return null;if(!this[_0x492a22(0x197)])this['_tickCount']=0x0;this[_0x492a22(0x197)]++;let _0x353b5c=this['currentBar']['get'](_0xd91c87);const _0x4fa15c=Math[_0x492a22(0x147)](_0x41511c/this['barIntervalMs'])*this[_0x492a22(0x174)];if(!_0x353b5c||_0x353b5c['startTime']!==_0x4fa15c){if(_0x353b5c){const _0x2a41bc={'timestamp':_0x353b5c['startTime'],'open':_0x353b5c['open'],'high':_0x353b5c[_0x492a22(0x144)],'low':_0x353b5c[_0x492a22(0x195)],'close':_0x353b5c[_0x492a22(0x193)],'volume':_0x353b5c[_0x492a22(0x155)]},_0x560d4e=this['barHistory']['get'](_0xd91c87)||[];this[_0x492a22(0x1a2)]('log',{'type':'debug','message':_0x492a22(0x167)+(_0x560d4e['length']+0x1)+_0x492a22(0x1a4)+_0x2a41bc[_0x492a22(0x193)]['toFixed'](0x2)+_0x492a22(0x1ba)+_0x2a41bc['open']['toFixed'](0x2)+_0x492a22(0x1aa)+_0x2a41bc[_0x492a22(0x144)]['toFixed'](0x2)+_0x492a22(0x15c)+_0x2a41bc['low'][_0x492a22(0x16d)](0x2)+'\x20Vol:'+_0x2a41bc[_0x492a22(0x155)]});const _0x2894bd=this[_0x492a22(0x19c)](_0xd91c87,_0x2a41bc);return this['currentBar'][_0x492a22(0x141)](_0xd91c87,{'startTime':_0x4fa15c,'open':_0x470291,'high':_0x470291,'low':_0x470291,'close':_0x470291,'volume':_0x1bf693}),_0x2894bd;}else return this[_0x492a22(0x170)]['set'](_0xd91c87,{'startTime':_0x4fa15c,'open':_0x470291,'high':_0x470291,'low':_0x470291,'close':_0x470291,'volume':_0x1bf693}),null;}else return _0x353b5c[_0x492a22(0x144)]=Math['max'](_0x353b5c['high'],_0x470291),_0x353b5c[_0x492a22(0x195)]=Math[_0x492a22(0x1ca)](_0x353b5c[_0x492a22(0x195)],_0x470291),_0x353b5c['close']=_0x470291,_0x353b5c['volume']+=_0x1bf693,null;}['onTick'](_0x321c3a){const _0x1d8ba3=_0x2b7f26;return this[_0x1d8ba3(0x17b)](_0x321c3a);}['onTrade'](_0x1b7389){const _0x993456=_0x2b7f26;return this['processTick']({'contractId':_0x1b7389[_0x993456(0x1b3)]||_0x1b7389[_0x993456(0x190)],'price':_0x1b7389['price'],'volume':_0x1b7389[_0x993456(0x138)]||_0x1b7389['volume']||0x1,'timestamp':_0x1b7389[_0x993456(0x136)]||Date['now']()});}['processBar'](_0x1a7a65,_0x164133){const _0x22bd32=_0x2b7f26;let _0x418086=this['barHistory'][_0x22bd32(0x1b0)](_0x1a7a65);!_0x418086&&(this['initialize'](_0x1a7a65),_0x418086=this['barHistory']['get'](_0x1a7a65));_0x418086['push'](_0x164133);if(_0x418086['length']>0x1f4)_0x418086[_0x22bd32(0x1c6)]();const _0x242f18=_0x418086[_0x22bd32(0x18b)]-0x1;if(_0x418086['length']<this[_0x22bd32(0x1b8)][_0x22bd32(0x164)][_0x22bd32(0x14a)]*0x3)return null;const _0x789f49=this[_0x22bd32(0x165)][_0x22bd32(0x1b0)](_0x1a7a65)['length'];this[_0x22bd32(0x1c5)](_0x1a7a65,_0x418086,_0x242f18);const _0x395caf=this['swingPoints']['get'](_0x1a7a65);if(_0x395caf[_0x22bd32(0x18b)]>_0x789f49){const _0x108e48=_0x395caf[_0x395caf['length']-0x1];this[_0x22bd32(0x1a2)]('log',{'type':_0x22bd32(0x16e),'message':_0x22bd32(0x1bd)+_0x108e48['type']['toUpperCase']()+'\x20@\x20'+_0x108e48[_0x22bd32(0x1c1)][_0x22bd32(0x16d)](0x2)+'\x20|\x20Total:\x20'+_0x395caf[_0x22bd32(0x18b)]});}const _0x175b47=this[_0x22bd32(0x172)](_0x1a7a65,_0x418086,_0x242f18);_0x175b47&&this[_0x22bd32(0x1a2)](_0x22bd32(0x14e),{'type':_0x22bd32(0x16e),'message':_0x22bd32(0x145)+_0x175b47[_0x22bd32(0x137)]+_0x22bd32(0x1c9)+_0x175b47['isValid']+'\x20|\x20Pen:\x20'+_0x175b47[_0x22bd32(0x1cb)]['toFixed'](0x1)+'t\x20|\x20Q:\x20'+(_0x175b47[_0x22bd32(0x13a)]*0x64)[_0x22bd32(0x16d)](0x0)+'%'});const _0x6a1a3e=this['liquidityZones']['get'](_0x1a7a65)[_0x22bd32(0x18b)];this['_updateZones'](_0x1a7a65,_0x242f18);const _0x5cad77=this['liquidityZones'][_0x22bd32(0x1b0)](_0x1a7a65);if(_0x5cad77[_0x22bd32(0x18b)]>_0x6a1a3e){const _0xbf1da6=_0x5cad77[_0x5cad77['length']-0x1];this['emit'](_0x22bd32(0x14e),{'type':'debug','message':_0x22bd32(0x180)+_0xbf1da6['type'][_0x22bd32(0x1c4)]()+_0x22bd32(0x1a0)+_0xbf1da6[_0x22bd32(0x1b4)]()['toFixed'](0x2)+_0x22bd32(0x13e)+_0x5cad77[_0x22bd32(0x18b)]});}if(_0x175b47&&_0x175b47[_0x22bd32(0x188)]){this['emit'](_0x22bd32(0x14e),{'type':_0x22bd32(0x16e),'message':'[2B]\x20Calling\x20_generateSignal\x20for\x20'+_0x175b47['sweepType']+'\x20sweep...'});const _0x13a970=this['_generateSignal'](_0x1a7a65,_0x164133,_0x242f18,_0x175b47);return!_0x13a970&&this[_0x22bd32(0x1a2)]('log',{'type':'debug','message':_0x22bd32(0x16c)}),_0x13a970;}return null;}['_detectSwings'](_0x544fec,_0x16a019,_0x273844){const _0x1b2bde=_0x2b7f26,_0x3a9928=this['config'][_0x1b2bde(0x164)]['lookbackBars'],_0x4bbfb7=this[_0x1b2bde(0x1b8)]['swing'][_0x1b2bde(0x152)];if(_0x273844<_0x3a9928*0x2)return;const _0x4e701f=this['swingPoints']['get'](_0x544fec),_0x140017=_0x273844-_0x3a9928,_0x257771=_0x16a019[_0x140017];_0x273844%0x5===0x0&&this[_0x1b2bde(0x1a2)]('log',{'type':'debug','message':'[SWING]\x20Checking\x20pivot\x20at\x20bar\x20'+_0x140017+'\x20|\x20H:'+_0x257771['high']['toFixed'](0x2)+_0x1b2bde(0x15c)+_0x257771[_0x1b2bde(0x195)][_0x1b2bde(0x16d)](0x2)+'\x20|\x20Total\x20swings:\x20'+_0x4e701f[_0x1b2bde(0x18b)]});let _0x280935=!![],_0x521908=0x0;for(let _0x1a6853=_0x140017-_0x3a9928;_0x1a6853<=_0x140017+_0x3a9928;_0x1a6853++){if(_0x1a6853===_0x140017||_0x1a6853<0x0||_0x1a6853>=_0x16a019[_0x1b2bde(0x18b)])continue;if(_0x16a019[_0x1a6853][_0x1b2bde(0x144)]>=_0x257771[_0x1b2bde(0x144)]){_0x280935=![];break;}_0x521908++;}if(_0x280935&&_0x521908>=_0x4bbfb7){const _0x5bed70=_0x4e701f[_0x1b2bde(0x142)](_0x337342=>_0x337342[_0x1b2bde(0x1b1)]===_0x140017&&_0x337342['type']===_0x1b2bde(0x144));!_0x5bed70&&(_0x4e701f['push'](new SwingPoint('high',_0x257771['high'],_0x140017,_0x257771[_0x1b2bde(0x136)],_0x521908)),this[_0x1b2bde(0x1a2)]('log',{'type':_0x1b2bde(0x16e),'message':_0x1b2bde(0x13c)+_0x257771[_0x1b2bde(0x144)]['toFixed'](0x2)+'\x20|\x20Bar\x20'+_0x140017+'\x20|\x20Strength:\x20'+_0x521908}));}let _0x26d6ea=!![],_0x4b3dfc=0x0;for(let _0x4227e3=_0x140017-_0x3a9928;_0x4227e3<=_0x140017+_0x3a9928;_0x4227e3++){if(_0x4227e3===_0x140017||_0x4227e3<0x0||_0x4227e3>=_0x16a019[_0x1b2bde(0x18b)])continue;if(_0x16a019[_0x4227e3][_0x1b2bde(0x195)]<=_0x257771['low']){_0x26d6ea=![];break;}_0x4b3dfc++;}if(_0x26d6ea&&_0x4b3dfc>=_0x4bbfb7){const _0x25746a=_0x4e701f[_0x1b2bde(0x142)](_0xedd508=>_0xedd508[_0x1b2bde(0x1b1)]===_0x140017&&_0xedd508[_0x1b2bde(0x1c2)]==='low');!_0x25746a&&(_0x4e701f[_0x1b2bde(0x15e)](new SwingPoint('low',_0x257771[_0x1b2bde(0x195)],_0x140017,_0x257771['timestamp'],_0x4b3dfc)),this[_0x1b2bde(0x1a2)]('log',{'type':'debug','message':_0x1b2bde(0x14f)+_0x257771['low'][_0x1b2bde(0x16d)](0x2)+_0x1b2bde(0x1bf)+_0x140017+'\x20|\x20Strength:\x20'+_0x4b3dfc}));}const _0x4aec4c=this['config']['zone']['maxZoneAgeBars'];while(_0x4e701f[_0x1b2bde(0x18b)]>0x0&&_0x4e701f[0x0]['barIndex']<_0x273844-_0x4aec4c){_0x4e701f[_0x1b2bde(0x1c6)]();}}[_0x2b7f26(0x185)](_0x196629,_0x2bfee0){const _0x31d1b0=_0x2b7f26,_0x25fba2=this['swingPoints'][_0x31d1b0(0x1b0)](_0x196629),_0x119925=this['liquidityZones']['get'](_0x196629),_0x3adb61=this['config']['zone']['clusterToleranceTicks']*this['tickSize'],_0x5e7d4e=this['config'][_0x31d1b0(0x179)][_0x31d1b0(0x186)];for(let _0x553991=_0x119925[_0x31d1b0(0x18b)]-0x1;_0x553991>=0x0;_0x553991--){_0x2bfee0-_0x119925[_0x553991][_0x31d1b0(0x1b1)]>_0x5e7d4e&&_0x119925['splice'](_0x553991,0x1);}for(const _0x451aa4 of _0x25fba2){let _0x38f244=null;for(const _0x5c15cc of _0x119925){if(_0x5c15cc['containsPrice'](_0x451aa4['price'],this[_0x31d1b0(0x1b8)]['zone'][_0x31d1b0(0x1a5)],this[_0x31d1b0(0x187)])){_0x38f244=_0x5c15cc;break;}}if(_0x38f244){_0x38f244[_0x31d1b0(0x16b)]++;if(_0x451aa4['price']>_0x38f244[_0x31d1b0(0x19b)])_0x38f244['priceHigh']=_0x451aa4[_0x31d1b0(0x1c1)];if(_0x451aa4['price']<_0x38f244[_0x31d1b0(0x19a)])_0x38f244[_0x31d1b0(0x19a)]=_0x451aa4['price'];_0x38f244['qualityScore']=Math[_0x31d1b0(0x1ca)](0x1,0.3+_0x38f244['touches']*0.15);}else{const _0x8620a6=_0x451aa4[_0x31d1b0(0x1c2)]===_0x31d1b0(0x144)?ZoneType['RESISTANCE']:ZoneType['SUPPORT'],_0xff29f5=new LiquidityZone(_0x8620a6,_0x451aa4['price']+_0x3adb61/0x2,_0x451aa4[_0x31d1b0(0x1c1)]-_0x3adb61/0x2,_0x451aa4['timestamp'],_0x451aa4[_0x31d1b0(0x1b1)]);_0xff29f5['qualityScore']=0.3+_0x451aa4[_0x31d1b0(0x17e)]*0.1,_0x119925['push'](_0xff29f5);}}}[_0x2b7f26(0x172)](_0x253098,_0x476147,_0x3b7b82){const _0x4d84aa=_0x2b7f26,_0x1f77d3=this[_0x4d84aa(0x1a3)]['get'](_0x253098),_0x5ee966=_0x476147[_0x3b7b82],_0x207ef8=_0x5ee966['close'],_0x177358=this['config']['sweep'],_0x3a40d3=this[_0x4d84aa(0x1b8)][_0x4d84aa(0x179)];for(const _0x2b4579 of _0x1f77d3){if(_0x2b4579['lastUsedBarIndex']>=0x0&&_0x3b7b82-_0x2b4579[_0x4d84aa(0x15f)]<_0x3a40d3[_0x4d84aa(0x1ad)])continue;const _0x48383d=_0x2b4579['getLevel'](),_0x55cbb9=Math[_0x4d84aa(0x158)](_0x207ef8-_0x48383d)/this['tickSize'];if(_0x55cbb9>_0x3a40d3['maxZoneDistanceTicks'])continue;const _0x3d2830=Math[_0x4d84aa(0x17d)](0x0,_0x3b7b82-_0x177358[_0x4d84aa(0x1c0)]*0x2);for(let _0x4f10fa=_0x3d2830;_0x4f10fa<_0x3b7b82;_0x4f10fa++){const _0x3ca6b8=_0x476147[_0x4f10fa];if(_0x2b4579['type']===ZoneType[_0x4d84aa(0x17f)]){const _0x67dbd=(_0x3ca6b8[_0x4d84aa(0x144)]-_0x2b4579['priceHigh'])/this['tickSize'];if(_0x67dbd>=_0x177358[_0x4d84aa(0x1be)]&&_0x67dbd<=_0x177358['maxPenetrationTicks']){const _0x51bc6f=Math['min'](_0x2b4579[_0x4d84aa(0x19b)],_0x2b4579['priceHigh']+_0x67dbd*this[_0x4d84aa(0x187)]);if(_0x207ef8<_0x51bc6f+this[_0x4d84aa(0x187)]*0x2){const _0x27a18e=_0x3ca6b8[_0x4d84aa(0x144)]-_0x3ca6b8[_0x4d84aa(0x195)],_0x56b9d0=Math['abs'](_0x3ca6b8[_0x4d84aa(0x193)]-_0x3ca6b8[_0x4d84aa(0x1ae)]),_0x456d0c=_0x27a18e>0x0?_0x56b9d0/_0x27a18e:0x0;if(_0x456d0c>=_0x177358['minBodyRatio']){const _0x3dd38c=this['_getVolumeRatio'](_0x476147,_0x4f10fa,0x14);if(_0x3dd38c>=_0x177358[_0x4d84aa(0x171)]){const _0x46adbf=new SweepEvent(SweepType[_0x4d84aa(0x1cf)],_0x2b4579,_0x4f10fa,_0x4f10fa,_0x3ca6b8['high']);_0x46adbf[_0x4d84aa(0x194)]=_0x3b7b82,_0x46adbf[_0x4d84aa(0x1cb)]=_0x67dbd,_0x46adbf['durationBars']=_0x3b7b82-_0x4f10fa,_0x46adbf[_0x4d84aa(0x169)]=_0x3dd38c,_0x46adbf[_0x4d84aa(0x13a)]=this['_scoreSweep'](_0x46adbf,_0x456d0c),_0x46adbf['isValid']=_0x46adbf['qualityScore']>=_0x177358['minQualityScore'];if(_0x46adbf['isValid'])return _0x46adbf;}}}}}if(_0x2b4579['type']===ZoneType[_0x4d84aa(0x18a)]){const _0x24bc95=(_0x2b4579['priceLow']-_0x3ca6b8['low'])/this[_0x4d84aa(0x187)];if(_0x24bc95>=_0x177358['minPenetrationTicks']&&_0x24bc95<=_0x177358['maxPenetrationTicks']){const _0x521aa4=Math[_0x4d84aa(0x17d)](_0x2b4579[_0x4d84aa(0x19a)],_0x2b4579['priceLow']-_0x24bc95*this[_0x4d84aa(0x187)]);if(_0x207ef8>_0x521aa4-this['tickSize']*0x2){const _0x42dd6c=_0x3ca6b8['high']-_0x3ca6b8[_0x4d84aa(0x195)],_0x4ccfeb=Math['abs'](_0x3ca6b8['close']-_0x3ca6b8['open']),_0x40bdb1=_0x42dd6c>0x0?_0x4ccfeb/_0x42dd6c:0x0;if(_0x40bdb1>=_0x177358[_0x4d84aa(0x19d)]){const _0x4ab1f4=this[_0x4d84aa(0x191)](_0x476147,_0x4f10fa,0x14);if(_0x4ab1f4>=_0x177358[_0x4d84aa(0x171)]){const _0x2bd8cb=new SweepEvent(SweepType[_0x4d84aa(0x16a)],_0x2b4579,_0x4f10fa,_0x4f10fa,_0x3ca6b8[_0x4d84aa(0x195)]);_0x2bd8cb['exitBarIndex']=_0x3b7b82,_0x2bd8cb[_0x4d84aa(0x1cb)]=_0x24bc95,_0x2bd8cb[_0x4d84aa(0x1b6)]=_0x3b7b82-_0x4f10fa,_0x2bd8cb['volumeRatio']=_0x4ab1f4,_0x2bd8cb[_0x4d84aa(0x13a)]=this['_scoreSweep'](_0x2bd8cb,_0x40bdb1),_0x2bd8cb['isValid']=_0x2bd8cb[_0x4d84aa(0x13a)]>=_0x177358['minQualityScore'];if(_0x2bd8cb[_0x4d84aa(0x188)])return _0x2bd8cb;}}}}}}}return null;}[_0x2b7f26(0x191)](_0x4757d5,_0x561020,_0x2a0d77){const _0x4b9126=_0x2b7f26,_0x40ed60=Math['max'](0x0,_0x561020-_0x2a0d77),_0x5ae0b1=_0x4757d5['slice'](_0x40ed60,_0x561020);if(_0x5ae0b1[_0x4b9126(0x18b)]===0x0)return 0x1;const _0xb09338=_0x5ae0b1['map'](_0x33c439=>_0x33c439[_0x4b9126(0x155)])[_0x4b9126(0x157)]((_0x49cb58,_0x287067)=>_0x49cb58-_0x287067),_0x1a3351=Math['floor'](_0xb09338[_0x4b9126(0x18b)]/0x2),_0x21aa93=_0xb09338[_0x1a3351]||0x1;return _0x4757d5[_0x561020][_0x4b9126(0x155)]/_0x21aa93;}[_0x2b7f26(0x163)](_0x4bc7e6,_0xcaadd6){const _0x4cb679=_0x2b7f26;let _0x322112=0x0;const _0x4b611b=0x4,_0x5a7039=Math['abs'](_0x4bc7e6['penetrationTicks']-_0x4b611b);return _0x322112+=Math['max'](0x0,0.3-_0x5a7039*0.03),_0x322112+=Math[_0x4cb679(0x17d)](0x0,0.25-_0x4bc7e6[_0x4cb679(0x1b6)]*0.05),_0x322112+=Math['min'](0.25,_0x4bc7e6[_0x4cb679(0x169)]*0.1),_0x322112+=Math[_0x4cb679(0x1ca)](0.2,_0xcaadd6*0.4),Math[_0x4cb679(0x1ca)](0x1,_0x322112);}['_generateSignal'](_0x56e5a8,_0x554186,_0xde732f,_0x3aa309){const _0x4a1b55=_0x2b7f26,_0xaee65a=Date['now']()-this['lastSignalTime'];if(_0xaee65a<this['config'][_0x4a1b55(0x15a)]['cooldownMs'])return this['emit']('log',{'type':_0x4a1b55(0x16e),'message':'[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20('+(_0xaee65a/0x3e8)[_0x4a1b55(0x16d)](0x1)+_0x4a1b55(0x1a8)+this[_0x4a1b55(0x1b8)]['execution']['cooldownMs']/0x3e8+'s)'}),null;const _0x12d293=this['config'][_0x4a1b55(0x15a)],_0x127e27=_0x554186[_0x4a1b55(0x193)],_0x24fdda=_0x3aa309[_0x4a1b55(0x137)]===SweepType[_0x4a1b55(0x1cf)]?_0x4a1b55(0x1c7):_0x4a1b55(0x1a1);let _0x36ad11,_0x426361,_0x53fc6c,_0x114aa9;_0x24fdda===_0x4a1b55(0x1a1)?(_0x36ad11=_0x127e27-_0x12d293[_0x4a1b55(0x135)]*this['tickSize'],_0x426361=_0x127e27+_0x12d293[_0x4a1b55(0x162)]*this['tickSize'],_0x53fc6c=_0x127e27+_0x12d293[_0x4a1b55(0x139)]*this[_0x4a1b55(0x187)],_0x114aa9=_0x127e27+_0x12d293[_0x4a1b55(0x161)]*this[_0x4a1b55(0x187)]):(_0x36ad11=_0x127e27+_0x12d293['stopTicks']*this['tickSize'],_0x426361=_0x127e27-_0x12d293[_0x4a1b55(0x162)]*this['tickSize'],_0x53fc6c=_0x127e27-_0x12d293['breakevenTicks']*this[_0x4a1b55(0x187)],_0x114aa9=_0x127e27-_0x12d293['trailTriggerTicks']*this['tickSize']);const _0x411a58=_0x12d293['targetTicks']/_0x12d293[_0x4a1b55(0x135)],_0x2ebe71=Math[_0x4a1b55(0x1ca)](0x1,_0x3aa309[_0x4a1b55(0x13a)]*0.5+_0x3aa309['zone'][_0x4a1b55(0x13a)]*0.3+(_0x3aa309[_0x4a1b55(0x169)]>1.5?0.2:_0x3aa309[_0x4a1b55(0x169)]*0.1));let _0x3bb9d5=SignalStrength[_0x4a1b55(0x14d)];if(_0x2ebe71>=0.8)_0x3bb9d5=SignalStrength['VERY_STRONG'];else{if(_0x2ebe71>=0.65)_0x3bb9d5=SignalStrength['STRONG'];else{if(_0x2ebe71<0.5)_0x3bb9d5=SignalStrength['WEAK'];}}const _0x33b12d=0.5+(_0x2ebe71-0.5)*0.4,_0x4b76ad=_0x33b12d*Math['abs'](_0x426361-_0x127e27)-(0x1-_0x33b12d)*Math['abs'](_0x127e27-_0x36ad11);_0x3aa309['zone'][_0x4a1b55(0x15f)]=_0xde732f,_0x3aa309[_0x4a1b55(0x179)][_0x4a1b55(0x1ce)]=!![],_0x3aa309['zone']['sweptAt']=new Date(_0x554186['timestamp']),this['lastSignalTime']=Date[_0x4a1b55(0x1cc)](),this['stats'][_0x4a1b55(0x189)]++;const _0x18b7f0={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x56e5a8['split']('.')[0x0]||_0x56e5a8,'contractId':_0x56e5a8,'side':_0x24fdda==='long'?OrderSide[_0x4a1b55(0x1c3)]:OrderSide['ASK'],'direction':_0x24fdda,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x3bb9d5,'edge':_0x4b76ad,'confidence':_0x2ebe71,'entry':_0x127e27,'entryPrice':_0x127e27,'stopLoss':_0x36ad11,'takeProfit':_0x426361,'riskReward':_0x411a58,'stopTicks':_0x12d293['stopTicks'],'targetTicks':_0x12d293[_0x4a1b55(0x162)],'breakevenTicks':_0x12d293['breakevenTicks'],'trailTriggerTicks':_0x12d293[_0x4a1b55(0x161)],'trailDistanceTicks':_0x12d293['trailDistanceTicks'],'beLevel':_0x53fc6c,'trailTrigger':_0x114aa9,'sweepType':_0x3aa309[_0x4a1b55(0x137)],'penetrationTicks':_0x3aa309[_0x4a1b55(0x1cb)],'sweepDurationBars':_0x3aa309['durationBars'],'sweepQuality':_0x3aa309['qualityScore'],'volumeRatio':_0x3aa309[_0x4a1b55(0x169)],'zoneType':_0x3aa309[_0x4a1b55(0x179)][_0x4a1b55(0x1c2)],'zoneLevel':_0x3aa309[_0x4a1b55(0x179)][_0x4a1b55(0x1b4)](),'zoneTouches':_0x3aa309[_0x4a1b55(0x179)]['touches'],'zoneQuality':_0x3aa309['zone'][_0x4a1b55(0x13a)],'expires':Date['now']()+0xea60};return this[_0x4a1b55(0x1a2)](_0x4a1b55(0x1af),{'side':_0x24fdda===_0x4a1b55(0x1a1)?'buy':'sell','action':_0x4a1b55(0x1ae),'reason':_0x4a1b55(0x13b)+_0x3aa309['sweepType']+_0x4a1b55(0x146)+_0x3aa309[_0x4a1b55(0x1cb)][_0x4a1b55(0x16d)](0x1)+'t\x20|\x20Vol:'+_0x3aa309[_0x4a1b55(0x169)]['toFixed'](0x1)+_0x4a1b55(0x1bb)+(_0x3aa309[_0x4a1b55(0x13a)]*0x64)['toFixed'](0x0)+'%',..._0x18b7f0}),this['emit']('log',{'type':_0x4a1b55(0x14b),'message':'[HQX-2B]\x20SIGNAL:\x20'+_0x24fdda['toUpperCase']()+_0x4a1b55(0x1a0)+_0x127e27['toFixed'](0x2)+'\x20|\x20'+_0x3aa309['sweepType']+'\x20|\x20Pen:'+_0x3aa309[_0x4a1b55(0x1cb)]['toFixed'](0x1)+'t\x20Vol:'+_0x3aa309[_0x4a1b55(0x169)][_0x4a1b55(0x16d)](0x1)+_0x4a1b55(0x192)+(_0x2ebe71*0x64)[_0x4a1b55(0x16d)](0x0)+'%'}),_0x18b7f0;}['getAnalysisState'](_0xb2426f,_0x298d64){const _0x23c7ed=_0x2b7f26,_0x31042d=this[_0x23c7ed(0x198)][_0x23c7ed(0x1b0)](_0xb2426f)||[],_0x3dd533=this[_0x23c7ed(0x1a3)][_0x23c7ed(0x1b0)](_0xb2426f)||[],_0x109922=this[_0x23c7ed(0x165)][_0x23c7ed(0x1b0)](_0xb2426f)||[];if(_0x31042d['length']<0x5)return{'ready':![],'message':_0x23c7ed(0x176)+_0x31042d[_0x23c7ed(0x18b)]+'/5\x20bars'};const _0x49cdc3=_0x3dd533['map'](_0x56409e=>({'zone':_0x56409e,'distance':Math['abs'](_0x298d64-_0x56409e['getLevel']())}))[_0x23c7ed(0x157)]((_0x39b439,_0x9f00c2)=>_0x39b439[_0x23c7ed(0x178)]-_0x9f00c2['distance']),_0x23e6cd=_0x49cdc3['find'](_0x399241=>_0x399241[_0x23c7ed(0x179)][_0x23c7ed(0x1c2)]===ZoneType[_0x23c7ed(0x17f)]),_0x58dc5e=_0x49cdc3['find'](_0x27617b=>_0x27617b[_0x23c7ed(0x179)]['type']===ZoneType[_0x23c7ed(0x18a)]);return{'ready':!![],'barsProcessed':_0x31042d[_0x23c7ed(0x18b)],'swingsDetected':_0x109922[_0x23c7ed(0x18b)],'activeZones':_0x3dd533[_0x23c7ed(0x18b)],'nearestResistance':_0x23e6cd?_0x23e6cd[_0x23c7ed(0x179)][_0x23c7ed(0x1b4)]():null,'nearestSupport':_0x58dc5e?_0x58dc5e[_0x23c7ed(0x179)]['getLevel']():null,'stopTicks':this[_0x23c7ed(0x1b8)]['execution'][_0x23c7ed(0x135)],'targetTicks':this[_0x23c7ed(0x1b8)][_0x23c7ed(0x15a)][_0x23c7ed(0x162)],'strategy':_0x23c7ed(0x1a6)};}['recordTradeResult'](_0x2d3fde){const _0x150ef0=_0x2b7f26;this['recentTrades']['push']({'netPnl':_0x2d3fde,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this['recentTrades'][_0x150ef0(0x1c6)]();_0x2d3fde>0x0?this['stats'][_0x150ef0(0x1cd)]++:this[_0x150ef0(0x1b2)]['losses']++,this['stats']['trades']++,this[_0x150ef0(0x1b2)]['pnl']+=_0x2d3fde,this[_0x150ef0(0x1a2)](_0x150ef0(0x14e),{'type':'debug','message':_0x150ef0(0x159)+(_0x2d3fde>0x0?_0x150ef0(0x175):'LOSS')+'\x20$'+_0x2d3fde[_0x150ef0(0x16d)](0x2)});}['getBarHistory'](_0x1ee8c3){const _0x2b034b=_0x2b7f26;return this[_0x2b034b(0x198)][_0x2b034b(0x1b0)](_0x1ee8c3)||[];}[_0x2b7f26(0x18e)](){return this['stats'];}[_0x2b7f26(0x17c)](_0x3bb748){const _0x22a336=_0x2b7f26,_0x6894c7=this['barHistory']['get'](_0x3bb748)||[],_0x3b3daf=this['liquidityZones']['get'](_0x3bb748)||[],_0x59f5cf=this[_0x22a336(0x165)][_0x22a336(0x1b0)](_0x3bb748)||[],_0x5b4451=this[_0x22a336(0x170)]['get'](_0x3bb748),_0xfe68f1=_0x6894c7[_0x6894c7['length']-0x1],_0x4a3504=_0xfe68f1?Date[_0x22a336(0x1cc)]()-_0xfe68f1[_0x22a336(0x136)]:null,_0x565141=_0x3b3daf[_0x22a336(0x1b7)](_0x42e970=>_0x42e970[_0x22a336(0x1c2)]===ZoneType[_0x22a336(0x17f)])[_0x22a336(0x18b)],_0x14f03a=_0x3b3daf[_0x22a336(0x1b7)](_0x2ce0ca=>_0x2ce0ca['type']===ZoneType['SUPPORT'])[_0x22a336(0x18b)];return{'healthy':_0x6894c7[_0x22a336(0x18b)]>=0x5,'barsTotal':_0x6894c7['length'],'barsLast5Min':_0x6894c7[_0x22a336(0x1b7)](_0x1846d9=>Date[_0x22a336(0x1cc)]()-_0x1846d9['timestamp']<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x59f5cf[_0x22a336(0x18b)],'zonesResistance':_0x565141,'zonesSupport':_0x14f03a,'zonesTotal':_0x3b3daf[_0x22a336(0x18b)],'currentBarTicks':_0x5b4451?_0x5b4451['tickCount']:0x0,'isAggregating':_0x5b4451&&_0x5b4451['tickCount']>0x0,'timeSinceLastBarMs':_0x4a3504,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this['config']['execution']['cooldownMs'],'uptime':Date['now']()-(this[_0x22a336(0x168)]||Date[_0x22a336(0x1cc)]())};}[_0x2b7f26(0x14c)](_0x5b62e2){const _0x126715=_0x2b7f26;this[_0x126715(0x198)]['set'](_0x5b62e2,[]),this[_0x126715(0x165)]['set'](_0x5b62e2,[]),this['liquidityZones']['set'](_0x5b62e2,[]),this[_0x126715(0x19f)][_0x126715(0x141)](_0x5b62e2,[]),this[_0x126715(0x170)]['delete'](_0x5b62e2),this[_0x126715(0x1a2)](_0x126715(0x14e),{'type':'info','message':_0x126715(0x156)+_0x5b62e2});}[_0x2b7f26(0x1b9)](_0x36cb98,_0x116ea5){const _0x313be6=_0x2b7f26;if(!_0x116ea5||_0x116ea5['length']===0x0){this[_0x313be6(0x1a2)](_0x313be6(0x14e),{'type':_0x313be6(0x16e),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory']['has'](_0x36cb98)&&this['initialize'](_0x36cb98);const _0x2d7ec2=[..._0x116ea5]['sort']((_0x191a64,_0x53dbc1)=>_0x191a64[_0x313be6(0x136)]-_0x53dbc1[_0x313be6(0x136)]);this['emit'](_0x313be6(0x14e),{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x2d7ec2[_0x313be6(0x18b)]+_0x313be6(0x183)});let _0x4bc60d=0x0;for(const _0x3b14c0 of _0x2d7ec2){const _0x216325=this['processBar'](_0x36cb98,_0x3b14c0);if(_0x216325)_0x4bc60d++;}const _0x3874b2=this['barHistory']['get'](_0x36cb98)||[],_0x3cb9a2=this['swingPoints'][_0x313be6(0x1b0)](_0x36cb98)||[],_0x44de21=this[_0x313be6(0x1a3)]['get'](_0x36cb98)||[];this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x3874b2[_0x313be6(0x18b)]+'\x20bars,\x20'+_0x3cb9a2['length']+_0x313be6(0x149)+_0x44de21['length']+_0x313be6(0x134)}),_0x4bc60d>0x0&&this[_0x313be6(0x1a2)](_0x313be6(0x14e),{'type':_0x313be6(0x16e),'message':'[HQX-2B]\x20'+_0x4bc60d+_0x313be6(0x173)}),this[_0x313be6(0x181)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x1795ae={}){const _0x1172ce=_0x2b7f26;super(),this[_0x1172ce(0x1b8)]=_0x1795ae,this['strategy']=new HQX2BLiquiditySweep(_0x1795ae),this[_0x1172ce(0x17a)]['on']('signal',_0x3b318a=>this['emit'](_0x1172ce(0x1af),_0x3b318a)),this['strategy']['on']('log',_0x215b6f=>this[_0x1172ce(0x1a2)](_0x1172ce(0x14e),_0x215b6f));}[_0x2b7f26(0x17b)](_0x3c7e01){return this['strategy']['processTick'](_0x3c7e01);}[_0x2b7f26(0x19e)](_0x330c1c){const _0x3e6a28=_0x2b7f26;return this['strategy'][_0x3e6a28(0x19e)](_0x330c1c);}['onTrade'](_0x2bcae9){return this['strategy']['onTrade'](_0x2bcae9);}['processBar'](_0x33780f,_0x4571de){const _0x2fc38=_0x2b7f26;return this[_0x2fc38(0x17a)]['processBar'](_0x33780f,_0x4571de);}['initialize'](_0x37548e,_0x1f0b9b,_0x5771c8){const _0xadbebc=_0x2b7f26;return this[_0xadbebc(0x17a)]['initialize'](_0x37548e,_0x1f0b9b,_0x5771c8);}['getAnalysisState'](_0x167eff,_0x2422d2){return this['strategy']['getAnalysisState'](_0x167eff,_0x2422d2);}['recordTradeResult'](_0x18dd00){return this['strategy']['recordTradeResult'](_0x18dd00);}[_0x2b7f26(0x14c)](_0x48b033){const _0x428681=_0x2b7f26;return this['strategy'][_0x428681(0x14c)](_0x48b033);}['getStats'](){const _0x514c13=_0x2b7f26;return this['strategy'][_0x514c13(0x18e)]();}[_0x2b7f26(0x15d)](_0x33d969){const _0x39227a=_0x2b7f26;return this[_0x39227a(0x17a)]['getBarHistory'](_0x33d969);}['preloadBars'](_0x176233,_0x5e588e){const _0x40bc9b=_0x2b7f26;return this['strategy'][_0x40bc9b(0x1b9)](_0x176233,_0x5e588e);}[_0x2b7f26(0x17c)](_0x2bffe7){const _0x26930e=_0x2b7f26;return this[_0x26930e(0x17a)][_0x26930e(0x17c)](_0x2bffe7);}['generateSignal'](_0x4cde76){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 +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 _0x3f38f4=_0x30a6;(function(_0x3c3e69,_0x1223f4){const _0x5e8f56=_0x30a6,_0xb5f6d7=_0x3c3e69();while(!![]){try{const _0x303347=-parseInt(_0x5e8f56(0x127))/0x1*(parseInt(_0x5e8f56(0x104))/0x2)+-parseInt(_0x5e8f56(0x113))/0x3+parseInt(_0x5e8f56(0x14b))/0x4+-parseInt(_0x5e8f56(0x126))/0x5+parseInt(_0x5e8f56(0xfa))/0x6+-parseInt(_0x5e8f56(0x139))/0x7*(-parseInt(_0x5e8f56(0x155))/0x8)+parseInt(_0x5e8f56(0x144))/0x9*(-parseInt(_0x5e8f56(0x159))/0xa);if(_0x303347===_0x1223f4)break;else _0xb5f6d7['push'](_0xb5f6d7['shift']());}catch(_0x5e1db9){_0xb5f6d7['push'](_0xb5f6d7['shift']());}}}(_0x492e,0xf0c16));const EventEmitter=require(_0x3f38f4(0x117)),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x3c54c6={}){const _0x5be687=_0x3f38f4;super(),this[_0x5be687(0x132)]=_0x3c54c6[_0x5be687(0x132)]||0.25,this['tickValue']=_0x3c54c6[_0x5be687(0xff)]||0x5,this[_0x5be687(0x10e)]=1.5,this[_0x5be687(0x135)]=0.5,this['vpinWindow']=0x32,this[_0x5be687(0x152)]=0.7,this[_0x5be687(0x14d)]=0.01,this['kalmanMeasurementNoise']=0.1,this[_0x5be687(0x140)]=0x64,this['ofiLookback']=0x14,this['baseStopTicks']=0x8,this[_0x5be687(0x120)]=0x10,this['breakevenTicks']=0x4,this['profitLockPct']=0.5,this['minConfidence']=0.55,this[_0x5be687(0x10a)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x5be687(0xfb)]=new Map(),this['priceBuffer']=new Map(),this['volumeBuffer']=new Map(),this['kalmanStates']=new Map(),this[_0x5be687(0x146)]=new Map(),this['recentTrades']=[],this[_0x5be687(0x142)]=0x0,this[_0x5be687(0x122)]=0x0,this[_0x5be687(0x145)]=0x0,this[_0x5be687(0x108)]=0x7530,this[_0x5be687(0x158)]=0x2710,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x3f38f4(0x136)](_0x464eb7,_0x5a9dff=0.25,_0x2fc97c=0x5){const _0x564b59=_0x3f38f4;this[_0x564b59(0x132)]=_0x5a9dff,this['tickValue']=_0x2fc97c,this['barHistory']['set'](_0x464eb7,[]),this[_0x564b59(0x11c)]['set'](_0x464eb7,[]),this[_0x564b59(0x125)][_0x564b59(0x11e)](_0x464eb7,[]),this['atrHistory'][_0x564b59(0x11e)](_0x464eb7,[]),this[_0x564b59(0x134)]['set'](_0x464eb7,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':_0x564b59(0x13e),'message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x464eb7+_0x564b59(0x11a)+_0x5a9dff+',\x20value='+_0x2fc97c}),this['emit'](_0x564b59(0x12f),{'type':'info','message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}['processTick'](_0x2d5017){const {contractId:_0x28f845,price:_0x88f637,volume:_0x7efaf6,side:_0x391eaf,timestamp:_0x3a6445}=_0x2d5017,_0x5e6b0b={'timestamp':_0x3a6445||Date['now'](),'open':_0x88f637,'high':_0x88f637,'low':_0x88f637,'close':_0x88f637,'volume':_0x7efaf6||0x1};return this['processBar'](_0x28f845,_0x5e6b0b);}[_0x3f38f4(0x105)](_0xa459d5){const _0x322b9e=_0x3f38f4;return this[_0x322b9e(0x130)](_0xa459d5);}['onTrade'](_0x5cf3bf){const _0xd0316b=_0x3f38f4;return this['processTick']({'contractId':_0x5cf3bf['contractId']||_0x5cf3bf['symbol'],'price':_0x5cf3bf['price'],'volume':_0x5cf3bf['size']||_0x5cf3bf['volume']||0x1,'side':_0x5cf3bf['side'],'timestamp':_0x5cf3bf[_0xd0316b(0x14c)]||Date[_0xd0316b(0x141)]()});}['processBar'](_0x50cd75,_0x58e8e3){const _0x4c230d=_0x3f38f4;let _0x590f41=this[_0x4c230d(0xfb)]['get'](_0x50cd75);!_0x590f41&&(this['initialize'](_0x50cd75),_0x590f41=this[_0x4c230d(0xfb)]['get'](_0x50cd75));_0x590f41[_0x4c230d(0x115)](_0x58e8e3);if(_0x590f41[_0x4c230d(0xf6)]>0x1f4)_0x590f41[_0x4c230d(0x10c)]();const _0x524a2d=this['priceBuffer'][_0x4c230d(0x10d)](_0x50cd75);_0x524a2d[_0x4c230d(0x115)](_0x58e8e3[_0x4c230d(0x150)]);if(_0x524a2d['length']>0xc8)_0x524a2d[_0x4c230d(0x10c)]();const _0xd29926=this['volumeBuffer']['get'](_0x50cd75),_0x55ca76=_0x58e8e3['high']-_0x58e8e3[_0x4c230d(0x13a)];let _0x2823ba=_0x58e8e3['volume']*0.5,_0x3a9aae=_0x58e8e3[_0x4c230d(0x119)]*0.5;if(_0x55ca76>0x0){const _0x362c99=(_0x58e8e3[_0x4c230d(0x150)]-_0x58e8e3[_0x4c230d(0x13a)])/_0x55ca76;_0x2823ba=_0x58e8e3['volume']*_0x362c99,_0x3a9aae=_0x58e8e3['volume']*(0x1-_0x362c99);}_0xd29926['push']({'buy':_0x2823ba,'sell':_0x3a9aae});if(_0xd29926['length']>0x64)_0xd29926[_0x4c230d(0x10c)]();if(_0x590f41[_0x4c230d(0xf6)]<0x32)return null;const _0x1325ba=this['_computeZScore'](_0x524a2d),_0x571dd6=this['_computeVPIN'](_0xd29926),_0x3b2656=this['_computeKyleLambda'](_0x590f41),_0x4756eb=this[_0x4c230d(0x147)](_0x50cd75,_0x58e8e3['close']),{regime:_0x2d97c8,params:_0x2a0174}=this[_0x4c230d(0x11d)](_0x50cd75,_0x590f41),_0x5047bc=this[_0x4c230d(0x13d)](_0x590f41);return this['_generateSignal'](_0x50cd75,_0x58e8e3['close'],_0x1325ba,_0x571dd6,_0x3b2656,_0x4756eb,_0x2d97c8,_0x2a0174,_0x5047bc,_0x590f41);}['_computeZScore'](_0x7deb7,_0x58db7a=0x32){const _0x414084=_0x3f38f4;if(_0x7deb7[_0x414084(0xf6)]<_0x58db7a)return 0x0;const _0x2e1682=_0x7deb7[_0x414084(0xf9)](-_0x58db7a),_0x318644=_0x2e1682[_0x414084(0xfe)]((_0xac1064,_0x2adf11)=>_0xac1064+_0x2adf11,0x0)/_0x58db7a,_0x254ca1=_0x2e1682[_0x414084(0xfe)]((_0x33805b,_0x2ed0d1)=>_0x33805b+Math['pow'](_0x2ed0d1-_0x318644,0x2),0x0)/_0x58db7a,_0x42d35e=Math['sqrt'](_0x254ca1);if(_0x42d35e<0.0001)return 0x0;const _0x88f22d=_0x7deb7[_0x7deb7['length']-0x1];return(_0x88f22d-_0x318644)/_0x42d35e;}[_0x3f38f4(0x157)](_0x211fb8){const _0x2b9432=_0x3f38f4;if(_0x211fb8['length']<this[_0x2b9432(0x137)])return 0.5;const _0x81e4de=_0x211fb8['slice'](-this[_0x2b9432(0x137)]);let _0x270492=0x0,_0x4a3949=0x0;for(const _0x36179f of _0x81e4de){_0x270492+=_0x36179f[_0x2b9432(0x129)],_0x4a3949+=_0x36179f[_0x2b9432(0x138)];}const _0x44a161=_0x270492+_0x4a3949;if(_0x44a161<0x1)return 0.5;return Math[_0x2b9432(0x12c)](_0x270492-_0x4a3949)/_0x44a161;}[_0x3f38f4(0x12e)](_0x2bb288){const _0x21dc46=_0x3f38f4;if(_0x2bb288[_0x21dc46(0xf6)]<0x14)return 0x0;const _0x114e7e=_0x2bb288[_0x21dc46(0xf9)](-0x14),_0x580449=[],_0x4d1abc=[];for(let _0x25a48c=0x1;_0x25a48c<_0x114e7e['length'];_0x25a48c++){_0x580449[_0x21dc46(0x115)](_0x114e7e[_0x25a48c][_0x21dc46(0x150)]-_0x114e7e[_0x25a48c-0x1]['close']),_0x4d1abc['push'](_0x114e7e[_0x25a48c][_0x21dc46(0x119)]);}const _0x1eed1c=_0x580449[_0x21dc46(0xfe)]((_0x551e0b,_0x79e264)=>_0x551e0b+_0x79e264,0x0)/_0x580449[_0x21dc46(0xf6)],_0x5d6f31=_0x4d1abc[_0x21dc46(0xfe)]((_0x19105f,_0x474e55)=>_0x19105f+_0x474e55,0x0)/_0x4d1abc[_0x21dc46(0xf6)];let _0x5bcef2=0x0,_0x52b84d=0x0;for(let _0x21c761=0x0;_0x21c761<_0x580449[_0x21dc46(0xf6)];_0x21c761++){_0x5bcef2+=(_0x580449[_0x21c761]-_0x1eed1c)*(_0x4d1abc[_0x21c761]-_0x5d6f31),_0x52b84d+=Math[_0x21dc46(0x154)](_0x4d1abc[_0x21c761]-_0x5d6f31,0x2);}_0x5bcef2/=_0x580449[_0x21dc46(0xf6)],_0x52b84d/=_0x580449['length'];if(_0x52b84d<0.0001)return 0x0;return Math['abs'](_0x5bcef2/_0x52b84d);}[_0x3f38f4(0x147)](_0xe221fa,_0x8dbb94){const _0x4dc809=_0x3f38f4;let _0x332c4e=this[_0x4dc809(0x134)][_0x4dc809(0x10d)](_0xe221fa);if(!_0x332c4e)return _0x332c4e={'estimate':_0x8dbb94,'errorCovariance':0x1},this[_0x4dc809(0x134)]['set'](_0xe221fa,_0x332c4e),_0x8dbb94;const _0x238ea1=_0x332c4e[_0x4dc809(0x128)],_0x2ce695=_0x332c4e['errorCovariance']+this['kalmanProcessNoise'],_0x1fb9a6=_0x2ce695/(_0x2ce695+this['kalmanMeasurementNoise']),_0x418ab9=_0x238ea1+_0x1fb9a6*(_0x8dbb94-_0x238ea1),_0xce5b9e=(0x1-_0x1fb9a6)*_0x2ce695;return _0x332c4e['estimate']=_0x418ab9,_0x332c4e[_0x4dc809(0x143)]=_0xce5b9e,_0x418ab9;}[_0x3f38f4(0x11d)](_0x26bd7b,_0x1640fe){const _0x34b40f=_0x3f38f4,_0x2726dd=this[_0x34b40f(0xf4)](_0x1640fe),_0x2b9bfe=_0x2726dd/this[_0x34b40f(0x132)];let _0x5b3cb2=this['atrHistory'][_0x34b40f(0x10d)](_0x26bd7b);!_0x5b3cb2&&(_0x5b3cb2=[],this['atrHistory'][_0x34b40f(0x11e)](_0x26bd7b,_0x5b3cb2));_0x5b3cb2[_0x34b40f(0x115)](_0x2726dd);if(_0x5b3cb2['length']>0x1f4)_0x5b3cb2[_0x34b40f(0x10c)]();let _0x4550ab=0.5;_0x5b3cb2[_0x34b40f(0xf6)]>=0x14&&(_0x4550ab=_0x5b3cb2[_0x34b40f(0x14f)](_0x389c46=>_0x389c46<=_0x2726dd)[_0x34b40f(0xf6)]/_0x5b3cb2['length']);let _0x322a81,_0x12da5f;if(_0x4550ab<0.25)_0x322a81='low',_0x12da5f={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x4550ab<0.75?(_0x322a81=_0x34b40f(0x13f),_0x12da5f={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x322a81=_0x34b40f(0xf3),_0x12da5f={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x322a81,'params':_0x12da5f};}[_0x3f38f4(0xf4)](_0x18e3e6,_0x4a2b73=0xe){const _0x212453=_0x3f38f4;if(_0x18e3e6[_0x212453(0xf6)]<_0x4a2b73+0x1)return 2.5;const _0x29de65=[];for(let _0x489b71=_0x18e3e6[_0x212453(0xf6)]-_0x4a2b73;_0x489b71<_0x18e3e6[_0x212453(0xf6)];_0x489b71++){const _0x2e0a47=_0x18e3e6[_0x489b71],_0x26dbf2=_0x18e3e6[_0x489b71-0x1]['close'],_0x3a3455=Math['max'](_0x2e0a47[_0x212453(0xf3)]-_0x2e0a47[_0x212453(0x13a)],Math['abs'](_0x2e0a47[_0x212453(0xf3)]-_0x26dbf2),Math['abs'](_0x2e0a47[_0x212453(0x13a)]-_0x26dbf2));_0x29de65['push'](_0x3a3455);}return _0x29de65[_0x212453(0xfe)]((_0xad4b3f,_0x5d77c7)=>_0xad4b3f+_0x5d77c7,0x0)/_0x29de65['length'];}[_0x3f38f4(0x13d)](_0x537d02){const _0x452547=_0x3f38f4;if(_0x537d02['length']<this['ofiLookback'])return 0x0;const _0xa1e75b=_0x537d02['slice'](-this['ofiLookback']);let _0xf2e98=0x0,_0x1a00ce=0x0;for(const _0x46657 of _0xa1e75b){const _0x1aeaaf=_0x46657[_0x452547(0xf3)]-_0x46657[_0x452547(0x13a)];if(_0x1aeaaf>0x0){const _0x3ad9ad=(_0x46657[_0x452547(0x150)]-_0x46657['low'])/_0x1aeaaf;_0xf2e98+=_0x3ad9ad*_0x46657[_0x452547(0x119)],_0x1a00ce+=(0x1-_0x3ad9ad)*_0x46657['volume'];}}const _0x54c894=_0xf2e98+_0x1a00ce;if(_0x54c894<0x1)return 0x0;return(_0xf2e98-_0x1a00ce)/_0x54c894;}[_0x3f38f4(0x14a)](_0x507b98,_0x3263f1,_0x2faa63,_0x1fab76,_0x3da40e,_0x596d19,_0x51c2b6,_0x52e7c0,_0x5b469b,_0x10653a){const _0x2ddf32=_0x3f38f4,_0x2441b5=Math['abs'](_0x2faa63);if(_0x2441b5<_0x52e7c0['zscoreThreshold'])return null;if(_0x1fab76>this['vpinToxicThreshold'])return null;let _0x1242ea;if(_0x2faa63<-_0x52e7c0['zscoreThreshold'])_0x1242ea='long';else{if(_0x2faa63>_0x52e7c0['zscoreThreshold'])_0x1242ea=_0x2ddf32(0xf7);else return null;}const _0x7db943=_0x1242ea===_0x2ddf32(0xfd)&&_0x5b469b>0.1||_0x1242ea===_0x2ddf32(0xf7)&&_0x5b469b<-0.1,_0x50fa47=_0x3263f1-_0x596d19,_0x1895a4=_0x1242ea===_0x2ddf32(0xfd)&&_0x50fa47<0x0||_0x1242ea===_0x2ddf32(0xf7)&&_0x50fa47>0x0,_0x4afb8d={'zscore':Math[_0x2ddf32(0x12b)](0x1,_0x2441b5/0x4),'vpin':0x1-_0x1fab76,'kyleLambda':_0x3da40e>0.001?0.5:0.8,'kalman':_0x1895a4?0.8:0.4,'volatility':_0x51c2b6===_0x2ddf32(0x13f)?0.8:_0x51c2b6==='low'?0.7:0.6,'ofi':_0x7db943?0.9:0.5,'composite':0x0};_0x4afb8d[_0x2ddf32(0xf5)]=_0x4afb8d['zscore']*this[_0x2ddf32(0x10a)]['zscore']+_0x4afb8d['vpin']*this[_0x2ddf32(0x10a)]['vpin']+_0x4afb8d['kyleLambda']*this['weights'][_0x2ddf32(0x106)]+_0x4afb8d['kalman']*this['weights'][_0x2ddf32(0x124)]+_0x4afb8d['volatility']*this['weights'][_0x2ddf32(0x15a)]+_0x4afb8d['ofi']*this['weights'][_0x2ddf32(0x15d)];const _0x256dc9=Math['min'](0x1,_0x4afb8d[_0x2ddf32(0xf5)]+_0x52e7c0[_0x2ddf32(0x156)]);if(_0x256dc9<this[_0x2ddf32(0x15c)])return null;if(Date['now']()-this['lastSignalTime']<this[_0x2ddf32(0x108)])return null;const _0x1ccb91=Math['round'](this[_0x2ddf32(0x15b)]*_0x52e7c0[_0x2ddf32(0x103)]),_0x5cc624=Math['round'](this['baseTargetTicks']*_0x52e7c0[_0x2ddf32(0x112)]),_0x44d2b0=Math[_0x2ddf32(0x10f)](0x6,Math['min'](0xc,_0x1ccb91)),_0x367001=Math['max'](_0x44d2b0*1.5,Math['min'](0x18,_0x5cc624));let _0x4408b9,_0x454d41,_0x1bfe33,_0x1d89bf;_0x1242ea==='long'?(_0x4408b9=_0x3263f1-_0x44d2b0*this['tickSize'],_0x454d41=_0x3263f1+_0x367001*this[_0x2ddf32(0x132)],_0x1bfe33=_0x3263f1+this[_0x2ddf32(0x14e)]*this[_0x2ddf32(0x132)],_0x1d89bf=_0x3263f1+_0x367001*this[_0x2ddf32(0xfc)]*this['tickSize']):(_0x4408b9=_0x3263f1+_0x44d2b0*this['tickSize'],_0x454d41=_0x3263f1-_0x367001*this['tickSize'],_0x1bfe33=_0x3263f1-this['breakevenTicks']*this[_0x2ddf32(0x132)],_0x1d89bf=_0x3263f1-_0x367001*this['profitLockPct']*this[_0x2ddf32(0x132)]);const _0x2df7f9=_0x367001/_0x44d2b0,_0x3e5215=Math[_0x2ddf32(0x133)](_0x367001*0.5),_0x19d283=Math['round'](_0x44d2b0*0.4);let _0x48825d=SignalStrength[_0x2ddf32(0x118)];if(_0x256dc9>=0.85)_0x48825d=SignalStrength[_0x2ddf32(0x13c)];else{if(_0x256dc9>=0.75)_0x48825d=SignalStrength['STRONG'];else{if(_0x256dc9<0.6)_0x48825d=SignalStrength['WEAK'];}}const _0x496c28=0.5+(_0x256dc9-0.5)*0.4,_0x21c395=_0x496c28*Math[_0x2ddf32(0x12c)](_0x454d41-_0x3263f1)-(0x1-_0x496c28)*Math[_0x2ddf32(0x12c)](_0x3263f1-_0x4408b9);this['lastSignalTime']=Date[_0x2ddf32(0x141)](),this[_0x2ddf32(0x11f)]['signals']++;const _0x253fba={'id':uuidv4(),'timestamp':Date[_0x2ddf32(0x141)](),'symbol':_0x507b98['split']('.')[0x0]||_0x507b98,'contractId':_0x507b98,'side':_0x1242ea==='long'?OrderSide['BID']:OrderSide['ASK'],'direction':_0x1242ea,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0x48825d,'edge':_0x21c395,'confidence':_0x256dc9,'entry':_0x3263f1,'entryPrice':_0x3263f1,'stopLoss':_0x4408b9,'takeProfit':_0x454d41,'riskReward':_0x2df7f9,'stopTicks':_0x44d2b0,'targetTicks':_0x367001,'trailTriggerTicks':_0x3e5215,'trailDistanceTicks':_0x19d283,'beBreakeven':_0x1bfe33,'profitLockLevel':_0x1d89bf,'zScore':_0x2faa63,'zScoreExit':this[_0x2ddf32(0x135)],'vpinValue':_0x1fab76,'kyleLambda':_0x3da40e,'kalmanEstimate':_0x596d19,'volatilityRegime':_0x51c2b6,'ofiValue':_0x5b469b,'models':_0x4afb8d,'orderFlowConfirmed':_0x7db943,'kalmanConfirmed':_0x1895a4,'expires':Date[_0x2ddf32(0x141)]()+0xea60};return this['emit'](_0x2ddf32(0x10b),{'side':_0x1242ea===_0x2ddf32(0xfd)?_0x2ddf32(0x129):'sell','action':'open','reason':'Z='+_0x2faa63['toFixed'](0x2)+_0x2ddf32(0x121)+(_0x1fab76*0x64)[_0x2ddf32(0x151)](0x0)+_0x2ddf32(0x111)+(_0x5b469b*0x64)['toFixed'](0x0)+'%,\x20cf='+(_0x256dc9*0x64)[_0x2ddf32(0x151)](0x0)+'%',..._0x253fba}),this['emit'](_0x2ddf32(0x12f),{'type':_0x2ddf32(0x13e),'message':_0x2ddf32(0x123)+_0x1242ea[_0x2ddf32(0x100)]()+'\x20@\x20'+_0x3263f1[_0x2ddf32(0x151)](0x2)+'\x20|\x20Z:'+_0x2faa63[_0x2ddf32(0x151)](0x2)+'\x20VPIN:'+(_0x1fab76*0x64)[_0x2ddf32(0x151)](0x0)+'%\x20OFI:'+(_0x5b469b*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x3da40e['toFixed'](0x5)+'\x20Regime:'+_0x51c2b6+'\x20|\x20Conf:'+(_0x256dc9*0x64)['toFixed'](0x0)+'%'}),_0x253fba;}[_0x3f38f4(0x107)](_0x3f100d){const _0x59d96e=_0x3f38f4,_0x464578=this[_0x59d96e(0x11c)][_0x59d96e(0x10d)](_0x3f100d);if(!_0x464578||_0x464578['length']<0x32)return![];const _0x3aa107=this[_0x59d96e(0x12a)](_0x464578);return Math[_0x59d96e(0x12c)](_0x3aa107)<this['zscoreExitThreshold'];}[_0x3f38f4(0xf8)](_0x3ca54b){const _0x127579=_0x3f38f4,_0x27b100=this['priceBuffer']['get'](_0x3ca54b),_0x27c0d3=this['volumeBuffer'][_0x127579(0x10d)](_0x3ca54b),_0x1af95c=this[_0x127579(0xfb)]['get'](_0x3ca54b);if(!_0x27b100||!_0x27c0d3||!_0x1af95c||_0x1af95c[_0x127579(0xf6)]<0x32)return null;const _0x596ec7=this['_computeZScore'](_0x27b100),_0x28214d=this[_0x127579(0x157)](_0x27c0d3),_0x4606b6=this['_computeKyleLambda'](_0x1af95c),_0x1d2055=this['_computeOrderFlowImbalance'](_0x1af95c);return{'zscore':Math['min'](0x1,Math['abs'](_0x596ec7)/0x4),'vpin':0x1-_0x28214d,'kyleLambda':_0x4606b6>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x1d2055)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x596ec7,'vpin':_0x28214d,'kyleLambda':_0x4606b6,'ofi':_0x1d2055}};}['getAnalysisState'](_0x1b5736,_0x2a931f){const _0x4e564d=_0x3f38f4,_0xb68db1=this['barHistory']['get'](_0x1b5736)||[];if(_0xb68db1[_0x4e564d(0xf6)]<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0xb68db1[_0x4e564d(0xf6)]+'/50\x20bars'};const _0x5592fa=this['priceBuffer']['get'](_0x1b5736)||[],_0x449d36=this['volumeBuffer']['get'](_0x1b5736)||[],_0x3e3124=this['_computeZScore'](_0x5592fa),_0x57a88c=this[_0x4e564d(0x157)](_0x449d36),_0x2e7e00=this[_0x4e564d(0x13d)](_0xb68db1),_0x5cb4e9=this['_computeKyleLambda'](_0xb68db1),{regime:_0x1035a4,params:_0x4b10bc}=this[_0x4e564d(0x11d)](_0x1b5736,_0xb68db1);return{'ready':!![],'zScore':_0x3e3124,'vpin':_0x57a88c,'ofi':_0x2e7e00,'kyleLambda':_0x5cb4e9,'regime':_0x1035a4,'stopTicks':Math['round'](this['baseStopTicks']*_0x4b10bc[_0x4e564d(0x103)]),'targetTicks':Math[_0x4e564d(0x133)](this['baseTargetTicks']*_0x4b10bc['targetMultiplier']),'threshold':_0x4b10bc['zscoreThreshold'],'barsProcessed':_0xb68db1[_0x4e564d(0xf6)],'models':'6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)'};}[_0x3f38f4(0x12d)](_0x450d04){const _0x52acbd=_0x3f38f4;this[_0x52acbd(0x116)]['push']({'netPnl':_0x450d04,'timestamp':Date[_0x52acbd(0x141)]()});if(this['recentTrades']['length']>0x64)this['recentTrades']['shift']();_0x450d04>0x0?(this[_0x52acbd(0x142)]++,this['lossStreak']=0x0,this[_0x52acbd(0x11f)]['wins']++):(this[_0x52acbd(0x122)]++,this['winStreak']=0x0,this['stats'][_0x52acbd(0xf2)]++),this[_0x52acbd(0x11f)][_0x52acbd(0x149)]++,this['stats']['pnl']+=_0x450d04,this['emit'](_0x52acbd(0x12f),{'type':_0x52acbd(0x102),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x450d04>0x0?'WIN':'LOSS')+'\x20$'+_0x450d04['toFixed'](0x2)+',\x20streak:\x20'+(_0x450d04>0x0?this['winStreak']:-this[_0x52acbd(0x122)])});}['getBarHistory'](_0x2909f8){const _0x462d7e=_0x3f38f4;return this[_0x462d7e(0xfb)]['get'](_0x2909f8)||[];}['getStats'](){const _0x5987ba=_0x3f38f4;return this[_0x5987ba(0x11f)];}['reset'](_0x2f1c56){const _0x3a12f5=_0x3f38f4;this['barHistory'][_0x3a12f5(0x11e)](_0x2f1c56,[]),this['priceBuffer']['set'](_0x2f1c56,[]),this['volumeBuffer']['set'](_0x2f1c56,[]),this['atrHistory'][_0x3a12f5(0x11e)](_0x2f1c56,[]),this[_0x3a12f5(0x134)]['set'](_0x2f1c56,{'estimate':0x0,'errorCovariance':0x1}),this[_0x3a12f5(0x114)](_0x3a12f5(0x12f),{'type':'info','message':_0x3a12f5(0x153)+_0x2f1c56});}}function _0x492e(){const _0x223a4b=['long','reduce','tickValue','toUpperCase','onTrade','debug','stopMultiplier','96702fpQzch','onTick','kyleLambda','shouldExitByZScore','cooldownMs','getAnalysisState','weights','signal','shift','get','zscoreEntryThreshold','max','getStats','%,\x20OFI=','targetMultiplier','1411050IMIQCo','emit','push','recentTrades','events','MODERATE','volume',':\x20tick=','getBarHistory','priceBuffer','_detectVolatilityRegime','set','stats','baseTargetTicks',',\x20VPIN=','lossStreak','[HQX]\x20SIGNAL:\x20','kalman','volumeBuffer','3286540CgzlHt','12ZmjSmH','estimate','buy','_computeZScore','min','abs','recordTradeResult','_computeKyleLambda','log','processTick','strategy','tickSize','round','kalmanStates','zscoreExitThreshold','initialize','vpinWindow','sell','12355JODrZy','low','processBar','VERY_STRONG','_computeOrderFlowImbalance','info','normal','volatilityLookback','now','winStreak','errorCovariance','207iZSoLF','lastSignalTime','atrHistory','_applyKalmanFilter','reset','trades','_generateSignal','7487032MEshvr','timestamp','kalmanProcessNoise','breakevenTicks','filter','close','toFixed','vpinToxicThreshold','[HQX-UltraScalping]\x20Reset\x20state\x20for\x20','pow','8288qXISxq','confidenceBonus','_computeVPIN','minHoldTimeMs','1069340CnLiZe','volatility','baseStopTicks','minConfidence','ofi','losses','high','_calculateATR','composite','length','short','getModelValues','slice','8719128UInoaM','barHistory','profitLockPct'];_0x492e=function(){return _0x223a4b;};return _0x492e();}function _0x30a6(_0x385a7b,_0x44cee7){_0x385a7b=_0x385a7b-0xf2;const _0x492e31=_0x492e();let _0x30a6e4=_0x492e31[_0x385a7b];return _0x30a6e4;}class UltraScalpingStrategy extends EventEmitter{constructor(_0x5b81aa={}){const _0x45add5=_0x3f38f4;super(),this['config']=_0x5b81aa,this[_0x45add5(0x131)]=new HQXUltraScalping(_0x5b81aa),this[_0x45add5(0x131)]['on'](_0x45add5(0x10b),_0x136f3b=>this['emit']('signal',_0x136f3b)),this['strategy']['on']('log',_0x222daa=>this[_0x45add5(0x114)]('log',_0x222daa));}['processTick'](_0x17aa81){const _0x40989e=_0x3f38f4;return this[_0x40989e(0x131)][_0x40989e(0x130)](_0x17aa81);}[_0x3f38f4(0x105)](_0xb2a0d3){const _0x13c7ae=_0x3f38f4;return this['strategy'][_0x13c7ae(0x105)](_0xb2a0d3);}[_0x3f38f4(0x101)](_0x47cc66){return this['strategy']['onTrade'](_0x47cc66);}[_0x3f38f4(0x13b)](_0x1fec33,_0x2b69c5){const _0x6a528a=_0x3f38f4;return this[_0x6a528a(0x131)][_0x6a528a(0x13b)](_0x1fec33,_0x2b69c5);}['initialize'](_0x2aeb31,_0x5e8a23,_0x1364cb){return this['strategy']['initialize'](_0x2aeb31,_0x5e8a23,_0x1364cb);}[_0x3f38f4(0x109)](_0x2e5e45,_0x52fb80){return this['strategy']['getAnalysisState'](_0x2e5e45,_0x52fb80);}[_0x3f38f4(0x12d)](_0x40c722){const _0x537a0c=_0x3f38f4;return this[_0x537a0c(0x131)]['recordTradeResult'](_0x40c722);}['reset'](_0x5d82c7){const _0x32c500=_0x3f38f4;return this[_0x32c500(0x131)][_0x32c500(0x148)](_0x5d82c7);}[_0x3f38f4(0x110)](){return this['strategy']['getStats']();}[_0x3f38f4(0x11b)](_0x20cecd){return this['strategy']['getBarHistory'](_0x20cecd);}[_0x3f38f4(0xf8)](_0x5c9f6d){return this['strategy']['getModelValues'](_0x5c9f6d);}[_0x3f38f4(0x107)](_0x3f5e7c){const _0x167e98=_0x3f38f4;return this[_0x167e98(0x131)]['shouldExitByZScore'](_0x3f5e7c);}['generateSignal'](_0x139b38){return null;}}module['exports']={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.130",
3
+ "version": "2.9.131",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {