hedgequantx 2.9.96 → 2.9.98
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.
package/dist/lib/m/hqx-2b.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x42d110=_0x3be2;(function(_0x1e7907,_0x949076){const _0x59dfca=_0x3be2,_0xeb804b=_0x1e7907();while(!![]){try{const _0x5e7a71=-parseInt(_0x59dfca(0x23a))/0x1*(-parseInt(_0x59dfca(0x22c))/0x2)+parseInt(_0x59dfca(0x257))/0x3+parseInt(_0x59dfca(0x256))/0x4*(-parseInt(_0x59dfca(0x252))/0x5)+-parseInt(_0x59dfca(0x21a))/0x6+parseInt(_0x59dfca(0x1fb))/0x7*(-parseInt(_0x59dfca(0x221))/0x8)+-parseInt(_0x59dfca(0x245))/0x9+parseInt(_0x59dfca(0x227))/0xa;if(_0x5e7a71===_0x949076)break;else _0xeb804b['push'](_0xeb804b['shift']());}catch(_0x27abfa){_0xeb804b['push'](_0xeb804b['shift']());}}}(_0x1d4b,0x9270e));function _0x3be2(_0x1efabc,_0x16e272){_0x1efabc=_0x1efabc-0x1ce;const _0x1d4b2b=_0x1d4b();let _0x3be218=_0x1d4b2b[_0x1efabc];return _0x3be218;}const EventEmitter=require(_0x42d110(0x23b)),{v4:uuidv4}=require(_0x42d110(0x24e)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':_0x42d110(0x251)},ZoneType={'RESISTANCE':_0x42d110(0x233),'SUPPORT':_0x42d110(0x1f0)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.2,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':!![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x42d110(0x1f4)}};class SwingPoint{constructor(_0x9aeb87,_0x1b12eb,_0x25b7d8,_0x31277a,_0x40b9c6=0x1){const _0x4b8ffd=_0x42d110;this['type']=_0x9aeb87,this[_0x4b8ffd(0x25c)]=_0x1b12eb,this[_0x4b8ffd(0x1ef)]=_0x25b7d8,this['timestamp']=_0x31277a,this['strength']=_0x40b9c6;}}class LiquidityZone{constructor(_0x45ca8a,_0x19217b,_0x4e691f,_0x234adc,_0x386b06){const _0x58f61f=_0x42d110;this['id']=uuidv4(),this[_0x58f61f(0x220)]=_0x45ca8a,this[_0x58f61f(0x25b)]=_0x19217b,this[_0x58f61f(0x1df)]=_0x4e691f,this['createdAt']=_0x234adc,this['barIndex']=_0x386b06,this[_0x58f61f(0x230)]=0x1,this[_0x58f61f(0x23d)]=![],this[_0x58f61f(0x1d3)]=null,this['lastUsedBarIndex']=-0x3e7,this[_0x58f61f(0x1d4)]=0.5;}[_0x42d110(0x25e)](_0x5ae7d5,_0x28e0ef,_0x3a2d4e){const _0x544960=_0x28e0ef*_0x3a2d4e;return _0x5ae7d5>=this['priceLow']-_0x544960&&_0x5ae7d5<=this['priceHigh']+_0x544960;}['getLevel'](){const _0x95461b=_0x42d110;return(this[_0x95461b(0x25b)]+this['priceLow'])/0x2;}}class SweepEvent{constructor(_0x2141ee,_0x1daa13,_0x228bde,_0x1d1fe9,_0x453ed4){const _0x2c0998=_0x42d110;this[_0x2c0998(0x1ff)]=_0x2141ee,this[_0x2c0998(0x223)]=_0x1daa13,this['entryBarIndex']=_0x228bde,this[_0x2c0998(0x208)]=_0x1d1fe9,this['extremePrice']=_0x453ed4,this[_0x2c0998(0x1e5)]=null,this[_0x2c0998(0x1d0)]=![],this[_0x2c0998(0x1d4)]=0x0,this['penetrationTicks']=0x0,this[_0x2c0998(0x207)]=0x0,this[_0x2c0998(0x24a)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x14aa1e={}){const _0x2c41d9=_0x42d110;super(),this['config']=this[_0x2c41d9(0x1e9)](DEFAULT_CONFIG,_0x14aa1e),this['tickSize']=this[_0x2c41d9(0x22b)]['tickSize'],this['tickValue']=this[_0x2c41d9(0x22b)][_0x2c41d9(0x212)],this['barHistory']=new Map(),this[_0x2c41d9(0x1ee)]=new Map(),this['liquidityZones']=new Map(),this[_0x2c41d9(0x237)]=new Map(),this['currentBar']=new Map(),this['barIntervalMs']=0xea60,this['lastSignalTime']=0x0,this['startTime']=Date['now'](),this[_0x2c41d9(0x1f2)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this['recentTrades']=[];}['_mergeConfig'](_0x555779,_0x42191e){const _0x115b51=_0x42d110,_0x5d1ae0={..._0x555779};for(const _0x20505d in _0x42191e){typeof _0x42191e[_0x20505d]===_0x115b51(0x218)&&!Array[_0x115b51(0x241)](_0x42191e[_0x20505d])?_0x5d1ae0[_0x20505d]={..._0x555779[_0x20505d],..._0x42191e[_0x20505d]}:_0x5d1ae0[_0x20505d]=_0x42191e[_0x20505d];}return _0x5d1ae0;}['isWithinSession'](_0x3f5ec5){const _0x4c16cb=_0x42d110;if(!this[_0x4c16cb(0x22b)][_0x4c16cb(0x20e)][_0x4c16cb(0x1db)])return!![];const _0x4d524f=new Date(_0x3f5ec5),_0x1a7fc9=this['isDST'](_0x4d524f)?-0x4:-0x5,_0xfd4b53=_0x4d524f['getUTCHours'](),_0xd39bbe=_0x4d524f['getUTCMinutes'](),_0x72695b=(_0xfd4b53+_0x1a7fc9+0x18)%0x18,{startHour:_0x13c7b1,startMinute:_0x5fdf18,endHour:_0x58aed0,endMinute:_0x4c293c}=this['config'][_0x4c16cb(0x20e)],_0x116996=_0x72695b*0x3c+_0xd39bbe,_0x55fd7d=_0x13c7b1*0x3c+_0x5fdf18,_0x445507=_0x58aed0*0x3c+_0x4c293c;return _0x116996>=_0x55fd7d&&_0x116996<_0x445507;}['isDST'](_0x56bc1c){const _0x2d20b7=_0x42d110,_0x3796a=new Date(_0x56bc1c[_0x2d20b7(0x1cf)](),0x0,0x1),_0x1c1255=new Date(_0x56bc1c['getFullYear'](),0x6,0x1),_0x382784=Math[_0x2d20b7(0x1f6)](_0x3796a[_0x2d20b7(0x258)](),_0x1c1255['getTimezoneOffset']());return _0x56bc1c['getTimezoneOffset']()<_0x382784;}[_0x42d110(0x259)](_0x25c1c0,_0x73eb84=0.25,_0x21d975=0x5){const _0x17c80c=_0x42d110;this[_0x17c80c(0x20b)]=_0x73eb84,this[_0x17c80c(0x212)]=_0x21d975,this[_0x17c80c(0x22b)]['tickSize']=_0x73eb84,this[_0x17c80c(0x22b)][_0x17c80c(0x212)]=_0x21d975,this[_0x17c80c(0x214)]['set'](_0x25c1c0,[]),this[_0x17c80c(0x1ee)]['set'](_0x25c1c0,[]),this['liquidityZones']['set'](_0x25c1c0,[]),this['activeSweeps'][_0x17c80c(0x211)](_0x25c1c0,[]),this[_0x17c80c(0x228)]['delete'](_0x25c1c0),this['emit'](_0x17c80c(0x248),{'type':_0x17c80c(0x1dd),'message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x25c1c0+_0x17c80c(0x20f)+_0x73eb84+_0x17c80c(0x1fa)+_0x21d975+_0x17c80c(0x1e6)}),this['emit'](_0x17c80c(0x248),{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x17c80c(0x22b)]['execution']['stopTicks']+'t,\x20Target='+this['config'][_0x17c80c(0x1fd)]['targetTicks']+'t,\x20BE='+this[_0x17c80c(0x22b)]['execution'][_0x17c80c(0x22e)]+_0x17c80c(0x1dc)+this[_0x17c80c(0x22b)]['execution']['trailTriggerTicks']+'/'+this['config']['execution']['trailDistanceTicks']});}['processTick'](_0x448053){const _0x3625d6=_0x42d110,{contractId:_0x1829b5,price:_0x232540,volume:_0x182a0e,timestamp:_0x15d3de}=_0x448053,_0x5570c6=_0x15d3de||Date['now'](),_0x25c35e=_0x182a0e||0x1;if(!this['isWithinSession'](_0x5570c6))return null;let _0x52a8d2=this['currentBar']['get'](_0x1829b5);const _0x27d017=Math[_0x3625d6(0x1ea)](_0x5570c6/this[_0x3625d6(0x247)])*this['barIntervalMs'];if(!_0x52a8d2||_0x52a8d2[_0x3625d6(0x204)]!==_0x27d017){if(_0x52a8d2){const _0x2643e9={'timestamp':_0x52a8d2[_0x3625d6(0x204)],'open':_0x52a8d2['open'],'high':_0x52a8d2['high'],'low':_0x52a8d2[_0x3625d6(0x251)],'close':_0x52a8d2['close'],'volume':_0x52a8d2[_0x3625d6(0x1e8)]},_0x2dcab6=this['processBar'](_0x1829b5,_0x2643e9);return this[_0x3625d6(0x228)][_0x3625d6(0x211)](_0x1829b5,{'startTime':_0x27d017,'open':_0x232540,'high':_0x232540,'low':_0x232540,'close':_0x232540,'volume':_0x25c35e}),_0x2dcab6;}else return this['currentBar'][_0x3625d6(0x211)](_0x1829b5,{'startTime':_0x27d017,'open':_0x232540,'high':_0x232540,'low':_0x232540,'close':_0x232540,'volume':_0x25c35e}),null;}else return _0x52a8d2['high']=Math['max'](_0x52a8d2[_0x3625d6(0x249)],_0x232540),_0x52a8d2[_0x3625d6(0x251)]=Math[_0x3625d6(0x253)](_0x52a8d2['low'],_0x232540),_0x52a8d2[_0x3625d6(0x22d)]=_0x232540,_0x52a8d2[_0x3625d6(0x1e8)]+=_0x25c35e,null;}[_0x42d110(0x1e4)](_0x7c6e1f){const _0x1fbbc4=_0x42d110;return this[_0x1fbbc4(0x250)](_0x7c6e1f);}[_0x42d110(0x1e1)](_0x117959){const _0x1ce320=_0x42d110;return this['processTick']({'contractId':_0x117959['contractId']||_0x117959['symbol'],'price':_0x117959['price'],'volume':_0x117959['size']||_0x117959['volume']||0x1,'timestamp':_0x117959[_0x1ce320(0x1e3)]||Date[_0x1ce320(0x21f)]()});}[_0x42d110(0x1d2)](_0x15cf51,_0x1d966b){const _0x542b18=_0x42d110;let _0x301634=this[_0x542b18(0x214)]['get'](_0x15cf51);!_0x301634&&(this[_0x542b18(0x259)](_0x15cf51),_0x301634=this['barHistory']['get'](_0x15cf51));_0x301634[_0x542b18(0x1d7)](_0x1d966b);if(_0x301634['length']>0x1f4)_0x301634[_0x542b18(0x20d)]();const _0xc55f8=_0x301634['length']-0x1;if(_0x301634['length']<this['config'][_0x542b18(0x23f)][_0x542b18(0x1e0)]*0x3)return null;const _0x399170=this['swingPoints']['get'](_0x15cf51)[_0x542b18(0x1f5)];this[_0x542b18(0x215)](_0x15cf51,_0x301634,_0xc55f8);const _0x5145d1=this['swingPoints'][_0x542b18(0x231)](_0x15cf51);if(_0x5145d1['length']>_0x399170){const _0x360100=_0x5145d1[_0x5145d1[_0x542b18(0x1f5)]-0x1];this['emit'](_0x542b18(0x248),{'type':_0x542b18(0x255),'message':'[2B]\x20NEW\x20SWING\x20'+_0x360100['type']['toUpperCase']()+_0x542b18(0x25f)+_0x360100[_0x542b18(0x25c)][_0x542b18(0x224)](0x2)+_0x542b18(0x1ce)+_0x5145d1[_0x542b18(0x1f5)]});}const _0x19b44e=this[_0x542b18(0x21b)][_0x542b18(0x231)](_0x15cf51)[_0x542b18(0x1f5)];this[_0x542b18(0x225)](_0x15cf51,_0xc55f8);const _0x2489e2=this[_0x542b18(0x21b)][_0x542b18(0x231)](_0x15cf51);if(_0x2489e2['length']>_0x19b44e){const _0x443a0d=_0x2489e2[_0x2489e2[_0x542b18(0x1f5)]-0x1];this[_0x542b18(0x254)](_0x542b18(0x248),{'type':'debug','message':'[2B]\x20NEW\x20ZONE\x20'+_0x443a0d['type']['toUpperCase']()+'\x20@\x20'+_0x443a0d[_0x542b18(0x25a)]()[_0x542b18(0x224)](0x2)+'\x20|\x20Total:\x20'+_0x2489e2['length']});}const _0x296cf6=this['_detectSweep'](_0x15cf51,_0x301634,_0xc55f8);_0x296cf6&&this['emit'](_0x542b18(0x248),{'type':_0x542b18(0x255),'message':_0x542b18(0x1d1)+_0x296cf6['sweepType']+'\x20|\x20Valid:\x20'+_0x296cf6['isValid']+'\x20|\x20Pen:\x20'+_0x296cf6['penetrationTicks'][_0x542b18(0x224)](0x1)+'t\x20|\x20Q:\x20'+(_0x296cf6['qualityScore']*0x64)[_0x542b18(0x224)](0x0)+'%'});if(_0x296cf6&&_0x296cf6[_0x542b18(0x1d0)])return this[_0x542b18(0x1ed)](_0x15cf51,_0x1d966b,_0xc55f8,_0x296cf6);return null;}[_0x42d110(0x215)](_0x220488,_0x2190dc,_0x494445){const _0x545e2d=_0x42d110,_0x3c4a58=this[_0x545e2d(0x22b)][_0x545e2d(0x23f)]['lookbackBars'],_0x2dee00=this['config']['swing'][_0x545e2d(0x246)];if(_0x494445<_0x3c4a58*0x2)return;const _0x33bc03=this[_0x545e2d(0x1ee)]['get'](_0x220488),_0x288bb3=_0x494445-_0x3c4a58,_0x497486=_0x2190dc[_0x288bb3];let _0x47365f=!![],_0x299727=0x0;for(let _0x40ee2b=_0x288bb3-_0x3c4a58;_0x40ee2b<=_0x288bb3+_0x3c4a58;_0x40ee2b++){if(_0x40ee2b===_0x288bb3||_0x40ee2b<0x0||_0x40ee2b>=_0x2190dc[_0x545e2d(0x1f5)])continue;if(_0x2190dc[_0x40ee2b]['high']>=_0x497486[_0x545e2d(0x249)]){_0x47365f=![];break;}_0x299727++;}if(_0x47365f&&_0x299727>=_0x2dee00){const _0x1273f5=_0x33bc03['find'](_0x3661e6=>_0x3661e6['barIndex']===_0x288bb3&&_0x3661e6[_0x545e2d(0x220)]==='high');!_0x1273f5&&_0x33bc03['push'](new SwingPoint(_0x545e2d(0x249),_0x497486[_0x545e2d(0x249)],_0x288bb3,_0x497486[_0x545e2d(0x1e3)],_0x299727));}let _0x11fa2a=!![],_0x14a1f4=0x0;for(let _0xcca4a1=_0x288bb3-_0x3c4a58;_0xcca4a1<=_0x288bb3+_0x3c4a58;_0xcca4a1++){if(_0xcca4a1===_0x288bb3||_0xcca4a1<0x0||_0xcca4a1>=_0x2190dc[_0x545e2d(0x1f5)])continue;if(_0x2190dc[_0xcca4a1][_0x545e2d(0x251)]<=_0x497486['low']){_0x11fa2a=![];break;}_0x14a1f4++;}if(_0x11fa2a&&_0x14a1f4>=_0x2dee00){const _0x27c2c9=_0x33bc03[_0x545e2d(0x242)](_0x3e02d6=>_0x3e02d6[_0x545e2d(0x1ef)]===_0x288bb3&&_0x3e02d6['type']===_0x545e2d(0x251));!_0x27c2c9&&_0x33bc03['push'](new SwingPoint(_0x545e2d(0x251),_0x497486['low'],_0x288bb3,_0x497486[_0x545e2d(0x1e3)],_0x14a1f4));}const _0x467605=this['config']['zone']['maxZoneAgeBars'];while(_0x33bc03[_0x545e2d(0x1f5)]>0x0&&_0x33bc03[0x0][_0x545e2d(0x1ef)]<_0x494445-_0x467605){_0x33bc03[_0x545e2d(0x20d)]();}}[_0x42d110(0x225)](_0x44e915,_0x55ec53){const _0x586886=_0x42d110,_0x55ec79=this['swingPoints'][_0x586886(0x231)](_0x44e915),_0x40579e=this[_0x586886(0x21b)][_0x586886(0x231)](_0x44e915),_0x541ccd=this[_0x586886(0x22b)][_0x586886(0x223)][_0x586886(0x206)]*this[_0x586886(0x20b)],_0x560fdc=this['config']['zone'][_0x586886(0x1ec)];for(let _0xfb8bee=_0x40579e[_0x586886(0x1f5)]-0x1;_0xfb8bee>=0x0;_0xfb8bee--){_0x55ec53-_0x40579e[_0xfb8bee][_0x586886(0x1ef)]>_0x560fdc&&_0x40579e[_0x586886(0x21c)](_0xfb8bee,0x1);}for(const _0x20b1f of _0x55ec79){let _0x36372f=null;for(const _0x326f80 of _0x40579e){if(_0x326f80[_0x586886(0x25e)](_0x20b1f[_0x586886(0x25c)],this['config'][_0x586886(0x223)][_0x586886(0x206)],this[_0x586886(0x20b)])){_0x36372f=_0x326f80;break;}}if(_0x36372f){_0x36372f[_0x586886(0x230)]++;if(_0x20b1f['price']>_0x36372f[_0x586886(0x25b)])_0x36372f['priceHigh']=_0x20b1f['price'];if(_0x20b1f[_0x586886(0x25c)]<_0x36372f[_0x586886(0x1df)])_0x36372f['priceLow']=_0x20b1f['price'];_0x36372f[_0x586886(0x1d4)]=Math[_0x586886(0x253)](0x1,0.3+_0x36372f[_0x586886(0x230)]*0.15);}else{const _0xcb778=_0x20b1f[_0x586886(0x220)]===_0x586886(0x249)?ZoneType['RESISTANCE']:ZoneType[_0x586886(0x200)],_0xe237f4=new LiquidityZone(_0xcb778,_0x20b1f['price']+_0x541ccd/0x2,_0x20b1f[_0x586886(0x25c)]-_0x541ccd/0x2,_0x20b1f['timestamp'],_0x20b1f['barIndex']);_0xe237f4['qualityScore']=0.3+_0x20b1f[_0x586886(0x1fc)]*0.1,_0x40579e[_0x586886(0x1d7)](_0xe237f4);}}}['_detectSweep'](_0xdef82e,_0x5df310,_0x3fb2b8){const _0x878147=_0x42d110,_0x379184=this[_0x878147(0x21b)][_0x878147(0x231)](_0xdef82e),_0x401f0a=_0x5df310[_0x3fb2b8],_0x4cabc4=_0x401f0a[_0x878147(0x22d)],_0x327f4f=this['config']['sweep'],_0x786dc5=this['config'][_0x878147(0x223)];for(const _0x26d3de of _0x379184){if(_0x26d3de['lastUsedBarIndex']>=0x0&&_0x3fb2b8-_0x26d3de[_0x878147(0x21e)]<_0x786dc5['cooldownBars'])continue;const _0x1517f2=_0x26d3de[_0x878147(0x25a)](),_0x2a18a9=Math[_0x878147(0x23c)](_0x4cabc4-_0x1517f2)/this['tickSize'];if(_0x2a18a9>_0x786dc5['maxZoneDistanceTicks'])continue;const _0x1dc212=Math[_0x878147(0x1f6)](0x0,_0x3fb2b8-_0x327f4f[_0x878147(0x229)]*0x2);for(let _0x42f2c6=_0x1dc212;_0x42f2c6<_0x3fb2b8;_0x42f2c6++){const _0x4991a0=_0x5df310[_0x42f2c6];if(_0x26d3de[_0x878147(0x220)]===ZoneType[_0x878147(0x201)]){const _0x31b9f4=(_0x4991a0['high']-_0x26d3de['priceHigh'])/this['tickSize'];if(_0x31b9f4>=_0x327f4f[_0x878147(0x202)]&&_0x31b9f4<=_0x327f4f['maxPenetrationTicks']){if(_0x4cabc4<_0x26d3de['priceHigh']){const _0x171fb6=_0x4991a0['high']-_0x4991a0[_0x878147(0x251)],_0x1e542f=Math['abs'](_0x4991a0['close']-_0x4991a0['open']),_0x4d71e2=_0x171fb6>0x0?_0x1e542f/_0x171fb6:0x0;if(_0x4d71e2>=_0x327f4f[_0x878147(0x23e)]){const _0x2776a3=this['_getVolumeRatio'](_0x5df310,_0x42f2c6,0x14);if(_0x2776a3>=_0x327f4f['minVolumeRatio']){const _0x27dec0=new SweepEvent(SweepType['HIGH_SWEEP'],_0x26d3de,_0x42f2c6,_0x42f2c6,_0x4991a0['high']);_0x27dec0[_0x878147(0x1e5)]=_0x3fb2b8,_0x27dec0[_0x878147(0x213)]=_0x31b9f4,_0x27dec0['durationBars']=_0x3fb2b8-_0x42f2c6,_0x27dec0[_0x878147(0x24a)]=_0x2776a3,_0x27dec0['qualityScore']=this[_0x878147(0x226)](_0x27dec0,_0x4d71e2),_0x27dec0['isValid']=_0x27dec0['qualityScore']>=_0x327f4f['minQualityScore'];if(_0x27dec0[_0x878147(0x1d0)])return _0x27dec0;}}}}}if(_0x26d3de[_0x878147(0x220)]===ZoneType['SUPPORT']){const _0x15d249=(_0x26d3de[_0x878147(0x1df)]-_0x4991a0[_0x878147(0x251)])/this[_0x878147(0x20b)];if(_0x15d249>=_0x327f4f[_0x878147(0x202)]&&_0x15d249<=_0x327f4f[_0x878147(0x243)]){if(_0x4cabc4>_0x26d3de['priceLow']){const _0x5751ac=_0x4991a0['high']-_0x4991a0[_0x878147(0x251)],_0x9629d5=Math[_0x878147(0x23c)](_0x4991a0[_0x878147(0x22d)]-_0x4991a0['open']),_0x7765f3=_0x5751ac>0x0?_0x9629d5/_0x5751ac:0x0;if(_0x7765f3>=_0x327f4f['minBodyRatio']){const _0x31cc55=this[_0x878147(0x1da)](_0x5df310,_0x42f2c6,0x14);if(_0x31cc55>=_0x327f4f[_0x878147(0x217)]){const _0x2ad2e9=new SweepEvent(SweepType['LOW_SWEEP'],_0x26d3de,_0x42f2c6,_0x42f2c6,_0x4991a0['low']);_0x2ad2e9['exitBarIndex']=_0x3fb2b8,_0x2ad2e9[_0x878147(0x213)]=_0x15d249,_0x2ad2e9['durationBars']=_0x3fb2b8-_0x42f2c6,_0x2ad2e9['volumeRatio']=_0x31cc55,_0x2ad2e9['qualityScore']=this['_scoreSweep'](_0x2ad2e9,_0x7765f3),_0x2ad2e9['isValid']=_0x2ad2e9[_0x878147(0x1d4)]>=_0x327f4f[_0x878147(0x1f8)];if(_0x2ad2e9['isValid'])return _0x2ad2e9;}}}}}}}return null;}['_getVolumeRatio'](_0x91a6b5,_0x46d424,_0x2f5224){const _0x11031c=_0x42d110,_0x572087=Math['max'](0x0,_0x46d424-_0x2f5224),_0x2143ed=_0x91a6b5[_0x11031c(0x235)](_0x572087,_0x46d424);if(_0x2143ed['length']===0x0)return 0x1;const _0x4e95f0=_0x2143ed['map'](_0x17fc14=>_0x17fc14[_0x11031c(0x1e8)])['sort']((_0x18fb41,_0xbf54aa)=>_0x18fb41-_0xbf54aa),_0x40d2ac=Math[_0x11031c(0x1ea)](_0x4e95f0[_0x11031c(0x1f5)]/0x2),_0x221eda=_0x4e95f0[_0x40d2ac]||0x1;return _0x91a6b5[_0x46d424][_0x11031c(0x1e8)]/_0x221eda;}[_0x42d110(0x226)](_0x4aa676,_0x15183e){const _0x162738=_0x42d110;let _0x39dd8e=0x0;const _0x5cf36b=0x4,_0x3e4c42=Math['abs'](_0x4aa676['penetrationTicks']-_0x5cf36b);return _0x39dd8e+=Math['max'](0x0,0.3-_0x3e4c42*0.03),_0x39dd8e+=Math[_0x162738(0x1f6)](0x0,0.25-_0x4aa676[_0x162738(0x207)]*0.05),_0x39dd8e+=Math[_0x162738(0x253)](0.25,_0x4aa676[_0x162738(0x24a)]*0.1),_0x39dd8e+=Math[_0x162738(0x253)](0.2,_0x15183e*0.4),Math['min'](0x1,_0x39dd8e);}[_0x42d110(0x1ed)](_0x692715,_0x303d70,_0x36438c,_0x29df68){const _0x31813c=_0x42d110;if(Date['now']()-this['lastSignalTime']<this[_0x31813c(0x22b)][_0x31813c(0x1fd)][_0x31813c(0x219)])return null;const _0x506a13=this['config']['execution'],_0x48b6fd=_0x303d70['close'],_0x25e46c=_0x29df68['sweepType']===SweepType[_0x31813c(0x234)]?_0x31813c(0x20c):'long';let _0x5d0b27,_0x60f692,_0x3d77bb,_0xdc7dae;_0x25e46c==='long'?(_0x5d0b27=_0x48b6fd-_0x506a13[_0x31813c(0x1e2)]*this['tickSize'],_0x60f692=_0x48b6fd+_0x506a13['targetTicks']*this[_0x31813c(0x20b)],_0x3d77bb=_0x48b6fd+_0x506a13[_0x31813c(0x22e)]*this[_0x31813c(0x20b)],_0xdc7dae=_0x48b6fd+_0x506a13[_0x31813c(0x1eb)]*this[_0x31813c(0x20b)]):(_0x5d0b27=_0x48b6fd+_0x506a13['stopTicks']*this[_0x31813c(0x20b)],_0x60f692=_0x48b6fd-_0x506a13['targetTicks']*this['tickSize'],_0x3d77bb=_0x48b6fd-_0x506a13[_0x31813c(0x22e)]*this[_0x31813c(0x20b)],_0xdc7dae=_0x48b6fd-_0x506a13['trailTriggerTicks']*this['tickSize']);const _0xe6984c=_0x506a13[_0x31813c(0x20a)]/_0x506a13['stopTicks'],_0x445cca=Math['min'](0x1,_0x29df68[_0x31813c(0x1d4)]*0.5+_0x29df68[_0x31813c(0x223)]['qualityScore']*0.3+(_0x29df68['volumeRatio']>1.5?0.2:_0x29df68['volumeRatio']*0.1));let _0x4899fd=SignalStrength[_0x31813c(0x209)];if(_0x445cca>=0.8)_0x4899fd=SignalStrength['VERY_STRONG'];else{if(_0x445cca>=0.65)_0x4899fd=SignalStrength['STRONG'];else{if(_0x445cca<0.5)_0x4899fd=SignalStrength['WEAK'];}}const _0x4530e4=0.5+(_0x445cca-0.5)*0.4,_0x22d984=_0x4530e4*Math[_0x31813c(0x23c)](_0x60f692-_0x48b6fd)-(0x1-_0x4530e4)*Math[_0x31813c(0x23c)](_0x48b6fd-_0x5d0b27);_0x29df68[_0x31813c(0x223)]['lastUsedBarIndex']=_0x36438c,_0x29df68[_0x31813c(0x223)][_0x31813c(0x23d)]=!![],_0x29df68['zone'][_0x31813c(0x1d3)]=new Date(_0x303d70['timestamp']),this['lastSignalTime']=Date['now'](),this[_0x31813c(0x1f2)][_0x31813c(0x260)]++;const _0x35878b={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x692715['split']('.')[0x0]||_0x692715,'contractId':_0x692715,'side':_0x25e46c==='long'?OrderSide[_0x31813c(0x1d5)]:OrderSide[_0x31813c(0x1fe)],'direction':_0x25e46c,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x4899fd,'edge':_0x22d984,'confidence':_0x445cca,'entry':_0x48b6fd,'entryPrice':_0x48b6fd,'stopLoss':_0x5d0b27,'takeProfit':_0x60f692,'riskReward':_0xe6984c,'stopTicks':_0x506a13['stopTicks'],'targetTicks':_0x506a13[_0x31813c(0x20a)],'breakevenTicks':_0x506a13['breakevenTicks'],'trailTriggerTicks':_0x506a13['trailTriggerTicks'],'trailDistanceTicks':_0x506a13[_0x31813c(0x236)],'beLevel':_0x3d77bb,'trailTrigger':_0xdc7dae,'sweepType':_0x29df68[_0x31813c(0x1ff)],'penetrationTicks':_0x29df68['penetrationTicks'],'sweepDurationBars':_0x29df68['durationBars'],'sweepQuality':_0x29df68['qualityScore'],'volumeRatio':_0x29df68[_0x31813c(0x24a)],'zoneType':_0x29df68[_0x31813c(0x223)][_0x31813c(0x220)],'zoneLevel':_0x29df68['zone'][_0x31813c(0x25a)](),'zoneTouches':_0x29df68[_0x31813c(0x223)]['touches'],'zoneQuality':_0x29df68[_0x31813c(0x223)][_0x31813c(0x1d4)],'expires':Date['now']()+0xea60};return this[_0x31813c(0x254)]('signal',{'side':_0x25e46c==='long'?_0x31813c(0x1f7):_0x31813c(0x238),'action':'open','reason':'2B\x20'+_0x29df68[_0x31813c(0x1ff)]+'\x20|\x20Pen:'+_0x29df68[_0x31813c(0x213)]['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x29df68['volumeRatio']['toFixed'](0x1)+_0x31813c(0x239)+(_0x29df68[_0x31813c(0x1d4)]*0x64)[_0x31813c(0x224)](0x0)+'%',..._0x35878b}),this[_0x31813c(0x254)]('log',{'type':'info','message':_0x31813c(0x1d9)+_0x25e46c['toUpperCase']()+_0x31813c(0x25f)+_0x48b6fd['toFixed'](0x2)+'\x20|\x20'+_0x29df68[_0x31813c(0x1ff)]+'\x20|\x20Pen:'+_0x29df68['penetrationTicks'][_0x31813c(0x224)](0x1)+_0x31813c(0x24f)+_0x29df68[_0x31813c(0x24a)]['toFixed'](0x1)+'x\x20|\x20Conf:'+(_0x445cca*0x64)['toFixed'](0x0)+'%'}),_0x35878b;}[_0x42d110(0x1de)](_0x327145,_0x4731da){const _0x5831ae=_0x42d110,_0xb10131=this[_0x5831ae(0x214)][_0x5831ae(0x231)](_0x327145)||[],_0x30bde5=this[_0x5831ae(0x21b)]['get'](_0x327145)||[],_0x5eaca4=this[_0x5831ae(0x1ee)]['get'](_0x327145)||[];if(_0xb10131['length']<0x5)return{'ready':![],'message':'Collecting\x20data...\x20'+_0xb10131['length']+'/5\x20bars'};const _0x31e8da=_0x30bde5['map'](_0x24c4e9=>({'zone':_0x24c4e9,'distance':Math[_0x5831ae(0x23c)](_0x4731da-_0x24c4e9['getLevel']())}))['sort']((_0x1bf6df,_0x31b271)=>_0x1bf6df[_0x5831ae(0x21d)]-_0x31b271['distance']),_0x24e42b=_0x31e8da['find'](_0xfe43f1=>_0xfe43f1['zone'][_0x5831ae(0x220)]===ZoneType[_0x5831ae(0x201)]),_0x504b1c=_0x31e8da[_0x5831ae(0x242)](_0x283616=>_0x283616['zone']['type']===ZoneType[_0x5831ae(0x200)]);return{'ready':!![],'barsProcessed':_0xb10131[_0x5831ae(0x1f5)],'swingsDetected':_0x5eaca4['length'],'activeZones':_0x30bde5['length'],'nearestResistance':_0x24e42b?_0x24e42b[_0x5831ae(0x223)][_0x5831ae(0x25a)]():null,'nearestSupport':_0x504b1c?_0x504b1c['zone']['getLevel']():null,'stopTicks':this['config'][_0x5831ae(0x1fd)][_0x5831ae(0x1e2)],'targetTicks':this['config'][_0x5831ae(0x1fd)]['targetTicks'],'strategy':_0x5831ae(0x1d8)};}[_0x42d110(0x25d)](_0x8c320d){const _0x17b14f=_0x42d110;this['recentTrades']['push']({'netPnl':_0x8c320d,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this['recentTrades'][_0x17b14f(0x20d)]();_0x8c320d>0x0?this['stats']['wins']++:this[_0x17b14f(0x1f2)]['losses']++,this[_0x17b14f(0x1f2)][_0x17b14f(0x203)]++,this['stats']['pnl']+=_0x8c320d,this['emit']('log',{'type':_0x17b14f(0x255),'message':'[HQX-2B]\x20Trade\x20result:\x20'+(_0x8c320d>0x0?'WIN':'LOSS')+'\x20$'+_0x8c320d[_0x17b14f(0x224)](0x2)});}[_0x42d110(0x24b)](_0x3a3594){const _0x346f77=_0x42d110;return this[_0x346f77(0x214)][_0x346f77(0x231)](_0x3a3594)||[];}[_0x42d110(0x22f)](){return this['stats'];}['getHealthStatus'](_0x40a972){const _0x459b60=_0x42d110,_0x296fae=this[_0x459b60(0x214)][_0x459b60(0x231)](_0x40a972)||[],_0x4c3e16=this[_0x459b60(0x21b)]['get'](_0x40a972)||[],_0x1e1e6=this[_0x459b60(0x1ee)]['get'](_0x40a972)||[],_0x49cd28=this[_0x459b60(0x228)]['get'](_0x40a972),_0x5a4cd6=_0x296fae[_0x296fae['length']-0x1],_0x430a85=_0x5a4cd6?Date[_0x459b60(0x21f)]()-_0x5a4cd6[_0x459b60(0x1e3)]:null,_0x53ecf6=_0x4c3e16['filter'](_0x3bad53=>_0x3bad53['type']===ZoneType[_0x459b60(0x201)])['length'],_0x3da4f9=_0x4c3e16[_0x459b60(0x1f9)](_0x249fa7=>_0x249fa7['type']===ZoneType['SUPPORT'])['length'];return{'healthy':_0x296fae['length']>=0x5,'barsTotal':_0x296fae['length'],'barsLast5Min':_0x296fae[_0x459b60(0x1f9)](_0x3bf46c=>Date[_0x459b60(0x21f)]()-_0x3bf46c['timestamp']<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x1e1e6['length'],'zonesResistance':_0x53ecf6,'zonesSupport':_0x3da4f9,'zonesTotal':_0x4c3e16['length'],'currentBarTicks':_0x49cd28?_0x49cd28['tickCount']:0x0,'isAggregating':_0x49cd28&&_0x49cd28['tickCount']>0x0,'timeSinceLastBarMs':_0x430a85,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this[_0x459b60(0x22b)]['execution']['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date['now']())};}['reset'](_0x1268a2){const _0x747c54=_0x42d110;this[_0x747c54(0x214)]['set'](_0x1268a2,[]),this[_0x747c54(0x1ee)]['set'](_0x1268a2,[]),this['liquidityZones']['set'](_0x1268a2,[]),this['activeSweeps'][_0x747c54(0x211)](_0x1268a2,[]),this['currentBar'][_0x747c54(0x244)](_0x1268a2),this[_0x747c54(0x254)](_0x747c54(0x248),{'type':'info','message':_0x747c54(0x216)+_0x1268a2});}[_0x42d110(0x205)](_0x124293,_0x4300bd){const _0x3dbf5f=_0x42d110;if(!_0x4300bd||_0x4300bd['length']===0x0){this[_0x3dbf5f(0x254)](_0x3dbf5f(0x248),{'type':'debug','message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory'][_0x3dbf5f(0x1f1)](_0x124293)&&this[_0x3dbf5f(0x259)](_0x124293);const _0x34afda=[..._0x4300bd][_0x3dbf5f(0x24c)]((_0xda6fb7,_0x111e8c)=>_0xda6fb7[_0x3dbf5f(0x1e3)]-_0x111e8c['timestamp']);this[_0x3dbf5f(0x254)]('log',{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x34afda[_0x3dbf5f(0x1f5)]+_0x3dbf5f(0x210)});let _0x3cc4b9=0x0;for(const _0x2a24d0 of _0x34afda){const _0x4e066d=this[_0x3dbf5f(0x1d2)](_0x124293,_0x2a24d0);if(_0x4e066d)_0x3cc4b9++;}const _0x126fb5=this[_0x3dbf5f(0x214)][_0x3dbf5f(0x231)](_0x124293)||[],_0x3d9a13=this[_0x3dbf5f(0x1ee)][_0x3dbf5f(0x231)](_0x124293)||[],_0x167bc6=this[_0x3dbf5f(0x21b)][_0x3dbf5f(0x231)](_0x124293)||[];this[_0x3dbf5f(0x254)](_0x3dbf5f(0x248),{'type':'info','message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x126fb5[_0x3dbf5f(0x1f5)]+'\x20bars,\x20'+_0x3d9a13[_0x3dbf5f(0x1f5)]+_0x3dbf5f(0x1d6)+_0x167bc6['length']+_0x3dbf5f(0x24d)}),_0x3cc4b9>0x0&&this[_0x3dbf5f(0x254)](_0x3dbf5f(0x248),{'type':_0x3dbf5f(0x255),'message':_0x3dbf5f(0x1f3)+_0x3cc4b9+'\x20historical\x20signals\x20detected\x20(ignored)'}),this[_0x3dbf5f(0x1e7)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x346b57={}){const _0x2051b0=_0x42d110;super(),this[_0x2051b0(0x22b)]=_0x346b57,this[_0x2051b0(0x232)]=new HQX2BLiquiditySweep(_0x346b57),this['strategy']['on']('signal',_0x300e6e=>this['emit']('signal',_0x300e6e)),this[_0x2051b0(0x232)]['on'](_0x2051b0(0x248),_0x9cdab9=>this['emit'](_0x2051b0(0x248),_0x9cdab9));}[_0x42d110(0x250)](_0x20c752){return this['strategy']['processTick'](_0x20c752);}[_0x42d110(0x1e4)](_0x116fc5){return this['strategy']['onTick'](_0x116fc5);}['onTrade'](_0x47dbf6){const _0x2888f7=_0x42d110;return this[_0x2888f7(0x232)][_0x2888f7(0x1e1)](_0x47dbf6);}['processBar'](_0x317eab,_0x604ec7){return this['strategy']['processBar'](_0x317eab,_0x604ec7);}[_0x42d110(0x259)](_0xe0a442,_0x4a38c5,_0x3abb15){return this['strategy']['initialize'](_0xe0a442,_0x4a38c5,_0x3abb15);}['getAnalysisState'](_0x2d9353,_0x286950){const _0x731018=_0x42d110;return this[_0x731018(0x232)][_0x731018(0x1de)](_0x2d9353,_0x286950);}[_0x42d110(0x25d)](_0x4c04be){const _0xe52c3f=_0x42d110;return this['strategy'][_0xe52c3f(0x25d)](_0x4c04be);}['reset'](_0x36ef08){const _0x187f7e=_0x42d110;return this[_0x187f7e(0x232)][_0x187f7e(0x222)](_0x36ef08);}[_0x42d110(0x22f)](){const _0x41e25a=_0x42d110;return this['strategy'][_0x41e25a(0x22f)]();}[_0x42d110(0x24b)](_0x584ae){const _0x5b4b4f=_0x42d110;return this[_0x5b4b4f(0x232)]['getBarHistory'](_0x584ae);}[_0x42d110(0x205)](_0x1f88a7,_0x19d1b2){const _0x2956a8=_0x42d110;return this['strategy'][_0x2956a8(0x205)](_0x1f88a7,_0x19d1b2);}[_0x42d110(0x22a)](_0x4f5c6a){const _0xd52c29=_0x42d110;return this['strategy'][_0xd52c29(0x22a)](_0x4f5c6a);}[_0x42d110(0x240)](_0x2d9552){return null;}}function _0x1d4b(){const _0x2c55d4=['[HQX-2B]\x20','America/New_York','length','max','buy','minQualityScore','filter',',\x20value=','2737ZFlBTB','strength','execution','ASK','sweepType','SUPPORT','RESISTANCE','minPenetrationTicks','trades','startTime','preloadBars','clusterToleranceTicks','durationBars','extremeBarIndex','MODERATE','targetTicks','tickSize','short','shift','session',':\x20tick=','\x20historical\x20bars...','set','tickValue','penetrationTicks','barHistory','_detectSwings','[HQX-2B]\x20Reset\x20state\x20for\x20','minVolumeRatio','object','cooldownMs','1777194TEhowt','liquidityZones','splice','distance','lastUsedBarIndex','now','type','19736JJjqGN','reset','zone','toFixed','_updateZones','_scoreSweep','19095890MzkmJM','currentBar','maxDurationBars','getHealthStatus','config','1245382WiHmjj','close','breakevenTicks','getStats','touches','get','strategy','resistance','HIGH_SWEEP','slice','trailDistanceTicks','activeSweeps','sell','x\x20|\x20Q:','1jDFrqs','events','abs','swept','minBodyRatio','swing','generateSignal','isArray','find','maxPenetrationTicks','delete','10021392hImrbv','minStrength','barIntervalMs','log','high','volumeRatio','getBarHistory','sort','\x20zones','uuid','t\x20Vol:','processTick','low','55vTPwkt','min','emit','debug','253384ZrnUDP','3415896CKXZdB','getTimezoneOffset','initialize','getLevel','priceHigh','price','recordTradeResult','containsPrice','\x20@\x20','signals','\x20|\x20Total:\x20','getFullYear','isValid','[2B]\x20SWEEP\x20','processBar','sweptAt','qualityScore','BID','\x20swings,\x20','push','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','[HQX-2B]\x20SIGNAL:\x20','_getVolumeRatio','enabled','t,\x20Trail=','info','getAnalysisState','priceLow','lookbackBars','onTrade','stopTicks','timestamp','onTick','exitBarIndex',',\x20TF=1min','lastSignalTime','volume','_mergeConfig','floor','trailTriggerTicks','maxZoneAgeBars','_generateSignal','swingPoints','barIndex','support','has','stats'];_0x1d4b=function(){return _0x2c55d4;};return _0x1d4b();}module['exports']={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
|
|
1
|
+
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 _0x25ec0c=_0x681d;function _0x1ce9(){const _0x591cb0=['WEAK','53200VgJmOL','reduce','6VRNGeR','trades','_calculateATR','vpinWindow','barHistory','max','_computeZScore','_generateSignal','estimate','onTrade','1713NlwPVu','toUpperCase','2874529FubOBY',':\x20tick=','zscoreEntryThreshold','/50\x20bars','strategy','getBarHistory','sqrt','atrHistory','kyleLambda','buy','breakevenTicks','generateSignal','[HQX]\x20Trade\x20result:\x20','zscoreExitThreshold','kalman','42518oTQpBD','get','short','open','emit','\x20@\x20','_computeOrderFlowImbalance','tickSize','stats','lastSignalTime','getStats','toFixed','winStreak','signal','zscoreThreshold','%,\x20OFI=','volumeBuffer','715772vlgJvY','confidenceBonus','abs','high','16LvQzXm','symbol','vpinToxicThreshold','ASK','weights','close','LOSS','recentTrades','12026840ZgJdoz','uuid','STRONG','\x20Regime:','_detectVolatilityRegime','volume','tickValue','onTick','processBar','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','processTick','[HQX-UltraScalping]\x20Initialized\x20for\x20','stopMultiplier','round','_computeVPIN','424UThnFM','\x20|\x20Conf:','long','reset','1960569dOqUUn','priceBuffer','vpin','profitLockPct','ofiLookback','_computeKyleLambda','min','kalmanMeasurementNoise','info','signals','set','shouldExitByZScore','recordTradeResult','push','filter','getAnalysisState','slice','baseStopTicks','baseTargetTicks','low','lossStreak','log','shift','length'];_0x1ce9=function(){return _0x591cb0;};return _0x1ce9();}(function(_0x3ecadb,_0x5aa991){const _0x145507=_0x681d,_0x4ab801=_0x3ecadb();while(!![]){try{const _0x1a76a7=-parseInt(_0x145507(0x14e))/0x1+parseInt(_0x145507(0x17a))/0x2*(parseInt(_0x145507(0x13d))/0x3)+-parseInt(_0x145507(0x15f))/0x4+-parseInt(_0x145507(0x131))/0x5+-parseInt(_0x145507(0x133))/0x6*(parseInt(_0x145507(0x13f))/0x7)+-parseInt(_0x145507(0x163))/0x8*(parseInt(_0x145507(0x118))/0x9)+parseInt(_0x145507(0x16b))/0xa;if(_0x1a76a7===_0x5aa991)break;else _0x4ab801['push'](_0x4ab801['shift']());}catch(_0x4f1393){_0x4ab801['push'](_0x4ab801['shift']());}}}(_0x1ce9,0x3be3a));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x25ec0c(0x16c)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0x681d(_0x13eb78,_0xc9ff03){_0x13eb78=_0x13eb78-0x118;const _0x1ce911=_0x1ce9();let _0x681d0c=_0x1ce911[_0x13eb78];return _0x681d0c;}class HQXUltraScalping extends EventEmitter{constructor(_0x24eb07={}){const _0x569675=_0x25ec0c;super(),this[_0x569675(0x155)]=_0x24eb07[_0x569675(0x155)]||0.25,this[_0x569675(0x171)]=_0x24eb07['tickValue']||0x5,this[_0x569675(0x141)]=1.5,this['zscoreExitThreshold']=0.5,this[_0x569675(0x136)]=0x32,this['vpinToxicThreshold']=0.7,this['kalmanProcessNoise']=0.01,this['kalmanMeasurementNoise']=0.1,this['volatilityLookback']=0x64,this['ofiLookback']=0x14,this['baseStopTicks']=0x8,this[_0x569675(0x12a)]=0x10,this['breakevenTicks']=0x4,this[_0x569675(0x11b)]=0.5,this['minConfidence']=0.55,this[_0x569675(0x167)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x569675(0x137)]=new Map(),this['priceBuffer']=new Map(),this[_0x569675(0x15e)]=new Map(),this['kalmanStates']=new Map(),this[_0x569675(0x146)]=new Map(),this[_0x569675(0x16a)]=[],this[_0x569675(0x15a)]=0x0,this[_0x569675(0x12c)]=0x0,this['lastSignalTime']=0x0,this['cooldownMs']=0x7530,this['minHoldTimeMs']=0x2710,this[_0x569675(0x156)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0xd388e8,_0x16d8cf=0.25,_0x138a3a=0x5){const _0x52a9ba=_0x25ec0c;this[_0x52a9ba(0x155)]=_0x16d8cf,this['tickValue']=_0x138a3a,this['barHistory']['set'](_0xd388e8,[]),this[_0x52a9ba(0x119)]['set'](_0xd388e8,[]),this['volumeBuffer'][_0x52a9ba(0x122)](_0xd388e8,[]),this[_0x52a9ba(0x146)][_0x52a9ba(0x122)](_0xd388e8,[]),this['kalmanStates']['set'](_0xd388e8,{'estimate':0x0,'errorCovariance':0x1}),this[_0x52a9ba(0x152)](_0x52a9ba(0x12d),{'type':_0x52a9ba(0x120),'message':_0x52a9ba(0x176)+_0xd388e8+_0x52a9ba(0x140)+_0x16d8cf+',\x20value='+_0x138a3a}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}[_0x25ec0c(0x175)](_0x564aca){const {contractId:_0x45b123,price:_0x167042,volume:_0x8c0e5d,side:_0xffe477,timestamp:_0x28a9d8}=_0x564aca,_0x5c0322={'timestamp':_0x28a9d8||Date['now'](),'open':_0x167042,'high':_0x167042,'low':_0x167042,'close':_0x167042,'volume':_0x8c0e5d||0x1};return this['processBar'](_0x45b123,_0x5c0322);}['onTick'](_0xc80be9){const _0xf652d9=_0x25ec0c;return this[_0xf652d9(0x175)](_0xc80be9);}[_0x25ec0c(0x13c)](_0x4fbdeb){const _0x250d38=_0x25ec0c;return this['processTick']({'contractId':_0x4fbdeb['contractId']||_0x4fbdeb[_0x250d38(0x164)],'price':_0x4fbdeb['price'],'volume':_0x4fbdeb['size']||_0x4fbdeb['volume']||0x1,'side':_0x4fbdeb['side'],'timestamp':_0x4fbdeb['timestamp']||Date['now']()});}['processBar'](_0x1442cf,_0x231c33){const _0x4a41d8=_0x25ec0c;let _0x532f3f=this['barHistory']['get'](_0x1442cf);!_0x532f3f&&(this['initialize'](_0x1442cf),_0x532f3f=this[_0x4a41d8(0x137)]['get'](_0x1442cf));_0x532f3f['push'](_0x231c33);if(_0x532f3f[_0x4a41d8(0x12f)]>0x1f4)_0x532f3f['shift']();const _0x54c1a3=this[_0x4a41d8(0x119)][_0x4a41d8(0x14f)](_0x1442cf);_0x54c1a3['push'](_0x231c33['close']);if(_0x54c1a3['length']>0xc8)_0x54c1a3[_0x4a41d8(0x12e)]();const _0x3e12c6=this[_0x4a41d8(0x15e)][_0x4a41d8(0x14f)](_0x1442cf),_0x20f9d8=_0x231c33[_0x4a41d8(0x162)]-_0x231c33[_0x4a41d8(0x12b)];let _0x4cce04=_0x231c33['volume']*0.5,_0xa5bffa=_0x231c33['volume']*0.5;if(_0x20f9d8>0x0){const _0x3c114e=(_0x231c33['close']-_0x231c33[_0x4a41d8(0x12b)])/_0x20f9d8;_0x4cce04=_0x231c33['volume']*_0x3c114e,_0xa5bffa=_0x231c33['volume']*(0x1-_0x3c114e);}_0x3e12c6[_0x4a41d8(0x125)]({'buy':_0x4cce04,'sell':_0xa5bffa});if(_0x3e12c6['length']>0x64)_0x3e12c6['shift']();if(_0x532f3f[_0x4a41d8(0x12f)]<0x32)return null;const _0x4a5788=this['_computeZScore'](_0x54c1a3),_0x4337d1=this['_computeVPIN'](_0x3e12c6),_0x5120e2=this[_0x4a41d8(0x11d)](_0x532f3f),_0x5cd1fc=this['_applyKalmanFilter'](_0x1442cf,_0x231c33['close']),{regime:_0x1e8732,params:_0x36dd63}=this[_0x4a41d8(0x16f)](_0x1442cf,_0x532f3f),_0x455254=this[_0x4a41d8(0x154)](_0x532f3f);return this[_0x4a41d8(0x13a)](_0x1442cf,_0x231c33[_0x4a41d8(0x168)],_0x4a5788,_0x4337d1,_0x5120e2,_0x5cd1fc,_0x1e8732,_0x36dd63,_0x455254,_0x532f3f);}['_computeZScore'](_0x56cc77,_0x44e30c=0x32){const _0x203b4e=_0x25ec0c;if(_0x56cc77['length']<_0x44e30c)return 0x0;const _0x1d8e30=_0x56cc77['slice'](-_0x44e30c),_0x36705a=_0x1d8e30[_0x203b4e(0x132)]((_0x333ff7,_0x3cf675)=>_0x333ff7+_0x3cf675,0x0)/_0x44e30c,_0x2de8f6=_0x1d8e30[_0x203b4e(0x132)]((_0x1f8c86,_0x27057b)=>_0x1f8c86+Math['pow'](_0x27057b-_0x36705a,0x2),0x0)/_0x44e30c,_0x2a63f3=Math[_0x203b4e(0x145)](_0x2de8f6);if(_0x2a63f3<0.0001)return 0x0;const _0x2a0b8c=_0x56cc77[_0x56cc77[_0x203b4e(0x12f)]-0x1];return(_0x2a0b8c-_0x36705a)/_0x2a63f3;}['_computeVPIN'](_0x2f67d7){const _0x1ee21a=_0x25ec0c;if(_0x2f67d7['length']<this[_0x1ee21a(0x136)])return 0.5;const _0x3920b3=_0x2f67d7['slice'](-this[_0x1ee21a(0x136)]);let _0x5e1231=0x0,_0x3057c5=0x0;for(const _0x1f11ed of _0x3920b3){_0x5e1231+=_0x1f11ed[_0x1ee21a(0x148)],_0x3057c5+=_0x1f11ed['sell'];}const _0x488ca2=_0x5e1231+_0x3057c5;if(_0x488ca2<0x1)return 0.5;return Math['abs'](_0x5e1231-_0x3057c5)/_0x488ca2;}['_computeKyleLambda'](_0x3e58e0){const _0x3c008a=_0x25ec0c;if(_0x3e58e0['length']<0x14)return 0x0;const _0x377e14=_0x3e58e0['slice'](-0x14),_0x383b9d=[],_0x41ee55=[];for(let _0x4417f7=0x1;_0x4417f7<_0x377e14['length'];_0x4417f7++){_0x383b9d['push'](_0x377e14[_0x4417f7][_0x3c008a(0x168)]-_0x377e14[_0x4417f7-0x1][_0x3c008a(0x168)]),_0x41ee55['push'](_0x377e14[_0x4417f7][_0x3c008a(0x170)]);}const _0x304307=_0x383b9d[_0x3c008a(0x132)]((_0x4a85d8,_0x4472f5)=>_0x4a85d8+_0x4472f5,0x0)/_0x383b9d['length'],_0x1b3832=_0x41ee55['reduce']((_0x5908ed,_0x3d50b3)=>_0x5908ed+_0x3d50b3,0x0)/_0x41ee55['length'];let _0x334ee2=0x0,_0x386c5e=0x0;for(let _0x41f00e=0x0;_0x41f00e<_0x383b9d[_0x3c008a(0x12f)];_0x41f00e++){_0x334ee2+=(_0x383b9d[_0x41f00e]-_0x304307)*(_0x41ee55[_0x41f00e]-_0x1b3832),_0x386c5e+=Math['pow'](_0x41ee55[_0x41f00e]-_0x1b3832,0x2);}_0x334ee2/=_0x383b9d['length'],_0x386c5e/=_0x383b9d['length'];if(_0x386c5e<0.0001)return 0x0;return Math['abs'](_0x334ee2/_0x386c5e);}['_applyKalmanFilter'](_0x2ba437,_0x55dc91){const _0x5e51c2=_0x25ec0c;let _0x5d6e15=this['kalmanStates']['get'](_0x2ba437);if(!_0x5d6e15)return _0x5d6e15={'estimate':_0x55dc91,'errorCovariance':0x1},this['kalmanStates']['set'](_0x2ba437,_0x5d6e15),_0x55dc91;const _0x326864=_0x5d6e15[_0x5e51c2(0x13b)],_0x63370d=_0x5d6e15['errorCovariance']+this['kalmanProcessNoise'],_0x2c0592=_0x63370d/(_0x63370d+this[_0x5e51c2(0x11f)]),_0x136516=_0x326864+_0x2c0592*(_0x55dc91-_0x326864),_0x288567=(0x1-_0x2c0592)*_0x63370d;return _0x5d6e15[_0x5e51c2(0x13b)]=_0x136516,_0x5d6e15['errorCovariance']=_0x288567,_0x136516;}[_0x25ec0c(0x16f)](_0x5e689e,_0x44afd7){const _0x3b5214=_0x25ec0c,_0x31ae07=this[_0x3b5214(0x135)](_0x44afd7),_0x144e0d=_0x31ae07/this['tickSize'];let _0x54ac70=this[_0x3b5214(0x146)][_0x3b5214(0x14f)](_0x5e689e);!_0x54ac70&&(_0x54ac70=[],this['atrHistory'][_0x3b5214(0x122)](_0x5e689e,_0x54ac70));_0x54ac70[_0x3b5214(0x125)](_0x31ae07);if(_0x54ac70['length']>0x1f4)_0x54ac70['shift']();let _0x60c15a=0.5;_0x54ac70['length']>=0x14&&(_0x60c15a=_0x54ac70[_0x3b5214(0x126)](_0x2c4acf=>_0x2c4acf<=_0x31ae07)['length']/_0x54ac70['length']);let _0x31775f,_0x136e93;if(_0x60c15a<0.25)_0x31775f='low',_0x136e93={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x60c15a<0.75?(_0x31775f='normal',_0x136e93={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x31775f='high',_0x136e93={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x31775f,'params':_0x136e93};}['_calculateATR'](_0x272d28,_0x26ea80=0xe){const _0x4764c5=_0x25ec0c;if(_0x272d28['length']<_0x26ea80+0x1)return 2.5;const _0x39e351=[];for(let _0x316356=_0x272d28['length']-_0x26ea80;_0x316356<_0x272d28['length'];_0x316356++){const _0x362b73=_0x272d28[_0x316356],_0x35bca5=_0x272d28[_0x316356-0x1]['close'],_0xc5c1d7=Math[_0x4764c5(0x138)](_0x362b73[_0x4764c5(0x162)]-_0x362b73[_0x4764c5(0x12b)],Math[_0x4764c5(0x161)](_0x362b73['high']-_0x35bca5),Math[_0x4764c5(0x161)](_0x362b73[_0x4764c5(0x12b)]-_0x35bca5));_0x39e351['push'](_0xc5c1d7);}return _0x39e351['reduce']((_0x547998,_0x26b7ed)=>_0x547998+_0x26b7ed,0x0)/_0x39e351[_0x4764c5(0x12f)];}['_computeOrderFlowImbalance'](_0x1cfd11){const _0x295658=_0x25ec0c;if(_0x1cfd11['length']<this[_0x295658(0x11c)])return 0x0;const _0x11857e=_0x1cfd11[_0x295658(0x128)](-this['ofiLookback']);let _0x428bb7=0x0,_0x288b9f=0x0;for(const _0x52f5ff of _0x11857e){const _0x3b8d71=_0x52f5ff[_0x295658(0x162)]-_0x52f5ff['low'];if(_0x3b8d71>0x0){const _0x37146f=(_0x52f5ff['close']-_0x52f5ff[_0x295658(0x12b)])/_0x3b8d71;_0x428bb7+=_0x37146f*_0x52f5ff[_0x295658(0x170)],_0x288b9f+=(0x1-_0x37146f)*_0x52f5ff[_0x295658(0x170)];}}const _0x577fff=_0x428bb7+_0x288b9f;if(_0x577fff<0x1)return 0x0;return(_0x428bb7-_0x288b9f)/_0x577fff;}[_0x25ec0c(0x13a)](_0x2a541f,_0x37bac3,_0x5362f8,_0x2fe4b8,_0x9084c0,_0x4a7a22,_0x5afb6d,_0x5c393b,_0x3ff8a2,_0x1987c4){const _0x210f1b=_0x25ec0c,_0xc36d49=Math[_0x210f1b(0x161)](_0x5362f8);if(_0xc36d49<_0x5c393b[_0x210f1b(0x15c)])return null;if(_0x2fe4b8>this[_0x210f1b(0x165)])return null;let _0x2cbd66;if(_0x5362f8<-_0x5c393b['zscoreThreshold'])_0x2cbd66=_0x210f1b(0x17c);else{if(_0x5362f8>_0x5c393b[_0x210f1b(0x15c)])_0x2cbd66=_0x210f1b(0x150);else return null;}const _0x2842c2=_0x2cbd66===_0x210f1b(0x17c)&&_0x3ff8a2>0.1||_0x2cbd66==='short'&&_0x3ff8a2<-0.1,_0x156f33=_0x37bac3-_0x4a7a22,_0x27a9ff=_0x2cbd66===_0x210f1b(0x17c)&&_0x156f33<0x0||_0x2cbd66===_0x210f1b(0x150)&&_0x156f33>0x0,_0xa70813={'zscore':Math[_0x210f1b(0x11e)](0x1,_0xc36d49/0x4),'vpin':0x1-_0x2fe4b8,'kyleLambda':_0x9084c0>0.001?0.5:0.8,'kalman':_0x27a9ff?0.8:0.4,'volatility':_0x5afb6d==='normal'?0.8:_0x5afb6d==='low'?0.7:0.6,'ofi':_0x2842c2?0.9:0.5,'composite':0x0};_0xa70813['composite']=_0xa70813['zscore']*this[_0x210f1b(0x167)]['zscore']+_0xa70813[_0x210f1b(0x11a)]*this['weights'][_0x210f1b(0x11a)]+_0xa70813[_0x210f1b(0x147)]*this[_0x210f1b(0x167)][_0x210f1b(0x147)]+_0xa70813['kalman']*this['weights'][_0x210f1b(0x14d)]+_0xa70813['volatility']*this[_0x210f1b(0x167)]['volatility']+_0xa70813['ofi']*this[_0x210f1b(0x167)]['ofi'];const _0xa1ae70=Math[_0x210f1b(0x11e)](0x1,_0xa70813['composite']+_0x5c393b[_0x210f1b(0x160)]);if(_0xa1ae70<this['minConfidence'])return null;if(Date['now']()-this[_0x210f1b(0x157)]<this['cooldownMs'])return null;const _0x1448bb=Math['round'](this[_0x210f1b(0x129)]*_0x5c393b['stopMultiplier']),_0x26ea75=Math[_0x210f1b(0x178)](this[_0x210f1b(0x12a)]*_0x5c393b['targetMultiplier']),_0x2c6a68=Math[_0x210f1b(0x138)](0x6,Math[_0x210f1b(0x11e)](0xc,_0x1448bb)),_0x2c9a8b=Math[_0x210f1b(0x138)](_0x2c6a68*1.5,Math[_0x210f1b(0x11e)](0x18,_0x26ea75));let _0x2e0b76,_0x32eca3,_0xb55e8f,_0x5b9b34;_0x2cbd66===_0x210f1b(0x17c)?(_0x2e0b76=_0x37bac3-_0x2c6a68*this[_0x210f1b(0x155)],_0x32eca3=_0x37bac3+_0x2c9a8b*this['tickSize'],_0xb55e8f=_0x37bac3+this[_0x210f1b(0x149)]*this['tickSize'],_0x5b9b34=_0x37bac3+_0x2c9a8b*this['profitLockPct']*this['tickSize']):(_0x2e0b76=_0x37bac3+_0x2c6a68*this[_0x210f1b(0x155)],_0x32eca3=_0x37bac3-_0x2c9a8b*this[_0x210f1b(0x155)],_0xb55e8f=_0x37bac3-this[_0x210f1b(0x149)]*this[_0x210f1b(0x155)],_0x5b9b34=_0x37bac3-_0x2c9a8b*this[_0x210f1b(0x11b)]*this['tickSize']);const _0x44e223=_0x2c9a8b/_0x2c6a68,_0x43d1c8=Math[_0x210f1b(0x178)](_0x2c9a8b*0.5),_0x2167b0=Math[_0x210f1b(0x178)](_0x2c6a68*0.4);let _0xbf3c45=SignalStrength['MODERATE'];if(_0xa1ae70>=0.85)_0xbf3c45=SignalStrength['VERY_STRONG'];else{if(_0xa1ae70>=0.75)_0xbf3c45=SignalStrength[_0x210f1b(0x16d)];else{if(_0xa1ae70<0.6)_0xbf3c45=SignalStrength[_0x210f1b(0x130)];}}const _0x104791=0.5+(_0xa1ae70-0.5)*0.4,_0x45900b=_0x104791*Math[_0x210f1b(0x161)](_0x32eca3-_0x37bac3)-(0x1-_0x104791)*Math['abs'](_0x37bac3-_0x2e0b76);this['lastSignalTime']=Date['now'](),this[_0x210f1b(0x156)][_0x210f1b(0x121)]++;const _0x1899ad={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x2a541f['split']('.')[0x0]||_0x2a541f,'contractId':_0x2a541f,'side':_0x2cbd66==='long'?OrderSide['BID']:OrderSide[_0x210f1b(0x166)],'direction':_0x2cbd66,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0xbf3c45,'edge':_0x45900b,'confidence':_0xa1ae70,'entry':_0x37bac3,'entryPrice':_0x37bac3,'stopLoss':_0x2e0b76,'takeProfit':_0x32eca3,'riskReward':_0x44e223,'stopTicks':_0x2c6a68,'targetTicks':_0x2c9a8b,'trailTriggerTicks':_0x43d1c8,'trailDistanceTicks':_0x2167b0,'beBreakeven':_0xb55e8f,'profitLockLevel':_0x5b9b34,'zScore':_0x5362f8,'zScoreExit':this[_0x210f1b(0x14c)],'vpinValue':_0x2fe4b8,'kyleLambda':_0x9084c0,'kalmanEstimate':_0x4a7a22,'volatilityRegime':_0x5afb6d,'ofiValue':_0x3ff8a2,'models':_0xa70813,'orderFlowConfirmed':_0x2842c2,'kalmanConfirmed':_0x27a9ff,'expires':Date['now']()+0xea60};return this[_0x210f1b(0x152)]('signal',{'side':_0x2cbd66==='long'?_0x210f1b(0x148):'sell','action':_0x210f1b(0x151),'reason':'Z='+_0x5362f8['toFixed'](0x2)+',\x20VPIN='+(_0x2fe4b8*0x64)['toFixed'](0x0)+_0x210f1b(0x15d)+(_0x3ff8a2*0x64)[_0x210f1b(0x159)](0x0)+'%,\x20cf='+(_0xa1ae70*0x64)[_0x210f1b(0x159)](0x0)+'%',..._0x1899ad}),this[_0x210f1b(0x152)](_0x210f1b(0x12d),{'type':_0x210f1b(0x120),'message':'[HQX]\x20SIGNAL:\x20'+_0x2cbd66[_0x210f1b(0x13e)]()+_0x210f1b(0x153)+_0x37bac3['toFixed'](0x2)+'\x20|\x20Z:'+_0x5362f8['toFixed'](0x2)+'\x20VPIN:'+(_0x2fe4b8*0x64)['toFixed'](0x0)+'%\x20OFI:'+(_0x3ff8a2*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x9084c0[_0x210f1b(0x159)](0x5)+_0x210f1b(0x16e)+_0x5afb6d+_0x210f1b(0x17b)+(_0xa1ae70*0x64)[_0x210f1b(0x159)](0x0)+'%'}),_0x1899ad;}['shouldExitByZScore'](_0x3cf5a0){const _0xaedc1f=_0x25ec0c,_0x6c2423=this[_0xaedc1f(0x119)][_0xaedc1f(0x14f)](_0x3cf5a0);if(!_0x6c2423||_0x6c2423['length']<0x32)return![];const _0x597b95=this[_0xaedc1f(0x139)](_0x6c2423);return Math[_0xaedc1f(0x161)](_0x597b95)<this[_0xaedc1f(0x14c)];}['getModelValues'](_0x34f955){const _0x1ac26c=_0x25ec0c,_0x4dbaa7=this[_0x1ac26c(0x119)]['get'](_0x34f955),_0x537d16=this[_0x1ac26c(0x15e)][_0x1ac26c(0x14f)](_0x34f955),_0x5dae22=this['barHistory'][_0x1ac26c(0x14f)](_0x34f955);if(!_0x4dbaa7||!_0x537d16||!_0x5dae22||_0x5dae22['length']<0x32)return null;const _0x5ad365=this['_computeZScore'](_0x4dbaa7),_0x480bb1=this['_computeVPIN'](_0x537d16),_0x398339=this[_0x1ac26c(0x11d)](_0x5dae22),_0x2a82cb=this['_computeOrderFlowImbalance'](_0x5dae22);return{'zscore':Math['min'](0x1,Math[_0x1ac26c(0x161)](_0x5ad365)/0x4),'vpin':0x1-_0x480bb1,'kyleLambda':_0x398339>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x2a82cb)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x5ad365,'vpin':_0x480bb1,'kyleLambda':_0x398339,'ofi':_0x2a82cb}};}[_0x25ec0c(0x127)](_0x868cfa,_0x45ed5c){const _0x3ed786=_0x25ec0c,_0x1135d8=this['barHistory'][_0x3ed786(0x14f)](_0x868cfa)||[];if(_0x1135d8['length']<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x1135d8['length']+_0x3ed786(0x142)};const _0x230ec9=this[_0x3ed786(0x119)]['get'](_0x868cfa)||[],_0x1d04ac=this[_0x3ed786(0x15e)]['get'](_0x868cfa)||[],_0x5d2f6c=this['_computeZScore'](_0x230ec9),_0x3d21c7=this[_0x3ed786(0x179)](_0x1d04ac),_0x552760=this[_0x3ed786(0x154)](_0x1135d8),_0xa93f48=this[_0x3ed786(0x11d)](_0x1135d8),{regime:_0x235004,params:_0x2dfb29}=this['_detectVolatilityRegime'](_0x868cfa,_0x1135d8);return{'ready':!![],'zScore':_0x5d2f6c,'vpin':_0x3d21c7,'ofi':_0x552760,'kyleLambda':_0xa93f48,'regime':_0x235004,'stopTicks':Math['round'](this[_0x3ed786(0x129)]*_0x2dfb29[_0x3ed786(0x177)]),'targetTicks':Math['round'](this['baseTargetTicks']*_0x2dfb29['targetMultiplier']),'threshold':_0x2dfb29['zscoreThreshold'],'barsProcessed':_0x1135d8[_0x3ed786(0x12f)],'models':_0x3ed786(0x174)};}['recordTradeResult'](_0x57c6fc){const _0x443d8e=_0x25ec0c;this[_0x443d8e(0x16a)][_0x443d8e(0x125)]({'netPnl':_0x57c6fc,'timestamp':Date['now']()});if(this[_0x443d8e(0x16a)]['length']>0x64)this['recentTrades'][_0x443d8e(0x12e)]();_0x57c6fc>0x0?(this[_0x443d8e(0x15a)]++,this[_0x443d8e(0x12c)]=0x0,this['stats']['wins']++):(this[_0x443d8e(0x12c)]++,this[_0x443d8e(0x15a)]=0x0,this[_0x443d8e(0x156)]['losses']++),this['stats'][_0x443d8e(0x134)]++,this['stats']['pnl']+=_0x57c6fc,this[_0x443d8e(0x152)]('log',{'type':'debug','message':_0x443d8e(0x14b)+(_0x57c6fc>0x0?'WIN':_0x443d8e(0x169))+'\x20$'+_0x57c6fc[_0x443d8e(0x159)](0x2)+',\x20streak:\x20'+(_0x57c6fc>0x0?this[_0x443d8e(0x15a)]:-this['lossStreak'])});}['getBarHistory'](_0x478bf3){const _0x5b5bf9=_0x25ec0c;return this[_0x5b5bf9(0x137)]['get'](_0x478bf3)||[];}[_0x25ec0c(0x158)](){return this['stats'];}['reset'](_0x15949e){const _0xd4e09f=_0x25ec0c;this['barHistory']['set'](_0x15949e,[]),this['priceBuffer']['set'](_0x15949e,[]),this[_0xd4e09f(0x15e)]['set'](_0x15949e,[]),this[_0xd4e09f(0x146)][_0xd4e09f(0x122)](_0x15949e,[]),this['kalmanStates']['set'](_0x15949e,{'estimate':0x0,'errorCovariance':0x1}),this[_0xd4e09f(0x152)]('log',{'type':_0xd4e09f(0x120),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x15949e});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x63f1c8={}){const _0x1a9473=_0x25ec0c;super(),this['config']=_0x63f1c8,this[_0x1a9473(0x143)]=new HQXUltraScalping(_0x63f1c8),this[_0x1a9473(0x143)]['on'](_0x1a9473(0x15b),_0x177427=>this[_0x1a9473(0x152)](_0x1a9473(0x15b),_0x177427)),this['strategy']['on'](_0x1a9473(0x12d),_0x3ae7e8=>this[_0x1a9473(0x152)]('log',_0x3ae7e8));}['processTick'](_0x15795e){const _0x230916=_0x25ec0c;return this[_0x230916(0x143)]['processTick'](_0x15795e);}['onTick'](_0x139ec2){const _0x32a3c2=_0x25ec0c;return this['strategy'][_0x32a3c2(0x172)](_0x139ec2);}['onTrade'](_0x260570){const _0x4a9f34=_0x25ec0c;return this[_0x4a9f34(0x143)][_0x4a9f34(0x13c)](_0x260570);}['processBar'](_0x517c9b,_0x4e2b5a){const _0x269f3d=_0x25ec0c;return this['strategy'][_0x269f3d(0x173)](_0x517c9b,_0x4e2b5a);}['initialize'](_0x5a3e4b,_0x4b240b,_0x43a10b){const _0x37d3d8=_0x25ec0c;return this[_0x37d3d8(0x143)]['initialize'](_0x5a3e4b,_0x4b240b,_0x43a10b);}['getAnalysisState'](_0x39e7f9,_0x4a7311){const _0x44c7c9=_0x25ec0c;return this[_0x44c7c9(0x143)]['getAnalysisState'](_0x39e7f9,_0x4a7311);}['recordTradeResult'](_0x3a8e0f){const _0x31841a=_0x25ec0c;return this[_0x31841a(0x143)][_0x31841a(0x124)](_0x3a8e0f);}[_0x25ec0c(0x17d)](_0x22890e){const _0x2bc4c5=_0x25ec0c;return this[_0x2bc4c5(0x143)][_0x2bc4c5(0x17d)](_0x22890e);}['getStats'](){return this['strategy']['getStats']();}[_0x25ec0c(0x144)](_0x2b734b){const _0x4039f4=_0x25ec0c;return this['strategy'][_0x4039f4(0x144)](_0x2b734b);}['getModelValues'](_0x4c7224){return this['strategy']['getModelValues'](_0x4c7224);}[_0x25ec0c(0x123)](_0x285148){const _0x2e749c=_0x25ec0c;return this[_0x2e749c(0x143)]['shouldExitByZScore'](_0x285148);}[_0x25ec0c(0x14a)](_0x5b2bb5){return null;}}module['exports']={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
|
|
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};
|