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