hedgequantx 2.9.97 → 2.9.99

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 _0x3d7924=_0x4626;function _0x4626(_0xfbf665,_0x32d984){_0xfbf665=_0xfbf665-0x1f3;const _0x21f88a=_0x21f8();let _0x462670=_0x21f88a[_0xfbf665];return _0x462670;}(function(_0x319f2b,_0x2e9d1a){const _0x47639a=_0x4626,_0x247b75=_0x319f2b();while(!![]){try{const _0x3f6a1e=-parseInt(_0x47639a(0x20a))/0x1*(-parseInt(_0x47639a(0x281))/0x2)+-parseInt(_0x47639a(0x27b))/0x3+-parseInt(_0x47639a(0x23b))/0x4+parseInt(_0x47639a(0x273))/0x5*(parseInt(_0x47639a(0x279))/0x6)+parseInt(_0x47639a(0x24b))/0x7*(parseInt(_0x47639a(0x22d))/0x8)+-parseInt(_0x47639a(0x23e))/0x9+-parseInt(_0x47639a(0x23c))/0xa*(-parseInt(_0x47639a(0x265))/0xb);if(_0x3f6a1e===_0x2e9d1a)break;else _0x247b75['push'](_0x247b75['shift']());}catch(_0x3aafe6){_0x247b75['push'](_0x247b75['shift']());}}}(_0x21f8,0xb20de));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x3d7924(0x24c)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x3d7924(0x203),'LOW_SWEEP':_0x3d7924(0x276)},ZoneType={'RESISTANCE':'resistance','SUPPORT':'support'},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.2,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':'America/New_York'}};function _0x21f8(){const _0x14996d=['[HQX-2B]\x20Preloading\x20','2uKRlon','BID','volume','LOSS','slice','initialize','barIntervalMs','startTime','maxDurationBars','lastSignalTime','_detectSwings','targetTicks','toUpperCase','preloadBars','containsPrice','signal','Collecting\x20data...\x20','abs','high','map','config','_getVolumeRatio','[HQX-2B]\x20SIGNAL:\x20','processBar','_generateSignal','271603CCQQUf','getUTCMinutes','onTick','isValid','log','entryBarIndex','getLevel','lookbackBars','contractId','minVolumeRatio','generateSignal','shift','qualityScore','[2B]\x20NEW\x20ZONE\x20','push','long','max','x\x20|\x20Q:','find','minQualityScore','_mergeConfig','pnl','priceHigh','has','HIGH_SWEEP','strategy','LOW_SWEEP','get','swing','strength','exports','currentBar','execution','\x20bars,\x20','info','2510176WNMWHM','close','set','createdAt','emit','min','/5\x20bars','exitBarIndex','stopTicks','\x20|\x20Pen:\x20','barHistory','\x20|\x20Pen:','now','filter','2326264kEZqOV','1290DtrZLd','getTimezoneOffset','6088428ssgQLy','breakevenTicks','lastUsedBarIndex','getUTCHours','getStats','stats','split','barIndex','\x20|\x20Total:\x20','size','recentTrades','isArray','type','14pPDJAM','uuid','processTick','durationBars','debug','open','[HQX-2B]\x20Preload\x20complete:\x20','swingPoints','_scoreSweep','minPenetrationTicks','extremePrice','RESISTANCE','tickValue','trailTriggerTicks','onTrade','swept','WIN','price','priceLow','t,\x20Trail=','penetrationTicks','reset','volumeRatio','recordTradeResult','activeSweeps','zone','65978kjfsfd','timestamp','t\x20|\x20Vol:','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','[HQX-2B]\x20Initialized\x20for\x20','touches','liquidityZones','tickSize','SUPPORT','toFixed','length','getBarHistory','sort','getAnalysisState','10pLbMMy','_updateZones','session','low',',\x20TF=1min','t\x20|\x20Q:\x20','3874620PosSEV','ASK','2931183AhIdyp','minBodyRatio','isWithinSession','\x20zones','isDST'];_0x21f8=function(){return _0x14996d;};return _0x21f8();}class SwingPoint{constructor(_0x29a20d,_0x15f606,_0x634ae5,_0x664cc6,_0x358ea4=0x1){const _0x1c3cbc=_0x3d7924;this[_0x1c3cbc(0x24a)]=_0x29a20d,this[_0x1c3cbc(0x25c)]=_0x15f606,this['barIndex']=_0x634ae5,this[_0x1c3cbc(0x266)]=_0x664cc6,this[_0x1c3cbc(0x227)]=_0x358ea4;}}class LiquidityZone{constructor(_0x4b7a19,_0x5f2f31,_0xb90f81,_0x1f0f7e,_0x5a74c9){const _0x405253=_0x3d7924;this['id']=uuidv4(),this[_0x405253(0x24a)]=_0x4b7a19,this[_0x405253(0x220)]=_0x5f2f31,this[_0x405253(0x25d)]=_0xb90f81,this[_0x405253(0x230)]=_0x1f0f7e,this['barIndex']=_0x5a74c9,this[_0x405253(0x26a)]=0x1,this[_0x405253(0x25a)]=![],this['sweptAt']=null,this[_0x405253(0x240)]=-0x3e7,this['qualityScore']=0.5;}['containsPrice'](_0x5c1d10,_0x43cd6a,_0x2e00f8){const _0x1eb7ad=_0x3d7924,_0x19f56b=_0x43cd6a*_0x2e00f8;return _0x5c1d10>=this[_0x1eb7ad(0x25d)]-_0x19f56b&&_0x5c1d10<=this[_0x1eb7ad(0x220)]+_0x19f56b;}[_0x3d7924(0x210)](){const _0x1312e5=_0x3d7924;return(this['priceHigh']+this[_0x1312e5(0x25d)])/0x2;}}class SweepEvent{constructor(_0x490e25,_0x88f12a,_0x4b197b,_0x1132c7,_0x72cdcd){const _0x3ae4b3=_0x3d7924;this['sweepType']=_0x490e25,this['zone']=_0x88f12a,this[_0x3ae4b3(0x20f)]=_0x4b197b,this['extremeBarIndex']=_0x1132c7,this[_0x3ae4b3(0x255)]=_0x72cdcd,this[_0x3ae4b3(0x234)]=null,this[_0x3ae4b3(0x20d)]=![],this['qualityScore']=0x0,this['penetrationTicks']=0x0,this[_0x3ae4b3(0x24e)]=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x34fbb2={}){const _0xd2f72e=_0x3d7924;super(),this['config']=this[_0xd2f72e(0x21e)](DEFAULT_CONFIG,_0x34fbb2),this['tickSize']=this['config']['tickSize'],this['tickValue']=this[_0xd2f72e(0x205)][_0xd2f72e(0x257)],this[_0xd2f72e(0x237)]=new Map(),this[_0xd2f72e(0x252)]=new Map(),this[_0xd2f72e(0x26b)]=new Map(),this['activeSweeps']=new Map(),this[_0xd2f72e(0x229)]=new Map(),this['barIntervalMs']=0xea60,this['lastSignalTime']=0x0,this[_0xd2f72e(0x1f8)]=Date[_0xd2f72e(0x239)](),this[_0xd2f72e(0x243)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0xd2f72e(0x248)]=[];}[_0x3d7924(0x21e)](_0x73119a,_0x1cea8e){const _0x24dbcc=_0x3d7924,_0x568651={..._0x73119a};for(const _0xb39f4e in _0x1cea8e){typeof _0x1cea8e[_0xb39f4e]==='object'&&!Array[_0x24dbcc(0x249)](_0x1cea8e[_0xb39f4e])?_0x568651[_0xb39f4e]={..._0x73119a[_0xb39f4e],..._0x1cea8e[_0xb39f4e]}:_0x568651[_0xb39f4e]=_0x1cea8e[_0xb39f4e];}return _0x568651;}[_0x3d7924(0x27d)](_0x3b115e){const _0xd73f32=_0x3d7924;if(!this['config']['session']['enabled'])return!![];const _0x30967b=new Date(_0x3b115e),_0x4ee2fe=this[_0xd73f32(0x27f)](_0x30967b)?-0x4:-0x5,_0x1e832f=_0x30967b[_0xd73f32(0x241)](),_0x43ff94=_0x30967b[_0xd73f32(0x20b)](),_0xc74026=(_0x1e832f+_0x4ee2fe+0x18)%0x18,{startHour:_0x1be5ed,startMinute:_0x1b564c,endHour:_0xe3617b,endMinute:_0x4b568a}=this[_0xd73f32(0x205)][_0xd73f32(0x275)],_0x538366=_0xc74026*0x3c+_0x43ff94,_0x425109=_0x1be5ed*0x3c+_0x1b564c,_0x204a51=_0xe3617b*0x3c+_0x4b568a;return _0x538366>=_0x425109&&_0x538366<_0x204a51;}['isDST'](_0x1ad1bc){const _0x52e159=_0x3d7924,_0x43d23f=new Date(_0x1ad1bc['getFullYear'](),0x0,0x1),_0x278b8d=new Date(_0x1ad1bc['getFullYear'](),0x6,0x1),_0x22be34=Math['max'](_0x43d23f[_0x52e159(0x23d)](),_0x278b8d['getTimezoneOffset']());return _0x1ad1bc['getTimezoneOffset']()<_0x22be34;}['initialize'](_0x183a87,_0x139c4a=0.25,_0x256bd9=0x5){const _0x5a73a9=_0x3d7924;this['tickSize']=_0x139c4a,this[_0x5a73a9(0x257)]=_0x256bd9,this[_0x5a73a9(0x205)][_0x5a73a9(0x26c)]=_0x139c4a,this[_0x5a73a9(0x205)][_0x5a73a9(0x257)]=_0x256bd9,this[_0x5a73a9(0x237)][_0x5a73a9(0x22f)](_0x183a87,[]),this['swingPoints']['set'](_0x183a87,[]),this[_0x5a73a9(0x26b)][_0x5a73a9(0x22f)](_0x183a87,[]),this['activeSweeps']['set'](_0x183a87,[]),this[_0x5a73a9(0x229)]['delete'](_0x183a87),this[_0x5a73a9(0x231)]('log',{'type':'info','message':_0x5a73a9(0x269)+_0x183a87+':\x20tick='+_0x139c4a+',\x20value='+_0x256bd9+_0x5a73a9(0x277)}),this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x5a73a9(0x205)][_0x5a73a9(0x22a)][_0x5a73a9(0x235)]+'t,\x20Target='+this[_0x5a73a9(0x205)][_0x5a73a9(0x22a)]['targetTicks']+'t,\x20BE='+this[_0x5a73a9(0x205)][_0x5a73a9(0x22a)][_0x5a73a9(0x23f)]+_0x5a73a9(0x25e)+this['config'][_0x5a73a9(0x22a)][_0x5a73a9(0x258)]+'/'+this['config']['execution']['trailDistanceTicks']});}[_0x3d7924(0x24d)](_0x278c94){const _0x272b98=_0x3d7924,{contractId:_0xc5b84d,price:_0x5cd3c7,volume:_0x3996b3,timestamp:_0x32412a}=_0x278c94,_0x2b659b=_0x32412a||Date[_0x272b98(0x239)](),_0x11811d=_0x3996b3||0x1;if(!this[_0x272b98(0x27d)](_0x2b659b))return null;let _0x2d9db2=this['currentBar']['get'](_0xc5b84d);const _0x2094be=Math['floor'](_0x2b659b/this[_0x272b98(0x1f7)])*this['barIntervalMs'];if(!_0x2d9db2||_0x2d9db2[_0x272b98(0x1f8)]!==_0x2094be){if(_0x2d9db2){const _0x4bcf22={'timestamp':_0x2d9db2[_0x272b98(0x1f8)],'open':_0x2d9db2['open'],'high':_0x2d9db2['high'],'low':_0x2d9db2['low'],'close':_0x2d9db2[_0x272b98(0x22e)],'volume':_0x2d9db2['volume']},_0x4c323f=this[_0x272b98(0x208)](_0xc5b84d,_0x4bcf22);return this['currentBar']['set'](_0xc5b84d,{'startTime':_0x2094be,'open':_0x5cd3c7,'high':_0x5cd3c7,'low':_0x5cd3c7,'close':_0x5cd3c7,'volume':_0x11811d}),_0x4c323f;}else return this['currentBar']['set'](_0xc5b84d,{'startTime':_0x2094be,'open':_0x5cd3c7,'high':_0x5cd3c7,'low':_0x5cd3c7,'close':_0x5cd3c7,'volume':_0x11811d}),null;}else return _0x2d9db2['high']=Math[_0x272b98(0x21a)](_0x2d9db2[_0x272b98(0x203)],_0x5cd3c7),_0x2d9db2['low']=Math['min'](_0x2d9db2[_0x272b98(0x276)],_0x5cd3c7),_0x2d9db2[_0x272b98(0x22e)]=_0x5cd3c7,_0x2d9db2[_0x272b98(0x1f3)]+=_0x11811d,null;}['onTick'](_0x899268){return this['processTick'](_0x899268);}[_0x3d7924(0x259)](_0x159421){const _0x57eb26=_0x3d7924;return this['processTick']({'contractId':_0x159421[_0x57eb26(0x212)]||_0x159421['symbol'],'price':_0x159421['price'],'volume':_0x159421[_0x57eb26(0x247)]||_0x159421['volume']||0x1,'timestamp':_0x159421['timestamp']||Date['now']()});}['processBar'](_0x140d09,_0x132d69){const _0x622998=_0x3d7924;let _0xcfdf1d=this['barHistory']['get'](_0x140d09);!_0xcfdf1d&&(this[_0x622998(0x1f6)](_0x140d09),_0xcfdf1d=this[_0x622998(0x237)][_0x622998(0x225)](_0x140d09));_0xcfdf1d['push'](_0x132d69);if(_0xcfdf1d['length']>0x1f4)_0xcfdf1d[_0x622998(0x215)]();const _0x20babe=_0xcfdf1d[_0x622998(0x26f)]-0x1;if(_0xcfdf1d['length']<this[_0x622998(0x205)]['swing']['lookbackBars']*0x3)return null;const _0x4b5a8a=this[_0x622998(0x252)][_0x622998(0x225)](_0x140d09)['length'];this[_0x622998(0x1fb)](_0x140d09,_0xcfdf1d,_0x20babe);const _0xc09007=this[_0x622998(0x252)]['get'](_0x140d09);if(_0xc09007[_0x622998(0x26f)]>_0x4b5a8a){const _0x297d32=_0xc09007[_0xc09007['length']-0x1];this[_0x622998(0x231)]('log',{'type':'debug','message':'[2B]\x20NEW\x20SWING\x20'+_0x297d32['type']['toUpperCase']()+'\x20@\x20'+_0x297d32['price']['toFixed'](0x2)+_0x622998(0x246)+_0xc09007[_0x622998(0x26f)]});}const _0x606643=this[_0x622998(0x26b)]['get'](_0x140d09)[_0x622998(0x26f)];this[_0x622998(0x274)](_0x140d09,_0x20babe);const _0x45a774=this['liquidityZones']['get'](_0x140d09);if(_0x45a774['length']>_0x606643){const _0x2f38da=_0x45a774[_0x45a774['length']-0x1];this[_0x622998(0x231)]('log',{'type':_0x622998(0x24f),'message':_0x622998(0x217)+_0x2f38da[_0x622998(0x24a)]['toUpperCase']()+'\x20@\x20'+_0x2f38da['getLevel']()[_0x622998(0x26e)](0x2)+'\x20|\x20Total:\x20'+_0x45a774[_0x622998(0x26f)]});}const _0x3470da=this['_detectSweep'](_0x140d09,_0xcfdf1d,_0x20babe);_0x3470da&&this[_0x622998(0x231)]('log',{'type':'debug','message':'[2B]\x20SWEEP\x20'+_0x3470da['sweepType']+'\x20|\x20Valid:\x20'+_0x3470da[_0x622998(0x20d)]+_0x622998(0x236)+_0x3470da[_0x622998(0x25f)]['toFixed'](0x1)+_0x622998(0x278)+(_0x3470da['qualityScore']*0x64)[_0x622998(0x26e)](0x0)+'%'});if(_0x3470da&&_0x3470da['isValid'])return this[_0x622998(0x209)](_0x140d09,_0x132d69,_0x20babe,_0x3470da);return null;}['_detectSwings'](_0x87607c,_0x31a98b,_0x5087d8){const _0x53e82f=_0x3d7924,_0x4109ca=this['config']['swing'][_0x53e82f(0x211)],_0x27fc8a=this['config'][_0x53e82f(0x226)]['minStrength'];if(_0x5087d8<_0x4109ca*0x2)return;const _0x3ede85=this['swingPoints'][_0x53e82f(0x225)](_0x87607c),_0x3625bd=_0x5087d8-_0x4109ca,_0x122cc5=_0x31a98b[_0x3625bd];let _0x95b538=!![],_0x45dc2e=0x0;for(let _0x197be8=_0x3625bd-_0x4109ca;_0x197be8<=_0x3625bd+_0x4109ca;_0x197be8++){if(_0x197be8===_0x3625bd||_0x197be8<0x0||_0x197be8>=_0x31a98b['length'])continue;if(_0x31a98b[_0x197be8]['high']>=_0x122cc5['high']){_0x95b538=![];break;}_0x45dc2e++;}if(_0x95b538&&_0x45dc2e>=_0x27fc8a){const _0x1d0cab=_0x3ede85[_0x53e82f(0x21c)](_0x241b00=>_0x241b00[_0x53e82f(0x245)]===_0x3625bd&&_0x241b00[_0x53e82f(0x24a)]==='high');!_0x1d0cab&&_0x3ede85[_0x53e82f(0x218)](new SwingPoint(_0x53e82f(0x203),_0x122cc5['high'],_0x3625bd,_0x122cc5['timestamp'],_0x45dc2e));}let _0x7c8314=!![],_0x4280d9=0x0;for(let _0x167a04=_0x3625bd-_0x4109ca;_0x167a04<=_0x3625bd+_0x4109ca;_0x167a04++){if(_0x167a04===_0x3625bd||_0x167a04<0x0||_0x167a04>=_0x31a98b[_0x53e82f(0x26f)])continue;if(_0x31a98b[_0x167a04]['low']<=_0x122cc5['low']){_0x7c8314=![];break;}_0x4280d9++;}if(_0x7c8314&&_0x4280d9>=_0x27fc8a){const _0x1e9d05=_0x3ede85[_0x53e82f(0x21c)](_0xb0d07a=>_0xb0d07a['barIndex']===_0x3625bd&&_0xb0d07a[_0x53e82f(0x24a)]==='low');!_0x1e9d05&&_0x3ede85['push'](new SwingPoint(_0x53e82f(0x276),_0x122cc5[_0x53e82f(0x276)],_0x3625bd,_0x122cc5[_0x53e82f(0x266)],_0x4280d9));}const _0x8a4635=this['config']['zone']['maxZoneAgeBars'];while(_0x3ede85['length']>0x0&&_0x3ede85[0x0][_0x53e82f(0x245)]<_0x5087d8-_0x8a4635){_0x3ede85[_0x53e82f(0x215)]();}}[_0x3d7924(0x274)](_0x19831d,_0x3ac3d5){const _0x223186=_0x3d7924,_0x231f1f=this['swingPoints'][_0x223186(0x225)](_0x19831d),_0x55a82d=this['liquidityZones'][_0x223186(0x225)](_0x19831d),_0x55b3e0=this['config']['zone']['clusterToleranceTicks']*this[_0x223186(0x26c)],_0x47a17e=this[_0x223186(0x205)]['zone']['maxZoneAgeBars'];for(let _0x19e92e=_0x55a82d[_0x223186(0x26f)]-0x1;_0x19e92e>=0x0;_0x19e92e--){_0x3ac3d5-_0x55a82d[_0x19e92e][_0x223186(0x245)]>_0x47a17e&&_0x55a82d['splice'](_0x19e92e,0x1);}for(const _0x163b14 of _0x231f1f){let _0x4f5685=null;for(const _0xc007e6 of _0x55a82d){if(_0xc007e6[_0x223186(0x1ff)](_0x163b14['price'],this[_0x223186(0x205)][_0x223186(0x264)]['clusterToleranceTicks'],this['tickSize'])){_0x4f5685=_0xc007e6;break;}}if(_0x4f5685){_0x4f5685['touches']++;if(_0x163b14['price']>_0x4f5685['priceHigh'])_0x4f5685[_0x223186(0x220)]=_0x163b14[_0x223186(0x25c)];if(_0x163b14[_0x223186(0x25c)]<_0x4f5685['priceLow'])_0x4f5685['priceLow']=_0x163b14['price'];_0x4f5685[_0x223186(0x216)]=Math[_0x223186(0x232)](0x1,0.3+_0x4f5685[_0x223186(0x26a)]*0.15);}else{const _0xcb9a91=_0x163b14[_0x223186(0x24a)]==='high'?ZoneType['RESISTANCE']:ZoneType[_0x223186(0x26d)],_0x1645a2=new LiquidityZone(_0xcb9a91,_0x163b14[_0x223186(0x25c)]+_0x55b3e0/0x2,_0x163b14[_0x223186(0x25c)]-_0x55b3e0/0x2,_0x163b14[_0x223186(0x266)],_0x163b14['barIndex']);_0x1645a2['qualityScore']=0.3+_0x163b14[_0x223186(0x227)]*0.1,_0x55a82d['push'](_0x1645a2);}}}['_detectSweep'](_0x3fdc4d,_0x5eec33,_0x32e7a4){const _0x3b54c2=_0x3d7924,_0x89ab93=this[_0x3b54c2(0x26b)][_0x3b54c2(0x225)](_0x3fdc4d),_0x454661=_0x5eec33[_0x32e7a4],_0x53437b=_0x454661[_0x3b54c2(0x22e)],_0x21300a=this['config']['sweep'],_0x3b545b=this['config']['zone'];for(const _0x175f08 of _0x89ab93){if(_0x175f08['lastUsedBarIndex']>=0x0&&_0x32e7a4-_0x175f08['lastUsedBarIndex']<_0x3b545b['cooldownBars'])continue;const _0x3ef434=_0x175f08[_0x3b54c2(0x210)](),_0x111a40=Math['abs'](_0x53437b-_0x3ef434)/this['tickSize'];if(_0x111a40>_0x3b545b['maxZoneDistanceTicks'])continue;const _0x4b337a=Math[_0x3b54c2(0x21a)](0x0,_0x32e7a4-_0x21300a[_0x3b54c2(0x1f9)]*0x2);for(let _0x2a1ed4=_0x4b337a;_0x2a1ed4<_0x32e7a4;_0x2a1ed4++){const _0x717ef1=_0x5eec33[_0x2a1ed4];if(_0x175f08['type']===ZoneType[_0x3b54c2(0x256)]){const _0x253cfc=(_0x717ef1['high']-_0x175f08[_0x3b54c2(0x220)])/this['tickSize'];if(_0x253cfc>=_0x21300a[_0x3b54c2(0x254)]&&_0x253cfc<=_0x21300a['maxPenetrationTicks']){if(_0x53437b<_0x175f08[_0x3b54c2(0x220)]){const _0x5244e9=_0x717ef1[_0x3b54c2(0x203)]-_0x717ef1['low'],_0x570d32=Math[_0x3b54c2(0x202)](_0x717ef1[_0x3b54c2(0x22e)]-_0x717ef1['open']),_0x19f657=_0x5244e9>0x0?_0x570d32/_0x5244e9:0x0;if(_0x19f657>=_0x21300a['minBodyRatio']){const _0x101de7=this['_getVolumeRatio'](_0x5eec33,_0x2a1ed4,0x14);if(_0x101de7>=_0x21300a['minVolumeRatio']){const _0x9fbffe=new SweepEvent(SweepType[_0x3b54c2(0x222)],_0x175f08,_0x2a1ed4,_0x2a1ed4,_0x717ef1['high']);_0x9fbffe[_0x3b54c2(0x234)]=_0x32e7a4,_0x9fbffe['penetrationTicks']=_0x253cfc,_0x9fbffe[_0x3b54c2(0x24e)]=_0x32e7a4-_0x2a1ed4,_0x9fbffe['volumeRatio']=_0x101de7,_0x9fbffe[_0x3b54c2(0x216)]=this[_0x3b54c2(0x253)](_0x9fbffe,_0x19f657),_0x9fbffe[_0x3b54c2(0x20d)]=_0x9fbffe['qualityScore']>=_0x21300a[_0x3b54c2(0x21d)];if(_0x9fbffe['isValid'])return _0x9fbffe;}}}}}if(_0x175f08[_0x3b54c2(0x24a)]===ZoneType['SUPPORT']){const _0x14ba75=(_0x175f08[_0x3b54c2(0x25d)]-_0x717ef1[_0x3b54c2(0x276)])/this['tickSize'];if(_0x14ba75>=_0x21300a[_0x3b54c2(0x254)]&&_0x14ba75<=_0x21300a['maxPenetrationTicks']){if(_0x53437b>_0x175f08[_0x3b54c2(0x25d)]){const _0x5d9a73=_0x717ef1['high']-_0x717ef1['low'],_0x2fdff3=Math['abs'](_0x717ef1[_0x3b54c2(0x22e)]-_0x717ef1['open']),_0xb5a9b4=_0x5d9a73>0x0?_0x2fdff3/_0x5d9a73:0x0;if(_0xb5a9b4>=_0x21300a[_0x3b54c2(0x27c)]){const _0x28c85a=this[_0x3b54c2(0x206)](_0x5eec33,_0x2a1ed4,0x14);if(_0x28c85a>=_0x21300a[_0x3b54c2(0x213)]){const _0x7307ba=new SweepEvent(SweepType[_0x3b54c2(0x224)],_0x175f08,_0x2a1ed4,_0x2a1ed4,_0x717ef1[_0x3b54c2(0x276)]);_0x7307ba['exitBarIndex']=_0x32e7a4,_0x7307ba[_0x3b54c2(0x25f)]=_0x14ba75,_0x7307ba[_0x3b54c2(0x24e)]=_0x32e7a4-_0x2a1ed4,_0x7307ba['volumeRatio']=_0x28c85a,_0x7307ba['qualityScore']=this[_0x3b54c2(0x253)](_0x7307ba,_0xb5a9b4),_0x7307ba['isValid']=_0x7307ba[_0x3b54c2(0x216)]>=_0x21300a['minQualityScore'];if(_0x7307ba['isValid'])return _0x7307ba;}}}}}}}return null;}['_getVolumeRatio'](_0x4eb594,_0x4d53e5,_0x3800df){const _0x19baed=_0x3d7924,_0x3898f4=Math['max'](0x0,_0x4d53e5-_0x3800df),_0x417e81=_0x4eb594[_0x19baed(0x1f5)](_0x3898f4,_0x4d53e5);if(_0x417e81['length']===0x0)return 0x1;const _0x549a07=_0x417e81[_0x19baed(0x204)](_0x3500a1=>_0x3500a1[_0x19baed(0x1f3)])[_0x19baed(0x271)]((_0x379816,_0x5cbde1)=>_0x379816-_0x5cbde1),_0x3885d2=Math['floor'](_0x549a07['length']/0x2),_0x575910=_0x549a07[_0x3885d2]||0x1;return _0x4eb594[_0x4d53e5]['volume']/_0x575910;}['_scoreSweep'](_0x29e67f,_0x195844){const _0x39bc2a=_0x3d7924;let _0x2c783f=0x0;const _0x2c3b47=0x4,_0x70e057=Math[_0x39bc2a(0x202)](_0x29e67f['penetrationTicks']-_0x2c3b47);return _0x2c783f+=Math['max'](0x0,0.3-_0x70e057*0.03),_0x2c783f+=Math[_0x39bc2a(0x21a)](0x0,0.25-_0x29e67f['durationBars']*0.05),_0x2c783f+=Math[_0x39bc2a(0x232)](0.25,_0x29e67f[_0x39bc2a(0x261)]*0.1),_0x2c783f+=Math[_0x39bc2a(0x232)](0.2,_0x195844*0.4),Math['min'](0x1,_0x2c783f);}['_generateSignal'](_0x3caef0,_0x444054,_0x536d9e,_0x23eb72){const _0x3e2a42=_0x3d7924;if(Date['now']()-this['lastSignalTime']<this['config']['execution']['cooldownMs'])return null;const _0x1788ab=this[_0x3e2a42(0x205)][_0x3e2a42(0x22a)],_0x1a8a55=_0x444054['close'],_0x4a593a=_0x23eb72['sweepType']===SweepType['HIGH_SWEEP']?'short':_0x3e2a42(0x219);let _0x3bd2e3,_0x480b9a,_0x5cb047,_0x6186f7;_0x4a593a==='long'?(_0x3bd2e3=_0x1a8a55-_0x1788ab['stopTicks']*this[_0x3e2a42(0x26c)],_0x480b9a=_0x1a8a55+_0x1788ab[_0x3e2a42(0x1fc)]*this['tickSize'],_0x5cb047=_0x1a8a55+_0x1788ab[_0x3e2a42(0x23f)]*this[_0x3e2a42(0x26c)],_0x6186f7=_0x1a8a55+_0x1788ab[_0x3e2a42(0x258)]*this['tickSize']):(_0x3bd2e3=_0x1a8a55+_0x1788ab['stopTicks']*this[_0x3e2a42(0x26c)],_0x480b9a=_0x1a8a55-_0x1788ab[_0x3e2a42(0x1fc)]*this['tickSize'],_0x5cb047=_0x1a8a55-_0x1788ab[_0x3e2a42(0x23f)]*this['tickSize'],_0x6186f7=_0x1a8a55-_0x1788ab['trailTriggerTicks']*this[_0x3e2a42(0x26c)]);const _0x40eaab=_0x1788ab[_0x3e2a42(0x1fc)]/_0x1788ab['stopTicks'],_0x9b44ba=Math['min'](0x1,_0x23eb72['qualityScore']*0.5+_0x23eb72[_0x3e2a42(0x264)]['qualityScore']*0.3+(_0x23eb72[_0x3e2a42(0x261)]>1.5?0.2:_0x23eb72[_0x3e2a42(0x261)]*0.1));let _0xe70668=SignalStrength['MODERATE'];if(_0x9b44ba>=0.8)_0xe70668=SignalStrength['VERY_STRONG'];else{if(_0x9b44ba>=0.65)_0xe70668=SignalStrength['STRONG'];else{if(_0x9b44ba<0.5)_0xe70668=SignalStrength['WEAK'];}}const _0x3442a9=0.5+(_0x9b44ba-0.5)*0.4,_0x48369d=_0x3442a9*Math[_0x3e2a42(0x202)](_0x480b9a-_0x1a8a55)-(0x1-_0x3442a9)*Math['abs'](_0x1a8a55-_0x3bd2e3);_0x23eb72['zone']['lastUsedBarIndex']=_0x536d9e,_0x23eb72['zone']['swept']=!![],_0x23eb72['zone']['sweptAt']=new Date(_0x444054['timestamp']),this[_0x3e2a42(0x1fa)]=Date['now'](),this[_0x3e2a42(0x243)]['signals']++;const _0x1ba67b={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x3caef0[_0x3e2a42(0x244)]('.')[0x0]||_0x3caef0,'contractId':_0x3caef0,'side':_0x4a593a===_0x3e2a42(0x219)?OrderSide[_0x3e2a42(0x282)]:OrderSide[_0x3e2a42(0x27a)],'direction':_0x4a593a,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0xe70668,'edge':_0x48369d,'confidence':_0x9b44ba,'entry':_0x1a8a55,'entryPrice':_0x1a8a55,'stopLoss':_0x3bd2e3,'takeProfit':_0x480b9a,'riskReward':_0x40eaab,'stopTicks':_0x1788ab[_0x3e2a42(0x235)],'targetTicks':_0x1788ab['targetTicks'],'breakevenTicks':_0x1788ab['breakevenTicks'],'trailTriggerTicks':_0x1788ab['trailTriggerTicks'],'trailDistanceTicks':_0x1788ab['trailDistanceTicks'],'beLevel':_0x5cb047,'trailTrigger':_0x6186f7,'sweepType':_0x23eb72['sweepType'],'penetrationTicks':_0x23eb72[_0x3e2a42(0x25f)],'sweepDurationBars':_0x23eb72['durationBars'],'sweepQuality':_0x23eb72['qualityScore'],'volumeRatio':_0x23eb72['volumeRatio'],'zoneType':_0x23eb72['zone'][_0x3e2a42(0x24a)],'zoneLevel':_0x23eb72[_0x3e2a42(0x264)][_0x3e2a42(0x210)](),'zoneTouches':_0x23eb72['zone'][_0x3e2a42(0x26a)],'zoneQuality':_0x23eb72[_0x3e2a42(0x264)][_0x3e2a42(0x216)],'expires':Date['now']()+0xea60};return this['emit'](_0x3e2a42(0x200),{'side':_0x4a593a===_0x3e2a42(0x219)?'buy':'sell','action':_0x3e2a42(0x250),'reason':'2B\x20'+_0x23eb72['sweepType']+'\x20|\x20Pen:'+_0x23eb72[_0x3e2a42(0x25f)]['toFixed'](0x1)+_0x3e2a42(0x267)+_0x23eb72[_0x3e2a42(0x261)]['toFixed'](0x1)+_0x3e2a42(0x21b)+(_0x23eb72['qualityScore']*0x64)['toFixed'](0x0)+'%',..._0x1ba67b}),this[_0x3e2a42(0x231)]('log',{'type':'info','message':_0x3e2a42(0x207)+_0x4a593a[_0x3e2a42(0x1fd)]()+'\x20@\x20'+_0x1a8a55[_0x3e2a42(0x26e)](0x2)+'\x20|\x20'+_0x23eb72['sweepType']+_0x3e2a42(0x238)+_0x23eb72['penetrationTicks']['toFixed'](0x1)+'t\x20Vol:'+_0x23eb72['volumeRatio'][_0x3e2a42(0x26e)](0x1)+'x\x20|\x20Conf:'+(_0x9b44ba*0x64)[_0x3e2a42(0x26e)](0x0)+'%'}),_0x1ba67b;}[_0x3d7924(0x272)](_0xc9f9c6,_0xebbfdd){const _0x15553c=_0x3d7924,_0x38ba27=this['barHistory']['get'](_0xc9f9c6)||[],_0x1a17dc=this['liquidityZones']['get'](_0xc9f9c6)||[],_0x51506a=this[_0x15553c(0x252)][_0x15553c(0x225)](_0xc9f9c6)||[];if(_0x38ba27[_0x15553c(0x26f)]<0x5)return{'ready':![],'message':_0x15553c(0x201)+_0x38ba27[_0x15553c(0x26f)]+_0x15553c(0x233)};const _0xad9e94=_0x1a17dc['map'](_0x19b540=>({'zone':_0x19b540,'distance':Math[_0x15553c(0x202)](_0xebbfdd-_0x19b540['getLevel']())}))[_0x15553c(0x271)]((_0x117f16,_0x56b291)=>_0x117f16['distance']-_0x56b291['distance']),_0x19674b=_0xad9e94['find'](_0x468fc7=>_0x468fc7[_0x15553c(0x264)][_0x15553c(0x24a)]===ZoneType['RESISTANCE']),_0x54626d=_0xad9e94[_0x15553c(0x21c)](_0x2775e4=>_0x2775e4['zone']['type']===ZoneType[_0x15553c(0x26d)]);return{'ready':!![],'barsProcessed':_0x38ba27['length'],'swingsDetected':_0x51506a[_0x15553c(0x26f)],'activeZones':_0x1a17dc[_0x15553c(0x26f)],'nearestResistance':_0x19674b?_0x19674b['zone'][_0x15553c(0x210)]():null,'nearestSupport':_0x54626d?_0x54626d[_0x15553c(0x264)]['getLevel']():null,'stopTicks':this[_0x15553c(0x205)]['execution']['stopTicks'],'targetTicks':this['config']['execution'][_0x15553c(0x1fc)],'strategy':_0x15553c(0x268)};}[_0x3d7924(0x262)](_0xc2c40b){const _0x1f2505=_0x3d7924;this['recentTrades']['push']({'netPnl':_0xc2c40b,'timestamp':Date['now']()});if(this['recentTrades'][_0x1f2505(0x26f)]>0x64)this['recentTrades']['shift']();_0xc2c40b>0x0?this[_0x1f2505(0x243)]['wins']++:this[_0x1f2505(0x243)]['losses']++,this[_0x1f2505(0x243)]['trades']++,this['stats'][_0x1f2505(0x21f)]+=_0xc2c40b,this['emit']('log',{'type':_0x1f2505(0x24f),'message':'[HQX-2B]\x20Trade\x20result:\x20'+(_0xc2c40b>0x0?_0x1f2505(0x25b):_0x1f2505(0x1f4))+'\x20$'+_0xc2c40b[_0x1f2505(0x26e)](0x2)});}['getBarHistory'](_0x55d933){const _0x4fbcdd=_0x3d7924;return this[_0x4fbcdd(0x237)][_0x4fbcdd(0x225)](_0x55d933)||[];}[_0x3d7924(0x242)](){return this['stats'];}['getHealthStatus'](_0x4200da){const _0xdd3982=_0x3d7924,_0x1b27a4=this[_0xdd3982(0x237)]['get'](_0x4200da)||[],_0x5b625d=this['liquidityZones']['get'](_0x4200da)||[],_0x45c2f6=this[_0xdd3982(0x252)]['get'](_0x4200da)||[],_0x1de156=this[_0xdd3982(0x229)]['get'](_0x4200da),_0xe4af89=_0x1b27a4[_0x1b27a4[_0xdd3982(0x26f)]-0x1],_0x7f9f77=_0xe4af89?Date['now']()-_0xe4af89[_0xdd3982(0x266)]:null,_0x5e34e1=_0x5b625d['filter'](_0x1d49c7=>_0x1d49c7['type']===ZoneType[_0xdd3982(0x256)])['length'],_0xb1fc30=_0x5b625d['filter'](_0x21ed23=>_0x21ed23[_0xdd3982(0x24a)]===ZoneType[_0xdd3982(0x26d)])[_0xdd3982(0x26f)];return{'healthy':_0x1b27a4['length']>=0x5,'barsTotal':_0x1b27a4[_0xdd3982(0x26f)],'barsLast5Min':_0x1b27a4[_0xdd3982(0x23a)](_0x537a8f=>Date['now']()-_0x537a8f[_0xdd3982(0x266)]<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x45c2f6['length'],'zonesResistance':_0x5e34e1,'zonesSupport':_0xb1fc30,'zonesTotal':_0x5b625d[_0xdd3982(0x26f)],'currentBarTicks':_0x1de156?_0x1de156['tickCount']:0x0,'isAggregating':_0x1de156&&_0x1de156['tickCount']>0x0,'timeSinceLastBarMs':_0x7f9f77,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this['config']['execution']['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date['now']())};}['reset'](_0x3aa84c){const _0x217c43=_0x3d7924;this['barHistory']['set'](_0x3aa84c,[]),this[_0x217c43(0x252)]['set'](_0x3aa84c,[]),this[_0x217c43(0x26b)][_0x217c43(0x22f)](_0x3aa84c,[]),this[_0x217c43(0x263)][_0x217c43(0x22f)](_0x3aa84c,[]),this[_0x217c43(0x229)]['delete'](_0x3aa84c),this['emit'](_0x217c43(0x20e),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x3aa84c});}[_0x3d7924(0x1fe)](_0x440120,_0x7a9923){const _0x42800c=_0x3d7924;if(!_0x7a9923||_0x7a9923[_0x42800c(0x26f)]===0x0){this['emit']('log',{'type':_0x42800c(0x24f),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory'][_0x42800c(0x221)](_0x440120)&&this[_0x42800c(0x1f6)](_0x440120);const _0x4e9ecc=[..._0x7a9923]['sort']((_0x181efe,_0x5c899c)=>_0x181efe[_0x42800c(0x266)]-_0x5c899c['timestamp']);this[_0x42800c(0x231)](_0x42800c(0x20e),{'type':'info','message':_0x42800c(0x280)+_0x4e9ecc[_0x42800c(0x26f)]+'\x20historical\x20bars...'});let _0x5d1609=0x0;for(const _0x48b240 of _0x4e9ecc){const _0x1d5d0c=this['processBar'](_0x440120,_0x48b240);if(_0x1d5d0c)_0x5d1609++;}const _0x39f4b3=this[_0x42800c(0x237)][_0x42800c(0x225)](_0x440120)||[],_0x5e17d3=this[_0x42800c(0x252)]['get'](_0x440120)||[],_0xb24c77=this['liquidityZones'][_0x42800c(0x225)](_0x440120)||[];this[_0x42800c(0x231)]('log',{'type':_0x42800c(0x22c),'message':_0x42800c(0x251)+_0x39f4b3[_0x42800c(0x26f)]+_0x42800c(0x22b)+_0x5e17d3['length']+'\x20swings,\x20'+_0xb24c77['length']+_0x42800c(0x27e)}),_0x5d1609>0x0&&this['emit']('log',{'type':_0x42800c(0x24f),'message':'[HQX-2B]\x20'+_0x5d1609+'\x20historical\x20signals\x20detected\x20(ignored)'}),this['lastSignalTime']=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x280e9c={}){const _0x11f21c=_0x3d7924;super(),this[_0x11f21c(0x205)]=_0x280e9c,this[_0x11f21c(0x223)]=new HQX2BLiquiditySweep(_0x280e9c),this['strategy']['on'](_0x11f21c(0x200),_0xd6531c=>this[_0x11f21c(0x231)](_0x11f21c(0x200),_0xd6531c)),this['strategy']['on']('log',_0x43f95c=>this['emit'](_0x11f21c(0x20e),_0x43f95c));}['processTick'](_0x40c417){const _0x553c10=_0x3d7924;return this[_0x553c10(0x223)][_0x553c10(0x24d)](_0x40c417);}[_0x3d7924(0x20c)](_0x23fbe8){return this['strategy']['onTick'](_0x23fbe8);}[_0x3d7924(0x259)](_0xd31c0d){const _0x506b8e=_0x3d7924;return this[_0x506b8e(0x223)][_0x506b8e(0x259)](_0xd31c0d);}['processBar'](_0x4b2d78,_0x4246dc){return this['strategy']['processBar'](_0x4b2d78,_0x4246dc);}[_0x3d7924(0x1f6)](_0x96c374,_0x455bf0,_0x5d35f2){const _0x71dca=_0x3d7924;return this[_0x71dca(0x223)]['initialize'](_0x96c374,_0x455bf0,_0x5d35f2);}[_0x3d7924(0x272)](_0x4dbcb8,_0x2d1dc9){const _0x5ad33d=_0x3d7924;return this[_0x5ad33d(0x223)]['getAnalysisState'](_0x4dbcb8,_0x2d1dc9);}['recordTradeResult'](_0xef89f1){const _0x7894f4=_0x3d7924;return this['strategy'][_0x7894f4(0x262)](_0xef89f1);}['reset'](_0x59fd6e){const _0x1deaf8=_0x3d7924;return this[_0x1deaf8(0x223)][_0x1deaf8(0x260)](_0x59fd6e);}['getStats'](){const _0x44e84f=_0x3d7924;return this[_0x44e84f(0x223)][_0x44e84f(0x242)]();}[_0x3d7924(0x270)](_0x443311){const _0x432de5=_0x3d7924;return this[_0x432de5(0x223)]['getBarHistory'](_0x443311);}['preloadBars'](_0x5994b8,_0xb2ede2){const _0x2489f5=_0x3d7924;return this[_0x2489f5(0x223)][_0x2489f5(0x1fe)](_0x5994b8,_0xb2ede2);}['getHealthStatus'](_0x3649e1){const _0x594169=_0x3d7924;return this[_0x594169(0x223)]['getHealthStatus'](_0x3649e1);}[_0x3d7924(0x214)](_0x5e113b){return null;}}module[_0x3d7924(0x228)]={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
1
+ const _0xe9f20f=_0x4ccb;(function(_0x165b9b,_0x1bb239){const _0x204a55=_0x4ccb,_0x3a7f1f=_0x165b9b();while(!![]){try{const _0x304b4d=parseInt(_0x204a55(0xfe))/0x1*(-parseInt(_0x204a55(0x13b))/0x2)+-parseInt(_0x204a55(0x10f))/0x3+parseInt(_0x204a55(0x134))/0x4*(parseInt(_0x204a55(0x10a))/0x5)+parseInt(_0x204a55(0x164))/0x6+parseInt(_0x204a55(0x106))/0x7*(parseInt(_0x204a55(0xeb))/0x8)+-parseInt(_0x204a55(0xe8))/0x9*(parseInt(_0x204a55(0xe2))/0xa)+parseInt(_0x204a55(0x132))/0xb*(-parseInt(_0x204a55(0x139))/0xc);if(_0x304b4d===_0x1bb239)break;else _0x3a7f1f['push'](_0x3a7f1f['shift']());}catch(_0x4a47aa){_0x3a7f1f['push'](_0x3a7f1f['shift']());}}}(_0x30a4,0x5ebc6));const EventEmitter=require('events'),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0xe9f20f(0x15e),'LOW_SWEEP':_0xe9f20f(0x116)},ZoneType={'RESISTANCE':_0xe9f20f(0xf3),'SUPPORT':_0xe9f20f(0xe0)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.25,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.1,'minVolumeRatio':0.3,'minBodyRatio':0.05},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x1388,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0xe9f20f(0x14f)}};class SwingPoint{constructor(_0x2b01a7,_0x5e9e29,_0x55f916,_0x3bf14d,_0x26e76a=0x1){const _0x248d38=_0xe9f20f;this['type']=_0x2b01a7,this[_0x248d38(0x102)]=_0x5e9e29,this['barIndex']=_0x55f916,this[_0x248d38(0x141)]=_0x3bf14d,this[_0x248d38(0x13d)]=_0x26e76a;}}function _0x30a4(){const _0x529bb6=['\x20bars,\x20','getAnalysisState','support','symbol','4090odtSXM','getUTCHours','has','processTick','x\x20|\x20Q:','_generateSignal','17037cRazoI','maxZoneAgeBars','size','351664HqcynT','volumeRatio','stats','emit','isValid','[HQX-2B]\x20SIGNAL:\x20','floor','createdAt','resistance','open','[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload','info','tickCount','barHistory','reset','lookbackBars','close','toUpperCase','penetrationTicks','121QVtERm','_updateZones','map','maxDurationBars','price','minBodyRatio','onTick','length','91euWRqR','\x20zones','object','getBarHistory','5puwMet','distance','now','entryBarIndex','liquidityZones','527376evCsSD','_detectSweep','tickValue','_scoreSweep','LOSS','trailDistanceTicks','trailTriggerTicks','low','\x20swings,\x20','sweptAt','targetTicks',':\x20tick=','zone','RESISTANCE','LOW_SWEEP','SUPPORT','tickSize','/5\x20bars','shift','preloadBars','ASK','[2B]\x20SWEEP\x20','[HQX-2B]\x20Trade\x20result:\x20','lastSignalTime','barIntervalMs','type','currentBar','isDST','getHealthStatus','generateSignal','config','lastUsedBarIndex','set','getFullYear','touches','22968rylGpH','processBar','2795516mqSmMf','swingPoints','push','\x20|\x20','toFixed','1812xBvQSD','_getVolumeRatio','868pURVsV','maxZoneDistanceTicks','strength','containsPrice','short','clusterToleranceTicks','timestamp','t,\x20Target=','abs','cooldownMs','minPenetrationTicks','t,\x20Trail=','log','max','find','signal','long','\x20|\x20Total:\x20','priceLow','initialize','America/New_York','minQualityScore',',\x20TF=1min','\x20historical\x20bars...','t\x20Vol:','priceHigh','sort','enabled','MODERATE','trades','getTimezoneOffset','debug','stopTicks','\x20@\x20','contractId','high','recordTradeResult','sweepType','strategy','get','extremeBarIndex','2613216kvByLI','maxPenetrationTicks','[HQX-2B]\x20Preloading\x20','volume','swing','exitBarIndex','delete','2B\x20','execution','BID','Collecting\x20data...\x20','swept','\x20|\x20Pen:','min','_detectSwings','barIndex','breakevenTicks','[HQX-2B]\x20Preload\x20complete:\x20','qualityScore','getLevel','filter'];_0x30a4=function(){return _0x529bb6;};return _0x30a4();}class LiquidityZone{constructor(_0x224987,_0x12a1b2,_0x140203,_0x45f4ce,_0x41ed22){const _0x270a8b=_0xe9f20f;this['id']=uuidv4(),this['type']=_0x224987,this['priceHigh']=_0x12a1b2,this[_0x270a8b(0x14d)]=_0x140203,this[_0x270a8b(0xf2)]=_0x45f4ce,this['barIndex']=_0x41ed22,this['touches']=0x1,this[_0x270a8b(0xd4)]=![],this['sweptAt']=null,this[_0x270a8b(0x12e)]=-0x3e7,this[_0x270a8b(0xdb)]=0.5;}['containsPrice'](_0x22241f,_0x1cf8da,_0x4cd927){const _0x16ce21=_0xe9f20f,_0x2d4332=_0x1cf8da*_0x4cd927;return _0x22241f>=this[_0x16ce21(0x14d)]-_0x2d4332&&_0x22241f<=this['priceHigh']+_0x2d4332;}['getLevel'](){const _0x496d1e=_0xe9f20f;return(this[_0x496d1e(0x154)]+this[_0x496d1e(0x14d)])/0x2;}}function _0x4ccb(_0x1f907e,_0x2377e2){_0x1f907e=_0x1f907e-0xce;const _0x30a4dc=_0x30a4();let _0x4ccbe1=_0x30a4dc[_0x1f907e];return _0x4ccbe1;}class SweepEvent{constructor(_0x512a48,_0x35f462,_0x302d38,_0x29edd5,_0x4e058a){const _0x5c9c12=_0xe9f20f;this[_0x5c9c12(0x160)]=_0x512a48,this['zone']=_0x35f462,this[_0x5c9c12(0x10d)]=_0x302d38,this[_0x5c9c12(0x163)]=_0x29edd5,this['extremePrice']=_0x4e058a,this[_0x5c9c12(0xce)]=null,this[_0x5c9c12(0xef)]=![],this[_0x5c9c12(0xdb)]=0x0,this[_0x5c9c12(0xfd)]=0x0,this['durationBars']=0x0,this[_0x5c9c12(0xec)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x20d856={}){const _0x3ac472=_0xe9f20f;super(),this[_0x3ac472(0x12d)]=this['_mergeConfig'](DEFAULT_CONFIG,_0x20d856),this[_0x3ac472(0x11f)]=this[_0x3ac472(0x12d)][_0x3ac472(0x11f)],this['tickValue']=this[_0x3ac472(0x12d)]['tickValue'],this['barHistory']=new Map(),this[_0x3ac472(0x135)]=new Map(),this[_0x3ac472(0x10e)]=new Map(),this['activeSweeps']=new Map(),this[_0x3ac472(0x129)]=new Map(),this['barIntervalMs']=0xea60,this[_0x3ac472(0x126)]=0x0,this['startTime']=Date['now'](),this[_0x3ac472(0xed)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this['recentTrades']=[];}['_mergeConfig'](_0xd30c84,_0x2216b9){const _0x190ef8=_0xe9f20f,_0x239fed={..._0xd30c84};for(const _0x5e7ede in _0x2216b9){typeof _0x2216b9[_0x5e7ede]===_0x190ef8(0x108)&&!Array['isArray'](_0x2216b9[_0x5e7ede])?_0x239fed[_0x5e7ede]={..._0xd30c84[_0x5e7ede],..._0x2216b9[_0x5e7ede]}:_0x239fed[_0x5e7ede]=_0x2216b9[_0x5e7ede];}return _0x239fed;}['isWithinSession'](_0x253744){const _0x19d91a=_0xe9f20f;if(!this['config']['session'][_0x19d91a(0x156)])return!![];const _0x2ac9fc=new Date(_0x253744),_0x2c22e2=this[_0x19d91a(0x12a)](_0x2ac9fc)?-0x4:-0x5,_0x29fb6d=_0x2ac9fc[_0x19d91a(0xe3)](),_0x325e0f=_0x2ac9fc['getUTCMinutes'](),_0x4686ad=(_0x29fb6d+_0x2c22e2+0x18)%0x18,{startHour:_0x45c59f,startMinute:_0x355263,endHour:_0x4b0bde,endMinute:_0x130fd5}=this['config']['session'],_0x427537=_0x4686ad*0x3c+_0x325e0f,_0x12b3cd=_0x45c59f*0x3c+_0x355263,_0x4a5d10=_0x4b0bde*0x3c+_0x130fd5;return _0x427537>=_0x12b3cd&&_0x427537<_0x4a5d10;}['isDST'](_0x424abc){const _0x5f5813=_0xe9f20f,_0x4e2213=new Date(_0x424abc['getFullYear'](),0x0,0x1),_0x3239fc=new Date(_0x424abc[_0x5f5813(0x130)](),0x6,0x1),_0x5d0925=Math['max'](_0x4e2213['getTimezoneOffset'](),_0x3239fc[_0x5f5813(0x159)]());return _0x424abc[_0x5f5813(0x159)]()<_0x5d0925;}['initialize'](_0x13251c,_0x581d44=0.25,_0x36336b=0x5){const _0x1c6944=_0xe9f20f;this['tickSize']=_0x581d44,this[_0x1c6944(0x111)]=_0x36336b,this[_0x1c6944(0x12d)]['tickSize']=_0x581d44,this['config'][_0x1c6944(0x111)]=_0x36336b,this[_0x1c6944(0xf8)][_0x1c6944(0x12f)](_0x13251c,[]),this[_0x1c6944(0x135)]['set'](_0x13251c,[]),this['liquidityZones'][_0x1c6944(0x12f)](_0x13251c,[]),this['activeSweeps']['set'](_0x13251c,[]),this[_0x1c6944(0x129)][_0x1c6944(0xcf)](_0x13251c),this['emit']('log',{'type':_0x1c6944(0xf6),'message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x13251c+_0x1c6944(0x11a)+_0x581d44+',\x20value='+_0x36336b+_0x1c6944(0x151)}),this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x1c6944(0x12d)]['execution']['stopTicks']+_0x1c6944(0x142)+this[_0x1c6944(0x12d)]['execution'][_0x1c6944(0x119)]+'t,\x20BE='+this[_0x1c6944(0x12d)][_0x1c6944(0xd1)][_0x1c6944(0xd9)]+_0x1c6944(0x146)+this['config'][_0x1c6944(0xd1)]['trailTriggerTicks']+'/'+this['config'][_0x1c6944(0xd1)]['trailDistanceTicks']});}[_0xe9f20f(0xe5)](_0x5665f6){const _0x361c9a=_0xe9f20f,{contractId:_0x5d3781,price:_0x57110c,volume:_0x31f961,timestamp:_0x51a452}=_0x5665f6,_0x4bd6e8=_0x51a452||Date['now'](),_0x597f7b=_0x31f961||0x1;if(!this['isWithinSession'](_0x4bd6e8))return null;let _0x2f6a76=this[_0x361c9a(0x129)]['get'](_0x5d3781);const _0x474f27=Math['floor'](_0x4bd6e8/this[_0x361c9a(0x127)])*this['barIntervalMs'];if(!_0x2f6a76||_0x2f6a76['startTime']!==_0x474f27){if(_0x2f6a76){const _0x511231={'timestamp':_0x2f6a76['startTime'],'open':_0x2f6a76['open'],'high':_0x2f6a76[_0x361c9a(0x15e)],'low':_0x2f6a76[_0x361c9a(0x116)],'close':_0x2f6a76['close'],'volume':_0x2f6a76['volume']},_0x467bac=this[_0x361c9a(0x133)](_0x5d3781,_0x511231);return this[_0x361c9a(0x129)][_0x361c9a(0x12f)](_0x5d3781,{'startTime':_0x474f27,'open':_0x57110c,'high':_0x57110c,'low':_0x57110c,'close':_0x57110c,'volume':_0x597f7b}),_0x467bac;}else return this[_0x361c9a(0x129)][_0x361c9a(0x12f)](_0x5d3781,{'startTime':_0x474f27,'open':_0x57110c,'high':_0x57110c,'low':_0x57110c,'close':_0x57110c,'volume':_0x597f7b}),null;}else return _0x2f6a76[_0x361c9a(0x15e)]=Math['max'](_0x2f6a76[_0x361c9a(0x15e)],_0x57110c),_0x2f6a76[_0x361c9a(0x116)]=Math['min'](_0x2f6a76['low'],_0x57110c),_0x2f6a76[_0x361c9a(0xfb)]=_0x57110c,_0x2f6a76['volume']+=_0x597f7b,null;}['onTick'](_0x5d5df0){const _0x476dce=_0xe9f20f;return this[_0x476dce(0xe5)](_0x5d5df0);}['onTrade'](_0x37f14a){const _0x36231f=_0xe9f20f;return this[_0x36231f(0xe5)]({'contractId':_0x37f14a[_0x36231f(0x15d)]||_0x37f14a[_0x36231f(0xe1)],'price':_0x37f14a[_0x36231f(0x102)],'volume':_0x37f14a[_0x36231f(0xea)]||_0x37f14a[_0x36231f(0x167)]||0x1,'timestamp':_0x37f14a['timestamp']||Date[_0x36231f(0x10c)]()});}[_0xe9f20f(0x133)](_0x1c4dec,_0x3b443c){const _0x3df781=_0xe9f20f;let _0x4a76e4=this['barHistory'][_0x3df781(0x162)](_0x1c4dec);!_0x4a76e4&&(this['initialize'](_0x1c4dec),_0x4a76e4=this['barHistory']['get'](_0x1c4dec));_0x4a76e4['push'](_0x3b443c);if(_0x4a76e4[_0x3df781(0x105)]>0x1f4)_0x4a76e4[_0x3df781(0x121)]();const _0x4990be=_0x4a76e4[_0x3df781(0x105)]-0x1;if(_0x4a76e4[_0x3df781(0x105)]<this['config']['swing'][_0x3df781(0xfa)]*0x3)return null;const _0x1e91b4=this[_0x3df781(0x135)]['get'](_0x1c4dec)[_0x3df781(0x105)];this[_0x3df781(0xd7)](_0x1c4dec,_0x4a76e4,_0x4990be);const _0xbd0d81=this[_0x3df781(0x135)]['get'](_0x1c4dec);if(_0xbd0d81['length']>_0x1e91b4){const _0x5b3bd5=_0xbd0d81[_0xbd0d81['length']-0x1];this[_0x3df781(0xee)](_0x3df781(0x147),{'type':'debug','message':'[2B]\x20NEW\x20SWING\x20'+_0x5b3bd5[_0x3df781(0x128)]['toUpperCase']()+_0x3df781(0x15c)+_0x5b3bd5['price']['toFixed'](0x2)+_0x3df781(0x14c)+_0xbd0d81['length']});}const _0x158b31=this[_0x3df781(0x10e)][_0x3df781(0x162)](_0x1c4dec)['length'];this['_updateZones'](_0x1c4dec,_0x4990be);const _0x567f32=this['liquidityZones']['get'](_0x1c4dec);if(_0x567f32['length']>_0x158b31){const _0x386fbc=_0x567f32[_0x567f32[_0x3df781(0x105)]-0x1];this['emit'](_0x3df781(0x147),{'type':'debug','message':'[2B]\x20NEW\x20ZONE\x20'+_0x386fbc[_0x3df781(0x128)]['toUpperCase']()+'\x20@\x20'+_0x386fbc['getLevel']()['toFixed'](0x2)+'\x20|\x20Total:\x20'+_0x567f32[_0x3df781(0x105)]});}const _0x440e9c=this['_detectSweep'](_0x1c4dec,_0x4a76e4,_0x4990be);_0x440e9c&&this[_0x3df781(0xee)](_0x3df781(0x147),{'type':'debug','message':_0x3df781(0x124)+_0x440e9c[_0x3df781(0x160)]+'\x20|\x20Valid:\x20'+_0x440e9c[_0x3df781(0xef)]+'\x20|\x20Pen:\x20'+_0x440e9c[_0x3df781(0xfd)][_0x3df781(0x138)](0x1)+'t\x20|\x20Q:\x20'+(_0x440e9c['qualityScore']*0x64)['toFixed'](0x0)+'%'});if(_0x440e9c&&_0x440e9c['isValid'])return this['_generateSignal'](_0x1c4dec,_0x3b443c,_0x4990be,_0x440e9c);return null;}[_0xe9f20f(0xd7)](_0x1eb7bc,_0x5282ff,_0x1f6151){const _0xc911f1=_0xe9f20f,_0x19e887=this['config']['swing']['lookbackBars'],_0x48d834=this[_0xc911f1(0x12d)][_0xc911f1(0x168)]['minStrength'];if(_0x1f6151<_0x19e887*0x2)return;const _0x594eff=this[_0xc911f1(0x135)]['get'](_0x1eb7bc),_0x5a9fd3=_0x1f6151-_0x19e887,_0x26d00b=_0x5282ff[_0x5a9fd3];let _0x97b5d9=!![],_0x30b7dd=0x0;for(let _0x28497b=_0x5a9fd3-_0x19e887;_0x28497b<=_0x5a9fd3+_0x19e887;_0x28497b++){if(_0x28497b===_0x5a9fd3||_0x28497b<0x0||_0x28497b>=_0x5282ff['length'])continue;if(_0x5282ff[_0x28497b]['high']>=_0x26d00b['high']){_0x97b5d9=![];break;}_0x30b7dd++;}if(_0x97b5d9&&_0x30b7dd>=_0x48d834){const _0x47f1b9=_0x594eff['find'](_0x80a7de=>_0x80a7de[_0xc911f1(0xd8)]===_0x5a9fd3&&_0x80a7de[_0xc911f1(0x128)]===_0xc911f1(0x15e));!_0x47f1b9&&_0x594eff['push'](new SwingPoint(_0xc911f1(0x15e),_0x26d00b['high'],_0x5a9fd3,_0x26d00b[_0xc911f1(0x141)],_0x30b7dd));}let _0x54ad94=!![],_0x1ff924=0x0;for(let _0x11915c=_0x5a9fd3-_0x19e887;_0x11915c<=_0x5a9fd3+_0x19e887;_0x11915c++){if(_0x11915c===_0x5a9fd3||_0x11915c<0x0||_0x11915c>=_0x5282ff[_0xc911f1(0x105)])continue;if(_0x5282ff[_0x11915c][_0xc911f1(0x116)]<=_0x26d00b[_0xc911f1(0x116)]){_0x54ad94=![];break;}_0x1ff924++;}if(_0x54ad94&&_0x1ff924>=_0x48d834){const _0xf012a6=_0x594eff[_0xc911f1(0x149)](_0x25a953=>_0x25a953[_0xc911f1(0xd8)]===_0x5a9fd3&&_0x25a953['type']==='low');!_0xf012a6&&_0x594eff[_0xc911f1(0x136)](new SwingPoint('low',_0x26d00b[_0xc911f1(0x116)],_0x5a9fd3,_0x26d00b['timestamp'],_0x1ff924));}const _0x803395=this[_0xc911f1(0x12d)]['zone'][_0xc911f1(0xe9)];while(_0x594eff[_0xc911f1(0x105)]>0x0&&_0x594eff[0x0][_0xc911f1(0xd8)]<_0x1f6151-_0x803395){_0x594eff['shift']();}}[_0xe9f20f(0xff)](_0x17c7f9,_0x4339cf){const _0x2198da=_0xe9f20f,_0x11b15b=this['swingPoints']['get'](_0x17c7f9),_0x23550f=this['liquidityZones']['get'](_0x17c7f9),_0x4560ca=this[_0x2198da(0x12d)]['zone'][_0x2198da(0x140)]*this[_0x2198da(0x11f)],_0x4aed86=this['config']['zone']['maxZoneAgeBars'];for(let _0x3ceedb=_0x23550f[_0x2198da(0x105)]-0x1;_0x3ceedb>=0x0;_0x3ceedb--){_0x4339cf-_0x23550f[_0x3ceedb][_0x2198da(0xd8)]>_0x4aed86&&_0x23550f['splice'](_0x3ceedb,0x1);}for(const _0x32d4a7 of _0x11b15b){let _0x48c417=null;for(const _0x2981dd of _0x23550f){if(_0x2981dd[_0x2198da(0x13e)](_0x32d4a7[_0x2198da(0x102)],this[_0x2198da(0x12d)][_0x2198da(0x11b)][_0x2198da(0x140)],this[_0x2198da(0x11f)])){_0x48c417=_0x2981dd;break;}}if(_0x48c417){_0x48c417['touches']++;if(_0x32d4a7['price']>_0x48c417[_0x2198da(0x154)])_0x48c417['priceHigh']=_0x32d4a7['price'];if(_0x32d4a7['price']<_0x48c417['priceLow'])_0x48c417['priceLow']=_0x32d4a7[_0x2198da(0x102)];_0x48c417[_0x2198da(0xdb)]=Math[_0x2198da(0xd6)](0x1,0.3+_0x48c417[_0x2198da(0x131)]*0.15);}else{const _0x405218=_0x32d4a7[_0x2198da(0x128)]==='high'?ZoneType[_0x2198da(0x11c)]:ZoneType['SUPPORT'],_0x41bcea=new LiquidityZone(_0x405218,_0x32d4a7[_0x2198da(0x102)]+_0x4560ca/0x2,_0x32d4a7['price']-_0x4560ca/0x2,_0x32d4a7['timestamp'],_0x32d4a7[_0x2198da(0xd8)]);_0x41bcea['qualityScore']=0.3+_0x32d4a7['strength']*0.1,_0x23550f['push'](_0x41bcea);}}}[_0xe9f20f(0x110)](_0x33c591,_0x3dd663,_0x42754b){const _0x5e0543=_0xe9f20f,_0x347eeb=this['liquidityZones'][_0x5e0543(0x162)](_0x33c591),_0x9bf91f=_0x3dd663[_0x42754b],_0x3aa74b=_0x9bf91f['close'],_0x4d106f=this['config']['sweep'],_0x308030=this[_0x5e0543(0x12d)][_0x5e0543(0x11b)];for(const _0x116804 of _0x347eeb){if(_0x116804['lastUsedBarIndex']>=0x0&&_0x42754b-_0x116804['lastUsedBarIndex']<_0x308030['cooldownBars'])continue;const _0x4b4f65=_0x116804['getLevel'](),_0x5410b5=Math['abs'](_0x3aa74b-_0x4b4f65)/this[_0x5e0543(0x11f)];if(_0x5410b5>_0x308030[_0x5e0543(0x13c)])continue;const _0x2bf3f0=Math[_0x5e0543(0x148)](0x0,_0x42754b-_0x4d106f[_0x5e0543(0x101)]*0x2);for(let _0x264c8f=_0x2bf3f0;_0x264c8f<_0x42754b;_0x264c8f++){const _0x31ff71=_0x3dd663[_0x264c8f];if(_0x116804['type']===ZoneType['RESISTANCE']){const _0x599f59=(_0x31ff71['high']-_0x116804['priceHigh'])/this['tickSize'];if(_0x599f59>=_0x4d106f[_0x5e0543(0x145)]&&_0x599f59<=_0x4d106f[_0x5e0543(0x165)]){if(_0x3aa74b<_0x116804[_0x5e0543(0x154)]){const _0x30f63d=_0x31ff71['high']-_0x31ff71['low'],_0xc0a1c3=Math[_0x5e0543(0x143)](_0x31ff71['close']-_0x31ff71['open']),_0x458c86=_0x30f63d>0x0?_0xc0a1c3/_0x30f63d:0x0;if(_0x458c86>=_0x4d106f[_0x5e0543(0x103)]){const _0x2f6e10=this[_0x5e0543(0x13a)](_0x3dd663,_0x264c8f,0x14);if(_0x2f6e10>=_0x4d106f['minVolumeRatio']){const _0x1056ba=new SweepEvent(SweepType['HIGH_SWEEP'],_0x116804,_0x264c8f,_0x264c8f,_0x31ff71[_0x5e0543(0x15e)]);_0x1056ba['exitBarIndex']=_0x42754b,_0x1056ba['penetrationTicks']=_0x599f59,_0x1056ba['durationBars']=_0x42754b-_0x264c8f,_0x1056ba['volumeRatio']=_0x2f6e10,_0x1056ba['qualityScore']=this['_scoreSweep'](_0x1056ba,_0x458c86),_0x1056ba['isValid']=_0x1056ba['qualityScore']>=_0x4d106f['minQualityScore'];if(_0x1056ba[_0x5e0543(0xef)])return _0x1056ba;}}}}}if(_0x116804[_0x5e0543(0x128)]===ZoneType['SUPPORT']){const _0x4da648=(_0x116804['priceLow']-_0x31ff71['low'])/this['tickSize'];if(_0x4da648>=_0x4d106f[_0x5e0543(0x145)]&&_0x4da648<=_0x4d106f[_0x5e0543(0x165)]){if(_0x3aa74b>_0x116804['priceLow']){const _0x8d387d=_0x31ff71[_0x5e0543(0x15e)]-_0x31ff71['low'],_0x351997=Math[_0x5e0543(0x143)](_0x31ff71[_0x5e0543(0xfb)]-_0x31ff71[_0x5e0543(0xf4)]),_0x69c9cf=_0x8d387d>0x0?_0x351997/_0x8d387d:0x0;if(_0x69c9cf>=_0x4d106f['minBodyRatio']){const _0x1553c0=this[_0x5e0543(0x13a)](_0x3dd663,_0x264c8f,0x14);if(_0x1553c0>=_0x4d106f['minVolumeRatio']){const _0x568bb4=new SweepEvent(SweepType[_0x5e0543(0x11d)],_0x116804,_0x264c8f,_0x264c8f,_0x31ff71[_0x5e0543(0x116)]);_0x568bb4[_0x5e0543(0xce)]=_0x42754b,_0x568bb4['penetrationTicks']=_0x4da648,_0x568bb4['durationBars']=_0x42754b-_0x264c8f,_0x568bb4[_0x5e0543(0xec)]=_0x1553c0,_0x568bb4[_0x5e0543(0xdb)]=this[_0x5e0543(0x112)](_0x568bb4,_0x69c9cf),_0x568bb4['isValid']=_0x568bb4[_0x5e0543(0xdb)]>=_0x4d106f[_0x5e0543(0x150)];if(_0x568bb4['isValid'])return _0x568bb4;}}}}}}}return null;}[_0xe9f20f(0x13a)](_0x5af0cf,_0x24f08f,_0x13e0fc){const _0x107a8f=_0xe9f20f,_0x1bd95e=Math['max'](0x0,_0x24f08f-_0x13e0fc),_0x2fa2c2=_0x5af0cf['slice'](_0x1bd95e,_0x24f08f);if(_0x2fa2c2[_0x107a8f(0x105)]===0x0)return 0x1;const _0x317a15=_0x2fa2c2['map'](_0x32d43e=>_0x32d43e[_0x107a8f(0x167)])['sort']((_0x35b99c,_0x34801e)=>_0x35b99c-_0x34801e),_0x260e99=Math[_0x107a8f(0xf1)](_0x317a15['length']/0x2),_0x4f7e52=_0x317a15[_0x260e99]||0x1;return _0x5af0cf[_0x24f08f]['volume']/_0x4f7e52;}['_scoreSweep'](_0x715217,_0x2c7e1a){const _0x168cc8=_0xe9f20f;let _0x53f151=0x0;const _0x3ecb65=0x4,_0x308a5e=Math[_0x168cc8(0x143)](_0x715217['penetrationTicks']-_0x3ecb65);return _0x53f151+=Math['max'](0x0,0.3-_0x308a5e*0.03),_0x53f151+=Math[_0x168cc8(0x148)](0x0,0.25-_0x715217['durationBars']*0.05),_0x53f151+=Math[_0x168cc8(0xd6)](0.25,_0x715217['volumeRatio']*0.1),_0x53f151+=Math['min'](0.2,_0x2c7e1a*0.4),Math[_0x168cc8(0xd6)](0x1,_0x53f151);}[_0xe9f20f(0xe7)](_0x459bf3,_0xa9cc83,_0x25eb8c,_0x54b92b){const _0x445bec=_0xe9f20f;if(Date['now']()-this[_0x445bec(0x126)]<this['config'][_0x445bec(0xd1)][_0x445bec(0x144)])return null;const _0x52797c=this[_0x445bec(0x12d)][_0x445bec(0xd1)],_0x3c5bbf=_0xa9cc83['close'],_0x2e0a89=_0x54b92b[_0x445bec(0x160)]===SweepType['HIGH_SWEEP']?_0x445bec(0x13f):_0x445bec(0x14b);let _0x130a6a,_0x2a6fb8,_0x113cb0,_0x3b35d0;_0x2e0a89==='long'?(_0x130a6a=_0x3c5bbf-_0x52797c[_0x445bec(0x15b)]*this[_0x445bec(0x11f)],_0x2a6fb8=_0x3c5bbf+_0x52797c[_0x445bec(0x119)]*this[_0x445bec(0x11f)],_0x113cb0=_0x3c5bbf+_0x52797c[_0x445bec(0xd9)]*this['tickSize'],_0x3b35d0=_0x3c5bbf+_0x52797c[_0x445bec(0x115)]*this['tickSize']):(_0x130a6a=_0x3c5bbf+_0x52797c['stopTicks']*this['tickSize'],_0x2a6fb8=_0x3c5bbf-_0x52797c['targetTicks']*this['tickSize'],_0x113cb0=_0x3c5bbf-_0x52797c['breakevenTicks']*this[_0x445bec(0x11f)],_0x3b35d0=_0x3c5bbf-_0x52797c['trailTriggerTicks']*this[_0x445bec(0x11f)]);const _0x35c96e=_0x52797c['targetTicks']/_0x52797c[_0x445bec(0x15b)],_0x21d93c=Math['min'](0x1,_0x54b92b[_0x445bec(0xdb)]*0.5+_0x54b92b['zone']['qualityScore']*0.3+(_0x54b92b[_0x445bec(0xec)]>1.5?0.2:_0x54b92b[_0x445bec(0xec)]*0.1));let _0x53685e=SignalStrength[_0x445bec(0x157)];if(_0x21d93c>=0.8)_0x53685e=SignalStrength['VERY_STRONG'];else{if(_0x21d93c>=0.65)_0x53685e=SignalStrength['STRONG'];else{if(_0x21d93c<0.5)_0x53685e=SignalStrength['WEAK'];}}const _0xd274c6=0.5+(_0x21d93c-0.5)*0.4,_0x5d3f10=_0xd274c6*Math[_0x445bec(0x143)](_0x2a6fb8-_0x3c5bbf)-(0x1-_0xd274c6)*Math[_0x445bec(0x143)](_0x3c5bbf-_0x130a6a);_0x54b92b[_0x445bec(0x11b)][_0x445bec(0x12e)]=_0x25eb8c,_0x54b92b[_0x445bec(0x11b)][_0x445bec(0xd4)]=!![],_0x54b92b[_0x445bec(0x11b)][_0x445bec(0x118)]=new Date(_0xa9cc83[_0x445bec(0x141)]),this[_0x445bec(0x126)]=Date[_0x445bec(0x10c)](),this['stats']['signals']++;const _0x3d224a={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x459bf3['split']('.')[0x0]||_0x459bf3,'contractId':_0x459bf3,'side':_0x2e0a89===_0x445bec(0x14b)?OrderSide[_0x445bec(0xd2)]:OrderSide[_0x445bec(0x123)],'direction':_0x2e0a89,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x53685e,'edge':_0x5d3f10,'confidence':_0x21d93c,'entry':_0x3c5bbf,'entryPrice':_0x3c5bbf,'stopLoss':_0x130a6a,'takeProfit':_0x2a6fb8,'riskReward':_0x35c96e,'stopTicks':_0x52797c['stopTicks'],'targetTicks':_0x52797c['targetTicks'],'breakevenTicks':_0x52797c[_0x445bec(0xd9)],'trailTriggerTicks':_0x52797c[_0x445bec(0x115)],'trailDistanceTicks':_0x52797c[_0x445bec(0x114)],'beLevel':_0x113cb0,'trailTrigger':_0x3b35d0,'sweepType':_0x54b92b[_0x445bec(0x160)],'penetrationTicks':_0x54b92b['penetrationTicks'],'sweepDurationBars':_0x54b92b['durationBars'],'sweepQuality':_0x54b92b[_0x445bec(0xdb)],'volumeRatio':_0x54b92b[_0x445bec(0xec)],'zoneType':_0x54b92b[_0x445bec(0x11b)]['type'],'zoneLevel':_0x54b92b['zone'][_0x445bec(0xdc)](),'zoneTouches':_0x54b92b[_0x445bec(0x11b)][_0x445bec(0x131)],'zoneQuality':_0x54b92b['zone'][_0x445bec(0xdb)],'expires':Date[_0x445bec(0x10c)]()+0xea60};return this[_0x445bec(0xee)](_0x445bec(0x14a),{'side':_0x2e0a89===_0x445bec(0x14b)?'buy':'sell','action':_0x445bec(0xf4),'reason':_0x445bec(0xd0)+_0x54b92b['sweepType']+'\x20|\x20Pen:'+_0x54b92b[_0x445bec(0xfd)]['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x54b92b[_0x445bec(0xec)]['toFixed'](0x1)+_0x445bec(0xe6)+(_0x54b92b['qualityScore']*0x64)['toFixed'](0x0)+'%',..._0x3d224a}),this['emit']('log',{'type':_0x445bec(0xf6),'message':_0x445bec(0xf0)+_0x2e0a89[_0x445bec(0xfc)]()+'\x20@\x20'+_0x3c5bbf[_0x445bec(0x138)](0x2)+_0x445bec(0x137)+_0x54b92b['sweepType']+_0x445bec(0xd5)+_0x54b92b['penetrationTicks'][_0x445bec(0x138)](0x1)+_0x445bec(0x153)+_0x54b92b[_0x445bec(0xec)]['toFixed'](0x1)+'x\x20|\x20Conf:'+(_0x21d93c*0x64)['toFixed'](0x0)+'%'}),_0x3d224a;}['getAnalysisState'](_0x117c91,_0x353eb0){const _0x592b55=_0xe9f20f,_0x523a54=this['barHistory']['get'](_0x117c91)||[],_0x4fa58c=this['liquidityZones'][_0x592b55(0x162)](_0x117c91)||[],_0xaabaad=this['swingPoints'][_0x592b55(0x162)](_0x117c91)||[];if(_0x523a54[_0x592b55(0x105)]<0x5)return{'ready':![],'message':_0x592b55(0xd3)+_0x523a54[_0x592b55(0x105)]+_0x592b55(0x120)};const _0x4ee45c=_0x4fa58c[_0x592b55(0x100)](_0x9d3f1e=>({'zone':_0x9d3f1e,'distance':Math[_0x592b55(0x143)](_0x353eb0-_0x9d3f1e['getLevel']())}))[_0x592b55(0x155)]((_0x247322,_0x185170)=>_0x247322[_0x592b55(0x10b)]-_0x185170['distance']),_0xb3f821=_0x4ee45c[_0x592b55(0x149)](_0x4746ed=>_0x4746ed['zone']['type']===ZoneType['RESISTANCE']),_0x14355a=_0x4ee45c[_0x592b55(0x149)](_0xc6444b=>_0xc6444b['zone']['type']===ZoneType[_0x592b55(0x11e)]);return{'ready':!![],'barsProcessed':_0x523a54[_0x592b55(0x105)],'swingsDetected':_0xaabaad[_0x592b55(0x105)],'activeZones':_0x4fa58c[_0x592b55(0x105)],'nearestResistance':_0xb3f821?_0xb3f821[_0x592b55(0x11b)]['getLevel']():null,'nearestSupport':_0x14355a?_0x14355a['zone'][_0x592b55(0xdc)]():null,'stopTicks':this['config']['execution'][_0x592b55(0x15b)],'targetTicks':this[_0x592b55(0x12d)]['execution'][_0x592b55(0x119)],'strategy':'HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)'};}['recordTradeResult'](_0x3fa498){const _0xfb4c45=_0xe9f20f;this['recentTrades']['push']({'netPnl':_0x3fa498,'timestamp':Date[_0xfb4c45(0x10c)]()});if(this['recentTrades'][_0xfb4c45(0x105)]>0x64)this['recentTrades'][_0xfb4c45(0x121)]();_0x3fa498>0x0?this[_0xfb4c45(0xed)]['wins']++:this['stats']['losses']++,this[_0xfb4c45(0xed)][_0xfb4c45(0x158)]++,this[_0xfb4c45(0xed)]['pnl']+=_0x3fa498,this['emit']('log',{'type':_0xfb4c45(0x15a),'message':_0xfb4c45(0x125)+(_0x3fa498>0x0?'WIN':_0xfb4c45(0x113))+'\x20$'+_0x3fa498['toFixed'](0x2)});}['getBarHistory'](_0x4a4ef4){return this['barHistory']['get'](_0x4a4ef4)||[];}['getStats'](){const _0x27458c=_0xe9f20f;return this[_0x27458c(0xed)];}['getHealthStatus'](_0x22046a){const _0x50a630=_0xe9f20f,_0x4e14a4=this['barHistory']['get'](_0x22046a)||[],_0x5f00d7=this['liquidityZones']['get'](_0x22046a)||[],_0x94637a=this[_0x50a630(0x135)]['get'](_0x22046a)||[],_0x5d9f9=this[_0x50a630(0x129)]['get'](_0x22046a),_0x442c6a=_0x4e14a4[_0x4e14a4['length']-0x1],_0x27dd93=_0x442c6a?Date[_0x50a630(0x10c)]()-_0x442c6a[_0x50a630(0x141)]:null,_0xa06375=_0x5f00d7['filter'](_0x4b71fd=>_0x4b71fd[_0x50a630(0x128)]===ZoneType['RESISTANCE'])['length'],_0x3b0605=_0x5f00d7['filter'](_0x931f3d=>_0x931f3d['type']===ZoneType['SUPPORT'])['length'];return{'healthy':_0x4e14a4[_0x50a630(0x105)]>=0x5,'barsTotal':_0x4e14a4['length'],'barsLast5Min':_0x4e14a4[_0x50a630(0xdd)](_0x5959b1=>Date[_0x50a630(0x10c)]()-_0x5959b1[_0x50a630(0x141)]<0x5*0x3c*0x3e8)[_0x50a630(0x105)],'swingsTotal':_0x94637a['length'],'zonesResistance':_0xa06375,'zonesSupport':_0x3b0605,'zonesTotal':_0x5f00d7[_0x50a630(0x105)],'currentBarTicks':_0x5d9f9?_0x5d9f9[_0x50a630(0xf7)]:0x0,'isAggregating':_0x5d9f9&&_0x5d9f9['tickCount']>0x0,'timeSinceLastBarMs':_0x27dd93,'lastSignalTime':this[_0x50a630(0x126)],'signalCooldownMs':this['config'][_0x50a630(0xd1)][_0x50a630(0x144)],'uptime':Date[_0x50a630(0x10c)]()-(this['startTime']||Date[_0x50a630(0x10c)]())};}['reset'](_0x4d21e3){const _0x81d339=_0xe9f20f;this['barHistory'][_0x81d339(0x12f)](_0x4d21e3,[]),this[_0x81d339(0x135)]['set'](_0x4d21e3,[]),this['liquidityZones']['set'](_0x4d21e3,[]),this['activeSweeps'][_0x81d339(0x12f)](_0x4d21e3,[]),this[_0x81d339(0x129)][_0x81d339(0xcf)](_0x4d21e3),this[_0x81d339(0xee)](_0x81d339(0x147),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x4d21e3});}[_0xe9f20f(0x122)](_0xc696c9,_0x3c9c5c){const _0x51100a=_0xe9f20f;if(!_0x3c9c5c||_0x3c9c5c[_0x51100a(0x105)]===0x0){this[_0x51100a(0xee)]('log',{'type':'debug','message':_0x51100a(0xf5)});return;}!this['barHistory'][_0x51100a(0xe4)](_0xc696c9)&&this[_0x51100a(0x14e)](_0xc696c9);const _0x151797=[..._0x3c9c5c][_0x51100a(0x155)]((_0x2eb83d,_0x248e94)=>_0x2eb83d['timestamp']-_0x248e94[_0x51100a(0x141)]);this[_0x51100a(0xee)](_0x51100a(0x147),{'type':_0x51100a(0xf6),'message':_0x51100a(0x166)+_0x151797[_0x51100a(0x105)]+_0x51100a(0x152)});let _0x2568ca=0x0;for(const _0x555de6 of _0x151797){const _0x2661e4=this[_0x51100a(0x133)](_0xc696c9,_0x555de6);if(_0x2661e4)_0x2568ca++;}const _0x365fcb=this['barHistory']['get'](_0xc696c9)||[],_0x3a7213=this['swingPoints'][_0x51100a(0x162)](_0xc696c9)||[],_0x570063=this[_0x51100a(0x10e)][_0x51100a(0x162)](_0xc696c9)||[];this['emit']('log',{'type':_0x51100a(0xf6),'message':_0x51100a(0xda)+_0x365fcb[_0x51100a(0x105)]+_0x51100a(0xde)+_0x3a7213[_0x51100a(0x105)]+_0x51100a(0x117)+_0x570063[_0x51100a(0x105)]+_0x51100a(0x107)}),_0x2568ca>0x0&&this[_0x51100a(0xee)](_0x51100a(0x147),{'type':'debug','message':'[HQX-2B]\x20'+_0x2568ca+'\x20historical\x20signals\x20detected\x20(ignored)'}),this[_0x51100a(0x126)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x1f50df={}){const _0x220419=_0xe9f20f;super(),this['config']=_0x1f50df,this[_0x220419(0x161)]=new HQX2BLiquiditySweep(_0x1f50df),this[_0x220419(0x161)]['on']('signal',_0x2a966f=>this[_0x220419(0xee)](_0x220419(0x14a),_0x2a966f)),this['strategy']['on']('log',_0x4ccb1d=>this['emit']('log',_0x4ccb1d));}[_0xe9f20f(0xe5)](_0x4c941a){const _0x2133c8=_0xe9f20f;return this[_0x2133c8(0x161)][_0x2133c8(0xe5)](_0x4c941a);}[_0xe9f20f(0x104)](_0x5df28d){const _0x21704=_0xe9f20f;return this['strategy'][_0x21704(0x104)](_0x5df28d);}['onTrade'](_0x25ad89){const _0x473f51=_0xe9f20f;return this[_0x473f51(0x161)]['onTrade'](_0x25ad89);}['processBar'](_0x5eb77b,_0x537689){return this['strategy']['processBar'](_0x5eb77b,_0x537689);}[_0xe9f20f(0x14e)](_0x4b323d,_0x407c44,_0x1a10eb){const _0x1bed4c=_0xe9f20f;return this[_0x1bed4c(0x161)]['initialize'](_0x4b323d,_0x407c44,_0x1a10eb);}[_0xe9f20f(0xdf)](_0x2ed4bd,_0x253fd2){const _0x33c5f5=_0xe9f20f;return this[_0x33c5f5(0x161)]['getAnalysisState'](_0x2ed4bd,_0x253fd2);}['recordTradeResult'](_0x358ab5){const _0x39ca76=_0xe9f20f;return this[_0x39ca76(0x161)][_0x39ca76(0x15f)](_0x358ab5);}[_0xe9f20f(0xf9)](_0x34eb0b){return this['strategy']['reset'](_0x34eb0b);}['getStats'](){const _0x5ac039=_0xe9f20f;return this[_0x5ac039(0x161)]['getStats']();}[_0xe9f20f(0x109)](_0x5ac205){const _0x264270=_0xe9f20f;return this[_0x264270(0x161)]['getBarHistory'](_0x5ac205);}[_0xe9f20f(0x122)](_0x4bec42,_0x5291ec){return this['strategy']['preloadBars'](_0x4bec42,_0x5291ec);}['getHealthStatus'](_0x112d40){const _0x503d92=_0xe9f20f;return this[_0x503d92(0x161)][_0x503d92(0x12b)](_0x112d40);}[_0xe9f20f(0x12c)](_0x4f9670){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
- const _0x5307f6=_0x4af8;(function(_0xb1459d,_0x379df9){const _0x8a42d7=_0x4af8,_0x28071f=_0xb1459d();while(!![]){try{const _0x360662=parseInt(_0x8a42d7(0x133))/0x1*(parseInt(_0x8a42d7(0x153))/0x2)+parseInt(_0x8a42d7(0x161))/0x3+-parseInt(_0x8a42d7(0x14f))/0x4*(-parseInt(_0x8a42d7(0x144))/0x5)+-parseInt(_0x8a42d7(0x16a))/0x6*(-parseInt(_0x8a42d7(0x165))/0x7)+-parseInt(_0x8a42d7(0x132))/0x8+parseInt(_0x8a42d7(0x159))/0x9+-parseInt(_0x8a42d7(0x126))/0xa;if(_0x360662===_0x379df9)break;else _0x28071f['push'](_0x28071f['shift']());}catch(_0x4c356f){_0x28071f['push'](_0x28071f['shift']());}}}(_0x4e4a,0x8303d));const EventEmitter=require(_0x5307f6(0x138)),{v4:uuidv4}=require(_0x5307f6(0x14e)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0x4af8(_0x12d8ea,_0x27df78){_0x12d8ea=_0x12d8ea-0x10b;const _0x4e4a05=_0x4e4a();let _0x4af858=_0x4e4a05[_0x12d8ea];return _0x4af858;}class HQXUltraScalping extends EventEmitter{constructor(_0x720157={}){const _0xe38a83=_0x5307f6;super(),this[_0xe38a83(0x15d)]=_0x720157[_0xe38a83(0x15d)]||0.25,this[_0xe38a83(0x154)]=_0x720157['tickValue']||0x5,this[_0xe38a83(0x110)]=1.5,this['zscoreExitThreshold']=0.5,this['vpinWindow']=0x32,this[_0xe38a83(0x119)]=0.7,this['kalmanProcessNoise']=0.01,this[_0xe38a83(0x124)]=0.1,this['volatilityLookback']=0x64,this[_0xe38a83(0x17c)]=0x14,this[_0xe38a83(0x146)]=0x8,this['baseTargetTicks']=0x10,this[_0xe38a83(0x123)]=0x4,this['profitLockPct']=0.5,this['minConfidence']=0.55,this['weights']={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0xe38a83(0x12e)]=new Map(),this['priceBuffer']=new Map(),this[_0xe38a83(0x167)]=new Map(),this['kalmanStates']=new Map(),this[_0xe38a83(0x12c)]=new Map(),this[_0xe38a83(0x120)]=[],this['winStreak']=0x0,this[_0xe38a83(0x11a)]=0x0,this[_0xe38a83(0x11f)]=0x0,this[_0xe38a83(0x16d)]=0x7530,this[_0xe38a83(0x10c)]=0x2710,this[_0xe38a83(0x15f)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0x38e34a,_0x44febc=0.25,_0x5a3ad1=0x5){const _0x8396ec=_0x5307f6;this[_0x8396ec(0x15d)]=_0x44febc,this[_0x8396ec(0x154)]=_0x5a3ad1,this['barHistory']['set'](_0x38e34a,[]),this['priceBuffer']['set'](_0x38e34a,[]),this[_0x8396ec(0x167)]['set'](_0x38e34a,[]),this['atrHistory'][_0x8396ec(0x127)](_0x38e34a,[]),this[_0x8396ec(0x13f)][_0x8396ec(0x127)](_0x38e34a,{'estimate':0x0,'errorCovariance':0x1}),this[_0x8396ec(0x166)](_0x8396ec(0x13c),{'type':'info','message':_0x8396ec(0x172)+_0x38e34a+':\x20tick='+_0x44febc+_0x8396ec(0x163)+_0x5a3ad1}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}[_0x5307f6(0x141)](_0x5b75c9){const _0x4c8fee=_0x5307f6,{contractId:_0x3b3020,price:_0x1a16a4,volume:_0x504855,side:_0x47ae08,timestamp:_0x4f5776}=_0x5b75c9,_0x52836f={'timestamp':_0x4f5776||Date[_0x4c8fee(0x13d)](),'open':_0x1a16a4,'high':_0x1a16a4,'low':_0x1a16a4,'close':_0x1a16a4,'volume':_0x504855||0x1};return this[_0x4c8fee(0x174)](_0x3b3020,_0x52836f);}['onTick'](_0x583ff3){return this['processTick'](_0x583ff3);}[_0x5307f6(0x13e)](_0x1ce7d6){const _0x5c9064=_0x5307f6;return this['processTick']({'contractId':_0x1ce7d6[_0x5c9064(0x14d)]||_0x1ce7d6['symbol'],'price':_0x1ce7d6[_0x5c9064(0x149)],'volume':_0x1ce7d6['size']||_0x1ce7d6['volume']||0x1,'side':_0x1ce7d6[_0x5c9064(0x11d)],'timestamp':_0x1ce7d6[_0x5c9064(0x17a)]||Date['now']()});}['processBar'](_0x279a62,_0x2b4416){const _0x275d1d=_0x5307f6;let _0x540d2b=this[_0x275d1d(0x12e)][_0x275d1d(0x11b)](_0x279a62);!_0x540d2b&&(this['initialize'](_0x279a62),_0x540d2b=this['barHistory']['get'](_0x279a62));_0x540d2b[_0x275d1d(0x175)](_0x2b4416);if(_0x540d2b['length']>0x1f4)_0x540d2b[_0x275d1d(0x15b)]();const _0x1a44d3=this[_0x275d1d(0x10d)]['get'](_0x279a62);_0x1a44d3['push'](_0x2b4416['close']);if(_0x1a44d3['length']>0xc8)_0x1a44d3[_0x275d1d(0x15b)]();const _0x3cd31d=this['volumeBuffer']['get'](_0x279a62),_0x52481a=_0x2b4416['high']-_0x2b4416['low'];let _0x21a256=_0x2b4416['volume']*0.5,_0xcb4705=_0x2b4416[_0x275d1d(0x16c)]*0.5;if(_0x52481a>0x0){const _0x27f327=(_0x2b4416['close']-_0x2b4416['low'])/_0x52481a;_0x21a256=_0x2b4416[_0x275d1d(0x16c)]*_0x27f327,_0xcb4705=_0x2b4416['volume']*(0x1-_0x27f327);}_0x3cd31d['push']({'buy':_0x21a256,'sell':_0xcb4705});if(_0x3cd31d[_0x275d1d(0x17b)]>0x64)_0x3cd31d[_0x275d1d(0x15b)]();if(_0x540d2b[_0x275d1d(0x17b)]<0x32)return null;const _0x27f1c8=this[_0x275d1d(0x160)](_0x1a44d3),_0x214fda=this[_0x275d1d(0x135)](_0x3cd31d),_0x1151ec=this[_0x275d1d(0x164)](_0x540d2b),_0x3b47fd=this[_0x275d1d(0x176)](_0x279a62,_0x2b4416[_0x275d1d(0x177)]),{regime:_0x305dba,params:_0x4f4ed6}=this[_0x275d1d(0x117)](_0x279a62,_0x540d2b),_0x4414e2=this['_computeOrderFlowImbalance'](_0x540d2b);return this[_0x275d1d(0x17e)](_0x279a62,_0x2b4416['close'],_0x27f1c8,_0x214fda,_0x1151ec,_0x3b47fd,_0x305dba,_0x4f4ed6,_0x4414e2,_0x540d2b);}[_0x5307f6(0x160)](_0x57a3c4,_0x44bdc=0x32){const _0x6adc66=_0x5307f6;if(_0x57a3c4[_0x6adc66(0x17b)]<_0x44bdc)return 0x0;const _0x5a67c1=_0x57a3c4[_0x6adc66(0x113)](-_0x44bdc),_0x526e73=_0x5a67c1[_0x6adc66(0x14a)]((_0x42d6ce,_0xadb9be)=>_0x42d6ce+_0xadb9be,0x0)/_0x44bdc,_0x57cb3d=_0x5a67c1[_0x6adc66(0x14a)]((_0x1a49c7,_0x108497)=>_0x1a49c7+Math['pow'](_0x108497-_0x526e73,0x2),0x0)/_0x44bdc,_0x2d39bf=Math['sqrt'](_0x57cb3d);if(_0x2d39bf<0.0001)return 0x0;const _0x42ee48=_0x57a3c4[_0x57a3c4[_0x6adc66(0x17b)]-0x1];return(_0x42ee48-_0x526e73)/_0x2d39bf;}['_computeVPIN'](_0x318b95){const _0x4254ad=_0x5307f6;if(_0x318b95[_0x4254ad(0x17b)]<this['vpinWindow'])return 0.5;const _0x9a0915=_0x318b95['slice'](-this[_0x4254ad(0x15c)]);let _0x545647=0x0,_0x3f6d8d=0x0;for(const _0x299932 of _0x9a0915){_0x545647+=_0x299932['buy'],_0x3f6d8d+=_0x299932['sell'];}const _0x45e6fe=_0x545647+_0x3f6d8d;if(_0x45e6fe<0x1)return 0.5;return Math[_0x4254ad(0x125)](_0x545647-_0x3f6d8d)/_0x45e6fe;}['_computeKyleLambda'](_0x4d17f0){const _0x4febed=_0x5307f6;if(_0x4d17f0[_0x4febed(0x17b)]<0x14)return 0x0;const _0x1a9eb7=_0x4d17f0['slice'](-0x14),_0x1a261b=[],_0x5dfe43=[];for(let _0x75a17=0x1;_0x75a17<_0x1a9eb7[_0x4febed(0x17b)];_0x75a17++){_0x1a261b[_0x4febed(0x175)](_0x1a9eb7[_0x75a17][_0x4febed(0x177)]-_0x1a9eb7[_0x75a17-0x1][_0x4febed(0x177)]),_0x5dfe43['push'](_0x1a9eb7[_0x75a17]['volume']);}const _0x531b35=_0x1a261b['reduce']((_0x598d8d,_0x4abf94)=>_0x598d8d+_0x4abf94,0x0)/_0x1a261b[_0x4febed(0x17b)],_0x3c02cd=_0x5dfe43[_0x4febed(0x14a)]((_0x7f1771,_0x58eabf)=>_0x7f1771+_0x58eabf,0x0)/_0x5dfe43['length'];let _0x27eda6=0x0,_0x360ac8=0x0;for(let _0x15358b=0x0;_0x15358b<_0x1a261b[_0x4febed(0x17b)];_0x15358b++){_0x27eda6+=(_0x1a261b[_0x15358b]-_0x531b35)*(_0x5dfe43[_0x15358b]-_0x3c02cd),_0x360ac8+=Math[_0x4febed(0x10f)](_0x5dfe43[_0x15358b]-_0x3c02cd,0x2);}_0x27eda6/=_0x1a261b['length'],_0x360ac8/=_0x1a261b['length'];if(_0x360ac8<0.0001)return 0x0;return Math['abs'](_0x27eda6/_0x360ac8);}[_0x5307f6(0x176)](_0x3c4e82,_0x3efb4b){const _0x59b99f=_0x5307f6;let _0x5c1e25=this['kalmanStates'][_0x59b99f(0x11b)](_0x3c4e82);if(!_0x5c1e25)return _0x5c1e25={'estimate':_0x3efb4b,'errorCovariance':0x1},this['kalmanStates'][_0x59b99f(0x127)](_0x3c4e82,_0x5c1e25),_0x3efb4b;const _0x298c07=_0x5c1e25[_0x59b99f(0x14b)],_0x1de2b9=_0x5c1e25[_0x59b99f(0x156)]+this['kalmanProcessNoise'],_0x38da72=_0x1de2b9/(_0x1de2b9+this[_0x59b99f(0x124)]),_0x5bfe4a=_0x298c07+_0x38da72*(_0x3efb4b-_0x298c07),_0x23bbf7=(0x1-_0x38da72)*_0x1de2b9;return _0x5c1e25['estimate']=_0x5bfe4a,_0x5c1e25[_0x59b99f(0x156)]=_0x23bbf7,_0x5bfe4a;}[_0x5307f6(0x117)](_0x5b6c9f,_0x104ec6){const _0x4c8059=_0x5307f6,_0x160e7f=this[_0x4c8059(0x112)](_0x104ec6),_0x5cd8a0=_0x160e7f/this[_0x4c8059(0x15d)];let _0x2a66fc=this['atrHistory'][_0x4c8059(0x11b)](_0x5b6c9f);!_0x2a66fc&&(_0x2a66fc=[],this['atrHistory'][_0x4c8059(0x127)](_0x5b6c9f,_0x2a66fc));_0x2a66fc[_0x4c8059(0x175)](_0x160e7f);if(_0x2a66fc['length']>0x1f4)_0x2a66fc[_0x4c8059(0x15b)]();let _0xb7ea2d=0.5;_0x2a66fc['length']>=0x14&&(_0xb7ea2d=_0x2a66fc['filter'](_0x9f904c=>_0x9f904c<=_0x160e7f)[_0x4c8059(0x17b)]/_0x2a66fc['length']);let _0x4a07ec,_0xb44148;if(_0xb7ea2d<0.25)_0x4a07ec=_0x4c8059(0x168),_0xb44148={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0xb7ea2d<0.75?(_0x4a07ec='normal',_0xb44148={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x4a07ec=_0x4c8059(0x10e),_0xb44148={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x4a07ec,'params':_0xb44148};}[_0x5307f6(0x112)](_0x4e1fef,_0x18bfee=0xe){const _0x56c386=_0x5307f6;if(_0x4e1fef[_0x56c386(0x17b)]<_0x18bfee+0x1)return 2.5;const _0x528fd0=[];for(let _0xe01baf=_0x4e1fef['length']-_0x18bfee;_0xe01baf<_0x4e1fef[_0x56c386(0x17b)];_0xe01baf++){const _0x5ecbe1=_0x4e1fef[_0xe01baf],_0x46e377=_0x4e1fef[_0xe01baf-0x1]['close'],_0x41ee6a=Math[_0x56c386(0x152)](_0x5ecbe1['high']-_0x5ecbe1['low'],Math[_0x56c386(0x125)](_0x5ecbe1['high']-_0x46e377),Math[_0x56c386(0x125)](_0x5ecbe1['low']-_0x46e377));_0x528fd0['push'](_0x41ee6a);}return _0x528fd0[_0x56c386(0x14a)]((_0x4a7dd3,_0x78050b)=>_0x4a7dd3+_0x78050b,0x0)/_0x528fd0['length'];}['_computeOrderFlowImbalance'](_0x56d9de){const _0x57f0e0=_0x5307f6;if(_0x56d9de[_0x57f0e0(0x17b)]<this['ofiLookback'])return 0x0;const _0x2b1103=_0x56d9de[_0x57f0e0(0x113)](-this[_0x57f0e0(0x17c)]);let _0x3be5eb=0x0,_0x5b1918=0x0;for(const _0x5191eb of _0x2b1103){const _0x2b20e7=_0x5191eb[_0x57f0e0(0x10e)]-_0x5191eb[_0x57f0e0(0x168)];if(_0x2b20e7>0x0){const _0x53ba1d=(_0x5191eb[_0x57f0e0(0x177)]-_0x5191eb['low'])/_0x2b20e7;_0x3be5eb+=_0x53ba1d*_0x5191eb[_0x57f0e0(0x16c)],_0x5b1918+=(0x1-_0x53ba1d)*_0x5191eb[_0x57f0e0(0x16c)];}}const _0x319a31=_0x3be5eb+_0x5b1918;if(_0x319a31<0x1)return 0x0;return(_0x3be5eb-_0x5b1918)/_0x319a31;}['_generateSignal'](_0x1426e3,_0x41a107,_0x429573,_0x6a6303,_0x513c55,_0x5c7beb,_0x598c72,_0x468c2b,_0x33cd7c,_0x33597d){const _0x131336=_0x5307f6,_0x1a2632=Math[_0x131336(0x125)](_0x429573);if(_0x1a2632<_0x468c2b[_0x131336(0x158)])return null;if(_0x6a6303>this['vpinToxicThreshold'])return null;let _0x3a1c27;if(_0x429573<-_0x468c2b[_0x131336(0x158)])_0x3a1c27=_0x131336(0x14c);else{if(_0x429573>_0x468c2b[_0x131336(0x158)])_0x3a1c27=_0x131336(0x128);else return null;}const _0x3c9906=_0x3a1c27==='long'&&_0x33cd7c>0.1||_0x3a1c27===_0x131336(0x128)&&_0x33cd7c<-0.1,_0x3248fb=_0x41a107-_0x5c7beb,_0x26e901=_0x3a1c27==='long'&&_0x3248fb<0x0||_0x3a1c27===_0x131336(0x128)&&_0x3248fb>0x0,_0x5486fd={'zscore':Math[_0x131336(0x145)](0x1,_0x1a2632/0x4),'vpin':0x1-_0x6a6303,'kyleLambda':_0x513c55>0.001?0.5:0.8,'kalman':_0x26e901?0.8:0.4,'volatility':_0x598c72==='normal'?0.8:_0x598c72==='low'?0.7:0.6,'ofi':_0x3c9906?0.9:0.5,'composite':0x0};_0x5486fd['composite']=_0x5486fd['zscore']*this['weights']['zscore']+_0x5486fd['vpin']*this['weights']['vpin']+_0x5486fd['kyleLambda']*this[_0x131336(0x16e)][_0x131336(0x10b)]+_0x5486fd[_0x131336(0x122)]*this['weights']['kalman']+_0x5486fd['volatility']*this['weights']['volatility']+_0x5486fd[_0x131336(0x147)]*this[_0x131336(0x16e)][_0x131336(0x147)];const _0x61bb38=Math['min'](0x1,_0x5486fd['composite']+_0x468c2b['confidenceBonus']);if(_0x61bb38<this[_0x131336(0x151)])return null;if(Date['now']()-this[_0x131336(0x11f)]<this['cooldownMs'])return null;const _0x738a14=Math['round'](this['baseStopTicks']*_0x468c2b[_0x131336(0x148)]),_0x4e0130=Math['round'](this[_0x131336(0x142)]*_0x468c2b['targetMultiplier']),_0x46f457=Math[_0x131336(0x152)](0x6,Math['min'](0xc,_0x738a14)),_0x48a075=Math[_0x131336(0x152)](_0x46f457*1.5,Math[_0x131336(0x145)](0x18,_0x4e0130));let _0x394bf8,_0x4c05de,_0xc6b03b,_0x1371b5;_0x3a1c27===_0x131336(0x14c)?(_0x394bf8=_0x41a107-_0x46f457*this['tickSize'],_0x4c05de=_0x41a107+_0x48a075*this['tickSize'],_0xc6b03b=_0x41a107+this[_0x131336(0x123)]*this[_0x131336(0x15d)],_0x1371b5=_0x41a107+_0x48a075*this[_0x131336(0x16f)]*this['tickSize']):(_0x394bf8=_0x41a107+_0x46f457*this['tickSize'],_0x4c05de=_0x41a107-_0x48a075*this[_0x131336(0x15d)],_0xc6b03b=_0x41a107-this['breakevenTicks']*this[_0x131336(0x15d)],_0x1371b5=_0x41a107-_0x48a075*this['profitLockPct']*this[_0x131336(0x15d)]);const _0x38a428=_0x48a075/_0x46f457,_0x58328d=Math[_0x131336(0x15a)](_0x48a075*0.5),_0x34e905=Math['round'](_0x46f457*0.4);let _0x3faee0=SignalStrength['MODERATE'];if(_0x61bb38>=0.85)_0x3faee0=SignalStrength[_0x131336(0x12d)];else{if(_0x61bb38>=0.75)_0x3faee0=SignalStrength[_0x131336(0x13b)];else{if(_0x61bb38<0.6)_0x3faee0=SignalStrength['WEAK'];}}const _0x54f76f=0.5+(_0x61bb38-0.5)*0.4,_0x591f1b=_0x54f76f*Math[_0x131336(0x125)](_0x4c05de-_0x41a107)-(0x1-_0x54f76f)*Math[_0x131336(0x125)](_0x41a107-_0x394bf8);this['lastSignalTime']=Date[_0x131336(0x13d)](),this['stats']['signals']++;const _0x365879={'id':uuidv4(),'timestamp':Date[_0x131336(0x13d)](),'symbol':_0x1426e3['split']('.')[0x0]||_0x1426e3,'contractId':_0x1426e3,'side':_0x3a1c27==='long'?OrderSide[_0x131336(0x11e)]:OrderSide[_0x131336(0x115)],'direction':_0x3a1c27,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0x3faee0,'edge':_0x591f1b,'confidence':_0x61bb38,'entry':_0x41a107,'entryPrice':_0x41a107,'stopLoss':_0x394bf8,'takeProfit':_0x4c05de,'riskReward':_0x38a428,'stopTicks':_0x46f457,'targetTicks':_0x48a075,'trailTriggerTicks':_0x58328d,'trailDistanceTicks':_0x34e905,'beBreakeven':_0xc6b03b,'profitLockLevel':_0x1371b5,'zScore':_0x429573,'zScoreExit':this['zscoreExitThreshold'],'vpinValue':_0x6a6303,'kyleLambda':_0x513c55,'kalmanEstimate':_0x5c7beb,'volatilityRegime':_0x598c72,'ofiValue':_0x33cd7c,'models':_0x5486fd,'orderFlowConfirmed':_0x3c9906,'kalmanConfirmed':_0x26e901,'expires':Date['now']()+0xea60};return this[_0x131336(0x166)](_0x131336(0x13a),{'side':_0x3a1c27===_0x131336(0x14c)?'buy':_0x131336(0x170),'action':_0x131336(0x130),'reason':'Z='+_0x429573['toFixed'](0x2)+_0x131336(0x15e)+(_0x6a6303*0x64)['toFixed'](0x0)+_0x131336(0x12f)+(_0x33cd7c*0x64)['toFixed'](0x0)+_0x131336(0x139)+(_0x61bb38*0x64)['toFixed'](0x0)+'%',..._0x365879}),this[_0x131336(0x166)](_0x131336(0x13c),{'type':_0x131336(0x134),'message':'[HQX]\x20SIGNAL:\x20'+_0x3a1c27[_0x131336(0x136)]()+'\x20@\x20'+_0x41a107['toFixed'](0x2)+'\x20|\x20Z:'+_0x429573[_0x131336(0x131)](0x2)+_0x131336(0x179)+(_0x6a6303*0x64)['toFixed'](0x0)+'%\x20OFI:'+(_0x33cd7c*0x64)[_0x131336(0x131)](0x0)+'%\x20Kyle:'+_0x513c55[_0x131336(0x131)](0x5)+'\x20Regime:'+_0x598c72+_0x131336(0x118)+(_0x61bb38*0x64)[_0x131336(0x131)](0x0)+'%'}),_0x365879;}['shouldExitByZScore'](_0x55e742){const _0x131886=_0x5307f6,_0x5800ea=this[_0x131886(0x10d)]['get'](_0x55e742);if(!_0x5800ea||_0x5800ea['length']<0x32)return![];const _0x4f0021=this[_0x131886(0x160)](_0x5800ea);return Math['abs'](_0x4f0021)<this['zscoreExitThreshold'];}[_0x5307f6(0x17d)](_0x48a51b){const _0x5b27df=_0x5307f6,_0x4a56fd=this['priceBuffer'][_0x5b27df(0x11b)](_0x48a51b),_0x156739=this[_0x5b27df(0x167)]['get'](_0x48a51b),_0x1439b9=this[_0x5b27df(0x12e)]['get'](_0x48a51b);if(!_0x4a56fd||!_0x156739||!_0x1439b9||_0x1439b9['length']<0x32)return null;const _0x1a338e=this['_computeZScore'](_0x4a56fd),_0x1764ba=this['_computeVPIN'](_0x156739),_0x586b7e=this[_0x5b27df(0x164)](_0x1439b9),_0x138267=this[_0x5b27df(0x11c)](_0x1439b9);return{'zscore':Math[_0x5b27df(0x145)](0x1,Math['abs'](_0x1a338e)/0x4),'vpin':0x1-_0x1764ba,'kyleLambda':_0x586b7e>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x5b27df(0x125)](_0x138267)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x1a338e,'vpin':_0x1764ba,'kyleLambda':_0x586b7e,'ofi':_0x138267}};}['getAnalysisState'](_0x373261,_0x58f6cd){const _0x26f820=_0x5307f6,_0x306b45=this['barHistory'][_0x26f820(0x11b)](_0x373261)||[];if(_0x306b45['length']<0x32)return{'ready':![],'message':_0x26f820(0x173)+_0x306b45[_0x26f820(0x17b)]+_0x26f820(0x114)};const _0x27ae67=this['priceBuffer'][_0x26f820(0x11b)](_0x373261)||[],_0x3ae8d9=this['volumeBuffer']['get'](_0x373261)||[],_0x4fcaa7=this['_computeZScore'](_0x27ae67),_0x47bc64=this['_computeVPIN'](_0x3ae8d9),_0x49105d=this['_computeOrderFlowImbalance'](_0x306b45),_0x59d7f4=this['_computeKyleLambda'](_0x306b45),{regime:_0x2eb87f,params:_0x44ca9f}=this[_0x26f820(0x117)](_0x373261,_0x306b45);return{'ready':!![],'zScore':_0x4fcaa7,'vpin':_0x47bc64,'ofi':_0x49105d,'kyleLambda':_0x59d7f4,'regime':_0x2eb87f,'stopTicks':Math['round'](this[_0x26f820(0x146)]*_0x44ca9f[_0x26f820(0x148)]),'targetTicks':Math['round'](this['baseTargetTicks']*_0x44ca9f[_0x26f820(0x162)]),'threshold':_0x44ca9f[_0x26f820(0x158)],'barsProcessed':_0x306b45[_0x26f820(0x17b)],'models':_0x26f820(0x12b)};}[_0x5307f6(0x169)](_0x57e4c7){const _0x12ac0e=_0x5307f6;this[_0x12ac0e(0x120)][_0x12ac0e(0x175)]({'netPnl':_0x57e4c7,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this[_0x12ac0e(0x120)][_0x12ac0e(0x15b)]();_0x57e4c7>0x0?(this['winStreak']++,this['lossStreak']=0x0,this[_0x12ac0e(0x15f)][_0x12ac0e(0x116)]++):(this[_0x12ac0e(0x11a)]++,this['winStreak']=0x0,this['stats']['losses']++),this[_0x12ac0e(0x15f)]['trades']++,this['stats']['pnl']+=_0x57e4c7,this['emit']('log',{'type':_0x12ac0e(0x12a),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x57e4c7>0x0?_0x12ac0e(0x171):_0x12ac0e(0x150))+'\x20$'+_0x57e4c7[_0x12ac0e(0x131)](0x2)+_0x12ac0e(0x16b)+(_0x57e4c7>0x0?this[_0x12ac0e(0x155)]:-this[_0x12ac0e(0x11a)])});}[_0x5307f6(0x111)](_0x2d110e){const _0x4edacd=_0x5307f6;return this[_0x4edacd(0x12e)][_0x4edacd(0x11b)](_0x2d110e)||[];}['getStats'](){const _0x3ca1b7=_0x5307f6;return this[_0x3ca1b7(0x15f)];}['reset'](_0x3af889){const _0x99c4bf=_0x5307f6;this[_0x99c4bf(0x12e)][_0x99c4bf(0x127)](_0x3af889,[]),this['priceBuffer']['set'](_0x3af889,[]),this[_0x99c4bf(0x167)][_0x99c4bf(0x127)](_0x3af889,[]),this['atrHistory'][_0x99c4bf(0x127)](_0x3af889,[]),this[_0x99c4bf(0x13f)][_0x99c4bf(0x127)](_0x3af889,{'estimate':0x0,'errorCovariance':0x1}),this[_0x99c4bf(0x166)](_0x99c4bf(0x13c),{'type':_0x99c4bf(0x134),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x3af889});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x52695f={}){const _0x263cfc=_0x5307f6;super(),this['config']=_0x52695f,this['strategy']=new HQXUltraScalping(_0x52695f),this['strategy']['on']('signal',_0x58c7b3=>this['emit']('signal',_0x58c7b3)),this[_0x263cfc(0x157)]['on'](_0x263cfc(0x13c),_0x3b913c=>this[_0x263cfc(0x166)](_0x263cfc(0x13c),_0x3b913c));}[_0x5307f6(0x141)](_0xedcb97){const _0x3f6f67=_0x5307f6;return this['strategy'][_0x3f6f67(0x141)](_0xedcb97);}['onTick'](_0x3b7c69){const _0x586370=_0x5307f6;return this[_0x586370(0x157)]['onTick'](_0x3b7c69);}['onTrade'](_0x1a13bf){const _0x661527=_0x5307f6;return this[_0x661527(0x157)]['onTrade'](_0x1a13bf);}[_0x5307f6(0x174)](_0x1a416d,_0x3751b2){const _0x45b340=_0x5307f6;return this[_0x45b340(0x157)]['processBar'](_0x1a416d,_0x3751b2);}['initialize'](_0x2d4ba8,_0x334655,_0x3b6ed1){return this['strategy']['initialize'](_0x2d4ba8,_0x334655,_0x3b6ed1);}[_0x5307f6(0x178)](_0x33baf8,_0x13030a){const _0x1e4bb7=_0x5307f6;return this['strategy'][_0x1e4bb7(0x178)](_0x33baf8,_0x13030a);}[_0x5307f6(0x169)](_0x325780){const _0x4766a1=_0x5307f6;return this[_0x4766a1(0x157)][_0x4766a1(0x169)](_0x325780);}[_0x5307f6(0x140)](_0x56b1f0){const _0x36796f=_0x5307f6;return this[_0x36796f(0x157)][_0x36796f(0x140)](_0x56b1f0);}[_0x5307f6(0x121)](){const _0xe67fdb=_0x5307f6;return this[_0xe67fdb(0x157)][_0xe67fdb(0x121)]();}[_0x5307f6(0x111)](_0x1a6db8){const _0x21be09=_0x5307f6;return this[_0x21be09(0x157)][_0x21be09(0x111)](_0x1a6db8);}['getModelValues'](_0x114be5){const _0x3fd5be=_0x5307f6;return this['strategy'][_0x3fd5be(0x17d)](_0x114be5);}[_0x5307f6(0x137)](_0x428627){return this['strategy']['shouldExitByZScore'](_0x428627);}[_0x5307f6(0x129)](_0x2d9d55){return null;}}function _0x4e4a(){const _0x156e2f=['exports','772150QRVvUr','min','baseStopTicks','ofi','stopMultiplier','price','reduce','estimate','long','contractId','uuid','8ZJmOhm','LOSS','minConfidence','max','99790VfeiRK','tickValue','winStreak','errorCovariance','strategy','zscoreThreshold','6303780kAquiR','round','shift','vpinWindow','tickSize',',\x20VPIN=','stats','_computeZScore','1591323ddDvht','targetMultiplier',',\x20value=','_computeKyleLambda','498169gRXSbO','emit','volumeBuffer','low','recordTradeResult','66MsRjPK',',\x20streak:\x20','volume','cooldownMs','weights','profitLockPct','sell','WIN','[HQX-UltraScalping]\x20Initialized\x20for\x20','Collecting\x20data...\x20','processBar','push','_applyKalmanFilter','close','getAnalysisState','\x20VPIN:','timestamp','length','ofiLookback','getModelValues','_generateSignal','kyleLambda','minHoldTimeMs','priceBuffer','high','pow','zscoreEntryThreshold','getBarHistory','_calculateATR','slice','/50\x20bars','ASK','wins','_detectVolatilityRegime','\x20|\x20Conf:','vpinToxicThreshold','lossStreak','get','_computeOrderFlowImbalance','side','BID','lastSignalTime','recentTrades','getStats','kalman','breakevenTicks','kalmanMeasurementNoise','abs','24485260nIqwjl','set','short','generateSignal','debug','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','atrHistory','VERY_STRONG','barHistory','%,\x20OFI=','open','toFixed','2283200jNdzfb','19FoJAnB','info','_computeVPIN','toUpperCase','shouldExitByZScore','events','%,\x20cf=','signal','STRONG','log','now','onTrade','kalmanStates','reset','processTick','baseTargetTicks'];_0x4e4a=function(){return _0x156e2f;};return _0x4e4a();}module[_0x5307f6(0x143)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
1
+ const _0x3da12b=_0x58c7;(function(_0xbdf1ef,_0x474ebe){const _0x57b7f=_0x58c7,_0x4b4117=_0xbdf1ef();while(!![]){try{const _0x5396a0=parseInt(_0x57b7f(0x109))/0x1*(-parseInt(_0x57b7f(0x12f))/0x2)+parseInt(_0x57b7f(0xcd))/0x3+parseInt(_0x57b7f(0xd6))/0x4*(parseInt(_0x57b7f(0xdf))/0x5)+-parseInt(_0x57b7f(0x11f))/0x6*(-parseInt(_0x57b7f(0xd4))/0x7)+parseInt(_0x57b7f(0xee))/0x8+-parseInt(_0x57b7f(0x114))/0x9+-parseInt(_0x57b7f(0x125))/0xa;if(_0x5396a0===_0x474ebe)break;else _0x4b4117['push'](_0x4b4117['shift']());}catch(_0x2ac42c){_0x4b4117['push'](_0x4b4117['shift']());}}}(_0x5566,0xa52a0));const EventEmitter=require(_0x3da12b(0xfb)),{v4:uuidv4}=require(_0x3da12b(0xf7)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x5a9aff={}){const _0x2653c1=_0x3da12b;super(),this['tickSize']=_0x5a9aff['tickSize']||0.25,this['tickValue']=_0x5a9aff['tickValue']||0x5,this['zscoreEntryThreshold']=1.5,this['zscoreExitThreshold']=0.5,this['vpinWindow']=0x32,this['vpinToxicThreshold']=0.7,this[_0x2653c1(0x104)]=0.01,this[_0x2653c1(0x121)]=0.1,this['volatilityLookback']=0x64,this['ofiLookback']=0x14,this[_0x2653c1(0xfa)]=0x8,this[_0x2653c1(0xeb)]=0x10,this['breakevenTicks']=0x4,this[_0x2653c1(0xc8)]=0.5,this['minConfidence']=0.55,this[_0x2653c1(0xe5)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x2653c1(0x130)]=new Map(),this[_0x2653c1(0x126)]=new Map(),this['volumeBuffer']=new Map(),this[_0x2653c1(0xdb)]=new Map(),this['atrHistory']=new Map(),this[_0x2653c1(0xf9)]=[],this['winStreak']=0x0,this[_0x2653c1(0xc4)]=0x0,this[_0x2653c1(0xf3)]=0x0,this[_0x2653c1(0xe8)]=0x7530,this['minHoldTimeMs']=0x2710,this[_0x2653c1(0xf0)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x3da12b(0xc5)](_0x5c2963,_0x2a4315=0.25,_0x7dedf5=0x5){const _0xd5d034=_0x3da12b;this['tickSize']=_0x2a4315,this['tickValue']=_0x7dedf5,this[_0xd5d034(0x130)][_0xd5d034(0x108)](_0x5c2963,[]),this[_0xd5d034(0x126)]['set'](_0x5c2963,[]),this['volumeBuffer'][_0xd5d034(0x108)](_0x5c2963,[]),this['atrHistory'][_0xd5d034(0x108)](_0x5c2963,[]),this[_0xd5d034(0xdb)]['set'](_0x5c2963,{'estimate':0x0,'errorCovariance':0x1}),this[_0xd5d034(0xea)]('log',{'type':'info','message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x5c2963+':\x20tick='+_0x2a4315+',\x20value='+_0x7dedf5}),this['emit'](_0xd5d034(0x128),{'type':'info','message':_0xd5d034(0x10f)});}[_0x3da12b(0xdc)](_0x3b4bbc){const _0x24ec74=_0x3da12b,{contractId:_0x40e85b,price:_0x2c5607,volume:_0xca50f2,side:_0x51e21a,timestamp:_0xfe5f31}=_0x3b4bbc,_0x3e212c={'timestamp':_0xfe5f31||Date[_0x24ec74(0x106)](),'open':_0x2c5607,'high':_0x2c5607,'low':_0x2c5607,'close':_0x2c5607,'volume':_0xca50f2||0x1};return this[_0x24ec74(0xcf)](_0x40e85b,_0x3e212c);}['onTick'](_0x101470){return this['processTick'](_0x101470);}[_0x3da12b(0xca)](_0x14c28a){const _0xb61fb2=_0x3da12b;return this[_0xb61fb2(0xdc)]({'contractId':_0x14c28a['contractId']||_0x14c28a[_0xb61fb2(0x10b)],'price':_0x14c28a['price'],'volume':_0x14c28a[_0xb61fb2(0xe2)]||_0x14c28a[_0xb61fb2(0xe9)]||0x1,'side':_0x14c28a['side'],'timestamp':_0x14c28a[_0xb61fb2(0x131)]||Date[_0xb61fb2(0x106)]()});}[_0x3da12b(0xcf)](_0x5a24f5,_0x8abd51){const _0x58f840=_0x3da12b;let _0x135c50=this[_0x58f840(0x130)][_0x58f840(0x110)](_0x5a24f5);!_0x135c50&&(this['initialize'](_0x5a24f5),_0x135c50=this[_0x58f840(0x130)][_0x58f840(0x110)](_0x5a24f5));_0x135c50['push'](_0x8abd51);if(_0x135c50[_0x58f840(0xcb)]>0x1f4)_0x135c50[_0x58f840(0x112)]();const _0xadbc5f=this['priceBuffer']['get'](_0x5a24f5);_0xadbc5f[_0x58f840(0xf1)](_0x8abd51[_0x58f840(0xfc)]);if(_0xadbc5f['length']>0xc8)_0xadbc5f[_0x58f840(0x112)]();const _0x3c5e0c=this[_0x58f840(0xd8)]['get'](_0x5a24f5),_0x37a714=_0x8abd51['high']-_0x8abd51['low'];let _0x240058=_0x8abd51['volume']*0.5,_0x30f27c=_0x8abd51[_0x58f840(0xe9)]*0.5;if(_0x37a714>0x0){const _0x1a90f0=(_0x8abd51['close']-_0x8abd51['low'])/_0x37a714;_0x240058=_0x8abd51[_0x58f840(0xe9)]*_0x1a90f0,_0x30f27c=_0x8abd51['volume']*(0x1-_0x1a90f0);}_0x3c5e0c[_0x58f840(0xf1)]({'buy':_0x240058,'sell':_0x30f27c});if(_0x3c5e0c[_0x58f840(0xcb)]>0x64)_0x3c5e0c[_0x58f840(0x112)]();if(_0x135c50['length']<0x32)return null;const _0x220d55=this[_0x58f840(0xed)](_0xadbc5f),_0x1b244a=this['_computeVPIN'](_0x3c5e0c),_0x54cdd9=this['_computeKyleLambda'](_0x135c50),_0x3257d8=this['_applyKalmanFilter'](_0x5a24f5,_0x8abd51['close']),{regime:_0x834b25,params:_0x591b23}=this['_detectVolatilityRegime'](_0x5a24f5,_0x135c50),_0xc0890a=this[_0x58f840(0xd1)](_0x135c50);return this['_generateSignal'](_0x5a24f5,_0x8abd51['close'],_0x220d55,_0x1b244a,_0x54cdd9,_0x3257d8,_0x834b25,_0x591b23,_0xc0890a,_0x135c50);}[_0x3da12b(0xed)](_0x15f4e7,_0x573fed=0x32){const _0x54153d=_0x3da12b;if(_0x15f4e7['length']<_0x573fed)return 0x0;const _0x1c20ca=_0x15f4e7[_0x54153d(0xfd)](-_0x573fed),_0x196d3e=_0x1c20ca[_0x54153d(0x11e)]((_0x2ebf0c,_0x2f4e69)=>_0x2ebf0c+_0x2f4e69,0x0)/_0x573fed,_0x5a60c0=_0x1c20ca['reduce']((_0x5df1d0,_0x4f65a1)=>_0x5df1d0+Math['pow'](_0x4f65a1-_0x196d3e,0x2),0x0)/_0x573fed,_0x175ed2=Math['sqrt'](_0x5a60c0);if(_0x175ed2<0.0001)return 0x0;const _0x2b7f0d=_0x15f4e7[_0x15f4e7['length']-0x1];return(_0x2b7f0d-_0x196d3e)/_0x175ed2;}['_computeVPIN'](_0x20eb56){const _0x5b53b5=_0x3da12b;if(_0x20eb56['length']<this[_0x5b53b5(0xd3)])return 0.5;const _0x5bcb11=_0x20eb56['slice'](-this['vpinWindow']);let _0x1baf33=0x0,_0x1fcbbf=0x0;for(const _0x22d925 of _0x5bcb11){_0x1baf33+=_0x22d925['buy'],_0x1fcbbf+=_0x22d925['sell'];}const _0x2e26cb=_0x1baf33+_0x1fcbbf;if(_0x2e26cb<0x1)return 0.5;return Math[_0x5b53b5(0x102)](_0x1baf33-_0x1fcbbf)/_0x2e26cb;}[_0x3da12b(0xef)](_0x101a50){const _0x5bcfc8=_0x3da12b;if(_0x101a50['length']<0x14)return 0x0;const _0x54370e=_0x101a50['slice'](-0x14),_0x2c4866=[],_0x329552=[];for(let _0x462446=0x1;_0x462446<_0x54370e[_0x5bcfc8(0xcb)];_0x462446++){_0x2c4866[_0x5bcfc8(0xf1)](_0x54370e[_0x462446][_0x5bcfc8(0xfc)]-_0x54370e[_0x462446-0x1][_0x5bcfc8(0xfc)]),_0x329552['push'](_0x54370e[_0x462446][_0x5bcfc8(0xe9)]);}const _0x86c99e=_0x2c4866[_0x5bcfc8(0x11e)]((_0x4026f9,_0x12c57f)=>_0x4026f9+_0x12c57f,0x0)/_0x2c4866['length'],_0x4e5cff=_0x329552['reduce']((_0x1e91c8,_0x47f7b6)=>_0x1e91c8+_0x47f7b6,0x0)/_0x329552['length'];let _0x3305ec=0x0,_0x293b7c=0x0;for(let _0x15d038=0x0;_0x15d038<_0x2c4866[_0x5bcfc8(0xcb)];_0x15d038++){_0x3305ec+=(_0x2c4866[_0x15d038]-_0x86c99e)*(_0x329552[_0x15d038]-_0x4e5cff),_0x293b7c+=Math[_0x5bcfc8(0xfe)](_0x329552[_0x15d038]-_0x4e5cff,0x2);}_0x3305ec/=_0x2c4866['length'],_0x293b7c/=_0x2c4866[_0x5bcfc8(0xcb)];if(_0x293b7c<0.0001)return 0x0;return Math[_0x5bcfc8(0x102)](_0x3305ec/_0x293b7c);}[_0x3da12b(0x123)](_0x20a79b,_0x599046){const _0x17bbb2=_0x3da12b;let _0x55c5dc=this['kalmanStates'][_0x17bbb2(0x110)](_0x20a79b);if(!_0x55c5dc)return _0x55c5dc={'estimate':_0x599046,'errorCovariance':0x1},this['kalmanStates'][_0x17bbb2(0x108)](_0x20a79b,_0x55c5dc),_0x599046;const _0x44e1c0=_0x55c5dc[_0x17bbb2(0x115)],_0x4563f6=_0x55c5dc[_0x17bbb2(0xf4)]+this[_0x17bbb2(0x104)],_0x5e912c=_0x4563f6/(_0x4563f6+this['kalmanMeasurementNoise']),_0x5ad057=_0x44e1c0+_0x5e912c*(_0x599046-_0x44e1c0),_0x5ae60d=(0x1-_0x5e912c)*_0x4563f6;return _0x55c5dc['estimate']=_0x5ad057,_0x55c5dc[_0x17bbb2(0xf4)]=_0x5ae60d,_0x5ad057;}[_0x3da12b(0x116)](_0x4a6bfc,_0x371812){const _0x418e81=_0x3da12b,_0x1641a2=this['_calculateATR'](_0x371812),_0x10bee3=_0x1641a2/this['tickSize'];let _0x50c8f2=this[_0x418e81(0x111)]['get'](_0x4a6bfc);!_0x50c8f2&&(_0x50c8f2=[],this['atrHistory'][_0x418e81(0x108)](_0x4a6bfc,_0x50c8f2));_0x50c8f2['push'](_0x1641a2);if(_0x50c8f2['length']>0x1f4)_0x50c8f2['shift']();let _0x1d0a21=0.5;_0x50c8f2['length']>=0x14&&(_0x1d0a21=_0x50c8f2[_0x418e81(0x12c)](_0x33cf51=>_0x33cf51<=_0x1641a2)[_0x418e81(0xcb)]/_0x50c8f2[_0x418e81(0xcb)]);let _0x3bc301,_0x5587cf;if(_0x1d0a21<0.25)_0x3bc301='low',_0x5587cf={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x1d0a21<0.75?(_0x3bc301='normal',_0x5587cf={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x3bc301=_0x418e81(0x11d),_0x5587cf={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x3bc301,'params':_0x5587cf};}['_calculateATR'](_0x4148ce,_0x1080a3=0xe){const _0x341874=_0x3da12b;if(_0x4148ce['length']<_0x1080a3+0x1)return 2.5;const _0x3ce9aa=[];for(let _0x3dd4f3=_0x4148ce['length']-_0x1080a3;_0x3dd4f3<_0x4148ce['length'];_0x3dd4f3++){const _0x166e67=_0x4148ce[_0x3dd4f3],_0x350e18=_0x4148ce[_0x3dd4f3-0x1]['close'],_0x15ad7f=Math[_0x341874(0x12a)](_0x166e67['high']-_0x166e67['low'],Math['abs'](_0x166e67['high']-_0x350e18),Math['abs'](_0x166e67[_0x341874(0xf8)]-_0x350e18));_0x3ce9aa['push'](_0x15ad7f);}return _0x3ce9aa[_0x341874(0x11e)]((_0xdadf67,_0x379d30)=>_0xdadf67+_0x379d30,0x0)/_0x3ce9aa['length'];}['_computeOrderFlowImbalance'](_0x485966){const _0x492ff1=_0x3da12b;if(_0x485966[_0x492ff1(0xcb)]<this['ofiLookback'])return 0x0;const _0x157890=_0x485966['slice'](-this[_0x492ff1(0x10a)]);let _0x193294=0x0,_0x12598f=0x0;for(const _0x5785ed of _0x157890){const _0x23c618=_0x5785ed['high']-_0x5785ed['low'];if(_0x23c618>0x0){const _0x5286d5=(_0x5785ed['close']-_0x5785ed[_0x492ff1(0xf8)])/_0x23c618;_0x193294+=_0x5286d5*_0x5785ed[_0x492ff1(0xe9)],_0x12598f+=(0x1-_0x5286d5)*_0x5785ed[_0x492ff1(0xe9)];}}const _0x194b47=_0x193294+_0x12598f;if(_0x194b47<0x1)return 0x0;return(_0x193294-_0x12598f)/_0x194b47;}[_0x3da12b(0x11c)](_0x362db6,_0x8d5f50,_0x5adacf,_0x5d16f9,_0x520006,_0x438c9b,_0x3c2af0,_0x397fd1,_0x232da3,_0x7674ea){const _0x1973a5=_0x3da12b,_0x5203b2=Math['abs'](_0x5adacf);if(_0x5203b2<_0x397fd1[_0x1973a5(0x122)])return null;if(_0x5d16f9>this['vpinToxicThreshold'])return null;let _0x6e0c76;if(_0x5adacf<-_0x397fd1['zscoreThreshold'])_0x6e0c76=_0x1973a5(0xd0);else{if(_0x5adacf>_0x397fd1['zscoreThreshold'])_0x6e0c76=_0x1973a5(0xce);else return null;}const _0xd25623=_0x6e0c76==='long'&&_0x232da3>0.1||_0x6e0c76==='short'&&_0x232da3<-0.1,_0x532fe0=_0x8d5f50-_0x438c9b,_0x4bdc55=_0x6e0c76==='long'&&_0x532fe0<0x0||_0x6e0c76===_0x1973a5(0xce)&&_0x532fe0>0x0,_0x49a590={'zscore':Math['min'](0x1,_0x5203b2/0x4),'vpin':0x1-_0x5d16f9,'kyleLambda':_0x520006>0.001?0.5:0.8,'kalman':_0x4bdc55?0.8:0.4,'volatility':_0x3c2af0===_0x1973a5(0xd2)?0.8:_0x3c2af0==='low'?0.7:0.6,'ofi':_0xd25623?0.9:0.5,'composite':0x0};_0x49a590[_0x1973a5(0xf2)]=_0x49a590[_0x1973a5(0xe1)]*this[_0x1973a5(0xe5)]['zscore']+_0x49a590['vpin']*this[_0x1973a5(0xe5)]['vpin']+_0x49a590['kyleLambda']*this['weights'][_0x1973a5(0x124)]+_0x49a590['kalman']*this[_0x1973a5(0xe5)]['kalman']+_0x49a590['volatility']*this['weights']['volatility']+_0x49a590[_0x1973a5(0x12d)]*this[_0x1973a5(0xe5)]['ofi'];const _0x574d0f=Math[_0x1973a5(0x129)](0x1,_0x49a590[_0x1973a5(0xf2)]+_0x397fd1['confidenceBonus']);if(_0x574d0f<this['minConfidence'])return null;if(Date['now']()-this['lastSignalTime']<this[_0x1973a5(0xe8)])return null;const _0x4e7291=Math[_0x1973a5(0x11b)](this[_0x1973a5(0xfa)]*_0x397fd1[_0x1973a5(0x100)]),_0x2116b1=Math[_0x1973a5(0x11b)](this['baseTargetTicks']*_0x397fd1['targetMultiplier']),_0xf92e7d=Math['max'](0x6,Math[_0x1973a5(0x129)](0xc,_0x4e7291)),_0x463630=Math[_0x1973a5(0x12a)](_0xf92e7d*1.5,Math['min'](0x18,_0x2116b1));let _0x2fe4e7,_0x417457,_0x105bb0,_0x6d52b2;_0x6e0c76===_0x1973a5(0xd0)?(_0x2fe4e7=_0x8d5f50-_0xf92e7d*this['tickSize'],_0x417457=_0x8d5f50+_0x463630*this[_0x1973a5(0x118)],_0x105bb0=_0x8d5f50+this['breakevenTicks']*this[_0x1973a5(0x118)],_0x6d52b2=_0x8d5f50+_0x463630*this['profitLockPct']*this[_0x1973a5(0x118)]):(_0x2fe4e7=_0x8d5f50+_0xf92e7d*this[_0x1973a5(0x118)],_0x417457=_0x8d5f50-_0x463630*this[_0x1973a5(0x118)],_0x105bb0=_0x8d5f50-this[_0x1973a5(0x10e)]*this[_0x1973a5(0x118)],_0x6d52b2=_0x8d5f50-_0x463630*this['profitLockPct']*this['tickSize']);const _0x28ef7c=_0x463630/_0xf92e7d,_0x19650d=Math['round'](_0x463630*0.5),_0x2337a4=Math[_0x1973a5(0x11b)](_0xf92e7d*0.4);let _0x4b10f9=SignalStrength['MODERATE'];if(_0x574d0f>=0.85)_0x4b10f9=SignalStrength['VERY_STRONG'];else{if(_0x574d0f>=0.75)_0x4b10f9=SignalStrength['STRONG'];else{if(_0x574d0f<0.6)_0x4b10f9=SignalStrength[_0x1973a5(0x103)];}}const _0x512316=0.5+(_0x574d0f-0.5)*0.4,_0x347e8f=_0x512316*Math['abs'](_0x417457-_0x8d5f50)-(0x1-_0x512316)*Math[_0x1973a5(0x102)](_0x8d5f50-_0x2fe4e7);this['lastSignalTime']=Date[_0x1973a5(0x106)](),this[_0x1973a5(0xf0)][_0x1973a5(0xcc)]++;const _0x1f5186={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x362db6['split']('.')[0x0]||_0x362db6,'contractId':_0x362db6,'side':_0x6e0c76==='long'?OrderSide[_0x1973a5(0x107)]:OrderSide[_0x1973a5(0x12e)],'direction':_0x6e0c76,'strategy':_0x1973a5(0x120),'strength':_0x4b10f9,'edge':_0x347e8f,'confidence':_0x574d0f,'entry':_0x8d5f50,'entryPrice':_0x8d5f50,'stopLoss':_0x2fe4e7,'takeProfit':_0x417457,'riskReward':_0x28ef7c,'stopTicks':_0xf92e7d,'targetTicks':_0x463630,'trailTriggerTicks':_0x19650d,'trailDistanceTicks':_0x2337a4,'beBreakeven':_0x105bb0,'profitLockLevel':_0x6d52b2,'zScore':_0x5adacf,'zScoreExit':this['zscoreExitThreshold'],'vpinValue':_0x5d16f9,'kyleLambda':_0x520006,'kalmanEstimate':_0x438c9b,'volatilityRegime':_0x3c2af0,'ofiValue':_0x232da3,'models':_0x49a590,'orderFlowConfirmed':_0xd25623,'kalmanConfirmed':_0x4bdc55,'expires':Date[_0x1973a5(0x106)]()+0xea60};return this['emit'](_0x1973a5(0xec),{'side':_0x6e0c76===_0x1973a5(0xd0)?'buy':'sell','action':_0x1973a5(0xc9),'reason':'Z='+_0x5adacf['toFixed'](0x2)+',\x20VPIN='+(_0x5d16f9*0x64)['toFixed'](0x0)+'%,\x20OFI='+(_0x232da3*0x64)[_0x1973a5(0x10d)](0x0)+_0x1973a5(0xf5)+(_0x574d0f*0x64)[_0x1973a5(0x10d)](0x0)+'%',..._0x1f5186}),this['emit'](_0x1973a5(0x128),{'type':_0x1973a5(0x105),'message':'[HQX]\x20SIGNAL:\x20'+_0x6e0c76['toUpperCase']()+_0x1973a5(0xd5)+_0x8d5f50['toFixed'](0x2)+'\x20|\x20Z:'+_0x5adacf['toFixed'](0x2)+_0x1973a5(0x117)+(_0x5d16f9*0x64)[_0x1973a5(0x10d)](0x0)+_0x1973a5(0x127)+(_0x232da3*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x520006['toFixed'](0x5)+'\x20Regime:'+_0x3c2af0+'\x20|\x20Conf:'+(_0x574d0f*0x64)['toFixed'](0x0)+'%'}),_0x1f5186;}['shouldExitByZScore'](_0x296a56){const _0x34aca4=_0x3da12b,_0x19a780=this['priceBuffer']['get'](_0x296a56);if(!_0x19a780||_0x19a780['length']<0x32)return![];const _0x28f18a=this['_computeZScore'](_0x19a780);return Math[_0x34aca4(0x102)](_0x28f18a)<this[_0x34aca4(0x113)];}[_0x3da12b(0xde)](_0x1e367e){const _0x1b844d=_0x3da12b,_0x537343=this[_0x1b844d(0x126)][_0x1b844d(0x110)](_0x1e367e),_0x40e92c=this['volumeBuffer'][_0x1b844d(0x110)](_0x1e367e),_0x124814=this[_0x1b844d(0x130)]['get'](_0x1e367e);if(!_0x537343||!_0x40e92c||!_0x124814||_0x124814['length']<0x32)return null;const _0x1700ab=this[_0x1b844d(0xed)](_0x537343),_0x4f7b7f=this['_computeVPIN'](_0x40e92c),_0xd4a247=this[_0x1b844d(0xef)](_0x124814),_0x4259a6=this[_0x1b844d(0xd1)](_0x124814);return{'zscore':Math['min'](0x1,Math[_0x1b844d(0x102)](_0x1700ab)/0x4),'vpin':0x1-_0x4f7b7f,'kyleLambda':_0xd4a247>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x1b844d(0x102)](_0x4259a6)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x1700ab,'vpin':_0x4f7b7f,'kyleLambda':_0xd4a247,'ofi':_0x4259a6}};}[_0x3da12b(0xc7)](_0x384545,_0x45eca4){const _0x31752b=_0x3da12b,_0xad502b=this[_0x31752b(0x130)][_0x31752b(0x110)](_0x384545)||[];if(_0xad502b[_0x31752b(0xcb)]<0x32)return{'ready':![],'message':_0x31752b(0xdd)+_0xad502b['length']+_0x31752b(0x119)};const _0x2c5617=this['priceBuffer'][_0x31752b(0x110)](_0x384545)||[],_0x24db6c=this[_0x31752b(0xd8)][_0x31752b(0x110)](_0x384545)||[],_0x345465=this['_computeZScore'](_0x2c5617),_0x2ef726=this[_0x31752b(0xe7)](_0x24db6c),_0x3bc367=this[_0x31752b(0xd1)](_0xad502b),_0x479828=this[_0x31752b(0xef)](_0xad502b),{regime:_0x2fbf4f,params:_0x284475}=this['_detectVolatilityRegime'](_0x384545,_0xad502b);return{'ready':!![],'zScore':_0x345465,'vpin':_0x2ef726,'ofi':_0x3bc367,'kyleLambda':_0x479828,'regime':_0x2fbf4f,'stopTicks':Math[_0x31752b(0x11b)](this[_0x31752b(0xfa)]*_0x284475['stopMultiplier']),'targetTicks':Math['round'](this[_0x31752b(0xeb)]*_0x284475['targetMultiplier']),'threshold':_0x284475[_0x31752b(0x122)],'barsProcessed':_0xad502b['length'],'models':_0x31752b(0xd9)};}['recordTradeResult'](_0x1311d9){const _0x21a2e1=_0x3da12b;this[_0x21a2e1(0xf9)]['push']({'netPnl':_0x1311d9,'timestamp':Date['now']()});if(this[_0x21a2e1(0xf9)]['length']>0x64)this[_0x21a2e1(0xf9)]['shift']();_0x1311d9>0x0?(this[_0x21a2e1(0xda)]++,this[_0x21a2e1(0xc4)]=0x0,this['stats'][_0x21a2e1(0xe4)]++):(this[_0x21a2e1(0xc4)]++,this[_0x21a2e1(0xda)]=0x0,this[_0x21a2e1(0xf0)][_0x21a2e1(0x10c)]++),this['stats']['trades']++,this[_0x21a2e1(0xf0)]['pnl']+=_0x1311d9,this[_0x21a2e1(0xea)](_0x21a2e1(0x128),{'type':'debug','message':_0x21a2e1(0xd7)+(_0x1311d9>0x0?'WIN':'LOSS')+'\x20$'+_0x1311d9[_0x21a2e1(0x10d)](0x2)+_0x21a2e1(0x11a)+(_0x1311d9>0x0?this['winStreak']:-this[_0x21a2e1(0xc4)])});}[_0x3da12b(0xe3)](_0x2f82b8){return this['barHistory']['get'](_0x2f82b8)||[];}[_0x3da12b(0x101)](){const _0x25eaad=_0x3da12b;return this[_0x25eaad(0xf0)];}[_0x3da12b(0xe6)](_0xdd980e){const _0x43cd06=_0x3da12b;this[_0x43cd06(0x130)]['set'](_0xdd980e,[]),this[_0x43cd06(0x126)][_0x43cd06(0x108)](_0xdd980e,[]),this[_0x43cd06(0xd8)][_0x43cd06(0x108)](_0xdd980e,[]),this['atrHistory']['set'](_0xdd980e,[]),this[_0x43cd06(0xdb)][_0x43cd06(0x108)](_0xdd980e,{'estimate':0x0,'errorCovariance':0x1}),this[_0x43cd06(0xea)](_0x43cd06(0x128),{'type':'info','message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0xdd980e});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x5e8184={}){const _0x45d715=_0x3da12b;super(),this['config']=_0x5e8184,this['strategy']=new HQXUltraScalping(_0x5e8184),this[_0x45d715(0xff)]['on'](_0x45d715(0xec),_0x4cebff=>this['emit']('signal',_0x4cebff)),this[_0x45d715(0xff)]['on']('log',_0x4e40c8=>this[_0x45d715(0xea)]('log',_0x4e40c8));}[_0x3da12b(0xdc)](_0x2967ce){const _0x21dba7=_0x3da12b;return this[_0x21dba7(0xff)]['processTick'](_0x2967ce);}['onTick'](_0xe6dc4c){const _0x275f48=_0x3da12b;return this[_0x275f48(0xff)]['onTick'](_0xe6dc4c);}[_0x3da12b(0xca)](_0x4929de){const _0x20cba1=_0x3da12b;return this[_0x20cba1(0xff)][_0x20cba1(0xca)](_0x4929de);}['processBar'](_0x31566d,_0x33938c){const _0x31b415=_0x3da12b;return this[_0x31b415(0xff)][_0x31b415(0xcf)](_0x31566d,_0x33938c);}['initialize'](_0x39baf2,_0x56fd90,_0x9264ab){const _0x11acc2=_0x3da12b;return this[_0x11acc2(0xff)][_0x11acc2(0xc5)](_0x39baf2,_0x56fd90,_0x9264ab);}['getAnalysisState'](_0x5e099e,_0x18d65a){const _0x2f7ff8=_0x3da12b;return this[_0x2f7ff8(0xff)][_0x2f7ff8(0xc7)](_0x5e099e,_0x18d65a);}['recordTradeResult'](_0x4aa3dd){const _0x5b4404=_0x3da12b;return this[_0x5b4404(0xff)][_0x5b4404(0xe0)](_0x4aa3dd);}[_0x3da12b(0xe6)](_0x306e62){const _0x393299=_0x3da12b;return this['strategy'][_0x393299(0xe6)](_0x306e62);}[_0x3da12b(0x101)](){const _0x31bd5e=_0x3da12b;return this[_0x31bd5e(0xff)][_0x31bd5e(0x101)]();}['getBarHistory'](_0x435b6a){return this['strategy']['getBarHistory'](_0x435b6a);}[_0x3da12b(0xde)](_0x23f498){return this['strategy']['getModelValues'](_0x23f498);}['shouldExitByZScore'](_0x875cff){const _0x43cc5c=_0x3da12b;return this[_0x43cc5c(0xff)][_0x43cc5c(0xc6)](_0x875cff);}[_0x3da12b(0xf6)](_0x55b6d0){return null;}}function _0x58c7(_0x5a0252,_0x2ab212){_0x5a0252=_0x5a0252-0xc4;const _0x556667=_0x5566();let _0x58c76c=_0x556667[_0x5a0252];return _0x58c76c;}function _0x5566(){const _0x20771a=['profitLockPct','open','onTrade','length','signals','2238696lGImgI','short','processBar','long','_computeOrderFlowImbalance','normal','vpinWindow','349601wOjQWr','\x20@\x20','18332YBVOaj','[HQX]\x20Trade\x20result:\x20','volumeBuffer','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','winStreak','kalmanStates','processTick','Collecting\x20data...\x20','getModelValues','1075VhKXQd','recordTradeResult','zscore','size','getBarHistory','wins','weights','reset','_computeVPIN','cooldownMs','volume','emit','baseTargetTicks','signal','_computeZScore','5560880tVMTVj','_computeKyleLambda','stats','push','composite','lastSignalTime','errorCovariance','%,\x20cf=','generateSignal','uuid','low','recentTrades','baseStopTicks','events','close','slice','pow','strategy','stopMultiplier','getStats','abs','WEAK','kalmanProcessNoise','info','now','BID','set','677EriKCE','ofiLookback','symbol','losses','toFixed','breakevenTicks','[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)','get','atrHistory','shift','zscoreExitThreshold','3631959exDCIv','estimate','_detectVolatilityRegime','\x20VPIN:','tickSize','/50\x20bars',',\x20streak:\x20','round','_generateSignal','high','reduce','60QFUEhj','HQX_ULTRA_SCALPING_6MODELS','kalmanMeasurementNoise','zscoreThreshold','_applyKalmanFilter','kyleLambda','16009800Zxfxtb','priceBuffer','%\x20OFI:','log','min','max','exports','filter','ofi','ASK','724PCJxav','barHistory','timestamp','lossStreak','initialize','shouldExitByZScore','getAnalysisState'];_0x5566=function(){return _0x20771a;};return _0x5566();}module[_0x3da12b(0x12b)]={'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.97",
3
+ "version": "2.9.99",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  const LONG_BIAS_MESSAGES = [
19
19
  '{bull:Buyers} taking control with aggressive {bull:lifting}',
20
20
  '{bull:Bid} side absorbing sell pressure',
21
- '{bull:Bullish} flow on {action:liquidity sweep}',
21
+ '{bull:Bullish} momentum building',
22
22
  '{bull:Buy} programs {bull:lifting} through {zone:resistance}',
23
23
  'Strong {bull:buyer} presence at {bull:bid} levels',
24
24
  '{flow:Accumulation} with increasing {flow:volume}',
@@ -40,7 +40,7 @@ const LONG_BIAS_MESSAGES = [
40
40
  const SHORT_BIAS_MESSAGES = [
41
41
  '{bear:Sellers} taking control with aggressive {bear:hitting}',
42
42
  '{bear:Offer} side absorbing buy pressure',
43
- '{bear:Bearish} flow on {action:liquidity sweep}',
43
+ '{bear:Bearish} momentum building',
44
44
  '{bear:Sell} programs {bear:hitting} through {zone:support}',
45
45
  'Strong {bear:seller} presence at {bear:offer} levels',
46
46
  '{flow:Distribution} with increasing {flow:volume}',
@@ -258,10 +258,10 @@ const RISK_BLOCKED_MESSAGES = [
258
258
  // =============================================================================
259
259
 
260
260
  const SCANNING_MESSAGES = [
261
- 'Scanning for {action:liquidity sweep}...',
261
+ 'Scanning for entry signals...',
262
262
  'Analyzing order flow for bias...',
263
- 'Monitoring {zone:structure} for zones...',
264
- 'Watching swing point development...',
263
+ 'Monitoring {zone:structure} for setups...',
264
+ 'Watching price action development...',
265
265
  'Evaluating high-probability setup...',
266
266
  'Processing through strategy filters...',
267
267
  'Analyzing order book imbalances...',
@@ -270,19 +270,19 @@ const SCANNING_MESSAGES = [
270
270
  'Evaluating at key {zone:levels}...',
271
271
  'Analyzing microstructure for edge...',
272
272
  'Monitoring {bull:bid}/{bear:ask} imbalances...',
273
- 'Scanning {zone:zones} for {action:sweep}...',
273
+ 'Scanning {zone:zones} for setups...',
274
274
  'Evaluating {flow:momentum}...',
275
275
  'Analyzing regime alignment...',
276
276
  ];
277
277
 
278
278
  const WAITING_MESSAGES = [
279
- 'Waiting for {action:sweep} confirmation...',
280
- 'Pending - {zone:zone} penetration needed...',
279
+ 'Waiting for signal confirmation...',
280
+ 'Pending - setup not complete...',
281
281
  'Standby - conditions not met...',
282
282
  'Awaiting signal - monitoring {zone:zone}...',
283
- 'Ready for {action:liquidity sweep}...',
283
+ 'Ready for entry trigger...',
284
284
  'Monitoring entry trigger...',
285
- 'Waiting for {action:rejection}...',
285
+ 'Waiting for confirmation...',
286
286
  'Confirmation pending...',
287
287
  'Entry conditions not met...',
288
288
  'Awaiting confluence...',