hedgequantx 2.9.118 → 2.9.120

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- const _0x2226ad=_0x5493;(function(_0x3164cd,_0x18254c){const _0x118c05=_0x5493,_0x107604=_0x3164cd();while(!![]){try{const _0x20984d=-parseInt(_0x118c05(0x181))/0x1+parseInt(_0x118c05(0x17b))/0x2*(-parseInt(_0x118c05(0x15f))/0x3)+parseInt(_0x118c05(0x15c))/0x4+-parseInt(_0x118c05(0x196))/0x5*(parseInt(_0x118c05(0x176))/0x6)+parseInt(_0x118c05(0x163))/0x7+-parseInt(_0x118c05(0x14f))/0x8*(-parseInt(_0x118c05(0x10e))/0x9)+parseInt(_0x118c05(0x191))/0xa;if(_0x20984d===_0x18254c)break;else _0x107604['push'](_0x107604['shift']());}catch(_0x251b2e){_0x107604['push'](_0x107604['shift']());}}}(_0x2bcb,0xe1d4c));const EventEmitter=require(_0x2226ad(0x18d)),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':_0x2226ad(0x187)},ZoneType={'RESISTANCE':'resistance','SUPPORT':_0x2226ad(0xff)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x3,'minStrength':0x2,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x4,'minTouches':0x2,'maxZoneAgeBars':0xc8,'maxZoneDistanceTicks':0x28,'cooldownBars':0xa},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x8,'maxDurationBars':0x5,'minQualityScore':0.25,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x2710,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':!![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x2226ad(0x14e)}};class SwingPoint{constructor(_0x59e60c,_0x14f1d1,_0x572f37,_0x4f9712,_0x4a3ee6=0x1){const _0x4b09b9=_0x2226ad;this['type']=_0x59e60c,this[_0x4b09b9(0x16e)]=_0x14f1d1,this[_0x4b09b9(0x122)]=_0x572f37,this[_0x4b09b9(0x16b)]=_0x4f9712,this[_0x4b09b9(0x170)]=_0x4a3ee6;}}function _0x2bcb(){const _0x1b269f=['support','priceHigh','_mergeConfig','startTime','short','minVolumeRatio','abs','delete','x\x20|\x20Q:','getStats','stopTicks','swept','trades','minPenetrationTicks','floor','720SDhNCg','initialize','generateSignal','\x20swings,\x20','t,\x20Trail=','toFixed','min','object','t\x20|\x20Q:\x20','set','zone','sweepType','_updateZones','getAnalysisState','extremePrice','minQualityScore','minBodyRatio','breakevenTicks','onTick','STRONG','barIndex','symbol','getLevel','[HQX-2B]\x20Initialized\x20for\x20','ASK','tickCount','t\x20Vol:','lastSignalTime','RESISTANCE','penetrationTicks','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','swing','[2B]\x20SWEEP\x20','sort','2B\x20','\x20historical\x20signals\x20detected\x20(ignored)','stats','get','getTimezoneOffset','\x20|\x20','\x20|\x20Total:\x20','createdAt','[2B]\x20NEW\x20SWING\x20','size','_scoreSweep','execution','filter','t\x20|\x20Vol:','SUPPORT','[HQX-2B]\x20SIGNAL:\x20','emit','distance','activeSweeps','\x20|\x20Pen:','containsPrice',',\x20value=','map','high','signals','isValid','toUpperCase','x\x20|\x20Conf:','cooldownBars','tickSize','America/New_York','67288VIMerE','maxZoneAgeBars','[2B]\x20Calling\x20_generateSignal\x20for\x20','[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)','barHistory','has','exports','find','currentBar','long','strategy','config','lookbackBars','3646276MEfkjV','VERY_STRONG','/5\x20bars','3uEvZLE','getBarHistory','sweep','trailDistanceTicks','6764716YVLaMt','isArray','recordTradeResult','reset','\x20@\x20','info','targetTicks','volumeRatio','timestamp','now','recentTrades','price','liquidityZones','strength','\x20sweep...','close','maxPenetrationTicks','swingPoints','max','6DowIar','buy','isDST','maxDurationBars','LOW_SWEEP','860972HjFEBe','processBar','debug','shift','split','HIGH_SWEEP','818206Hyckgg','push','priceLow','_detectSwings','tickValue','getHealthStatus','low','qualityScore','_generateSignal','s\x20<\x20','type','exitBarIndex','events','\x20bars,\x20','[HQX-2B]\x20Trade\x20result:\x20','lastUsedBarIndex','14618930kBITOV','getUTCMinutes','minStrength','processTick','_getVolumeRatio','9195170ZSyzHn','log','length','MODERATE','onTrade','durationBars','touches','sweptAt'];_0x2bcb=function(){return _0x1b269f;};return _0x2bcb();}class LiquidityZone{constructor(_0x1e8846,_0x1a07ee,_0x2b6c4d,_0x13e46b,_0xcac9ce){const _0x2da023=_0x2226ad;this['id']=uuidv4(),this[_0x2da023(0x18b)]=_0x1e8846,this[_0x2da023(0x100)]=_0x1a07ee,this['priceLow']=_0x2b6c4d,this[_0x2da023(0x137)]=_0x13e46b,this[_0x2da023(0x122)]=_0xcac9ce,this[_0x2da023(0xfd)]=0x1,this['swept']=![],this[_0x2da023(0xfe)]=null,this['lastUsedBarIndex']=-0x3e7,this[_0x2da023(0x188)]=0.5;}['containsPrice'](_0x164bbe,_0xe31ab9,_0x4241e5){const _0x2107f6=_0x2226ad,_0x137c53=_0xe31ab9*_0x4241e5;return _0x164bbe>=this[_0x2107f6(0x183)]-_0x137c53&&_0x164bbe<=this[_0x2107f6(0x100)]+_0x137c53;}['getLevel'](){const _0x508fcf=_0x2226ad;return(this[_0x508fcf(0x100)]+this[_0x508fcf(0x183)])/0x2;}}class SweepEvent{constructor(_0x227a5a,_0x2b13cc,_0x5b9902,_0x526305,_0x232bdc){const _0x538ed1=_0x2226ad;this['sweepType']=_0x227a5a,this[_0x538ed1(0x118)]=_0x2b13cc,this['entryBarIndex']=_0x5b9902,this['extremeBarIndex']=_0x526305,this[_0x538ed1(0x11c)]=_0x232bdc,this['exitBarIndex']=null,this['isValid']=![],this['qualityScore']=0x0,this['penetrationTicks']=0x0,this[_0x538ed1(0xfc)]=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x4d1d40={}){const _0x2fdd2d=_0x2226ad;super(),this['config']=this[_0x2fdd2d(0x101)](DEFAULT_CONFIG,_0x4d1d40),this[_0x2fdd2d(0x14d)]=this['config']['tickSize'],this[_0x2fdd2d(0x185)]=this['config'][_0x2fdd2d(0x185)],this[_0x2fdd2d(0x153)]=new Map(),this['swingPoints']=new Map(),this['liquidityZones']=new Map(),this[_0x2fdd2d(0x142)]=new Map(),this['currentBar']=new Map(),this['barIntervalMs']=0xea60,this[_0x2fdd2d(0x129)]=0x0,this['startTime']=Date['now'](),this[_0x2fdd2d(0x132)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x2fdd2d(0x16d)]=[];}[_0x2226ad(0x101)](_0x3ee334,_0x2771a2){const _0xfc6a9d=_0x2226ad,_0x17a108={..._0x3ee334};for(const _0x126432 in _0x2771a2){typeof _0x2771a2[_0x126432]===_0xfc6a9d(0x115)&&!Array[_0xfc6a9d(0x164)](_0x2771a2[_0x126432])?_0x17a108[_0x126432]={..._0x3ee334[_0x126432],..._0x2771a2[_0x126432]}:_0x17a108[_0x126432]=_0x2771a2[_0x126432];}return _0x17a108;}['isWithinSession'](_0x4c7b4c){const _0xc7454a=_0x2226ad;if(!this['config']['session']['enabled'])return!![];const _0x48b7c0=new Date(_0x4c7b4c),_0x4630dd=this['isDST'](_0x48b7c0)?-0x4:-0x5,_0x2817c8=_0x48b7c0['getUTCHours'](),_0x52a89f=_0x48b7c0[_0xc7454a(0x192)](),_0x32da9c=(_0x2817c8+_0x4630dd+0x18)%0x18,{startHour:_0xa1a975,startMinute:_0x5cfaa5,endHour:_0x15fbf2,endMinute:_0x483615}=this[_0xc7454a(0x15a)]['session'],_0x1f73ad=_0x32da9c*0x3c+_0x52a89f,_0x546645=_0xa1a975*0x3c+_0x5cfaa5,_0x4fa06d=_0x15fbf2*0x3c+_0x483615;return _0x1f73ad>=_0x546645&&_0x1f73ad<_0x4fa06d;}[_0x2226ad(0x178)](_0x56bf15){const _0x1b882d=_0x2226ad,_0x29b21e=new Date(_0x56bf15['getFullYear'](),0x0,0x1),_0x5a7436=new Date(_0x56bf15['getFullYear'](),0x6,0x1),_0x3a68ee=Math[_0x1b882d(0x175)](_0x29b21e[_0x1b882d(0x134)](),_0x5a7436['getTimezoneOffset']());return _0x56bf15['getTimezoneOffset']()<_0x3a68ee;}['initialize'](_0x36523e,_0x2a6f4e=0.25,_0x3a5f8c=0x5){const _0x5e65bc=_0x2226ad;this[_0x5e65bc(0x14d)]=_0x2a6f4e,this[_0x5e65bc(0x185)]=_0x3a5f8c,this[_0x5e65bc(0x15a)][_0x5e65bc(0x14d)]=_0x2a6f4e,this[_0x5e65bc(0x15a)]['tickValue']=_0x3a5f8c,this['barHistory'][_0x5e65bc(0x117)](_0x36523e,[]),this['swingPoints'][_0x5e65bc(0x117)](_0x36523e,[]),this['liquidityZones'][_0x5e65bc(0x117)](_0x36523e,[]),this['activeSweeps'][_0x5e65bc(0x117)](_0x36523e,[]),this['currentBar'][_0x5e65bc(0x106)](_0x36523e),this['emit']('log',{'type':'info','message':_0x5e65bc(0x125)+_0x36523e+':\x20tick='+_0x2a6f4e+_0x5e65bc(0x145)+_0x3a5f8c+',\x20TF=1min'}),this['emit']('log',{'type':_0x5e65bc(0x168),'message':'[HQX-2B]\x20Params:\x20Stop='+this['config'][_0x5e65bc(0x13b)][_0x5e65bc(0x109)]+'t,\x20Target='+this[_0x5e65bc(0x15a)]['execution'][_0x5e65bc(0x169)]+'t,\x20BE='+this['config'][_0x5e65bc(0x13b)]['breakevenTicks']+_0x5e65bc(0x112)+this[_0x5e65bc(0x15a)][_0x5e65bc(0x13b)]['trailTriggerTicks']+'/'+this[_0x5e65bc(0x15a)]['execution']['trailDistanceTicks']});}['processTick'](_0x8ef9cf){const _0x2f53b8=_0x2226ad,{contractId:_0x39a3f6,price:_0x2a601e,volume:_0x1fb204,timestamp:_0x1c3298}=_0x8ef9cf,_0x48519a=_0x1c3298||Date['now'](),_0x37452d=_0x1fb204||0x1;if(!this['isWithinSession'](_0x48519a))return null;let _0x15df30=this[_0x2f53b8(0x157)][_0x2f53b8(0x133)](_0x39a3f6);const _0x1cc1f4=Math[_0x2f53b8(0x10d)](_0x48519a/this['barIntervalMs'])*this['barIntervalMs'];if(!_0x15df30||_0x15df30[_0x2f53b8(0x102)]!==_0x1cc1f4){if(_0x15df30){const _0x4aed75={'timestamp':_0x15df30['startTime'],'open':_0x15df30['open'],'high':_0x15df30[_0x2f53b8(0x147)],'low':_0x15df30[_0x2f53b8(0x187)],'close':_0x15df30[_0x2f53b8(0x172)],'volume':_0x15df30['volume']},_0x117a19=this[_0x2f53b8(0x17c)](_0x39a3f6,_0x4aed75);return this[_0x2f53b8(0x157)]['set'](_0x39a3f6,{'startTime':_0x1cc1f4,'open':_0x2a601e,'high':_0x2a601e,'low':_0x2a601e,'close':_0x2a601e,'volume':_0x37452d}),_0x117a19;}else return this[_0x2f53b8(0x157)][_0x2f53b8(0x117)](_0x39a3f6,{'startTime':_0x1cc1f4,'open':_0x2a601e,'high':_0x2a601e,'low':_0x2a601e,'close':_0x2a601e,'volume':_0x37452d}),null;}else return _0x15df30[_0x2f53b8(0x147)]=Math[_0x2f53b8(0x175)](_0x15df30[_0x2f53b8(0x147)],_0x2a601e),_0x15df30[_0x2f53b8(0x187)]=Math[_0x2f53b8(0x114)](_0x15df30[_0x2f53b8(0x187)],_0x2a601e),_0x15df30[_0x2f53b8(0x172)]=_0x2a601e,_0x15df30['volume']+=_0x37452d,null;}[_0x2226ad(0x120)](_0xae5a58){const _0x2386f8=_0x2226ad;return this[_0x2386f8(0x194)](_0xae5a58);}[_0x2226ad(0xfb)](_0x462cd5){const _0x2d6908=_0x2226ad;return this['processTick']({'contractId':_0x462cd5['contractId']||_0x462cd5[_0x2d6908(0x123)],'price':_0x462cd5['price'],'volume':_0x462cd5[_0x2d6908(0x139)]||_0x462cd5['volume']||0x1,'timestamp':_0x462cd5[_0x2d6908(0x16b)]||Date[_0x2d6908(0x16c)]()});}['processBar'](_0x43ecf5,_0x446316){const _0x37e259=_0x2226ad;let _0x49c5b7=this[_0x37e259(0x153)][_0x37e259(0x133)](_0x43ecf5);!_0x49c5b7&&(this[_0x37e259(0x10f)](_0x43ecf5),_0x49c5b7=this[_0x37e259(0x153)]['get'](_0x43ecf5));_0x49c5b7[_0x37e259(0x182)](_0x446316);if(_0x49c5b7['length']>0x1f4)_0x49c5b7['shift']();const _0x16390a=_0x49c5b7['length']-0x1;if(_0x49c5b7['length']<this['config'][_0x37e259(0x12d)][_0x37e259(0x15b)]*0x3)return null;const _0x5049b0=this[_0x37e259(0x174)]['get'](_0x43ecf5)['length'];this[_0x37e259(0x184)](_0x43ecf5,_0x49c5b7,_0x16390a);const _0x46ef47=this['swingPoints']['get'](_0x43ecf5);if(_0x46ef47[_0x37e259(0xf9)]>_0x5049b0){const _0xef9edb=_0x46ef47[_0x46ef47['length']-0x1];this[_0x37e259(0x140)]('log',{'type':_0x37e259(0x17d),'message':_0x37e259(0x138)+_0xef9edb['type'][_0x37e259(0x14a)]()+_0x37e259(0x167)+_0xef9edb[_0x37e259(0x16e)][_0x37e259(0x113)](0x2)+_0x37e259(0x136)+_0x46ef47['length']});}const _0x434899=this['_detectSweep'](_0x43ecf5,_0x49c5b7,_0x16390a);_0x434899&&this['emit'](_0x37e259(0xf8),{'type':'debug','message':_0x37e259(0x12e)+_0x434899[_0x37e259(0x119)]+'\x20|\x20Valid:\x20'+_0x434899[_0x37e259(0x149)]+'\x20|\x20Pen:\x20'+_0x434899['penetrationTicks'][_0x37e259(0x113)](0x1)+_0x37e259(0x116)+(_0x434899['qualityScore']*0x64)[_0x37e259(0x113)](0x0)+'%'});const _0x587482=this['liquidityZones']['get'](_0x43ecf5)['length'];this[_0x37e259(0x11a)](_0x43ecf5,_0x16390a);const _0x4c9978=this['liquidityZones'][_0x37e259(0x133)](_0x43ecf5);if(_0x4c9978[_0x37e259(0xf9)]>_0x587482){const _0x173527=_0x4c9978[_0x4c9978['length']-0x1];this['emit']('log',{'type':_0x37e259(0x17d),'message':'[2B]\x20NEW\x20ZONE\x20'+_0x173527[_0x37e259(0x18b)]['toUpperCase']()+'\x20@\x20'+_0x173527['getLevel']()['toFixed'](0x2)+'\x20|\x20Total:\x20'+_0x4c9978['length']});}if(_0x434899&&_0x434899['isValid']){this['emit']('log',{'type':_0x37e259(0x17d),'message':_0x37e259(0x151)+_0x434899[_0x37e259(0x119)]+_0x37e259(0x171)});const _0x375001=this[_0x37e259(0x189)](_0x43ecf5,_0x446316,_0x16390a,_0x434899);return!_0x375001&&this[_0x37e259(0x140)](_0x37e259(0xf8),{'type':'debug','message':_0x37e259(0x152)}),_0x375001;}return null;}[_0x2226ad(0x184)](_0x470039,_0x198d24,_0x4edf0d){const _0x5c535f=_0x2226ad,_0x537de4=this[_0x5c535f(0x15a)]['swing'][_0x5c535f(0x15b)],_0x57642e=this['config']['swing'][_0x5c535f(0x193)];if(_0x4edf0d<_0x537de4*0x2)return;const _0x552a37=this['swingPoints'][_0x5c535f(0x133)](_0x470039),_0x435671=_0x4edf0d-_0x537de4,_0xc44619=_0x198d24[_0x435671];let _0x5e927d=!![],_0x2c0330=0x0;for(let _0x519573=_0x435671-_0x537de4;_0x519573<=_0x435671+_0x537de4;_0x519573++){if(_0x519573===_0x435671||_0x519573<0x0||_0x519573>=_0x198d24[_0x5c535f(0xf9)])continue;if(_0x198d24[_0x519573][_0x5c535f(0x147)]>=_0xc44619[_0x5c535f(0x147)]){_0x5e927d=![];break;}_0x2c0330++;}if(_0x5e927d&&_0x2c0330>=_0x57642e){const _0x4813aa=_0x552a37[_0x5c535f(0x156)](_0x3d30d4=>_0x3d30d4['barIndex']===_0x435671&&_0x3d30d4[_0x5c535f(0x18b)]===_0x5c535f(0x147));!_0x4813aa&&_0x552a37['push'](new SwingPoint('high',_0xc44619['high'],_0x435671,_0xc44619[_0x5c535f(0x16b)],_0x2c0330));}let _0x3a5286=!![],_0x579aae=0x0;for(let _0x59d8b7=_0x435671-_0x537de4;_0x59d8b7<=_0x435671+_0x537de4;_0x59d8b7++){if(_0x59d8b7===_0x435671||_0x59d8b7<0x0||_0x59d8b7>=_0x198d24['length'])continue;if(_0x198d24[_0x59d8b7][_0x5c535f(0x187)]<=_0xc44619[_0x5c535f(0x187)]){_0x3a5286=![];break;}_0x579aae++;}if(_0x3a5286&&_0x579aae>=_0x57642e){const _0x43a754=_0x552a37[_0x5c535f(0x156)](_0x41d8d5=>_0x41d8d5['barIndex']===_0x435671&&_0x41d8d5['type']===_0x5c535f(0x187));!_0x43a754&&_0x552a37[_0x5c535f(0x182)](new SwingPoint(_0x5c535f(0x187),_0xc44619[_0x5c535f(0x187)],_0x435671,_0xc44619['timestamp'],_0x579aae));}const _0x1dd3a2=this[_0x5c535f(0x15a)]['zone'][_0x5c535f(0x150)];while(_0x552a37[_0x5c535f(0xf9)]>0x0&&_0x552a37[0x0]['barIndex']<_0x4edf0d-_0x1dd3a2){_0x552a37[_0x5c535f(0x17e)]();}}['_updateZones'](_0x587c46,_0x3af955){const _0x4cb03b=_0x2226ad,_0x188b3b=this[_0x4cb03b(0x174)]['get'](_0x587c46),_0x51f799=this['liquidityZones']['get'](_0x587c46),_0x2cd457=this['config'][_0x4cb03b(0x118)]['clusterToleranceTicks']*this['tickSize'],_0x415796=this['config']['zone']['maxZoneAgeBars'];for(let _0x9d4634=_0x51f799['length']-0x1;_0x9d4634>=0x0;_0x9d4634--){_0x3af955-_0x51f799[_0x9d4634][_0x4cb03b(0x122)]>_0x415796&&_0x51f799['splice'](_0x9d4634,0x1);}for(const _0x31d426 of _0x188b3b){let _0x1e7d5f=null;for(const _0x4441cd of _0x51f799){if(_0x4441cd[_0x4cb03b(0x144)](_0x31d426['price'],this[_0x4cb03b(0x15a)]['zone']['clusterToleranceTicks'],this[_0x4cb03b(0x14d)])){_0x1e7d5f=_0x4441cd;break;}}if(_0x1e7d5f){_0x1e7d5f['touches']++;if(_0x31d426['price']>_0x1e7d5f['priceHigh'])_0x1e7d5f['priceHigh']=_0x31d426['price'];if(_0x31d426[_0x4cb03b(0x16e)]<_0x1e7d5f['priceLow'])_0x1e7d5f[_0x4cb03b(0x183)]=_0x31d426['price'];_0x1e7d5f[_0x4cb03b(0x188)]=Math[_0x4cb03b(0x114)](0x1,0.3+_0x1e7d5f[_0x4cb03b(0xfd)]*0.15);}else{const _0x11076e=_0x31d426['type']==='high'?ZoneType['RESISTANCE']:ZoneType['SUPPORT'],_0x3e48e3=new LiquidityZone(_0x11076e,_0x31d426['price']+_0x2cd457/0x2,_0x31d426['price']-_0x2cd457/0x2,_0x31d426[_0x4cb03b(0x16b)],_0x31d426['barIndex']);_0x3e48e3['qualityScore']=0.3+_0x31d426['strength']*0.1,_0x51f799['push'](_0x3e48e3);}}}['_detectSweep'](_0x548dba,_0x3a2b26,_0x466e97){const _0x59da80=_0x2226ad,_0x15efaa=this[_0x59da80(0x16f)]['get'](_0x548dba),_0x14a821=_0x3a2b26[_0x466e97],_0x1e40d0=_0x14a821['close'],_0x4e5b89=this[_0x59da80(0x15a)][_0x59da80(0x161)],_0x3461a8=this['config'][_0x59da80(0x118)];for(const _0x5a96e0 of _0x15efaa){if(_0x5a96e0[_0x59da80(0x190)]>=0x0&&_0x466e97-_0x5a96e0['lastUsedBarIndex']<_0x3461a8[_0x59da80(0x14c)])continue;const _0x45f697=_0x5a96e0[_0x59da80(0x124)](),_0x8e582a=Math['abs'](_0x1e40d0-_0x45f697)/this['tickSize'];if(_0x8e582a>_0x3461a8['maxZoneDistanceTicks'])continue;const _0x1249bc=Math['max'](0x0,_0x466e97-_0x4e5b89[_0x59da80(0x179)]*0x2);for(let _0x299086=_0x1249bc;_0x299086<_0x466e97;_0x299086++){const _0x3c948b=_0x3a2b26[_0x299086];if(_0x5a96e0['type']===ZoneType['RESISTANCE']){const _0x4eb723=(_0x3c948b['high']-_0x5a96e0['priceHigh'])/this['tickSize'];if(_0x4eb723>=_0x4e5b89[_0x59da80(0x10c)]&&_0x4eb723<=_0x4e5b89[_0x59da80(0x173)]){const _0x5c4896=Math['min'](_0x5a96e0[_0x59da80(0x100)],_0x5a96e0['priceHigh']+_0x4eb723*this['tickSize']);if(_0x1e40d0<_0x5c4896+this['tickSize']*0x2){const _0x48e778=_0x3c948b['high']-_0x3c948b[_0x59da80(0x187)],_0x527c4d=Math['abs'](_0x3c948b[_0x59da80(0x172)]-_0x3c948b['open']),_0x2475c1=_0x48e778>0x0?_0x527c4d/_0x48e778:0x0;if(_0x2475c1>=_0x4e5b89[_0x59da80(0x11e)]){const _0x691589=this[_0x59da80(0x195)](_0x3a2b26,_0x299086,0x14);if(_0x691589>=_0x4e5b89[_0x59da80(0x104)]){const _0xdbd3e5=new SweepEvent(SweepType['HIGH_SWEEP'],_0x5a96e0,_0x299086,_0x299086,_0x3c948b['high']);_0xdbd3e5['exitBarIndex']=_0x466e97,_0xdbd3e5[_0x59da80(0x12b)]=_0x4eb723,_0xdbd3e5['durationBars']=_0x466e97-_0x299086,_0xdbd3e5[_0x59da80(0x16a)]=_0x691589,_0xdbd3e5[_0x59da80(0x188)]=this[_0x59da80(0x13a)](_0xdbd3e5,_0x2475c1),_0xdbd3e5[_0x59da80(0x149)]=_0xdbd3e5[_0x59da80(0x188)]>=_0x4e5b89[_0x59da80(0x11d)];if(_0xdbd3e5['isValid'])return _0xdbd3e5;}}}}}if(_0x5a96e0[_0x59da80(0x18b)]===ZoneType[_0x59da80(0x13e)]){const _0x26b60a=(_0x5a96e0[_0x59da80(0x183)]-_0x3c948b['low'])/this[_0x59da80(0x14d)];if(_0x26b60a>=_0x4e5b89['minPenetrationTicks']&&_0x26b60a<=_0x4e5b89['maxPenetrationTicks']){const _0x2fd14e=Math[_0x59da80(0x175)](_0x5a96e0[_0x59da80(0x183)],_0x5a96e0[_0x59da80(0x183)]-_0x26b60a*this[_0x59da80(0x14d)]);if(_0x1e40d0>_0x2fd14e-this[_0x59da80(0x14d)]*0x2){const _0x12237c=_0x3c948b[_0x59da80(0x147)]-_0x3c948b['low'],_0x494225=Math['abs'](_0x3c948b[_0x59da80(0x172)]-_0x3c948b['open']),_0x2abe21=_0x12237c>0x0?_0x494225/_0x12237c:0x0;if(_0x2abe21>=_0x4e5b89[_0x59da80(0x11e)]){const _0x2270e1=this['_getVolumeRatio'](_0x3a2b26,_0x299086,0x14);if(_0x2270e1>=_0x4e5b89[_0x59da80(0x104)]){const _0x2bf6e5=new SweepEvent(SweepType[_0x59da80(0x17a)],_0x5a96e0,_0x299086,_0x299086,_0x3c948b[_0x59da80(0x187)]);_0x2bf6e5[_0x59da80(0x18c)]=_0x466e97,_0x2bf6e5[_0x59da80(0x12b)]=_0x26b60a,_0x2bf6e5[_0x59da80(0xfc)]=_0x466e97-_0x299086,_0x2bf6e5[_0x59da80(0x16a)]=_0x2270e1,_0x2bf6e5['qualityScore']=this['_scoreSweep'](_0x2bf6e5,_0x2abe21),_0x2bf6e5[_0x59da80(0x149)]=_0x2bf6e5['qualityScore']>=_0x4e5b89['minQualityScore'];if(_0x2bf6e5[_0x59da80(0x149)])return _0x2bf6e5;}}}}}}}return null;}['_getVolumeRatio'](_0x431ebe,_0x405f79,_0x3318a4){const _0x9ca874=_0x2226ad,_0x3cb0df=Math['max'](0x0,_0x405f79-_0x3318a4),_0x599986=_0x431ebe['slice'](_0x3cb0df,_0x405f79);if(_0x599986[_0x9ca874(0xf9)]===0x0)return 0x1;const _0x31eb5a=_0x599986[_0x9ca874(0x146)](_0x32968a=>_0x32968a['volume'])['sort']((_0x26951c,_0x4bee72)=>_0x26951c-_0x4bee72),_0x46f83d=Math['floor'](_0x31eb5a[_0x9ca874(0xf9)]/0x2),_0x37f5c5=_0x31eb5a[_0x46f83d]||0x1;return _0x431ebe[_0x405f79]['volume']/_0x37f5c5;}['_scoreSweep'](_0x578282,_0x32af82){const _0x6e9f36=_0x2226ad;let _0x2a826e=0x0;const _0x11af70=0x4,_0x53c8a9=Math['abs'](_0x578282['penetrationTicks']-_0x11af70);return _0x2a826e+=Math[_0x6e9f36(0x175)](0x0,0.3-_0x53c8a9*0.03),_0x2a826e+=Math[_0x6e9f36(0x175)](0x0,0.25-_0x578282[_0x6e9f36(0xfc)]*0.05),_0x2a826e+=Math[_0x6e9f36(0x114)](0.25,_0x578282[_0x6e9f36(0x16a)]*0.1),_0x2a826e+=Math[_0x6e9f36(0x114)](0.2,_0x32af82*0.4),Math[_0x6e9f36(0x114)](0x1,_0x2a826e);}['_generateSignal'](_0x423f9e,_0x360210,_0x3b3dca,_0x327d13){const _0x4984de=_0x2226ad,_0x2963fa=Date[_0x4984de(0x16c)]()-this['lastSignalTime'];if(_0x2963fa<this[_0x4984de(0x15a)]['execution']['cooldownMs'])return this[_0x4984de(0x140)](_0x4984de(0xf8),{'type':'debug','message':'[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20('+(_0x2963fa/0x3e8)[_0x4984de(0x113)](0x1)+_0x4984de(0x18a)+this[_0x4984de(0x15a)][_0x4984de(0x13b)]['cooldownMs']/0x3e8+'s)'}),null;const _0x47f30d=this['config']['execution'],_0x1fa02f=_0x360210['close'],_0x33dbd6=_0x327d13[_0x4984de(0x119)]===SweepType[_0x4984de(0x180)]?_0x4984de(0x103):'long';let _0x2fb87d,_0x2201bc,_0x5487cc,_0x205818;_0x33dbd6===_0x4984de(0x158)?(_0x2fb87d=_0x1fa02f-_0x47f30d['stopTicks']*this['tickSize'],_0x2201bc=_0x1fa02f+_0x47f30d['targetTicks']*this['tickSize'],_0x5487cc=_0x1fa02f+_0x47f30d[_0x4984de(0x11f)]*this['tickSize'],_0x205818=_0x1fa02f+_0x47f30d['trailTriggerTicks']*this['tickSize']):(_0x2fb87d=_0x1fa02f+_0x47f30d[_0x4984de(0x109)]*this['tickSize'],_0x2201bc=_0x1fa02f-_0x47f30d[_0x4984de(0x169)]*this['tickSize'],_0x5487cc=_0x1fa02f-_0x47f30d['breakevenTicks']*this[_0x4984de(0x14d)],_0x205818=_0x1fa02f-_0x47f30d['trailTriggerTicks']*this[_0x4984de(0x14d)]);const _0x260923=_0x47f30d['targetTicks']/_0x47f30d[_0x4984de(0x109)],_0x1ba117=Math['min'](0x1,_0x327d13['qualityScore']*0.5+_0x327d13[_0x4984de(0x118)]['qualityScore']*0.3+(_0x327d13['volumeRatio']>1.5?0.2:_0x327d13['volumeRatio']*0.1));let _0x4d1151=SignalStrength[_0x4984de(0xfa)];if(_0x1ba117>=0.8)_0x4d1151=SignalStrength[_0x4984de(0x15d)];else{if(_0x1ba117>=0.65)_0x4d1151=SignalStrength[_0x4984de(0x121)];else{if(_0x1ba117<0.5)_0x4d1151=SignalStrength['WEAK'];}}const _0x46fd47=0.5+(_0x1ba117-0.5)*0.4,_0x24c1ff=_0x46fd47*Math[_0x4984de(0x105)](_0x2201bc-_0x1fa02f)-(0x1-_0x46fd47)*Math[_0x4984de(0x105)](_0x1fa02f-_0x2fb87d);_0x327d13['zone']['lastUsedBarIndex']=_0x3b3dca,_0x327d13['zone'][_0x4984de(0x10a)]=!![],_0x327d13[_0x4984de(0x118)]['sweptAt']=new Date(_0x360210['timestamp']),this['lastSignalTime']=Date['now'](),this[_0x4984de(0x132)][_0x4984de(0x148)]++;const _0xedee86={'id':uuidv4(),'timestamp':Date[_0x4984de(0x16c)](),'symbol':_0x423f9e[_0x4984de(0x17f)]('.')[0x0]||_0x423f9e,'contractId':_0x423f9e,'side':_0x33dbd6===_0x4984de(0x158)?OrderSide['BID']:OrderSide[_0x4984de(0x126)],'direction':_0x33dbd6,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x4d1151,'edge':_0x24c1ff,'confidence':_0x1ba117,'entry':_0x1fa02f,'entryPrice':_0x1fa02f,'stopLoss':_0x2fb87d,'takeProfit':_0x2201bc,'riskReward':_0x260923,'stopTicks':_0x47f30d['stopTicks'],'targetTicks':_0x47f30d[_0x4984de(0x169)],'breakevenTicks':_0x47f30d[_0x4984de(0x11f)],'trailTriggerTicks':_0x47f30d['trailTriggerTicks'],'trailDistanceTicks':_0x47f30d[_0x4984de(0x162)],'beLevel':_0x5487cc,'trailTrigger':_0x205818,'sweepType':_0x327d13[_0x4984de(0x119)],'penetrationTicks':_0x327d13[_0x4984de(0x12b)],'sweepDurationBars':_0x327d13[_0x4984de(0xfc)],'sweepQuality':_0x327d13['qualityScore'],'volumeRatio':_0x327d13[_0x4984de(0x16a)],'zoneType':_0x327d13[_0x4984de(0x118)]['type'],'zoneLevel':_0x327d13['zone'][_0x4984de(0x124)](),'zoneTouches':_0x327d13[_0x4984de(0x118)][_0x4984de(0xfd)],'zoneQuality':_0x327d13[_0x4984de(0x118)]['qualityScore'],'expires':Date['now']()+0xea60};return this[_0x4984de(0x140)]('signal',{'side':_0x33dbd6==='long'?_0x4984de(0x177):'sell','action':'open','reason':_0x4984de(0x130)+_0x327d13[_0x4984de(0x119)]+_0x4984de(0x143)+_0x327d13['penetrationTicks'][_0x4984de(0x113)](0x1)+_0x4984de(0x13d)+_0x327d13[_0x4984de(0x16a)]['toFixed'](0x1)+_0x4984de(0x107)+(_0x327d13['qualityScore']*0x64)[_0x4984de(0x113)](0x0)+'%',..._0xedee86}),this['emit'](_0x4984de(0xf8),{'type':_0x4984de(0x168),'message':_0x4984de(0x13f)+_0x33dbd6['toUpperCase']()+_0x4984de(0x167)+_0x1fa02f['toFixed'](0x2)+_0x4984de(0x135)+_0x327d13['sweepType']+'\x20|\x20Pen:'+_0x327d13['penetrationTicks']['toFixed'](0x1)+_0x4984de(0x128)+_0x327d13['volumeRatio']['toFixed'](0x1)+_0x4984de(0x14b)+(_0x1ba117*0x64)['toFixed'](0x0)+'%'}),_0xedee86;}[_0x2226ad(0x11b)](_0x16b3bc,_0x1b05d4){const _0x4840c5=_0x2226ad,_0x221f90=this['barHistory']['get'](_0x16b3bc)||[],_0x5b7bcf=this[_0x4840c5(0x16f)][_0x4840c5(0x133)](_0x16b3bc)||[],_0x12d727=this[_0x4840c5(0x174)]['get'](_0x16b3bc)||[];if(_0x221f90[_0x4840c5(0xf9)]<0x5)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x221f90[_0x4840c5(0xf9)]+_0x4840c5(0x15e)};const _0x4fcd54=_0x5b7bcf[_0x4840c5(0x146)](_0xc6234e=>({'zone':_0xc6234e,'distance':Math['abs'](_0x1b05d4-_0xc6234e['getLevel']())}))['sort']((_0x44bea7,_0x301fd2)=>_0x44bea7['distance']-_0x301fd2[_0x4840c5(0x141)]),_0x143ff4=_0x4fcd54[_0x4840c5(0x156)](_0x52997b=>_0x52997b['zone']['type']===ZoneType['RESISTANCE']),_0x1362e5=_0x4fcd54['find'](_0x12595c=>_0x12595c['zone'][_0x4840c5(0x18b)]===ZoneType['SUPPORT']);return{'ready':!![],'barsProcessed':_0x221f90['length'],'swingsDetected':_0x12d727['length'],'activeZones':_0x5b7bcf['length'],'nearestResistance':_0x143ff4?_0x143ff4[_0x4840c5(0x118)]['getLevel']():null,'nearestSupport':_0x1362e5?_0x1362e5['zone']['getLevel']():null,'stopTicks':this['config']['execution']['stopTicks'],'targetTicks':this[_0x4840c5(0x15a)]['execution']['targetTicks'],'strategy':_0x4840c5(0x12c)};}[_0x2226ad(0x165)](_0x54f7b1){const _0x234394=_0x2226ad;this['recentTrades'][_0x234394(0x182)]({'netPnl':_0x54f7b1,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this[_0x234394(0x16d)]['shift']();_0x54f7b1>0x0?this['stats']['wins']++:this[_0x234394(0x132)]['losses']++,this['stats'][_0x234394(0x10b)]++,this[_0x234394(0x132)]['pnl']+=_0x54f7b1,this['emit']('log',{'type':'debug','message':_0x234394(0x18f)+(_0x54f7b1>0x0?'WIN':'LOSS')+'\x20$'+_0x54f7b1['toFixed'](0x2)});}[_0x2226ad(0x160)](_0x52610f){return this['barHistory']['get'](_0x52610f)||[];}['getStats'](){const _0x1f6177=_0x2226ad;return this[_0x1f6177(0x132)];}['getHealthStatus'](_0x190bc5){const _0x392143=_0x2226ad,_0x478ebe=this['barHistory']['get'](_0x190bc5)||[],_0x1ab606=this['liquidityZones']['get'](_0x190bc5)||[],_0x2da6d1=this['swingPoints'][_0x392143(0x133)](_0x190bc5)||[],_0x50b1f2=this[_0x392143(0x157)]['get'](_0x190bc5),_0x5c298c=_0x478ebe[_0x478ebe[_0x392143(0xf9)]-0x1],_0x455ed5=_0x5c298c?Date['now']()-_0x5c298c['timestamp']:null,_0x53c17b=_0x1ab606[_0x392143(0x13c)](_0x58e577=>_0x58e577['type']===ZoneType[_0x392143(0x12a)])['length'],_0x55e799=_0x1ab606[_0x392143(0x13c)](_0x3dd413=>_0x3dd413[_0x392143(0x18b)]===ZoneType['SUPPORT'])['length'];return{'healthy':_0x478ebe[_0x392143(0xf9)]>=0x5,'barsTotal':_0x478ebe[_0x392143(0xf9)],'barsLast5Min':_0x478ebe[_0x392143(0x13c)](_0x12f638=>Date['now']()-_0x12f638[_0x392143(0x16b)]<0x5*0x3c*0x3e8)[_0x392143(0xf9)],'swingsTotal':_0x2da6d1[_0x392143(0xf9)],'zonesResistance':_0x53c17b,'zonesSupport':_0x55e799,'zonesTotal':_0x1ab606[_0x392143(0xf9)],'currentBarTicks':_0x50b1f2?_0x50b1f2[_0x392143(0x127)]:0x0,'isAggregating':_0x50b1f2&&_0x50b1f2[_0x392143(0x127)]>0x0,'timeSinceLastBarMs':_0x455ed5,'lastSignalTime':this[_0x392143(0x129)],'signalCooldownMs':this['config']['execution']['cooldownMs'],'uptime':Date['now']()-(this[_0x392143(0x102)]||Date['now']())};}[_0x2226ad(0x166)](_0x4684ab){const _0x4e8600=_0x2226ad;this[_0x4e8600(0x153)]['set'](_0x4684ab,[]),this[_0x4e8600(0x174)][_0x4e8600(0x117)](_0x4684ab,[]),this['liquidityZones'][_0x4e8600(0x117)](_0x4684ab,[]),this[_0x4e8600(0x142)][_0x4e8600(0x117)](_0x4684ab,[]),this['currentBar']['delete'](_0x4684ab),this[_0x4e8600(0x140)](_0x4e8600(0xf8),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x4684ab});}['preloadBars'](_0x278de4,_0x656511){const _0x3bb1b1=_0x2226ad;if(!_0x656511||_0x656511[_0x3bb1b1(0xf9)]===0x0){this[_0x3bb1b1(0x140)](_0x3bb1b1(0xf8),{'type':_0x3bb1b1(0x17d),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory'][_0x3bb1b1(0x154)](_0x278de4)&&this[_0x3bb1b1(0x10f)](_0x278de4);const _0x15c1bb=[..._0x656511][_0x3bb1b1(0x12f)]((_0x2109a6,_0x48fb03)=>_0x2109a6['timestamp']-_0x48fb03['timestamp']);this['emit'](_0x3bb1b1(0xf8),{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x15c1bb[_0x3bb1b1(0xf9)]+'\x20historical\x20bars...'});let _0x5e2914=0x0;for(const _0x33bb10 of _0x15c1bb){const _0x2ad532=this[_0x3bb1b1(0x17c)](_0x278de4,_0x33bb10);if(_0x2ad532)_0x5e2914++;}const _0x5836e7=this['barHistory']['get'](_0x278de4)||[],_0x1abdc9=this['swingPoints'][_0x3bb1b1(0x133)](_0x278de4)||[],_0x1b0e44=this['liquidityZones'][_0x3bb1b1(0x133)](_0x278de4)||[];this[_0x3bb1b1(0x140)]('log',{'type':_0x3bb1b1(0x168),'message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x5836e7['length']+_0x3bb1b1(0x18e)+_0x1abdc9['length']+_0x3bb1b1(0x111)+_0x1b0e44[_0x3bb1b1(0xf9)]+'\x20zones'}),_0x5e2914>0x0&&this['emit'](_0x3bb1b1(0xf8),{'type':'debug','message':'[HQX-2B]\x20'+_0x5e2914+_0x3bb1b1(0x131)}),this['lastSignalTime']=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x5b5547={}){const _0x518db6=_0x2226ad;super(),this[_0x518db6(0x15a)]=_0x5b5547,this['strategy']=new HQX2BLiquiditySweep(_0x5b5547),this[_0x518db6(0x159)]['on']('signal',_0x583c7d=>this[_0x518db6(0x140)]('signal',_0x583c7d)),this[_0x518db6(0x159)]['on'](_0x518db6(0xf8),_0x23a729=>this[_0x518db6(0x140)]('log',_0x23a729));}[_0x2226ad(0x194)](_0x37449d){const _0x7d3be3=_0x2226ad;return this[_0x7d3be3(0x159)][_0x7d3be3(0x194)](_0x37449d);}['onTick'](_0x4667e4){const _0x9301b2=_0x2226ad;return this['strategy'][_0x9301b2(0x120)](_0x4667e4);}[_0x2226ad(0xfb)](_0x1a0ebd){const _0x554887=_0x2226ad;return this['strategy'][_0x554887(0xfb)](_0x1a0ebd);}[_0x2226ad(0x17c)](_0x17fd64,_0x460e81){const _0x5c6b7e=_0x2226ad;return this['strategy'][_0x5c6b7e(0x17c)](_0x17fd64,_0x460e81);}['initialize'](_0x590436,_0x5b3ab4,_0x1f2e7e){return this['strategy']['initialize'](_0x590436,_0x5b3ab4,_0x1f2e7e);}[_0x2226ad(0x11b)](_0x42547f,_0x15573a){const _0x418516=_0x2226ad;return this['strategy'][_0x418516(0x11b)](_0x42547f,_0x15573a);}['recordTradeResult'](_0x328a2e){const _0x2bb581=_0x2226ad;return this['strategy'][_0x2bb581(0x165)](_0x328a2e);}['reset'](_0x3d8d34){const _0x481932=_0x2226ad;return this['strategy'][_0x481932(0x166)](_0x3d8d34);}[_0x2226ad(0x108)](){return this['strategy']['getStats']();}[_0x2226ad(0x160)](_0x237b0f){const _0x42ac43=_0x2226ad;return this['strategy'][_0x42ac43(0x160)](_0x237b0f);}['preloadBars'](_0x47d9ef,_0x1682d0){const _0x46e215=_0x2226ad;return this[_0x46e215(0x159)]['preloadBars'](_0x47d9ef,_0x1682d0);}[_0x2226ad(0x186)](_0x34dd8b){const _0xb4bf3=_0x2226ad;return this[_0xb4bf3(0x159)][_0xb4bf3(0x186)](_0x34dd8b);}[_0x2226ad(0x110)](_0x2c0cc1){return null;}}function _0x5493(_0x3f882a,_0x11948f){_0x3f882a=_0x3f882a-0xf8;const _0x2bcb4c=_0x2bcb();let _0x549337=_0x2bcb4c[_0x3f882a];return _0x549337;}module[_0x2226ad(0x155)]={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
1
+ const _0x3c2c79=_0x3286;(function(_0x29ac90,_0x4d799b){const _0x37e0b4=_0x3286,_0x2b55b4=_0x29ac90();while(!![]){try{const _0xc35e54=-parseInt(_0x37e0b4(0x170))/0x1+parseInt(_0x37e0b4(0x137))/0x2*(-parseInt(_0x37e0b4(0x12a))/0x3)+parseInt(_0x37e0b4(0x1a6))/0x4+-parseInt(_0x37e0b4(0x166))/0x5*(-parseInt(_0x37e0b4(0x16b))/0x6)+-parseInt(_0x37e0b4(0x14f))/0x7*(-parseInt(_0x37e0b4(0x163))/0x8)+-parseInt(_0x37e0b4(0x1a7))/0x9+parseInt(_0x37e0b4(0x1a5))/0xa*(-parseInt(_0x37e0b4(0x174))/0xb);if(_0xc35e54===_0x4d799b)break;else _0x2b55b4['push'](_0x2b55b4['shift']());}catch(_0x5e77b5){_0x2b55b4['push'](_0x2b55b4['shift']());}}}(_0x2306,0x6eb2b));const EventEmitter=require(_0x3c2c79(0x14b)),{v4:uuidv4}=require(_0x3c2c79(0x11d)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x3c2c79(0x176),'LOW_SWEEP':'low'},ZoneType={'RESISTANCE':_0x3c2c79(0x118),'SUPPORT':'support'},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x3,'minStrength':0x2,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x4,'minTouches':0x2,'maxZoneAgeBars':0xc8,'maxZoneDistanceTicks':0x28,'cooldownBars':0xa},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x8,'maxDurationBars':0x5,'minQualityScore':0.25,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x2710,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':'America/New_York'}};class SwingPoint{constructor(_0x4c7556,_0x2b0437,_0x4a33de,_0x5510cd,_0x3ea663=0x1){const _0x531e4e=_0x3c2c79;this['type']=_0x4c7556,this[_0x531e4e(0x13e)]=_0x2b0437,this['barIndex']=_0x4a33de,this['timestamp']=_0x5510cd,this['strength']=_0x3ea663;}}function _0x2306(){const _0x1d6ecf=['tickSize','getStats','stopTicks','swingPoints','getAnalysisState','session','min','s\x20<\x20','_detectSwings','timestamp','sweepType','getBarHistory','info','delete','processTick','strategy','getHealthStatus','penetrationTicks','map','execution','minVolumeRatio','sort','low','toFixed','stats','volumeRatio','barIndex','SUPPORT','length','x\x20|\x20Q:','now','cooldownBars','[HQX-2B]\x20Preload\x20complete:\x20','reset','\x20|\x20Total:\x20','clusterToleranceTicks','set','[2B]\x20SWEEP\x20','isValid','emit','breakevenTicks','priceHigh','20LUhKRy','2891544dWvjDd','516339jAtdHk','long','wins','qualityScore','size','close','log','has','split','targetTicks','maxPenetrationTicks','barHistory','resistance','WIN','_detectSweep','priceLow','filter','uuid','floor','HIGH_SWEEP','push','signal','_getVolumeRatio','open','/5\x20bars','isWithinSession','max','\x20|\x20','config','[2B]\x20Calling\x20_generateSignal\x20for\x20','2026110EvaPsr','maxZoneAgeBars','splice','maxDurationBars','RESISTANCE','startTime','\x20|\x20Pen:','exitBarIndex','preloadBars','processBar','tickCount','shift','containsPrice','2CMiweW','\x20historical\x20signals\x20detected\x20(ignored)','getLevel','trailTriggerTicks','liquidityZones','durationBars','BID','price','currentBar','extremeBarIndex','\x20historical\x20bars...','isDST','onTrade','onTick','type','WEAK','t,\x20BE=','swing','minQualityScore','generateSignal','events','_generateSignal','get','find','21RsODKP','lastSignalTime','buy','distance','barIntervalMs','STRONG','touches','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','_mergeConfig','activeSweeps','cooldownMs','toUpperCase','recentTrades','HQX_2B_LIQUIDITY_SWEEP','exports','createdAt','tickValue','sweptAt','trailDistanceTicks','LOSS','2374576aztBTa','_updateZones','volume','550asBGBf','abs','MODERATE','short',',\x20value=','46668ElOrNT','Collecting\x20data...\x20','minPenetrationTicks','initialize','zone','542336KtDGBb','swept','\x20@\x20','recordTradeResult','4072398pKWXOf','lastUsedBarIndex','high','debug','[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)','getFullYear','[2B]\x20NEW\x20ZONE\x20'];_0x2306=function(){return _0x1d6ecf;};return _0x2306();}class LiquidityZone{constructor(_0x47dd02,_0x91f01b,_0x2fc927,_0x60a931,_0x970786){const _0x5b63e4=_0x3c2c79;this['id']=uuidv4(),this['type']=_0x47dd02,this['priceHigh']=_0x91f01b,this['priceLow']=_0x2fc927,this[_0x5b63e4(0x15e)]=_0x60a931,this[_0x5b63e4(0x195)]=_0x970786,this['touches']=0x1,this['swept']=![],this['sweptAt']=null,this['lastUsedBarIndex']=-0x3e7,this['qualityScore']=0.5;}[_0x3c2c79(0x136)](_0x1021bb,_0x259fdd,_0x4d601d){const _0x3c5670=_0x3c2c79,_0x56b511=_0x259fdd*_0x4d601d;return _0x1021bb>=this[_0x3c5670(0x11b)]-_0x56b511&&_0x1021bb<=this[_0x3c5670(0x1a4)]+_0x56b511;}[_0x3c2c79(0x139)](){const _0x505bc5=_0x3c2c79;return(this[_0x505bc5(0x1a4)]+this[_0x505bc5(0x11b)])/0x2;}}class SweepEvent{constructor(_0x1dd70a,_0x3f2142,_0x5da72a,_0x5d7747,_0x388d23){const _0x378def=_0x3c2c79;this[_0x378def(0x185)]=_0x1dd70a,this['zone']=_0x3f2142,this['entryBarIndex']=_0x5da72a,this[_0x378def(0x140)]=_0x5d7747,this['extremePrice']=_0x388d23,this[_0x378def(0x131)]=null,this[_0x378def(0x1a1)]=![],this['qualityScore']=0x0,this[_0x378def(0x18c)]=0x0,this[_0x378def(0x13c)]=0x0,this[_0x378def(0x194)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x73ec9d={}){const _0x10b74a=_0x3c2c79;super(),this['config']=this[_0x10b74a(0x157)](DEFAULT_CONFIG,_0x73ec9d),this[_0x10b74a(0x17b)]=this[_0x10b74a(0x128)]['tickSize'],this['tickValue']=this['config'][_0x10b74a(0x15f)],this['barHistory']=new Map(),this['swingPoints']=new Map(),this['liquidityZones']=new Map(),this['activeSweeps']=new Map(),this[_0x10b74a(0x13f)]=new Map(),this[_0x10b74a(0x153)]=0xea60,this[_0x10b74a(0x150)]=0x0,this['startTime']=Date['now'](),this[_0x10b74a(0x193)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x10b74a(0x15b)]=[];}[_0x3c2c79(0x157)](_0x2ed7e0,_0x35aaed){const _0xffafaf={..._0x2ed7e0};for(const _0x39396d in _0x35aaed){typeof _0x35aaed[_0x39396d]==='object'&&!Array['isArray'](_0x35aaed[_0x39396d])?_0xffafaf[_0x39396d]={..._0x2ed7e0[_0x39396d],..._0x35aaed[_0x39396d]}:_0xffafaf[_0x39396d]=_0x35aaed[_0x39396d];}return _0xffafaf;}['isWithinSession'](_0x51bb43){const _0x47c243=_0x3c2c79;if(!this[_0x47c243(0x128)][_0x47c243(0x180)]['enabled'])return!![];const _0x3aaefc=new Date(_0x51bb43),_0x1bfb98=this[_0x47c243(0x142)](_0x3aaefc)?-0x4:-0x5,_0x3bc5c9=_0x3aaefc['getUTCHours'](),_0x426554=_0x3aaefc['getUTCMinutes'](),_0xd6e43d=(_0x3bc5c9+_0x1bfb98+0x18)%0x18,{startHour:_0x5ec534,startMinute:_0xcdb89c,endHour:_0x5f856b,endMinute:_0x3f11a3}=this[_0x47c243(0x128)][_0x47c243(0x180)],_0x426f54=_0xd6e43d*0x3c+_0x426554,_0x1895fd=_0x5ec534*0x3c+_0xcdb89c,_0x5d165b=_0x5f856b*0x3c+_0x3f11a3;return _0x426f54>=_0x1895fd&&_0x426f54<_0x5d165b;}['isDST'](_0x1f9d17){const _0x273de5=_0x3c2c79,_0xb94322=new Date(_0x1f9d17[_0x273de5(0x179)](),0x0,0x1),_0x227bf7=new Date(_0x1f9d17[_0x273de5(0x179)](),0x6,0x1),_0x5dc005=Math[_0x273de5(0x126)](_0xb94322['getTimezoneOffset'](),_0x227bf7['getTimezoneOffset']());return _0x1f9d17['getTimezoneOffset']()<_0x5dc005;}['initialize'](_0x188519,_0x4ddbbf=0.25,_0x5d88e0=0x5){const _0x43c69f=_0x3c2c79;this[_0x43c69f(0x17b)]=_0x4ddbbf,this['tickValue']=_0x5d88e0,this[_0x43c69f(0x128)]['tickSize']=_0x4ddbbf,this[_0x43c69f(0x128)][_0x43c69f(0x15f)]=_0x5d88e0,this[_0x43c69f(0x117)][_0x43c69f(0x19f)](_0x188519,[]),this['swingPoints']['set'](_0x188519,[]),this[_0x43c69f(0x13b)]['set'](_0x188519,[]),this['activeSweeps']['set'](_0x188519,[]),this['currentBar'][_0x43c69f(0x188)](_0x188519),this[_0x43c69f(0x1a2)]('log',{'type':_0x43c69f(0x187),'message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x188519+':\x20tick='+_0x4ddbbf+_0x43c69f(0x16a)+_0x5d88e0+',\x20TF=1min'}),this['emit'](_0x43c69f(0x1ad),{'type':_0x43c69f(0x187),'message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x43c69f(0x128)]['execution']['stopTicks']+'t,\x20Target='+this[_0x43c69f(0x128)]['execution'][_0x43c69f(0x115)]+_0x43c69f(0x147)+this['config']['execution']['breakevenTicks']+'t,\x20Trail='+this[_0x43c69f(0x128)][_0x43c69f(0x18e)]['trailTriggerTicks']+'/'+this['config']['execution'][_0x43c69f(0x161)]});}[_0x3c2c79(0x189)](_0x2afd93){const _0x1b6503=_0x3c2c79,{contractId:_0x3f6535,price:_0x1b0c2c,volume:_0x21311b,timestamp:_0x539db5}=_0x2afd93,_0x222ac5=_0x539db5||Date[_0x1b6503(0x199)](),_0x15d4ff=_0x21311b||0x1;if(!this[_0x1b6503(0x125)](_0x222ac5))return null;let _0x143ce8=this[_0x1b6503(0x13f)][_0x1b6503(0x14d)](_0x3f6535);const _0x57cd92=Math[_0x1b6503(0x11e)](_0x222ac5/this[_0x1b6503(0x153)])*this[_0x1b6503(0x153)];if(!_0x143ce8||_0x143ce8[_0x1b6503(0x12f)]!==_0x57cd92){if(_0x143ce8){const _0x914633={'timestamp':_0x143ce8['startTime'],'open':_0x143ce8['open'],'high':_0x143ce8['high'],'low':_0x143ce8['low'],'close':_0x143ce8[_0x1b6503(0x1ac)],'volume':_0x143ce8['volume']},_0x1a4ebb=this[_0x1b6503(0x133)](_0x3f6535,_0x914633);return this['currentBar']['set'](_0x3f6535,{'startTime':_0x57cd92,'open':_0x1b0c2c,'high':_0x1b0c2c,'low':_0x1b0c2c,'close':_0x1b0c2c,'volume':_0x15d4ff}),_0x1a4ebb;}else return this[_0x1b6503(0x13f)][_0x1b6503(0x19f)](_0x3f6535,{'startTime':_0x57cd92,'open':_0x1b0c2c,'high':_0x1b0c2c,'low':_0x1b0c2c,'close':_0x1b0c2c,'volume':_0x15d4ff}),null;}else return _0x143ce8[_0x1b6503(0x176)]=Math[_0x1b6503(0x126)](_0x143ce8[_0x1b6503(0x176)],_0x1b0c2c),_0x143ce8[_0x1b6503(0x191)]=Math[_0x1b6503(0x181)](_0x143ce8[_0x1b6503(0x191)],_0x1b0c2c),_0x143ce8[_0x1b6503(0x1ac)]=_0x1b0c2c,_0x143ce8[_0x1b6503(0x165)]+=_0x15d4ff,null;}['onTick'](_0x1c4e6b){const _0xee5035=_0x3c2c79;return this[_0xee5035(0x189)](_0x1c4e6b);}['onTrade'](_0x3cacf6){const _0x49c4c0=_0x3c2c79;return this['processTick']({'contractId':_0x3cacf6['contractId']||_0x3cacf6['symbol'],'price':_0x3cacf6[_0x49c4c0(0x13e)],'volume':_0x3cacf6[_0x49c4c0(0x1ab)]||_0x3cacf6[_0x49c4c0(0x165)]||0x1,'timestamp':_0x3cacf6[_0x49c4c0(0x184)]||Date[_0x49c4c0(0x199)]()});}[_0x3c2c79(0x133)](_0x35e484,_0x28439a){const _0x128f24=_0x3c2c79;let _0x3f7c59=this[_0x128f24(0x117)]['get'](_0x35e484);!_0x3f7c59&&(this[_0x128f24(0x16e)](_0x35e484),_0x3f7c59=this[_0x128f24(0x117)][_0x128f24(0x14d)](_0x35e484));_0x3f7c59['push'](_0x28439a);if(_0x3f7c59[_0x128f24(0x197)]>0x1f4)_0x3f7c59['shift']();const _0x328a5c=_0x3f7c59[_0x128f24(0x197)]-0x1;if(_0x3f7c59['length']<this['config'][_0x128f24(0x148)]['lookbackBars']*0x3)return null;const _0x5b9c9b=this[_0x128f24(0x17e)]['get'](_0x35e484)['length'];this['_detectSwings'](_0x35e484,_0x3f7c59,_0x328a5c);const _0x517b49=this['swingPoints'][_0x128f24(0x14d)](_0x35e484);if(_0x517b49[_0x128f24(0x197)]>_0x5b9c9b){const _0x3cbed6=_0x517b49[_0x517b49['length']-0x1];this['emit'](_0x128f24(0x1ad),{'type':_0x128f24(0x177),'message':'[2B]\x20NEW\x20SWING\x20'+_0x3cbed6['type'][_0x128f24(0x15a)]()+'\x20@\x20'+_0x3cbed6[_0x128f24(0x13e)]['toFixed'](0x2)+_0x128f24(0x19d)+_0x517b49['length']});}const _0x1f5273=this[_0x128f24(0x11a)](_0x35e484,_0x3f7c59,_0x328a5c);_0x1f5273&&this['emit'](_0x128f24(0x1ad),{'type':_0x128f24(0x177),'message':_0x128f24(0x1a0)+_0x1f5273['sweepType']+'\x20|\x20Valid:\x20'+_0x1f5273[_0x128f24(0x1a1)]+'\x20|\x20Pen:\x20'+_0x1f5273['penetrationTicks'][_0x128f24(0x192)](0x1)+'t\x20|\x20Q:\x20'+(_0x1f5273[_0x128f24(0x1aa)]*0x64)[_0x128f24(0x192)](0x0)+'%'});const _0x547e4f=this['liquidityZones']['get'](_0x35e484)[_0x128f24(0x197)];this[_0x128f24(0x164)](_0x35e484,_0x328a5c);const _0x6a3c62=this['liquidityZones'][_0x128f24(0x14d)](_0x35e484);if(_0x6a3c62[_0x128f24(0x197)]>_0x547e4f){const _0x173ed7=_0x6a3c62[_0x6a3c62[_0x128f24(0x197)]-0x1];this['emit']('log',{'type':'debug','message':_0x128f24(0x17a)+_0x173ed7['type'][_0x128f24(0x15a)]()+_0x128f24(0x172)+_0x173ed7[_0x128f24(0x139)]()['toFixed'](0x2)+'\x20|\x20Total:\x20'+_0x6a3c62['length']});}if(_0x1f5273&&_0x1f5273[_0x128f24(0x1a1)]){this[_0x128f24(0x1a2)]('log',{'type':_0x128f24(0x177),'message':_0x128f24(0x129)+_0x1f5273[_0x128f24(0x185)]+'\x20sweep...'});const _0x170907=this[_0x128f24(0x14c)](_0x35e484,_0x28439a,_0x328a5c,_0x1f5273);return!_0x170907&&this['emit'](_0x128f24(0x1ad),{'type':'debug','message':_0x128f24(0x178)}),_0x170907;}return null;}[_0x3c2c79(0x183)](_0x53b086,_0xd2b83e,_0x2e4c6e){const _0x3d9adb=_0x3c2c79,_0x1d03d9=this[_0x3d9adb(0x128)][_0x3d9adb(0x148)]['lookbackBars'],_0x5aade9=this['config'][_0x3d9adb(0x148)]['minStrength'];if(_0x2e4c6e<_0x1d03d9*0x2)return;const _0x401dcd=this['swingPoints']['get'](_0x53b086),_0x2eb524=_0x2e4c6e-_0x1d03d9,_0x3876de=_0xd2b83e[_0x2eb524];let _0x8112a=!![],_0x33497c=0x0;for(let _0x2b97ec=_0x2eb524-_0x1d03d9;_0x2b97ec<=_0x2eb524+_0x1d03d9;_0x2b97ec++){if(_0x2b97ec===_0x2eb524||_0x2b97ec<0x0||_0x2b97ec>=_0xd2b83e['length'])continue;if(_0xd2b83e[_0x2b97ec][_0x3d9adb(0x176)]>=_0x3876de[_0x3d9adb(0x176)]){_0x8112a=![];break;}_0x33497c++;}if(_0x8112a&&_0x33497c>=_0x5aade9){const _0x896569=_0x401dcd[_0x3d9adb(0x14e)](_0x246a61=>_0x246a61[_0x3d9adb(0x195)]===_0x2eb524&&_0x246a61[_0x3d9adb(0x145)]===_0x3d9adb(0x176));!_0x896569&&_0x401dcd['push'](new SwingPoint(_0x3d9adb(0x176),_0x3876de[_0x3d9adb(0x176)],_0x2eb524,_0x3876de[_0x3d9adb(0x184)],_0x33497c));}let _0x1478c8=!![],_0x24cb3d=0x0;for(let _0x1cd509=_0x2eb524-_0x1d03d9;_0x1cd509<=_0x2eb524+_0x1d03d9;_0x1cd509++){if(_0x1cd509===_0x2eb524||_0x1cd509<0x0||_0x1cd509>=_0xd2b83e[_0x3d9adb(0x197)])continue;if(_0xd2b83e[_0x1cd509]['low']<=_0x3876de['low']){_0x1478c8=![];break;}_0x24cb3d++;}if(_0x1478c8&&_0x24cb3d>=_0x5aade9){const _0x5b749b=_0x401dcd[_0x3d9adb(0x14e)](_0x5685f3=>_0x5685f3[_0x3d9adb(0x195)]===_0x2eb524&&_0x5685f3['type']==='low');!_0x5b749b&&_0x401dcd[_0x3d9adb(0x120)](new SwingPoint(_0x3d9adb(0x191),_0x3876de['low'],_0x2eb524,_0x3876de[_0x3d9adb(0x184)],_0x24cb3d));}const _0x1eb0b7=this[_0x3d9adb(0x128)]['zone'][_0x3d9adb(0x12b)];while(_0x401dcd[_0x3d9adb(0x197)]>0x0&&_0x401dcd[0x0][_0x3d9adb(0x195)]<_0x2e4c6e-_0x1eb0b7){_0x401dcd[_0x3d9adb(0x135)]();}}[_0x3c2c79(0x164)](_0x2a7d5e,_0x4d04f6){const _0x35951b=_0x3c2c79,_0x465fe9=this[_0x35951b(0x17e)]['get'](_0x2a7d5e),_0x43d9b2=this['liquidityZones'][_0x35951b(0x14d)](_0x2a7d5e),_0x16aa39=this['config']['zone'][_0x35951b(0x19e)]*this[_0x35951b(0x17b)],_0x387e8b=this[_0x35951b(0x128)][_0x35951b(0x16f)][_0x35951b(0x12b)];for(let _0x1af409=_0x43d9b2['length']-0x1;_0x1af409>=0x0;_0x1af409--){_0x4d04f6-_0x43d9b2[_0x1af409][_0x35951b(0x195)]>_0x387e8b&&_0x43d9b2[_0x35951b(0x12c)](_0x1af409,0x1);}for(const _0x2a73ac of _0x465fe9){let _0x2a8b30=null;for(const _0x5500dc of _0x43d9b2){if(_0x5500dc['containsPrice'](_0x2a73ac[_0x35951b(0x13e)],this['config'][_0x35951b(0x16f)][_0x35951b(0x19e)],this[_0x35951b(0x17b)])){_0x2a8b30=_0x5500dc;break;}}if(_0x2a8b30){_0x2a8b30['touches']++;if(_0x2a73ac[_0x35951b(0x13e)]>_0x2a8b30['priceHigh'])_0x2a8b30['priceHigh']=_0x2a73ac['price'];if(_0x2a73ac['price']<_0x2a8b30['priceLow'])_0x2a8b30[_0x35951b(0x11b)]=_0x2a73ac[_0x35951b(0x13e)];_0x2a8b30['qualityScore']=Math['min'](0x1,0.3+_0x2a8b30['touches']*0.15);}else{const _0x299f07=_0x2a73ac['type']===_0x35951b(0x176)?ZoneType['RESISTANCE']:ZoneType['SUPPORT'],_0x343645=new LiquidityZone(_0x299f07,_0x2a73ac[_0x35951b(0x13e)]+_0x16aa39/0x2,_0x2a73ac[_0x35951b(0x13e)]-_0x16aa39/0x2,_0x2a73ac['timestamp'],_0x2a73ac[_0x35951b(0x195)]);_0x343645[_0x35951b(0x1aa)]=0.3+_0x2a73ac['strength']*0.1,_0x43d9b2[_0x35951b(0x120)](_0x343645);}}}['_detectSweep'](_0x25ee86,_0x146c82,_0x5af283){const _0x10aa22=_0x3c2c79,_0x1efb0b=this[_0x10aa22(0x13b)]['get'](_0x25ee86),_0x439ded=_0x146c82[_0x5af283],_0x2753b3=_0x439ded[_0x10aa22(0x1ac)],_0x1a7494=this['config']['sweep'],_0x3b34dc=this['config'][_0x10aa22(0x16f)];for(const _0x2c9257 of _0x1efb0b){if(_0x2c9257['lastUsedBarIndex']>=0x0&&_0x5af283-_0x2c9257[_0x10aa22(0x175)]<_0x3b34dc[_0x10aa22(0x19a)])continue;const _0x448ff6=_0x2c9257[_0x10aa22(0x139)](),_0x505f83=Math['abs'](_0x2753b3-_0x448ff6)/this[_0x10aa22(0x17b)];if(_0x505f83>_0x3b34dc['maxZoneDistanceTicks'])continue;const _0x130a81=Math[_0x10aa22(0x126)](0x0,_0x5af283-_0x1a7494[_0x10aa22(0x12d)]*0x2);for(let _0x1fe75e=_0x130a81;_0x1fe75e<_0x5af283;_0x1fe75e++){const _0x21823b=_0x146c82[_0x1fe75e];if(_0x2c9257['type']===ZoneType[_0x10aa22(0x12e)]){const _0x13df06=(_0x21823b['high']-_0x2c9257['priceHigh'])/this['tickSize'];if(_0x13df06>=_0x1a7494[_0x10aa22(0x16d)]&&_0x13df06<=_0x1a7494[_0x10aa22(0x116)]){const _0x307fae=Math[_0x10aa22(0x181)](_0x2c9257['priceHigh'],_0x2c9257[_0x10aa22(0x1a4)]+_0x13df06*this['tickSize']);if(_0x2753b3<_0x307fae+this[_0x10aa22(0x17b)]*0x2){const _0x128da3=_0x21823b[_0x10aa22(0x176)]-_0x21823b['low'],_0x14d4bf=Math['abs'](_0x21823b['close']-_0x21823b['open']),_0x5eefa3=_0x128da3>0x0?_0x14d4bf/_0x128da3:0x0;if(_0x5eefa3>=_0x1a7494['minBodyRatio']){const _0x4d188b=this[_0x10aa22(0x122)](_0x146c82,_0x1fe75e,0x14);if(_0x4d188b>=_0x1a7494[_0x10aa22(0x18f)]){const _0x759152=new SweepEvent(SweepType[_0x10aa22(0x11f)],_0x2c9257,_0x1fe75e,_0x1fe75e,_0x21823b[_0x10aa22(0x176)]);_0x759152[_0x10aa22(0x131)]=_0x5af283,_0x759152['penetrationTicks']=_0x13df06,_0x759152[_0x10aa22(0x13c)]=_0x5af283-_0x1fe75e,_0x759152['volumeRatio']=_0x4d188b,_0x759152['qualityScore']=this['_scoreSweep'](_0x759152,_0x5eefa3),_0x759152['isValid']=_0x759152[_0x10aa22(0x1aa)]>=_0x1a7494[_0x10aa22(0x149)];if(_0x759152['isValid'])return _0x759152;}}}}}if(_0x2c9257['type']===ZoneType[_0x10aa22(0x196)]){const _0x45ac67=(_0x2c9257['priceLow']-_0x21823b['low'])/this[_0x10aa22(0x17b)];if(_0x45ac67>=_0x1a7494[_0x10aa22(0x16d)]&&_0x45ac67<=_0x1a7494[_0x10aa22(0x116)]){const _0x19ee56=Math['max'](_0x2c9257[_0x10aa22(0x11b)],_0x2c9257['priceLow']-_0x45ac67*this[_0x10aa22(0x17b)]);if(_0x2753b3>_0x19ee56-this[_0x10aa22(0x17b)]*0x2){const _0x281d8b=_0x21823b['high']-_0x21823b['low'],_0xc92c37=Math[_0x10aa22(0x167)](_0x21823b['close']-_0x21823b[_0x10aa22(0x123)]),_0xbc603c=_0x281d8b>0x0?_0xc92c37/_0x281d8b:0x0;if(_0xbc603c>=_0x1a7494['minBodyRatio']){const _0x367213=this['_getVolumeRatio'](_0x146c82,_0x1fe75e,0x14);if(_0x367213>=_0x1a7494['minVolumeRatio']){const _0x3a2885=new SweepEvent(SweepType['LOW_SWEEP'],_0x2c9257,_0x1fe75e,_0x1fe75e,_0x21823b[_0x10aa22(0x191)]);_0x3a2885['exitBarIndex']=_0x5af283,_0x3a2885['penetrationTicks']=_0x45ac67,_0x3a2885['durationBars']=_0x5af283-_0x1fe75e,_0x3a2885['volumeRatio']=_0x367213,_0x3a2885['qualityScore']=this['_scoreSweep'](_0x3a2885,_0xbc603c),_0x3a2885['isValid']=_0x3a2885[_0x10aa22(0x1aa)]>=_0x1a7494[_0x10aa22(0x149)];if(_0x3a2885['isValid'])return _0x3a2885;}}}}}}}return null;}[_0x3c2c79(0x122)](_0x6fb17f,_0x1ceb64,_0x4fb291){const _0x3707b1=_0x3c2c79,_0x264191=Math[_0x3707b1(0x126)](0x0,_0x1ceb64-_0x4fb291),_0x202d8f=_0x6fb17f['slice'](_0x264191,_0x1ceb64);if(_0x202d8f['length']===0x0)return 0x1;const _0x33ba18=_0x202d8f['map'](_0x35f097=>_0x35f097[_0x3707b1(0x165)])['sort']((_0x5e80e2,_0x4ba738)=>_0x5e80e2-_0x4ba738),_0x522d9a=Math[_0x3707b1(0x11e)](_0x33ba18[_0x3707b1(0x197)]/0x2),_0x214fb5=_0x33ba18[_0x522d9a]||0x1;return _0x6fb17f[_0x1ceb64]['volume']/_0x214fb5;}['_scoreSweep'](_0x4669c0,_0x439bcc){const _0x57063=_0x3c2c79;let _0x18b656=0x0;const _0x426427=0x4,_0x12f3fa=Math[_0x57063(0x167)](_0x4669c0['penetrationTicks']-_0x426427);return _0x18b656+=Math['max'](0x0,0.3-_0x12f3fa*0.03),_0x18b656+=Math[_0x57063(0x126)](0x0,0.25-_0x4669c0[_0x57063(0x13c)]*0.05),_0x18b656+=Math['min'](0.25,_0x4669c0['volumeRatio']*0.1),_0x18b656+=Math['min'](0.2,_0x439bcc*0.4),Math[_0x57063(0x181)](0x1,_0x18b656);}['_generateSignal'](_0x46a390,_0x8b7857,_0x5e7564,_0x10cf4b){const _0x12e294=_0x3c2c79,_0xb0e6cf=Date[_0x12e294(0x199)]()-this['lastSignalTime'];if(_0xb0e6cf<this[_0x12e294(0x128)]['execution'][_0x12e294(0x159)])return this['emit'](_0x12e294(0x1ad),{'type':'debug','message':'[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20('+(_0xb0e6cf/0x3e8)['toFixed'](0x1)+_0x12e294(0x182)+this['config'][_0x12e294(0x18e)][_0x12e294(0x159)]/0x3e8+'s)'}),null;const _0x3a38ce=this[_0x12e294(0x128)]['execution'],_0x1487ea=_0x8b7857['close'],_0x3d7861=_0x10cf4b['sweepType']===SweepType['HIGH_SWEEP']?_0x12e294(0x169):'long';let _0x38c2c8,_0x331476,_0x159785,_0x3ae0d9;_0x3d7861==='long'?(_0x38c2c8=_0x1487ea-_0x3a38ce['stopTicks']*this[_0x12e294(0x17b)],_0x331476=_0x1487ea+_0x3a38ce[_0x12e294(0x115)]*this[_0x12e294(0x17b)],_0x159785=_0x1487ea+_0x3a38ce['breakevenTicks']*this['tickSize'],_0x3ae0d9=_0x1487ea+_0x3a38ce['trailTriggerTicks']*this['tickSize']):(_0x38c2c8=_0x1487ea+_0x3a38ce[_0x12e294(0x17d)]*this[_0x12e294(0x17b)],_0x331476=_0x1487ea-_0x3a38ce['targetTicks']*this['tickSize'],_0x159785=_0x1487ea-_0x3a38ce['breakevenTicks']*this['tickSize'],_0x3ae0d9=_0x1487ea-_0x3a38ce['trailTriggerTicks']*this['tickSize']);const _0x5ca101=_0x3a38ce['targetTicks']/_0x3a38ce[_0x12e294(0x17d)],_0x280928=Math[_0x12e294(0x181)](0x1,_0x10cf4b[_0x12e294(0x1aa)]*0.5+_0x10cf4b[_0x12e294(0x16f)][_0x12e294(0x1aa)]*0.3+(_0x10cf4b[_0x12e294(0x194)]>1.5?0.2:_0x10cf4b['volumeRatio']*0.1));let _0x511247=SignalStrength[_0x12e294(0x168)];if(_0x280928>=0.8)_0x511247=SignalStrength['VERY_STRONG'];else{if(_0x280928>=0.65)_0x511247=SignalStrength[_0x12e294(0x154)];else{if(_0x280928<0.5)_0x511247=SignalStrength[_0x12e294(0x146)];}}const _0x444401=0.5+(_0x280928-0.5)*0.4,_0x486bba=_0x444401*Math[_0x12e294(0x167)](_0x331476-_0x1487ea)-(0x1-_0x444401)*Math[_0x12e294(0x167)](_0x1487ea-_0x38c2c8);_0x10cf4b[_0x12e294(0x16f)]['lastUsedBarIndex']=_0x5e7564,_0x10cf4b[_0x12e294(0x16f)][_0x12e294(0x171)]=!![],_0x10cf4b['zone'][_0x12e294(0x160)]=new Date(_0x8b7857[_0x12e294(0x184)]),this['lastSignalTime']=Date['now'](),this[_0x12e294(0x193)]['signals']++;const _0xff5c2b={'id':uuidv4(),'timestamp':Date[_0x12e294(0x199)](),'symbol':_0x46a390[_0x12e294(0x114)]('.')[0x0]||_0x46a390,'contractId':_0x46a390,'side':_0x3d7861==='long'?OrderSide[_0x12e294(0x13d)]:OrderSide['ASK'],'direction':_0x3d7861,'strategy':_0x12e294(0x15c),'strength':_0x511247,'edge':_0x486bba,'confidence':_0x280928,'entry':_0x1487ea,'entryPrice':_0x1487ea,'stopLoss':_0x38c2c8,'takeProfit':_0x331476,'riskReward':_0x5ca101,'stopTicks':_0x3a38ce[_0x12e294(0x17d)],'targetTicks':_0x3a38ce['targetTicks'],'breakevenTicks':_0x3a38ce[_0x12e294(0x1a3)],'trailTriggerTicks':_0x3a38ce[_0x12e294(0x13a)],'trailDistanceTicks':_0x3a38ce[_0x12e294(0x161)],'beLevel':_0x159785,'trailTrigger':_0x3ae0d9,'sweepType':_0x10cf4b[_0x12e294(0x185)],'penetrationTicks':_0x10cf4b[_0x12e294(0x18c)],'sweepDurationBars':_0x10cf4b['durationBars'],'sweepQuality':_0x10cf4b['qualityScore'],'volumeRatio':_0x10cf4b[_0x12e294(0x194)],'zoneType':_0x10cf4b['zone']['type'],'zoneLevel':_0x10cf4b['zone'][_0x12e294(0x139)](),'zoneTouches':_0x10cf4b[_0x12e294(0x16f)][_0x12e294(0x155)],'zoneQuality':_0x10cf4b['zone'][_0x12e294(0x1aa)],'expires':Date['now']()+0xea60};return this['emit'](_0x12e294(0x121),{'side':_0x3d7861===_0x12e294(0x1a8)?_0x12e294(0x151):'sell','action':_0x12e294(0x123),'reason':'2B\x20'+_0x10cf4b['sweepType']+_0x12e294(0x130)+_0x10cf4b['penetrationTicks']['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x10cf4b['volumeRatio']['toFixed'](0x1)+_0x12e294(0x198)+(_0x10cf4b['qualityScore']*0x64)[_0x12e294(0x192)](0x0)+'%',..._0xff5c2b}),this['emit'](_0x12e294(0x1ad),{'type':_0x12e294(0x187),'message':'[HQX-2B]\x20SIGNAL:\x20'+_0x3d7861[_0x12e294(0x15a)]()+_0x12e294(0x172)+_0x1487ea['toFixed'](0x2)+_0x12e294(0x127)+_0x10cf4b['sweepType']+_0x12e294(0x130)+_0x10cf4b['penetrationTicks'][_0x12e294(0x192)](0x1)+'t\x20Vol:'+_0x10cf4b[_0x12e294(0x194)]['toFixed'](0x1)+'x\x20|\x20Conf:'+(_0x280928*0x64)['toFixed'](0x0)+'%'}),_0xff5c2b;}[_0x3c2c79(0x17f)](_0x148f90,_0x38363f){const _0x5cdd8f=_0x3c2c79,_0x44cbcc=this[_0x5cdd8f(0x117)][_0x5cdd8f(0x14d)](_0x148f90)||[],_0x7c10e7=this[_0x5cdd8f(0x13b)]['get'](_0x148f90)||[],_0x25dd0c=this[_0x5cdd8f(0x17e)][_0x5cdd8f(0x14d)](_0x148f90)||[];if(_0x44cbcc[_0x5cdd8f(0x197)]<0x5)return{'ready':![],'message':_0x5cdd8f(0x16c)+_0x44cbcc[_0x5cdd8f(0x197)]+_0x5cdd8f(0x124)};const _0x2ff932=_0x7c10e7[_0x5cdd8f(0x18d)](_0x4d7d2a=>({'zone':_0x4d7d2a,'distance':Math['abs'](_0x38363f-_0x4d7d2a[_0x5cdd8f(0x139)]())}))[_0x5cdd8f(0x190)]((_0x19f3d4,_0x2b6c91)=>_0x19f3d4['distance']-_0x2b6c91[_0x5cdd8f(0x152)]),_0xacfc44=_0x2ff932[_0x5cdd8f(0x14e)](_0x17a28d=>_0x17a28d[_0x5cdd8f(0x16f)][_0x5cdd8f(0x145)]===ZoneType['RESISTANCE']),_0x34cc80=_0x2ff932[_0x5cdd8f(0x14e)](_0x203c43=>_0x203c43['zone'][_0x5cdd8f(0x145)]===ZoneType['SUPPORT']);return{'ready':!![],'barsProcessed':_0x44cbcc[_0x5cdd8f(0x197)],'swingsDetected':_0x25dd0c[_0x5cdd8f(0x197)],'activeZones':_0x7c10e7['length'],'nearestResistance':_0xacfc44?_0xacfc44[_0x5cdd8f(0x16f)]['getLevel']():null,'nearestSupport':_0x34cc80?_0x34cc80['zone']['getLevel']():null,'stopTicks':this[_0x5cdd8f(0x128)][_0x5cdd8f(0x18e)][_0x5cdd8f(0x17d)],'targetTicks':this[_0x5cdd8f(0x128)]['execution'][_0x5cdd8f(0x115)],'strategy':_0x5cdd8f(0x156)};}[_0x3c2c79(0x173)](_0x41d059){const _0xc6178f=_0x3c2c79;this[_0xc6178f(0x15b)][_0xc6178f(0x120)]({'netPnl':_0x41d059,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this['recentTrades'][_0xc6178f(0x135)]();_0x41d059>0x0?this['stats'][_0xc6178f(0x1a9)]++:this[_0xc6178f(0x193)]['losses']++,this['stats']['trades']++,this[_0xc6178f(0x193)]['pnl']+=_0x41d059,this['emit']('log',{'type':_0xc6178f(0x177),'message':'[HQX-2B]\x20Trade\x20result:\x20'+(_0x41d059>0x0?_0xc6178f(0x119):_0xc6178f(0x162))+'\x20$'+_0x41d059['toFixed'](0x2)});}['getBarHistory'](_0x24aeff){return this['barHistory']['get'](_0x24aeff)||[];}[_0x3c2c79(0x17c)](){return this['stats'];}[_0x3c2c79(0x18b)](_0x2af4f3){const _0x20a135=_0x3c2c79,_0xf3be6e=this[_0x20a135(0x117)]['get'](_0x2af4f3)||[],_0x20f361=this[_0x20a135(0x13b)][_0x20a135(0x14d)](_0x2af4f3)||[],_0x4a2ef7=this['swingPoints']['get'](_0x2af4f3)||[],_0x53eda4=this['currentBar'][_0x20a135(0x14d)](_0x2af4f3),_0x1bf284=_0xf3be6e[_0xf3be6e['length']-0x1],_0x2d0b8d=_0x1bf284?Date['now']()-_0x1bf284['timestamp']:null,_0x1c22ed=_0x20f361[_0x20a135(0x11c)](_0x138bfa=>_0x138bfa['type']===ZoneType['RESISTANCE'])['length'],_0x2a363f=_0x20f361['filter'](_0x5d761c=>_0x5d761c['type']===ZoneType['SUPPORT'])['length'];return{'healthy':_0xf3be6e[_0x20a135(0x197)]>=0x5,'barsTotal':_0xf3be6e['length'],'barsLast5Min':_0xf3be6e[_0x20a135(0x11c)](_0x5aca2d=>Date['now']()-_0x5aca2d['timestamp']<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x4a2ef7[_0x20a135(0x197)],'zonesResistance':_0x1c22ed,'zonesSupport':_0x2a363f,'zonesTotal':_0x20f361['length'],'currentBarTicks':_0x53eda4?_0x53eda4[_0x20a135(0x134)]:0x0,'isAggregating':_0x53eda4&&_0x53eda4[_0x20a135(0x134)]>0x0,'timeSinceLastBarMs':_0x2d0b8d,'lastSignalTime':this[_0x20a135(0x150)],'signalCooldownMs':this[_0x20a135(0x128)][_0x20a135(0x18e)]['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date['now']())};}['reset'](_0x204b27){const _0x2fe758=_0x3c2c79;this[_0x2fe758(0x117)][_0x2fe758(0x19f)](_0x204b27,[]),this[_0x2fe758(0x17e)]['set'](_0x204b27,[]),this[_0x2fe758(0x13b)]['set'](_0x204b27,[]),this[_0x2fe758(0x158)]['set'](_0x204b27,[]),this[_0x2fe758(0x13f)][_0x2fe758(0x188)](_0x204b27),this[_0x2fe758(0x1a2)](_0x2fe758(0x1ad),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x204b27});}['preloadBars'](_0x51174e,_0x50d3c4){const _0x1702ad=_0x3c2c79;if(!_0x50d3c4||_0x50d3c4['length']===0x0){this[_0x1702ad(0x1a2)](_0x1702ad(0x1ad),{'type':'debug','message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this[_0x1702ad(0x117)][_0x1702ad(0x1ae)](_0x51174e)&&this['initialize'](_0x51174e);const _0x26b1bc=[..._0x50d3c4]['sort']((_0x49cef0,_0x440a6f)=>_0x49cef0[_0x1702ad(0x184)]-_0x440a6f['timestamp']);this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x26b1bc[_0x1702ad(0x197)]+_0x1702ad(0x141)});let _0x46099c=0x0;for(const _0x6a6972 of _0x26b1bc){const _0x2d6015=this[_0x1702ad(0x133)](_0x51174e,_0x6a6972);if(_0x2d6015)_0x46099c++;}const _0x3bdbdc=this['barHistory'][_0x1702ad(0x14d)](_0x51174e)||[],_0x6235e9=this[_0x1702ad(0x17e)]['get'](_0x51174e)||[],_0x3c280b=this[_0x1702ad(0x13b)][_0x1702ad(0x14d)](_0x51174e)||[];this[_0x1702ad(0x1a2)]('log',{'type':'info','message':_0x1702ad(0x19b)+_0x3bdbdc[_0x1702ad(0x197)]+'\x20bars,\x20'+_0x6235e9[_0x1702ad(0x197)]+'\x20swings,\x20'+_0x3c280b[_0x1702ad(0x197)]+'\x20zones'}),_0x46099c>0x0&&this['emit']('log',{'type':'debug','message':'[HQX-2B]\x20'+_0x46099c+_0x1702ad(0x138)}),this[_0x1702ad(0x150)]=0x0;}}function _0x3286(_0x3044e3,_0x56310f){_0x3044e3=_0x3044e3-0x114;const _0x230694=_0x2306();let _0x32866b=_0x230694[_0x3044e3];return _0x32866b;}class HQX2BStrategy extends EventEmitter{constructor(_0x300ae8={}){const _0x5c848d=_0x3c2c79;super(),this[_0x5c848d(0x128)]=_0x300ae8,this[_0x5c848d(0x18a)]=new HQX2BLiquiditySweep(_0x300ae8),this['strategy']['on'](_0x5c848d(0x121),_0x570bcb=>this[_0x5c848d(0x1a2)]('signal',_0x570bcb)),this['strategy']['on'](_0x5c848d(0x1ad),_0x71898a=>this['emit']('log',_0x71898a));}['processTick'](_0x174544){const _0x302f2b=_0x3c2c79;return this[_0x302f2b(0x18a)][_0x302f2b(0x189)](_0x174544);}[_0x3c2c79(0x144)](_0x5c7d9c){const _0x4274bc=_0x3c2c79;return this[_0x4274bc(0x18a)]['onTick'](_0x5c7d9c);}[_0x3c2c79(0x143)](_0x163ba0){const _0x4f4246=_0x3c2c79;return this['strategy'][_0x4f4246(0x143)](_0x163ba0);}['processBar'](_0x1f5bd9,_0x2629d3){return this['strategy']['processBar'](_0x1f5bd9,_0x2629d3);}['initialize'](_0x3d64ff,_0x47305d,_0x604d79){return this['strategy']['initialize'](_0x3d64ff,_0x47305d,_0x604d79);}['getAnalysisState'](_0x5d93d8,_0x5dfcfb){const _0x2ba36d=_0x3c2c79;return this[_0x2ba36d(0x18a)]['getAnalysisState'](_0x5d93d8,_0x5dfcfb);}['recordTradeResult'](_0x3c2dc1){const _0x2cdbd6=_0x3c2c79;return this[_0x2cdbd6(0x18a)]['recordTradeResult'](_0x3c2dc1);}[_0x3c2c79(0x19c)](_0x411477){return this['strategy']['reset'](_0x411477);}['getStats'](){const _0x121bfc=_0x3c2c79;return this[_0x121bfc(0x18a)][_0x121bfc(0x17c)]();}[_0x3c2c79(0x186)](_0x3a9ae0){const _0x683ede=_0x3c2c79;return this[_0x683ede(0x18a)]['getBarHistory'](_0x3a9ae0);}[_0x3c2c79(0x132)](_0x477061,_0x5a6c68){return this['strategy']['preloadBars'](_0x477061,_0x5a6c68);}[_0x3c2c79(0x18b)](_0x450f8e){const _0x2af21b=_0x3c2c79;return this[_0x2af21b(0x18a)]['getHealthStatus'](_0x450f8e);}[_0x3c2c79(0x14a)](_0x4b30fc){return null;}}module[_0x3c2c79(0x15d)]={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
@@ -1 +1 @@
1
- const _0x41bd06=_0x21ae;function _0x48c5(){const _0x4e7db3=['long','_detectVolatilityRegime','vpinWindow','%,\x20OFI=','now','stats','length','strategy','priceBuffer','\x20VPIN:','ofi','WEAK','29230JdVFhQ',':\x20tick=','_calculateATR','653050yfbkEs','%,\x20cf=','emit','lossStreak','HQX_ULTRA_SCALPING_6MODELS','processBar','\x20Regime:','atrHistory','generateSignal','_computeZScore','pow','%\x20OFI:','low','set','losses','tickValue','getAnalysisState','847654bhGkfI','volatility','830992sveCRR','cooldownMs','filter','uuid','kyleLambda','normal','max','get','ofiLookback','getBarHistory','barHistory','events','min','318vNYpgx','winStreak','_computeOrderFlowImbalance','kalmanProcessNoise','tickSize','buy','kalmanMeasurementNoise','debug','_computeKyleLambda','volatilityLookback','pnl','3TtRwMa','getModelValues','slice','onTick','vpinToxicThreshold','breakevenTicks','3481356HPcOmZ','initialize','signals','profitLockPct','estimate',',\x20streak:\x20','onTrade','volume','ASK','baseStopTicks','close','toUpperCase','round','/50\x20bars','zscoreExitThreshold','sqrt','minHoldTimeMs','abs','push','recentTrades','_generateSignal','_computeVPIN','zscore','602415QhKgfm','log','lastSignalTime','shift','short','targetMultiplier','info','63nQYXIt','BID','reset','%\x20Kyle:','processTick','baseTargetTicks','1233701TQsHgu','minConfidence','sell','weights','kalmanStates','getStats','vpin','volumeBuffer','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','70xddyGO','stopMultiplier','[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)','signal','price','recordTradeResult','high','toFixed','reduce','shouldExitByZScore'];_0x48c5=function(){return _0x4e7db3;};return _0x48c5();}(function(_0x480416,_0x3fd8aa){const _0x266074=_0x21ae,_0x2c9339=_0x480416();while(!![]){try{const _0xaa1fe9=parseInt(_0x266074(0x237))/0x1+parseInt(_0x266074(0x226))/0x2+parseInt(_0x266074(0x1da))/0x3*(-parseInt(_0x266074(0x1e0))/0x4)+parseInt(_0x266074(0x223))/0x5*(parseInt(_0x266074(0x246))/0x6)+parseInt(_0x266074(0x204))/0x7+-parseInt(_0x266074(0x239))/0x8*(parseInt(_0x266074(0x1fe))/0x9)+parseInt(_0x266074(0x20d))/0xa*(parseInt(_0x266074(0x1f7))/0xb);if(_0xaa1fe9===_0x3fd8aa)break;else _0x2c9339['push'](_0x2c9339['shift']());}catch(_0x447511){_0x2c9339['push'](_0x2c9339['shift']());}}}(_0x48c5,0x6cece));function _0x21ae(_0x5c39c9,_0x5cd376){_0x5c39c9=_0x5c39c9-0x1da;const _0x48c5f1=_0x48c5();let _0x21ae40=_0x48c5f1[_0x5c39c9];return _0x21ae40;}const EventEmitter=require(_0x41bd06(0x244)),{v4:uuidv4}=require(_0x41bd06(0x23c)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x6c8c3b={}){const _0x5621ad=_0x41bd06;super(),this[_0x5621ad(0x24a)]=_0x6c8c3b[_0x5621ad(0x24a)]||0.25,this[_0x5621ad(0x235)]=_0x6c8c3b['tickValue']||0x5,this['zscoreEntryThreshold']=1.5,this[_0x5621ad(0x1ee)]=0.5,this[_0x5621ad(0x219)]=0x32,this[_0x5621ad(0x1de)]=0.7,this[_0x5621ad(0x249)]=0.01,this[_0x5621ad(0x24c)]=0.1,this[_0x5621ad(0x24f)]=0x64,this[_0x5621ad(0x241)]=0x14,this['baseStopTicks']=0x8,this[_0x5621ad(0x203)]=0x10,this[_0x5621ad(0x1df)]=0x4,this['profitLockPct']=0.5,this[_0x5621ad(0x205)]=0.55,this[_0x5621ad(0x207)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x5621ad(0x243)]=new Map(),this[_0x5621ad(0x21f)]=new Map(),this['volumeBuffer']=new Map(),this['kalmanStates']=new Map(),this['atrHistory']=new Map(),this[_0x5621ad(0x1f3)]=[],this[_0x5621ad(0x247)]=0x0,this[_0x5621ad(0x229)]=0x0,this['lastSignalTime']=0x0,this['cooldownMs']=0x7530,this[_0x5621ad(0x1f0)]=0x2710,this[_0x5621ad(0x21c)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x41bd06(0x1e1)](_0x5af076,_0xe0de06=0.25,_0x5cac00=0x5){const _0x3556fe=_0x41bd06;this['tickSize']=_0xe0de06,this['tickValue']=_0x5cac00,this[_0x3556fe(0x243)]['set'](_0x5af076,[]),this['priceBuffer']['set'](_0x5af076,[]),this[_0x3556fe(0x20b)][_0x3556fe(0x233)](_0x5af076,[]),this[_0x3556fe(0x22d)]['set'](_0x5af076,[]),this['kalmanStates'][_0x3556fe(0x233)](_0x5af076,{'estimate':0x0,'errorCovariance':0x1}),this[_0x3556fe(0x228)](_0x3556fe(0x1f8),{'type':_0x3556fe(0x1fd),'message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x5af076+_0x3556fe(0x224)+_0xe0de06+',\x20value='+_0x5cac00}),this[_0x3556fe(0x228)]('log',{'type':'info','message':_0x3556fe(0x20f)});}['processTick'](_0x336dd6){const {contractId:_0x4dca7a,price:_0xa81acf,volume:_0x133943,side:_0x254c22,timestamp:_0x324485}=_0x336dd6,_0x4ec5c6={'timestamp':_0x324485||Date['now'](),'open':_0xa81acf,'high':_0xa81acf,'low':_0xa81acf,'close':_0xa81acf,'volume':_0x133943||0x1};return this['processBar'](_0x4dca7a,_0x4ec5c6);}[_0x41bd06(0x1dd)](_0x5abc9a){return this['processTick'](_0x5abc9a);}[_0x41bd06(0x1e6)](_0x5cee6b){const _0x4c33e8=_0x41bd06;return this[_0x4c33e8(0x202)]({'contractId':_0x5cee6b['contractId']||_0x5cee6b['symbol'],'price':_0x5cee6b[_0x4c33e8(0x211)],'volume':_0x5cee6b['size']||_0x5cee6b[_0x4c33e8(0x1e7)]||0x1,'side':_0x5cee6b['side'],'timestamp':_0x5cee6b['timestamp']||Date['now']()});}['processBar'](_0x38be87,_0x450a59){const _0x1e07d3=_0x41bd06;let _0x36823a=this[_0x1e07d3(0x243)]['get'](_0x38be87);!_0x36823a&&(this['initialize'](_0x38be87),_0x36823a=this['barHistory'][_0x1e07d3(0x240)](_0x38be87));_0x36823a['push'](_0x450a59);if(_0x36823a[_0x1e07d3(0x21d)]>0x1f4)_0x36823a['shift']();const _0x20d723=this[_0x1e07d3(0x21f)][_0x1e07d3(0x240)](_0x38be87);_0x20d723['push'](_0x450a59[_0x1e07d3(0x1ea)]);if(_0x20d723[_0x1e07d3(0x21d)]>0xc8)_0x20d723['shift']();const _0x45e512=this[_0x1e07d3(0x20b)]['get'](_0x38be87),_0xdf1df3=_0x450a59[_0x1e07d3(0x213)]-_0x450a59['low'];let _0x26b127=_0x450a59[_0x1e07d3(0x1e7)]*0.5,_0x1aa31d=_0x450a59['volume']*0.5;if(_0xdf1df3>0x0){const _0x24e867=(_0x450a59['close']-_0x450a59[_0x1e07d3(0x232)])/_0xdf1df3;_0x26b127=_0x450a59[_0x1e07d3(0x1e7)]*_0x24e867,_0x1aa31d=_0x450a59['volume']*(0x1-_0x24e867);}_0x45e512[_0x1e07d3(0x1f2)]({'buy':_0x26b127,'sell':_0x1aa31d});if(_0x45e512['length']>0x64)_0x45e512[_0x1e07d3(0x1fa)]();if(_0x36823a[_0x1e07d3(0x21d)]<0x32)return null;const _0x1190a7=this[_0x1e07d3(0x22f)](_0x20d723),_0x145a48=this[_0x1e07d3(0x1f5)](_0x45e512),_0x51483c=this['_computeKyleLambda'](_0x36823a),_0x4b252d=this['_applyKalmanFilter'](_0x38be87,_0x450a59['close']),{regime:_0x4ad27f,params:_0x4a5cc1}=this['_detectVolatilityRegime'](_0x38be87,_0x36823a),_0x40c0e2=this['_computeOrderFlowImbalance'](_0x36823a);return this['_generateSignal'](_0x38be87,_0x450a59['close'],_0x1190a7,_0x145a48,_0x51483c,_0x4b252d,_0x4ad27f,_0x4a5cc1,_0x40c0e2,_0x36823a);}[_0x41bd06(0x22f)](_0x3fb1ea,_0x4171de=0x32){const _0x1f9557=_0x41bd06;if(_0x3fb1ea[_0x1f9557(0x21d)]<_0x4171de)return 0x0;const _0x3d41d9=_0x3fb1ea['slice'](-_0x4171de),_0x51b52d=_0x3d41d9[_0x1f9557(0x215)]((_0x178b50,_0x257fb1)=>_0x178b50+_0x257fb1,0x0)/_0x4171de,_0x43b8ff=_0x3d41d9[_0x1f9557(0x215)]((_0x32c984,_0x303dea)=>_0x32c984+Math[_0x1f9557(0x230)](_0x303dea-_0x51b52d,0x2),0x0)/_0x4171de,_0x561f07=Math[_0x1f9557(0x1ef)](_0x43b8ff);if(_0x561f07<0.0001)return 0x0;const _0x482fa2=_0x3fb1ea[_0x3fb1ea[_0x1f9557(0x21d)]-0x1];return(_0x482fa2-_0x51b52d)/_0x561f07;}['_computeVPIN'](_0x22e58d){const _0xe73c84=_0x41bd06;if(_0x22e58d['length']<this['vpinWindow'])return 0.5;const _0x1396af=_0x22e58d[_0xe73c84(0x1dc)](-this['vpinWindow']);let _0x191eb8=0x0,_0x4b3a71=0x0;for(const _0x1a2569 of _0x1396af){_0x191eb8+=_0x1a2569[_0xe73c84(0x24b)],_0x4b3a71+=_0x1a2569[_0xe73c84(0x206)];}const _0x51c14f=_0x191eb8+_0x4b3a71;if(_0x51c14f<0x1)return 0.5;return Math['abs'](_0x191eb8-_0x4b3a71)/_0x51c14f;}['_computeKyleLambda'](_0x27d0e2){const _0x562810=_0x41bd06;if(_0x27d0e2[_0x562810(0x21d)]<0x14)return 0x0;const _0x1acd0e=_0x27d0e2['slice'](-0x14),_0x50fa92=[],_0x72da0d=[];for(let _0xf46dcf=0x1;_0xf46dcf<_0x1acd0e[_0x562810(0x21d)];_0xf46dcf++){_0x50fa92['push'](_0x1acd0e[_0xf46dcf]['close']-_0x1acd0e[_0xf46dcf-0x1][_0x562810(0x1ea)]),_0x72da0d['push'](_0x1acd0e[_0xf46dcf]['volume']);}const _0x3874c0=_0x50fa92['reduce']((_0x4cd379,_0x1e05ca)=>_0x4cd379+_0x1e05ca,0x0)/_0x50fa92[_0x562810(0x21d)],_0x37b9f1=_0x72da0d[_0x562810(0x215)]((_0x323930,_0x49ac07)=>_0x323930+_0x49ac07,0x0)/_0x72da0d['length'];let _0x29a830=0x0,_0x57ed47=0x0;for(let _0x51f0f6=0x0;_0x51f0f6<_0x50fa92['length'];_0x51f0f6++){_0x29a830+=(_0x50fa92[_0x51f0f6]-_0x3874c0)*(_0x72da0d[_0x51f0f6]-_0x37b9f1),_0x57ed47+=Math[_0x562810(0x230)](_0x72da0d[_0x51f0f6]-_0x37b9f1,0x2);}_0x29a830/=_0x50fa92['length'],_0x57ed47/=_0x50fa92['length'];if(_0x57ed47<0.0001)return 0x0;return Math[_0x562810(0x1f1)](_0x29a830/_0x57ed47);}['_applyKalmanFilter'](_0x56905a,_0x20d110){const _0x4bd344=_0x41bd06;let _0x25624b=this[_0x4bd344(0x208)][_0x4bd344(0x240)](_0x56905a);if(!_0x25624b)return _0x25624b={'estimate':_0x20d110,'errorCovariance':0x1},this['kalmanStates']['set'](_0x56905a,_0x25624b),_0x20d110;const _0x4fddd0=_0x25624b[_0x4bd344(0x1e4)],_0x4b6418=_0x25624b['errorCovariance']+this['kalmanProcessNoise'],_0x2894ff=_0x4b6418/(_0x4b6418+this[_0x4bd344(0x24c)]),_0x473d4a=_0x4fddd0+_0x2894ff*(_0x20d110-_0x4fddd0),_0x903701=(0x1-_0x2894ff)*_0x4b6418;return _0x25624b['estimate']=_0x473d4a,_0x25624b['errorCovariance']=_0x903701,_0x473d4a;}[_0x41bd06(0x218)](_0x4604d4,_0x36112f){const _0x41c46a=_0x41bd06,_0x3508a8=this[_0x41c46a(0x225)](_0x36112f),_0xe9b967=_0x3508a8/this[_0x41c46a(0x24a)];let _0x19cef1=this['atrHistory']['get'](_0x4604d4);!_0x19cef1&&(_0x19cef1=[],this[_0x41c46a(0x22d)][_0x41c46a(0x233)](_0x4604d4,_0x19cef1));_0x19cef1[_0x41c46a(0x1f2)](_0x3508a8);if(_0x19cef1[_0x41c46a(0x21d)]>0x1f4)_0x19cef1['shift']();let _0x43c6fd=0.5;_0x19cef1['length']>=0x14&&(_0x43c6fd=_0x19cef1[_0x41c46a(0x23b)](_0x3d4d88=>_0x3d4d88<=_0x3508a8)[_0x41c46a(0x21d)]/_0x19cef1[_0x41c46a(0x21d)]);let _0x46352b,_0x5648c9;if(_0x43c6fd<0.25)_0x46352b='low',_0x5648c9={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x43c6fd<0.75?(_0x46352b=_0x41c46a(0x23e),_0x5648c9={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x46352b=_0x41c46a(0x213),_0x5648c9={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x46352b,'params':_0x5648c9};}[_0x41bd06(0x225)](_0x22abe9,_0x53b3bf=0xe){const _0x56cec0=_0x41bd06;if(_0x22abe9['length']<_0x53b3bf+0x1)return 2.5;const _0x50e946=[];for(let _0x3fa8a6=_0x22abe9[_0x56cec0(0x21d)]-_0x53b3bf;_0x3fa8a6<_0x22abe9['length'];_0x3fa8a6++){const _0x2bfd5e=_0x22abe9[_0x3fa8a6],_0xc65006=_0x22abe9[_0x3fa8a6-0x1][_0x56cec0(0x1ea)],_0x77959b=Math['max'](_0x2bfd5e[_0x56cec0(0x213)]-_0x2bfd5e[_0x56cec0(0x232)],Math['abs'](_0x2bfd5e[_0x56cec0(0x213)]-_0xc65006),Math[_0x56cec0(0x1f1)](_0x2bfd5e[_0x56cec0(0x232)]-_0xc65006));_0x50e946['push'](_0x77959b);}return _0x50e946['reduce']((_0x1623e9,_0x177141)=>_0x1623e9+_0x177141,0x0)/_0x50e946['length'];}['_computeOrderFlowImbalance'](_0x48f64e){const _0x2c6b1e=_0x41bd06;if(_0x48f64e['length']<this['ofiLookback'])return 0x0;const _0x4a8421=_0x48f64e['slice'](-this[_0x2c6b1e(0x241)]);let _0x12f37a=0x0,_0xf0a715=0x0;for(const _0x277a0d of _0x4a8421){const _0x5d1a0b=_0x277a0d[_0x2c6b1e(0x213)]-_0x277a0d[_0x2c6b1e(0x232)];if(_0x5d1a0b>0x0){const _0x2c7f48=(_0x277a0d[_0x2c6b1e(0x1ea)]-_0x277a0d['low'])/_0x5d1a0b;_0x12f37a+=_0x2c7f48*_0x277a0d['volume'],_0xf0a715+=(0x1-_0x2c7f48)*_0x277a0d[_0x2c6b1e(0x1e7)];}}const _0xf6c99f=_0x12f37a+_0xf0a715;if(_0xf6c99f<0x1)return 0x0;return(_0x12f37a-_0xf0a715)/_0xf6c99f;}[_0x41bd06(0x1f4)](_0xb26a83,_0x4d8e8f,_0x4d95bf,_0xbff631,_0x4907b8,_0x53b747,_0x4d6df2,_0x56f5f9,_0x3b4daa,_0x2738d0){const _0x13fc65=_0x41bd06,_0x41ed19=Math['abs'](_0x4d95bf);if(_0x41ed19<_0x56f5f9['zscoreThreshold'])return null;if(_0xbff631>this[_0x13fc65(0x1de)])return null;let _0x3dd068;if(_0x4d95bf<-_0x56f5f9['zscoreThreshold'])_0x3dd068=_0x13fc65(0x217);else{if(_0x4d95bf>_0x56f5f9['zscoreThreshold'])_0x3dd068=_0x13fc65(0x1fb);else return null;}const _0x20c480=_0x3dd068===_0x13fc65(0x217)&&_0x3b4daa>0.1||_0x3dd068===_0x13fc65(0x1fb)&&_0x3b4daa<-0.1,_0x957233=_0x4d8e8f-_0x53b747,_0x556d92=_0x3dd068==='long'&&_0x957233<0x0||_0x3dd068==='short'&&_0x957233>0x0,_0x48d3a9={'zscore':Math[_0x13fc65(0x245)](0x1,_0x41ed19/0x4),'vpin':0x1-_0xbff631,'kyleLambda':_0x4907b8>0.001?0.5:0.8,'kalman':_0x556d92?0.8:0.4,'volatility':_0x4d6df2==='normal'?0.8:_0x4d6df2==='low'?0.7:0.6,'ofi':_0x20c480?0.9:0.5,'composite':0x0};_0x48d3a9['composite']=_0x48d3a9[_0x13fc65(0x1f6)]*this[_0x13fc65(0x207)][_0x13fc65(0x1f6)]+_0x48d3a9[_0x13fc65(0x20a)]*this[_0x13fc65(0x207)][_0x13fc65(0x20a)]+_0x48d3a9['kyleLambda']*this['weights'][_0x13fc65(0x23d)]+_0x48d3a9['kalman']*this['weights']['kalman']+_0x48d3a9[_0x13fc65(0x238)]*this[_0x13fc65(0x207)][_0x13fc65(0x238)]+_0x48d3a9['ofi']*this['weights'][_0x13fc65(0x221)];const _0x331b01=Math[_0x13fc65(0x245)](0x1,_0x48d3a9['composite']+_0x56f5f9['confidenceBonus']);if(_0x331b01<this[_0x13fc65(0x205)])return null;if(Date[_0x13fc65(0x21b)]()-this[_0x13fc65(0x1f9)]<this[_0x13fc65(0x23a)])return null;const _0xe98fab=Math['round'](this[_0x13fc65(0x1e9)]*_0x56f5f9['stopMultiplier']),_0x588bf5=Math[_0x13fc65(0x1ec)](this['baseTargetTicks']*_0x56f5f9[_0x13fc65(0x1fc)]),_0x3e1806=Math[_0x13fc65(0x23f)](0x6,Math['min'](0xc,_0xe98fab)),_0x16c480=Math['max'](_0x3e1806*1.5,Math[_0x13fc65(0x245)](0x18,_0x588bf5));let _0x101298,_0x2ccb3e,_0x467185,_0x494528;_0x3dd068==='long'?(_0x101298=_0x4d8e8f-_0x3e1806*this['tickSize'],_0x2ccb3e=_0x4d8e8f+_0x16c480*this[_0x13fc65(0x24a)],_0x467185=_0x4d8e8f+this[_0x13fc65(0x1df)]*this[_0x13fc65(0x24a)],_0x494528=_0x4d8e8f+_0x16c480*this[_0x13fc65(0x1e3)]*this[_0x13fc65(0x24a)]):(_0x101298=_0x4d8e8f+_0x3e1806*this['tickSize'],_0x2ccb3e=_0x4d8e8f-_0x16c480*this['tickSize'],_0x467185=_0x4d8e8f-this['breakevenTicks']*this[_0x13fc65(0x24a)],_0x494528=_0x4d8e8f-_0x16c480*this[_0x13fc65(0x1e3)]*this['tickSize']);const _0x480741=_0x16c480/_0x3e1806,_0x10c108=Math[_0x13fc65(0x1ec)](_0x16c480*0.5),_0x15bfb4=Math['round'](_0x3e1806*0.4);let _0x459b80=SignalStrength['MODERATE'];if(_0x331b01>=0.85)_0x459b80=SignalStrength['VERY_STRONG'];else{if(_0x331b01>=0.75)_0x459b80=SignalStrength['STRONG'];else{if(_0x331b01<0.6)_0x459b80=SignalStrength[_0x13fc65(0x222)];}}const _0x339366=0.5+(_0x331b01-0.5)*0.4,_0x57a91f=_0x339366*Math['abs'](_0x2ccb3e-_0x4d8e8f)-(0x1-_0x339366)*Math['abs'](_0x4d8e8f-_0x101298);this[_0x13fc65(0x1f9)]=Date['now'](),this[_0x13fc65(0x21c)][_0x13fc65(0x1e2)]++;const _0x332b01={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0xb26a83['split']('.')[0x0]||_0xb26a83,'contractId':_0xb26a83,'side':_0x3dd068===_0x13fc65(0x217)?OrderSide[_0x13fc65(0x1ff)]:OrderSide[_0x13fc65(0x1e8)],'direction':_0x3dd068,'strategy':_0x13fc65(0x22a),'strength':_0x459b80,'edge':_0x57a91f,'confidence':_0x331b01,'entry':_0x4d8e8f,'entryPrice':_0x4d8e8f,'stopLoss':_0x101298,'takeProfit':_0x2ccb3e,'riskReward':_0x480741,'stopTicks':_0x3e1806,'targetTicks':_0x16c480,'trailTriggerTicks':_0x10c108,'trailDistanceTicks':_0x15bfb4,'beBreakeven':_0x467185,'profitLockLevel':_0x494528,'zScore':_0x4d95bf,'zScoreExit':this[_0x13fc65(0x1ee)],'vpinValue':_0xbff631,'kyleLambda':_0x4907b8,'kalmanEstimate':_0x53b747,'volatilityRegime':_0x4d6df2,'ofiValue':_0x3b4daa,'models':_0x48d3a9,'orderFlowConfirmed':_0x20c480,'kalmanConfirmed':_0x556d92,'expires':Date[_0x13fc65(0x21b)]()+0xea60};return this['emit'](_0x13fc65(0x210),{'side':_0x3dd068==='long'?'buy':_0x13fc65(0x206),'action':'open','reason':'Z='+_0x4d95bf[_0x13fc65(0x214)](0x2)+',\x20VPIN='+(_0xbff631*0x64)[_0x13fc65(0x214)](0x0)+_0x13fc65(0x21a)+(_0x3b4daa*0x64)['toFixed'](0x0)+_0x13fc65(0x227)+(_0x331b01*0x64)[_0x13fc65(0x214)](0x0)+'%',..._0x332b01}),this['emit'](_0x13fc65(0x1f8),{'type':_0x13fc65(0x1fd),'message':'[HQX]\x20SIGNAL:\x20'+_0x3dd068[_0x13fc65(0x1eb)]()+'\x20@\x20'+_0x4d8e8f['toFixed'](0x2)+'\x20|\x20Z:'+_0x4d95bf['toFixed'](0x2)+_0x13fc65(0x220)+(_0xbff631*0x64)[_0x13fc65(0x214)](0x0)+_0x13fc65(0x231)+(_0x3b4daa*0x64)[_0x13fc65(0x214)](0x0)+_0x13fc65(0x201)+_0x4907b8['toFixed'](0x5)+_0x13fc65(0x22c)+_0x4d6df2+'\x20|\x20Conf:'+(_0x331b01*0x64)['toFixed'](0x0)+'%'}),_0x332b01;}['shouldExitByZScore'](_0x2f1ca1){const _0x3ae19e=_0x41bd06,_0x4cdbc6=this[_0x3ae19e(0x21f)][_0x3ae19e(0x240)](_0x2f1ca1);if(!_0x4cdbc6||_0x4cdbc6[_0x3ae19e(0x21d)]<0x32)return![];const _0x5ca7d5=this['_computeZScore'](_0x4cdbc6);return Math[_0x3ae19e(0x1f1)](_0x5ca7d5)<this['zscoreExitThreshold'];}[_0x41bd06(0x1db)](_0x127ec6){const _0x52ea56=_0x41bd06,_0x20b498=this['priceBuffer'][_0x52ea56(0x240)](_0x127ec6),_0x2ecac2=this['volumeBuffer']['get'](_0x127ec6),_0x402fd6=this['barHistory'][_0x52ea56(0x240)](_0x127ec6);if(!_0x20b498||!_0x2ecac2||!_0x402fd6||_0x402fd6[_0x52ea56(0x21d)]<0x32)return null;const _0x437a6a=this[_0x52ea56(0x22f)](_0x20b498),_0x4d7ac3=this[_0x52ea56(0x1f5)](_0x2ecac2),_0x51c0a0=this['_computeKyleLambda'](_0x402fd6),_0x20ca1b=this['_computeOrderFlowImbalance'](_0x402fd6);return{'zscore':Math[_0x52ea56(0x245)](0x1,Math['abs'](_0x437a6a)/0x4),'vpin':0x1-_0x4d7ac3,'kyleLambda':_0x51c0a0>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x20ca1b)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x437a6a,'vpin':_0x4d7ac3,'kyleLambda':_0x51c0a0,'ofi':_0x20ca1b}};}['getAnalysisState'](_0x4386de,_0xfdcc07){const _0x4abd40=_0x41bd06,_0x50cdd5=this['barHistory'][_0x4abd40(0x240)](_0x4386de)||[];if(_0x50cdd5['length']<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x50cdd5[_0x4abd40(0x21d)]+_0x4abd40(0x1ed)};const _0x4f1aef=this['priceBuffer'][_0x4abd40(0x240)](_0x4386de)||[],_0x3a12a2=this[_0x4abd40(0x20b)][_0x4abd40(0x240)](_0x4386de)||[],_0x349f60=this['_computeZScore'](_0x4f1aef),_0x1e8a40=this[_0x4abd40(0x1f5)](_0x3a12a2),_0x4fd1cd=this[_0x4abd40(0x248)](_0x50cdd5),_0x49bfa3=this[_0x4abd40(0x24e)](_0x50cdd5),{regime:_0x30738f,params:_0x22b4c4}=this[_0x4abd40(0x218)](_0x4386de,_0x50cdd5);return{'ready':!![],'zScore':_0x349f60,'vpin':_0x1e8a40,'ofi':_0x4fd1cd,'kyleLambda':_0x49bfa3,'regime':_0x30738f,'stopTicks':Math[_0x4abd40(0x1ec)](this['baseStopTicks']*_0x22b4c4[_0x4abd40(0x20e)]),'targetTicks':Math['round'](this['baseTargetTicks']*_0x22b4c4['targetMultiplier']),'threshold':_0x22b4c4['zscoreThreshold'],'barsProcessed':_0x50cdd5['length'],'models':_0x4abd40(0x20c)};}[_0x41bd06(0x212)](_0x31b2d8){const _0x592335=_0x41bd06;this[_0x592335(0x1f3)]['push']({'netPnl':_0x31b2d8,'timestamp':Date[_0x592335(0x21b)]()});if(this['recentTrades'][_0x592335(0x21d)]>0x64)this['recentTrades']['shift']();_0x31b2d8>0x0?(this['winStreak']++,this['lossStreak']=0x0,this[_0x592335(0x21c)]['wins']++):(this['lossStreak']++,this['winStreak']=0x0,this['stats'][_0x592335(0x234)]++),this['stats']['trades']++,this[_0x592335(0x21c)][_0x592335(0x250)]+=_0x31b2d8,this[_0x592335(0x228)]('log',{'type':_0x592335(0x24d),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x31b2d8>0x0?'WIN':'LOSS')+'\x20$'+_0x31b2d8['toFixed'](0x2)+_0x592335(0x1e5)+(_0x31b2d8>0x0?this[_0x592335(0x247)]:-this[_0x592335(0x229)])});}['getBarHistory'](_0x5a2626){return this['barHistory']['get'](_0x5a2626)||[];}['getStats'](){return this['stats'];}[_0x41bd06(0x200)](_0x17a0b2){const _0x317f70=_0x41bd06;this[_0x317f70(0x243)]['set'](_0x17a0b2,[]),this['priceBuffer'][_0x317f70(0x233)](_0x17a0b2,[]),this['volumeBuffer']['set'](_0x17a0b2,[]),this['atrHistory']['set'](_0x17a0b2,[]),this[_0x317f70(0x208)][_0x317f70(0x233)](_0x17a0b2,{'estimate':0x0,'errorCovariance':0x1}),this['emit'](_0x317f70(0x1f8),{'type':_0x317f70(0x1fd),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x17a0b2});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x6f7ee={}){const _0x2ab7b3=_0x41bd06;super(),this['config']=_0x6f7ee,this['strategy']=new HQXUltraScalping(_0x6f7ee),this['strategy']['on'](_0x2ab7b3(0x210),_0x5f3e0a=>this['emit']('signal',_0x5f3e0a)),this['strategy']['on']('log',_0x1342c7=>this[_0x2ab7b3(0x228)]('log',_0x1342c7));}[_0x41bd06(0x202)](_0x18fe95){const _0x274f6e=_0x41bd06;return this[_0x274f6e(0x21e)]['processTick'](_0x18fe95);}['onTick'](_0x16ece7){const _0x28bff4=_0x41bd06;return this[_0x28bff4(0x21e)][_0x28bff4(0x1dd)](_0x16ece7);}['onTrade'](_0x5d26a3){const _0x3af181=_0x41bd06;return this[_0x3af181(0x21e)][_0x3af181(0x1e6)](_0x5d26a3);}['processBar'](_0x16c6f3,_0x11b017){const _0x3660ce=_0x41bd06;return this[_0x3660ce(0x21e)][_0x3660ce(0x22b)](_0x16c6f3,_0x11b017);}[_0x41bd06(0x1e1)](_0x17dddd,_0x36331e,_0x3c8bd7){const _0x693100=_0x41bd06;return this['strategy'][_0x693100(0x1e1)](_0x17dddd,_0x36331e,_0x3c8bd7);}[_0x41bd06(0x236)](_0x40c2c2,_0x4e9d3f){const _0x41628c=_0x41bd06;return this['strategy'][_0x41628c(0x236)](_0x40c2c2,_0x4e9d3f);}['recordTradeResult'](_0x4886c4){const _0x37fcab=_0x41bd06;return this[_0x37fcab(0x21e)][_0x37fcab(0x212)](_0x4886c4);}['reset'](_0x33b827){const _0xfd6755=_0x41bd06;return this['strategy'][_0xfd6755(0x200)](_0x33b827);}[_0x41bd06(0x209)](){const _0x1588d7=_0x41bd06;return this['strategy'][_0x1588d7(0x209)]();}[_0x41bd06(0x242)](_0x15f622){return this['strategy']['getBarHistory'](_0x15f622);}[_0x41bd06(0x1db)](_0x32261c){const _0x192706=_0x41bd06;return this['strategy'][_0x192706(0x1db)](_0x32261c);}[_0x41bd06(0x216)](_0x4edb82){const _0x4cc465=_0x41bd06;return this[_0x4cc465(0x21e)][_0x4cc465(0x216)](_0x4edb82);}[_0x41bd06(0x22e)](_0x3ed470){return null;}}module['exports']={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
1
+ const _0x2f642f=_0xc24e;(function(_0x534985,_0x43b609){const _0x144ed8=_0xc24e,_0x4f2c1b=_0x534985();while(!![]){try{const _0x14585b=parseInt(_0x144ed8(0x1c1))/0x1+parseInt(_0x144ed8(0x209))/0x2*(parseInt(_0x144ed8(0x1d3))/0x3)+parseInt(_0x144ed8(0x1cd))/0x4+-parseInt(_0x144ed8(0x222))/0x5*(-parseInt(_0x144ed8(0x1c5))/0x6)+parseInt(_0x144ed8(0x1f9))/0x7*(parseInt(_0x144ed8(0x1fe))/0x8)+parseInt(_0x144ed8(0x20a))/0x9+-parseInt(_0x144ed8(0x1eb))/0xa*(parseInt(_0x144ed8(0x221))/0xb);if(_0x14585b===_0x43b609)break;else _0x4f2c1b['push'](_0x4f2c1b['shift']());}catch(_0x4967e7){_0x4f2c1b['push'](_0x4f2c1b['shift']());}}}(_0x48c6,0x5f6c4));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x2f642f(0x1de)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0xc24e(_0x283884,_0x5434b3){_0x283884=_0x283884-0x1c1;const _0x48c67c=_0x48c6();let _0xc24e09=_0x48c67c[_0x283884];return _0xc24e09;}class HQXUltraScalping extends EventEmitter{constructor(_0x2414d4={}){const _0x3f1b40=_0x2f642f;super(),this['tickSize']=_0x2414d4[_0x3f1b40(0x225)]||0.25,this['tickValue']=_0x2414d4[_0x3f1b40(0x1ec)]||0x5,this[_0x3f1b40(0x1f8)]=1.5,this[_0x3f1b40(0x1f0)]=0.5,this[_0x3f1b40(0x22b)]=0x32,this['vpinToxicThreshold']=0.7,this['kalmanProcessNoise']=0.01,this[_0x3f1b40(0x1ca)]=0.1,this[_0x3f1b40(0x214)]=0x64,this['ofiLookback']=0x14,this[_0x3f1b40(0x204)]=0x8,this['baseTargetTicks']=0x10,this[_0x3f1b40(0x207)]=0x4,this[_0x3f1b40(0x21b)]=0.5,this[_0x3f1b40(0x1d7)]=0.55,this[_0x3f1b40(0x1cf)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this['barHistory']=new Map(),this['priceBuffer']=new Map(),this[_0x3f1b40(0x228)]=new Map(),this[_0x3f1b40(0x1f5)]=new Map(),this[_0x3f1b40(0x1da)]=new Map(),this[_0x3f1b40(0x22c)]=[],this['winStreak']=0x0,this[_0x3f1b40(0x1c7)]=0x0,this['lastSignalTime']=0x0,this[_0x3f1b40(0x1d2)]=0x7530,this['minHoldTimeMs']=0x2710,this[_0x3f1b40(0x218)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0x399a09,_0x345ef3=0.25,_0x2b342b=0x5){const _0x22c560=_0x2f642f;this['tickSize']=_0x345ef3,this[_0x22c560(0x1ec)]=_0x2b342b,this['barHistory'][_0x22c560(0x1e4)](_0x399a09,[]),this['priceBuffer'][_0x22c560(0x1e4)](_0x399a09,[]),this['volumeBuffer']['set'](_0x399a09,[]),this[_0x22c560(0x1da)][_0x22c560(0x1e4)](_0x399a09,[]),this['kalmanStates'][_0x22c560(0x1e4)](_0x399a09,{'estimate':0x0,'errorCovariance':0x1}),this[_0x22c560(0x1e3)](_0x22c560(0x21c),{'type':_0x22c560(0x1fb),'message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x399a09+_0x22c560(0x22f)+_0x345ef3+_0x22c560(0x227)+_0x2b342b}),this['emit']('log',{'type':_0x22c560(0x1fb),'message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}[_0x2f642f(0x1e7)](_0x75bef9){const _0x1da886=_0x2f642f,{contractId:_0x20709,price:_0x3c4554,volume:_0x59081c,side:_0x4553c2,timestamp:_0x329465}=_0x75bef9,_0x311f44={'timestamp':_0x329465||Date[_0x1da886(0x1d4)](),'open':_0x3c4554,'high':_0x3c4554,'low':_0x3c4554,'close':_0x3c4554,'volume':_0x59081c||0x1};return this[_0x1da886(0x1f7)](_0x20709,_0x311f44);}['onTick'](_0x2bb0ab){const _0x2f43a1=_0x2f642f;return this[_0x2f43a1(0x1e7)](_0x2bb0ab);}[_0x2f642f(0x1c3)](_0x409667){const _0x5b3a82=_0x2f642f;return this['processTick']({'contractId':_0x409667['contractId']||_0x409667['symbol'],'price':_0x409667['price'],'volume':_0x409667['size']||_0x409667[_0x5b3a82(0x20f)]||0x1,'side':_0x409667['side'],'timestamp':_0x409667['timestamp']||Date[_0x5b3a82(0x1d4)]()});}['processBar'](_0x26a6fa,_0x5b1f4c){const _0x4a78ef=_0x2f642f;let _0xf19f87=this[_0x4a78ef(0x1d6)]['get'](_0x26a6fa);!_0xf19f87&&(this['initialize'](_0x26a6fa),_0xf19f87=this[_0x4a78ef(0x1d6)][_0x4a78ef(0x21f)](_0x26a6fa));_0xf19f87[_0x4a78ef(0x202)](_0x5b1f4c);if(_0xf19f87['length']>0x1f4)_0xf19f87[_0x4a78ef(0x203)]();const _0x35caf7=this['priceBuffer'][_0x4a78ef(0x21f)](_0x26a6fa);_0x35caf7['push'](_0x5b1f4c[_0x4a78ef(0x1e0)]);if(_0x35caf7[_0x4a78ef(0x219)]>0xc8)_0x35caf7[_0x4a78ef(0x203)]();const _0x561b2f=this[_0x4a78ef(0x228)]['get'](_0x26a6fa),_0x572621=_0x5b1f4c[_0x4a78ef(0x210)]-_0x5b1f4c['low'];let _0x541019=_0x5b1f4c['volume']*0.5,_0x548299=_0x5b1f4c['volume']*0.5;if(_0x572621>0x0){const _0x34f7a3=(_0x5b1f4c['close']-_0x5b1f4c[_0x4a78ef(0x1cb)])/_0x572621;_0x541019=_0x5b1f4c[_0x4a78ef(0x20f)]*_0x34f7a3,_0x548299=_0x5b1f4c[_0x4a78ef(0x20f)]*(0x1-_0x34f7a3);}_0x561b2f['push']({'buy':_0x541019,'sell':_0x548299});if(_0x561b2f['length']>0x64)_0x561b2f['shift']();if(_0xf19f87[_0x4a78ef(0x219)]<0x32)return null;const _0x31da01=this['_computeZScore'](_0x35caf7),_0x56ba55=this[_0x4a78ef(0x1ce)](_0x561b2f),_0x2673a5=this['_computeKyleLambda'](_0xf19f87),_0x16f9fd=this['_applyKalmanFilter'](_0x26a6fa,_0x5b1f4c[_0x4a78ef(0x1e0)]),{regime:_0x412535,params:_0x116ada}=this['_detectVolatilityRegime'](_0x26a6fa,_0xf19f87),_0x4bf2f5=this[_0x4a78ef(0x1ee)](_0xf19f87);return this['_generateSignal'](_0x26a6fa,_0x5b1f4c[_0x4a78ef(0x1e0)],_0x31da01,_0x56ba55,_0x2673a5,_0x16f9fd,_0x412535,_0x116ada,_0x4bf2f5,_0xf19f87);}['_computeZScore'](_0x1161cd,_0x164df5=0x32){const _0x29e0cd=_0x2f642f;if(_0x1161cd[_0x29e0cd(0x219)]<_0x164df5)return 0x0;const _0xca41d6=_0x1161cd[_0x29e0cd(0x201)](-_0x164df5),_0x3d6b74=_0xca41d6[_0x29e0cd(0x21a)]((_0x438fb5,_0x5d2b28)=>_0x438fb5+_0x5d2b28,0x0)/_0x164df5,_0x3f2d03=_0xca41d6['reduce']((_0x31e357,_0xa39a04)=>_0x31e357+Math['pow'](_0xa39a04-_0x3d6b74,0x2),0x0)/_0x164df5,_0x56c7a2=Math['sqrt'](_0x3f2d03);if(_0x56c7a2<0.0001)return 0x0;const _0x101e32=_0x1161cd[_0x1161cd['length']-0x1];return(_0x101e32-_0x3d6b74)/_0x56c7a2;}[_0x2f642f(0x1ce)](_0x396c66){const _0x47d144=_0x2f642f;if(_0x396c66[_0x47d144(0x219)]<this['vpinWindow'])return 0.5;const _0x3437ba=_0x396c66['slice'](-this[_0x47d144(0x22b)]);let _0x2c7542=0x0,_0x5c01ab=0x0;for(const _0x448869 of _0x3437ba){_0x2c7542+=_0x448869['buy'],_0x5c01ab+=_0x448869[_0x47d144(0x200)];}const _0x430093=_0x2c7542+_0x5c01ab;if(_0x430093<0x1)return 0.5;return Math['abs'](_0x2c7542-_0x5c01ab)/_0x430093;}[_0x2f642f(0x20c)](_0x2ecd65){const _0x24d324=_0x2f642f;if(_0x2ecd65[_0x24d324(0x219)]<0x14)return 0x0;const _0x158b71=_0x2ecd65['slice'](-0x14),_0x25477e=[],_0xbe90ab=[];for(let _0x48142a=0x1;_0x48142a<_0x158b71['length'];_0x48142a++){_0x25477e[_0x24d324(0x202)](_0x158b71[_0x48142a][_0x24d324(0x1e0)]-_0x158b71[_0x48142a-0x1]['close']),_0xbe90ab[_0x24d324(0x202)](_0x158b71[_0x48142a]['volume']);}const _0x56e280=_0x25477e[_0x24d324(0x21a)]((_0x35b610,_0x11c18c)=>_0x35b610+_0x11c18c,0x0)/_0x25477e['length'],_0x294f35=_0xbe90ab['reduce']((_0x7fc270,_0x4ee76a)=>_0x7fc270+_0x4ee76a,0x0)/_0xbe90ab[_0x24d324(0x219)];let _0x5675fd=0x0,_0x302fd0=0x0;for(let _0x485f43=0x0;_0x485f43<_0x25477e[_0x24d324(0x219)];_0x485f43++){_0x5675fd+=(_0x25477e[_0x485f43]-_0x56e280)*(_0xbe90ab[_0x485f43]-_0x294f35),_0x302fd0+=Math['pow'](_0xbe90ab[_0x485f43]-_0x294f35,0x2);}_0x5675fd/=_0x25477e['length'],_0x302fd0/=_0x25477e[_0x24d324(0x219)];if(_0x302fd0<0.0001)return 0x0;return Math[_0x24d324(0x1e8)](_0x5675fd/_0x302fd0);}[_0x2f642f(0x1c4)](_0x30a1f0,_0x5665d3){const _0x1639e6=_0x2f642f;let _0x2ad690=this[_0x1639e6(0x1f5)]['get'](_0x30a1f0);if(!_0x2ad690)return _0x2ad690={'estimate':_0x5665d3,'errorCovariance':0x1},this[_0x1639e6(0x1f5)][_0x1639e6(0x1e4)](_0x30a1f0,_0x2ad690),_0x5665d3;const _0x1592b8=_0x2ad690[_0x1639e6(0x224)],_0x5d2221=_0x2ad690[_0x1639e6(0x1d9)]+this['kalmanProcessNoise'],_0x242476=_0x5d2221/(_0x5d2221+this['kalmanMeasurementNoise']),_0x206629=_0x1592b8+_0x242476*(_0x5665d3-_0x1592b8),_0x9d4e0d=(0x1-_0x242476)*_0x5d2221;return _0x2ad690['estimate']=_0x206629,_0x2ad690['errorCovariance']=_0x9d4e0d,_0x206629;}[_0x2f642f(0x1fc)](_0x114c0f,_0x36e0ae){const _0x42027e=_0x2f642f,_0x270f51=this['_calculateATR'](_0x36e0ae),_0x1bcad5=_0x270f51/this['tickSize'];let _0x327f56=this[_0x42027e(0x1da)][_0x42027e(0x21f)](_0x114c0f);!_0x327f56&&(_0x327f56=[],this['atrHistory']['set'](_0x114c0f,_0x327f56));_0x327f56['push'](_0x270f51);if(_0x327f56[_0x42027e(0x219)]>0x1f4)_0x327f56[_0x42027e(0x203)]();let _0x49426c=0.5;_0x327f56[_0x42027e(0x219)]>=0x14&&(_0x49426c=_0x327f56['filter'](_0x280a36=>_0x280a36<=_0x270f51)['length']/_0x327f56[_0x42027e(0x219)]);let _0x4f0473,_0x49115d;if(_0x49426c<0.25)_0x4f0473='low',_0x49115d={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x49426c<0.75?(_0x4f0473=_0x42027e(0x1fd),_0x49115d={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x4f0473=_0x42027e(0x210),_0x49115d={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x4f0473,'params':_0x49115d};}['_calculateATR'](_0x28314f,_0x3fc9b2=0xe){const _0x47e4f8=_0x2f642f;if(_0x28314f['length']<_0x3fc9b2+0x1)return 2.5;const _0x1252a8=[];for(let _0x1ec026=_0x28314f[_0x47e4f8(0x219)]-_0x3fc9b2;_0x1ec026<_0x28314f['length'];_0x1ec026++){const _0x2e3a81=_0x28314f[_0x1ec026],_0xc80a30=_0x28314f[_0x1ec026-0x1][_0x47e4f8(0x1e0)],_0x8e586d=Math['max'](_0x2e3a81['high']-_0x2e3a81['low'],Math[_0x47e4f8(0x1e8)](_0x2e3a81[_0x47e4f8(0x210)]-_0xc80a30),Math[_0x47e4f8(0x1e8)](_0x2e3a81['low']-_0xc80a30));_0x1252a8['push'](_0x8e586d);}return _0x1252a8['reduce']((_0x52e839,_0x2313d0)=>_0x52e839+_0x2313d0,0x0)/_0x1252a8['length'];}[_0x2f642f(0x1ee)](_0x52aaaa){const _0x12b781=_0x2f642f;if(_0x52aaaa['length']<this[_0x12b781(0x1fa)])return 0x0;const _0x58a42e=_0x52aaaa['slice'](-this['ofiLookback']);let _0x5e22c9=0x0,_0x3e4a54=0x0;for(const _0x3604d4 of _0x58a42e){const _0x564bb5=_0x3604d4['high']-_0x3604d4['low'];if(_0x564bb5>0x0){const _0x2252e8=(_0x3604d4[_0x12b781(0x1e0)]-_0x3604d4[_0x12b781(0x1cb)])/_0x564bb5;_0x5e22c9+=_0x2252e8*_0x3604d4['volume'],_0x3e4a54+=(0x1-_0x2252e8)*_0x3604d4['volume'];}}const _0x1a545c=_0x5e22c9+_0x3e4a54;if(_0x1a545c<0x1)return 0x0;return(_0x5e22c9-_0x3e4a54)/_0x1a545c;}[_0x2f642f(0x1e6)](_0x572768,_0x33d398,_0x5732c7,_0x285202,_0x1efeb9,_0x28e662,_0x37fb21,_0x3733a1,_0x58ba42,_0x240380){const _0x59ebe3=_0x2f642f,_0x95c4f8=Math[_0x59ebe3(0x1e8)](_0x5732c7);if(_0x95c4f8<_0x3733a1['zscoreThreshold'])return null;if(_0x285202>this['vpinToxicThreshold'])return null;let _0x270e0c;if(_0x5732c7<-_0x3733a1[_0x59ebe3(0x1d8)])_0x270e0c=_0x59ebe3(0x21d);else{if(_0x5732c7>_0x3733a1[_0x59ebe3(0x1d8)])_0x270e0c=_0x59ebe3(0x223);else return null;}const _0x1d3ef6=_0x270e0c==='long'&&_0x58ba42>0.1||_0x270e0c===_0x59ebe3(0x223)&&_0x58ba42<-0.1,_0x1fb89e=_0x33d398-_0x28e662,_0x3bf8d6=_0x270e0c===_0x59ebe3(0x21d)&&_0x1fb89e<0x0||_0x270e0c==='short'&&_0x1fb89e>0x0,_0x3c3886={'zscore':Math['min'](0x1,_0x95c4f8/0x4),'vpin':0x1-_0x285202,'kyleLambda':_0x1efeb9>0.001?0.5:0.8,'kalman':_0x3bf8d6?0.8:0.4,'volatility':_0x37fb21===_0x59ebe3(0x1fd)?0.8:_0x37fb21==='low'?0.7:0.6,'ofi':_0x1d3ef6?0.9:0.5,'composite':0x0};_0x3c3886[_0x59ebe3(0x1d0)]=_0x3c3886[_0x59ebe3(0x1cc)]*this[_0x59ebe3(0x1cf)]['zscore']+_0x3c3886['vpin']*this['weights']['vpin']+_0x3c3886[_0x59ebe3(0x20e)]*this['weights']['kyleLambda']+_0x3c3886['kalman']*this['weights']['kalman']+_0x3c3886[_0x59ebe3(0x1d1)]*this[_0x59ebe3(0x1cf)][_0x59ebe3(0x1d1)]+_0x3c3886['ofi']*this[_0x59ebe3(0x1cf)][_0x59ebe3(0x216)];const _0x3f8db7=Math['min'](0x1,_0x3c3886['composite']+_0x3733a1[_0x59ebe3(0x213)]);if(_0x3f8db7<this['minConfidence'])return null;if(Date['now']()-this['lastSignalTime']<this['cooldownMs'])return null;const _0x5bc68e=Math['round'](this['baseStopTicks']*_0x3733a1['stopMultiplier']),_0x768062=Math[_0x59ebe3(0x20b)](this[_0x59ebe3(0x22e)]*_0x3733a1['targetMultiplier']),_0x31307c=Math['max'](0x6,Math['min'](0xc,_0x5bc68e)),_0x206f74=Math['max'](_0x31307c*1.5,Math['min'](0x18,_0x768062));let _0x15c472,_0x11d4bb,_0x118339,_0x7e3ca2;_0x270e0c===_0x59ebe3(0x21d)?(_0x15c472=_0x33d398-_0x31307c*this['tickSize'],_0x11d4bb=_0x33d398+_0x206f74*this[_0x59ebe3(0x225)],_0x118339=_0x33d398+this['breakevenTicks']*this[_0x59ebe3(0x225)],_0x7e3ca2=_0x33d398+_0x206f74*this[_0x59ebe3(0x21b)]*this[_0x59ebe3(0x225)]):(_0x15c472=_0x33d398+_0x31307c*this['tickSize'],_0x11d4bb=_0x33d398-_0x206f74*this['tickSize'],_0x118339=_0x33d398-this['breakevenTicks']*this[_0x59ebe3(0x225)],_0x7e3ca2=_0x33d398-_0x206f74*this['profitLockPct']*this['tickSize']);const _0x52be1d=_0x206f74/_0x31307c,_0x72d77b=Math[_0x59ebe3(0x20b)](_0x206f74*0.5),_0x285a79=Math['round'](_0x31307c*0.4);let _0x28ac1c=SignalStrength[_0x59ebe3(0x208)];if(_0x3f8db7>=0.85)_0x28ac1c=SignalStrength['VERY_STRONG'];else{if(_0x3f8db7>=0.75)_0x28ac1c=SignalStrength['STRONG'];else{if(_0x3f8db7<0.6)_0x28ac1c=SignalStrength['WEAK'];}}const _0x2fd433=0.5+(_0x3f8db7-0.5)*0.4,_0x5483cb=_0x2fd433*Math['abs'](_0x11d4bb-_0x33d398)-(0x1-_0x2fd433)*Math[_0x59ebe3(0x1e8)](_0x33d398-_0x15c472);this[_0x59ebe3(0x1d5)]=Date[_0x59ebe3(0x1d4)](),this[_0x59ebe3(0x218)][_0x59ebe3(0x1f4)]++;const _0x4c8b68={'id':uuidv4(),'timestamp':Date[_0x59ebe3(0x1d4)](),'symbol':_0x572768['split']('.')[0x0]||_0x572768,'contractId':_0x572768,'side':_0x270e0c===_0x59ebe3(0x21d)?OrderSide[_0x59ebe3(0x1e2)]:OrderSide[_0x59ebe3(0x1c2)],'direction':_0x270e0c,'strategy':_0x59ebe3(0x1f2),'strength':_0x28ac1c,'edge':_0x5483cb,'confidence':_0x3f8db7,'entry':_0x33d398,'entryPrice':_0x33d398,'stopLoss':_0x15c472,'takeProfit':_0x11d4bb,'riskReward':_0x52be1d,'stopTicks':_0x31307c,'targetTicks':_0x206f74,'trailTriggerTicks':_0x72d77b,'trailDistanceTicks':_0x285a79,'beBreakeven':_0x118339,'profitLockLevel':_0x7e3ca2,'zScore':_0x5732c7,'zScoreExit':this['zscoreExitThreshold'],'vpinValue':_0x285202,'kyleLambda':_0x1efeb9,'kalmanEstimate':_0x28e662,'volatilityRegime':_0x37fb21,'ofiValue':_0x58ba42,'models':_0x3c3886,'orderFlowConfirmed':_0x1d3ef6,'kalmanConfirmed':_0x3bf8d6,'expires':Date['now']()+0xea60};return this[_0x59ebe3(0x1e3)](_0x59ebe3(0x229),{'side':_0x270e0c===_0x59ebe3(0x21d)?_0x59ebe3(0x217):'sell','action':_0x59ebe3(0x220),'reason':'Z='+_0x5732c7['toFixed'](0x2)+_0x59ebe3(0x1e5)+(_0x285202*0x64)['toFixed'](0x0)+'%,\x20OFI='+(_0x58ba42*0x64)[_0x59ebe3(0x1f6)](0x0)+_0x59ebe3(0x215)+(_0x3f8db7*0x64)['toFixed'](0x0)+'%',..._0x4c8b68}),this['emit']('log',{'type':_0x59ebe3(0x1fb),'message':'[HQX]\x20SIGNAL:\x20'+_0x270e0c['toUpperCase']()+'\x20@\x20'+_0x33d398[_0x59ebe3(0x1f6)](0x2)+'\x20|\x20Z:'+_0x5732c7['toFixed'](0x2)+'\x20VPIN:'+(_0x285202*0x64)[_0x59ebe3(0x1f6)](0x0)+_0x59ebe3(0x1ff)+(_0x58ba42*0x64)[_0x59ebe3(0x1f6)](0x0)+_0x59ebe3(0x21e)+_0x1efeb9['toFixed'](0x5)+'\x20Regime:'+_0x37fb21+_0x59ebe3(0x1df)+(_0x3f8db7*0x64)[_0x59ebe3(0x1f6)](0x0)+'%'}),_0x4c8b68;}['shouldExitByZScore'](_0x35553e){const _0x3100b2=_0x2f642f,_0x4d18f6=this[_0x3100b2(0x1dc)][_0x3100b2(0x21f)](_0x35553e);if(!_0x4d18f6||_0x4d18f6['length']<0x32)return![];const _0x25f249=this[_0x3100b2(0x22a)](_0x4d18f6);return Math['abs'](_0x25f249)<this[_0x3100b2(0x1f0)];}[_0x2f642f(0x226)](_0x20f79c){const _0x3967e1=_0x2f642f,_0x453533=this[_0x3967e1(0x1dc)]['get'](_0x20f79c),_0x43daf0=this['volumeBuffer']['get'](_0x20f79c),_0x1e60be=this[_0x3967e1(0x1d6)]['get'](_0x20f79c);if(!_0x453533||!_0x43daf0||!_0x1e60be||_0x1e60be['length']<0x32)return null;const _0x1a1dc9=this['_computeZScore'](_0x453533),_0x14c4da=this[_0x3967e1(0x1ce)](_0x43daf0),_0x39dceb=this[_0x3967e1(0x20c)](_0x1e60be),_0x4a2092=this['_computeOrderFlowImbalance'](_0x1e60be);return{'zscore':Math[_0x3967e1(0x1f3)](0x1,Math['abs'](_0x1a1dc9)/0x4),'vpin':0x1-_0x14c4da,'kyleLambda':_0x39dceb>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x3967e1(0x1e8)](_0x4a2092)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x1a1dc9,'vpin':_0x14c4da,'kyleLambda':_0x39dceb,'ofi':_0x4a2092}};}[_0x2f642f(0x1ef)](_0x15937a,_0x56b1e5){const _0x4e2ee8=_0x2f642f,_0x139953=this['barHistory']['get'](_0x15937a)||[];if(_0x139953[_0x4e2ee8(0x219)]<0x32)return{'ready':![],'message':_0x4e2ee8(0x206)+_0x139953[_0x4e2ee8(0x219)]+'/50\x20bars'};const _0x119888=this['priceBuffer'][_0x4e2ee8(0x21f)](_0x15937a)||[],_0x57c1cf=this[_0x4e2ee8(0x228)]['get'](_0x15937a)||[],_0x19f0b4=this[_0x4e2ee8(0x22a)](_0x119888),_0x921872=this[_0x4e2ee8(0x1ce)](_0x57c1cf),_0x5def40=this['_computeOrderFlowImbalance'](_0x139953),_0xc85c2b=this[_0x4e2ee8(0x20c)](_0x139953),{regime:_0x16c6d5,params:_0x1a43c5}=this['_detectVolatilityRegime'](_0x15937a,_0x139953);return{'ready':!![],'zScore':_0x19f0b4,'vpin':_0x921872,'ofi':_0x5def40,'kyleLambda':_0xc85c2b,'regime':_0x16c6d5,'stopTicks':Math['round'](this['baseStopTicks']*_0x1a43c5['stopMultiplier']),'targetTicks':Math['round'](this['baseTargetTicks']*_0x1a43c5[_0x4e2ee8(0x205)]),'threshold':_0x1a43c5['zscoreThreshold'],'barsProcessed':_0x139953['length'],'models':'6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)'};}[_0x2f642f(0x1db)](_0x34f4ee){const _0x27c887=_0x2f642f;this[_0x27c887(0x22c)][_0x27c887(0x202)]({'netPnl':_0x34f4ee,'timestamp':Date[_0x27c887(0x1d4)]()});if(this['recentTrades'][_0x27c887(0x219)]>0x64)this['recentTrades'][_0x27c887(0x203)]();_0x34f4ee>0x0?(this['winStreak']++,this[_0x27c887(0x1c7)]=0x0,this['stats']['wins']++):(this[_0x27c887(0x1c7)]++,this['winStreak']=0x0,this[_0x27c887(0x218)][_0x27c887(0x22d)]++),this['stats'][_0x27c887(0x20d)]++,this['stats'][_0x27c887(0x1f1)]+=_0x34f4ee,this['emit'](_0x27c887(0x21c),{'type':'debug','message':_0x27c887(0x1c8)+(_0x34f4ee>0x0?'WIN':_0x27c887(0x1ea))+'\x20$'+_0x34f4ee[_0x27c887(0x1f6)](0x2)+_0x27c887(0x1c9)+(_0x34f4ee>0x0?this['winStreak']:-this['lossStreak'])});}['getBarHistory'](_0x93968b){const _0x132087=_0x2f642f;return this['barHistory'][_0x132087(0x21f)](_0x93968b)||[];}[_0x2f642f(0x1ed)](){return this['stats'];}[_0x2f642f(0x1dd)](_0x5bcc92){const _0x58220e=_0x2f642f;this['barHistory'][_0x58220e(0x1e4)](_0x5bcc92,[]),this['priceBuffer']['set'](_0x5bcc92,[]),this['volumeBuffer']['set'](_0x5bcc92,[]),this[_0x58220e(0x1da)][_0x58220e(0x1e4)](_0x5bcc92,[]),this['kalmanStates']['set'](_0x5bcc92,{'estimate':0x0,'errorCovariance':0x1}),this[_0x58220e(0x1e3)]('log',{'type':'info','message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x5bcc92});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x1c68b9={}){const _0x27786d=_0x2f642f;super(),this['config']=_0x1c68b9,this[_0x27786d(0x211)]=new HQXUltraScalping(_0x1c68b9),this['strategy']['on'](_0x27786d(0x229),_0x26640d=>this['emit'](_0x27786d(0x229),_0x26640d)),this['strategy']['on']('log',_0x24647b=>this['emit']('log',_0x24647b));}[_0x2f642f(0x1e7)](_0x43265a){const _0x1c2d27=_0x2f642f;return this[_0x1c2d27(0x211)][_0x1c2d27(0x1e7)](_0x43265a);}['onTick'](_0x3d1505){return this['strategy']['onTick'](_0x3d1505);}['onTrade'](_0x4b9f05){const _0x62a743=_0x2f642f;return this[_0x62a743(0x211)][_0x62a743(0x1c3)](_0x4b9f05);}['processBar'](_0xfb06fb,_0x5935b6){return this['strategy']['processBar'](_0xfb06fb,_0x5935b6);}['initialize'](_0x38e2e1,_0x4aea8e,_0x3d4b0f){const _0x1997da=_0x2f642f;return this['strategy'][_0x1997da(0x212)](_0x38e2e1,_0x4aea8e,_0x3d4b0f);}[_0x2f642f(0x1ef)](_0x366f26,_0x32c33d){const _0x5074bc=_0x2f642f;return this[_0x5074bc(0x211)][_0x5074bc(0x1ef)](_0x366f26,_0x32c33d);}['recordTradeResult'](_0x1c8b45){const _0x49a1ad=_0x2f642f;return this[_0x49a1ad(0x211)]['recordTradeResult'](_0x1c8b45);}[_0x2f642f(0x1dd)](_0x5b64d8){const _0x250714=_0x2f642f;return this['strategy'][_0x250714(0x1dd)](_0x5b64d8);}['getStats'](){const _0x31780e=_0x2f642f;return this[_0x31780e(0x211)][_0x31780e(0x1ed)]();}['getBarHistory'](_0x48fbb3){const _0x40b812=_0x2f642f;return this[_0x40b812(0x211)][_0x40b812(0x1c6)](_0x48fbb3);}[_0x2f642f(0x226)](_0x3120e1){const _0x1c5a1e=_0x2f642f;return this['strategy'][_0x1c5a1e(0x226)](_0x3120e1);}['shouldExitByZScore'](_0x572f72){const _0x4a0aa1=_0x2f642f;return this['strategy'][_0x4a0aa1(0x1e1)](_0x572f72);}[_0x2f642f(0x1e9)](_0x1df7f7){return null;}}module['exports']={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};function _0x48c6(){const _0x147040=['reset','uuid','\x20|\x20Conf:','close','shouldExitByZScore','BID','emit','set',',\x20VPIN=','_generateSignal','processTick','abs','generateSignal','LOSS','10eDFdqK','tickValue','getStats','_computeOrderFlowImbalance','getAnalysisState','zscoreExitThreshold','pnl','HQX_ULTRA_SCALPING_6MODELS','min','signals','kalmanStates','toFixed','processBar','zscoreEntryThreshold','42OUKcWP','ofiLookback','info','_detectVolatilityRegime','normal','756384ICUZpV','%\x20OFI:','sell','slice','push','shift','baseStopTicks','targetMultiplier','Collecting\x20data...\x20','breakevenTicks','MODERATE','2JHluhv','1314171KXLtHF','round','_computeKyleLambda','trades','kyleLambda','volume','high','strategy','initialize','confidenceBonus','volatilityLookback','%,\x20cf=','ofi','buy','stats','length','reduce','profitLockPct','log','long','%\x20Kyle:','get','open','14929277lhfYna','1563010cOsStZ','short','estimate','tickSize','getModelValues',',\x20value=','volumeBuffer','signal','_computeZScore','vpinWindow','recentTrades','losses','baseTargetTicks',':\x20tick=','430726yXGdiw','ASK','onTrade','_applyKalmanFilter','6icBfld','getBarHistory','lossStreak','[HQX]\x20Trade\x20result:\x20',',\x20streak:\x20','kalmanMeasurementNoise','low','zscore','749528SyvYql','_computeVPIN','weights','composite','volatility','cooldownMs','312126MTruvf','now','lastSignalTime','barHistory','minConfidence','zscoreThreshold','errorCovariance','atrHistory','recordTradeResult','priceBuffer'];_0x48c6=function(){return _0x147040;};return _0x48c6();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.118",
3
+ "version": "2.9.120",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -85,6 +85,29 @@ const CONTRACT_DESCRIPTIONS = {
85
85
 
86
86
  const getContractDescription = (baseSymbol) => CONTRACT_DESCRIPTIONS[baseSymbol] || baseSymbol;
87
87
 
88
+ // Tick sizes for common contracts (used when API doesn't provide)
89
+ const CONTRACT_TICK_SIZES = {
90
+ // Equity Index
91
+ ES: 0.25, MES: 0.25, NQ: 0.25, MNQ: 0.25,
92
+ RTY: 0.10, M2K: 0.10, YM: 1.00, MYM: 1.00,
93
+ // Metals
94
+ GC: 0.10, MGC: 0.10, '1OZ': 0.10, SI: 0.005, SIL: 0.001,
95
+ HG: 0.0005, MHG: 0.0005, PL: 0.10, PA: 0.10,
96
+ // Energy
97
+ CL: 0.01, MCL: 0.01, NG: 0.001, BZ: 0.01,
98
+ // Currencies
99
+ '6E': 0.00005, M6E: 0.0001, '6B': 0.0001, '6J': 0.0000005,
100
+ '6A': 0.0001, '6C': 0.00005, '6S': 0.0001,
101
+ // Crypto
102
+ BTC: 5.00, MBT: 5.00, ETH: 0.50, MET: 0.50,
103
+ // Treasuries
104
+ ZB: 0.03125, ZN: 0.015625, ZF: 0.0078125, ZT: 0.0078125,
105
+ // Grains
106
+ ZC: 0.25, ZS: 0.25, ZW: 0.25,
107
+ };
108
+
109
+ const getTickSize = (baseSymbol) => CONTRACT_TICK_SIZES[baseSymbol] || 0.25;
110
+
88
111
  module.exports = {
89
112
  ACCOUNT_STATUS,
90
113
  ACCOUNT_TYPE,
@@ -92,5 +115,7 @@ module.exports = {
92
115
  ORDER_TYPE,
93
116
  ORDER_SIDE,
94
117
  CONTRACT_DESCRIPTIONS,
118
+ CONTRACT_TICK_SIZES,
95
119
  getContractDescription,
120
+ getTickSize,
96
121
  };
@@ -8,6 +8,7 @@
8
8
  const { decodeFrontMonthContract } = require('./protobuf');
9
9
  const { TIMEOUTS, CACHE } = require('../../config/settings');
10
10
  const { logger } = require('../../utils/logger');
11
+ const { getContractDescription, getTickSize } = require('../../config/constants');
11
12
 
12
13
  const log = logger.scope('Rithmic:Contracts');
13
14
 
@@ -155,12 +156,15 @@ const fetchAllFrontMonths = (service) => {
155
156
  const productKey = `${baseSymbol}:${contract.exchange}`;
156
157
  const product = productsToCheck.get(productKey);
157
158
 
158
- // 100% API data - no static symbol info
159
+ // Use our descriptions for better display names
160
+ const apiName = product?.productName || baseSymbol;
161
+ const displayName = getContractDescription(baseSymbol) || apiName;
159
162
  results.push({
160
163
  symbol: contract.symbol,
161
164
  baseSymbol,
162
- name: product?.productName || baseSymbol,
165
+ name: displayName,
163
166
  exchange: contract.exchange,
167
+ tickSize: getTickSize(baseSymbol),
164
168
  });
165
169
  }
166
170