hedgequantx 2.9.111 → 2.9.113

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 _0x387f6b=_0x233b;(function(_0x2261ea,_0x2bcbbd){const _0x53db05=_0x233b,_0x319ece=_0x2261ea();while(!![]){try{const _0x3c9a46=parseInt(_0x53db05(0xb2))/0x1+-parseInt(_0x53db05(0x124))/0x2+-parseInt(_0x53db05(0xc9))/0x3*(parseInt(_0x53db05(0x123))/0x4)+-parseInt(_0x53db05(0xea))/0x5*(-parseInt(_0x53db05(0x116))/0x6)+-parseInt(_0x53db05(0xf3))/0x7*(parseInt(_0x53db05(0xd6))/0x8)+parseInt(_0x53db05(0x109))/0x9*(parseInt(_0x53db05(0xb5))/0xa)+-parseInt(_0x53db05(0xfc))/0xb;if(_0x3c9a46===_0x2bcbbd)break;else _0x319ece['push'](_0x319ece['shift']());}catch(_0x1b371b){_0x319ece['push'](_0x319ece['shift']());}}}(_0x2ecc,0xe2df0));function _0x233b(_0x4c82d6,_0x328663){_0x4c82d6=_0x4c82d6-0x93;const _0x2ecc7e=_0x2ecc();let _0x233ba5=_0x2ecc7e[_0x4c82d6];return _0x233ba5;}const EventEmitter=require('events'),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':_0x387f6b(0xb6)},ZoneType={'RESISTANCE':'resistance','SUPPORT':'support'},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.25,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.1,'minVolumeRatio':0.3,'minBodyRatio':0.05},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x1388,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x387f6b(0x10b)}};class SwingPoint{constructor(_0x4b5dc1,_0x48923a,_0x559ed9,_0x22313a,_0x13c5e4=0x1){const _0x287264=_0x387f6b;this['type']=_0x4b5dc1,this['price']=_0x48923a,this['barIndex']=_0x559ed9,this['timestamp']=_0x22313a,this[_0x287264(0xcd)]=_0x13c5e4;}}class LiquidityZone{constructor(_0xe51a62,_0x52ddb0,_0x3b41df,_0x1ce3c3,_0x302dc7){const _0x1d85e2=_0x387f6b;this['id']=uuidv4(),this['type']=_0xe51a62,this['priceHigh']=_0x52ddb0,this[_0x1d85e2(0x100)]=_0x3b41df,this[_0x1d85e2(0xba)]=_0x1ce3c3,this['barIndex']=_0x302dc7,this['touches']=0x1,this['swept']=![],this[_0x1d85e2(0x96)]=null,this['lastUsedBarIndex']=-0x3e7,this['qualityScore']=0.5;}[_0x387f6b(0xab)](_0x457a4f,_0x458a03,_0x4b79cf){const _0x27769a=_0x387f6b,_0x411e33=_0x458a03*_0x4b79cf;return _0x457a4f>=this[_0x27769a(0x100)]-_0x411e33&&_0x457a4f<=this[_0x27769a(0xb7)]+_0x411e33;}['getLevel'](){const _0x23a498=_0x387f6b;return(this['priceHigh']+this[_0x23a498(0x100)])/0x2;}}class SweepEvent{constructor(_0x213d6b,_0x5aecd9,_0x3a0ba8,_0x5189fb,_0x51c6ba){const _0x28ae01=_0x387f6b;this[_0x28ae01(0x11c)]=_0x213d6b,this[_0x28ae01(0x105)]=_0x5aecd9,this['entryBarIndex']=_0x3a0ba8,this['extremeBarIndex']=_0x5189fb,this['extremePrice']=_0x51c6ba,this[_0x28ae01(0xb4)]=null,this['isValid']=![],this['qualityScore']=0x0,this[_0x28ae01(0xa3)]=0x0,this[_0x28ae01(0xd2)]=0x0,this[_0x28ae01(0x9d)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x12bbba={}){const _0x406e05=_0x387f6b;super(),this['config']=this['_mergeConfig'](DEFAULT_CONFIG,_0x12bbba),this[_0x406e05(0x11d)]=this['config'][_0x406e05(0x11d)],this['tickValue']=this[_0x406e05(0xbd)]['tickValue'],this['barHistory']=new Map(),this[_0x406e05(0xe7)]=new Map(),this[_0x406e05(0xf1)]=new Map(),this['activeSweeps']=new Map(),this[_0x406e05(0xac)]=new Map(),this[_0x406e05(0xc0)]=0xea60,this[_0x406e05(0xd4)]=0x0,this[_0x406e05(0xe5)]=Date['now'](),this[_0x406e05(0x127)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x406e05(0xfb)]=[];}[_0x387f6b(0x11a)](_0xb5822d,_0x6d6b7e){const _0x1efdcf=_0x387f6b,_0x42a373={..._0xb5822d};for(const _0x72e6df in _0x6d6b7e){typeof _0x6d6b7e[_0x72e6df]===_0x1efdcf(0xc2)&&!Array[_0x1efdcf(0x113)](_0x6d6b7e[_0x72e6df])?_0x42a373[_0x72e6df]={..._0xb5822d[_0x72e6df],..._0x6d6b7e[_0x72e6df]}:_0x42a373[_0x72e6df]=_0x6d6b7e[_0x72e6df];}return _0x42a373;}[_0x387f6b(0x10f)](_0xf288be){const _0xa59c71=_0x387f6b;if(!this['config']['session'][_0xa59c71(0xd9)])return!![];const _0x59eb9a=new Date(_0xf288be),_0x101cfb=this[_0xa59c71(0xee)](_0x59eb9a)?-0x4:-0x5,_0x3c1acb=_0x59eb9a[_0xa59c71(0xf2)](),_0x410118=_0x59eb9a['getUTCMinutes'](),_0x5401c4=(_0x3c1acb+_0x101cfb+0x18)%0x18,{startHour:_0x29f0f5,startMinute:_0x39f2db,endHour:_0x588961,endMinute:_0x12b541}=this['config']['session'],_0x55c322=_0x5401c4*0x3c+_0x410118,_0x171ba0=_0x29f0f5*0x3c+_0x39f2db,_0xf9c212=_0x588961*0x3c+_0x12b541;return _0x55c322>=_0x171ba0&&_0x55c322<_0xf9c212;}[_0x387f6b(0xee)](_0x42ff52){const _0x96ebdd=_0x387f6b,_0x20e6eb=new Date(_0x42ff52[_0x96ebdd(0xe0)](),0x0,0x1),_0x47feb2=new Date(_0x42ff52['getFullYear'](),0x6,0x1),_0x28c054=Math['max'](_0x20e6eb['getTimezoneOffset'](),_0x47feb2[_0x96ebdd(0x114)]());return _0x42ff52['getTimezoneOffset']()<_0x28c054;}['initialize'](_0x4ab254,_0x33ed2d=0.25,_0x3cace4=0x5){const _0x425d80=_0x387f6b;this['tickSize']=_0x33ed2d,this['tickValue']=_0x3cace4,this[_0x425d80(0xbd)]['tickSize']=_0x33ed2d,this['config']['tickValue']=_0x3cace4,this['barHistory']['set'](_0x4ab254,[]),this[_0x425d80(0xe7)][_0x425d80(0xd0)](_0x4ab254,[]),this['liquidityZones']['set'](_0x4ab254,[]),this['activeSweeps']['set'](_0x4ab254,[]),this['currentBar']['delete'](_0x4ab254),this[_0x425d80(0xfd)](_0x425d80(0xbf),{'type':'info','message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x4ab254+_0x425d80(0xfe)+_0x33ed2d+_0x425d80(0x11f)+_0x3cace4+_0x425d80(0x110)}),this[_0x425d80(0xfd)]('log',{'type':_0x425d80(0xa8),'message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x425d80(0xbd)][_0x425d80(0xdd)][_0x425d80(0x117)]+'t,\x20Target='+this[_0x425d80(0xbd)]['execution']['targetTicks']+_0x425d80(0x10c)+this['config']['execution']['breakevenTicks']+'t,\x20Trail='+this['config']['execution'][_0x425d80(0x122)]+'/'+this['config']['execution']['trailDistanceTicks']});}['processTick'](_0x3310d9){const _0x407299=_0x387f6b,{contractId:_0x1a87ac,price:_0x101777,volume:_0xdd0492,timestamp:_0x23df41}=_0x3310d9,_0x54d631=_0x23df41||Date['now'](),_0x5c80d0=_0xdd0492||0x1;if(!this[_0x407299(0x10f)](_0x54d631))return null;let _0x314581=this['currentBar']['get'](_0x1a87ac);const _0xc8943b=Math[_0x407299(0xdf)](_0x54d631/this[_0x407299(0xc0)])*this['barIntervalMs'];if(!_0x314581||_0x314581[_0x407299(0xe5)]!==_0xc8943b){if(_0x314581){const _0x48c446={'timestamp':_0x314581['startTime'],'open':_0x314581['open'],'high':_0x314581['high'],'low':_0x314581[_0x407299(0xb6)],'close':_0x314581['close'],'volume':_0x314581[_0x407299(0x9c)]},_0xd0df2=this['processBar'](_0x1a87ac,_0x48c446);return this['currentBar'][_0x407299(0xd0)](_0x1a87ac,{'startTime':_0xc8943b,'open':_0x101777,'high':_0x101777,'low':_0x101777,'close':_0x101777,'volume':_0x5c80d0}),_0xd0df2;}else return this[_0x407299(0xac)][_0x407299(0xd0)](_0x1a87ac,{'startTime':_0xc8943b,'open':_0x101777,'high':_0x101777,'low':_0x101777,'close':_0x101777,'volume':_0x5c80d0}),null;}else return _0x314581[_0x407299(0xca)]=Math['max'](_0x314581['high'],_0x101777),_0x314581['low']=Math['min'](_0x314581[_0x407299(0xb6)],_0x101777),_0x314581['close']=_0x101777,_0x314581['volume']+=_0x5c80d0,null;}[_0x387f6b(0xff)](_0xc95c84){const _0x28bb76=_0x387f6b;return this[_0x28bb76(0x115)](_0xc95c84);}[_0x387f6b(0xcf)](_0x1e44a5){const _0x384800=_0x387f6b;return this['processTick']({'contractId':_0x1e44a5[_0x384800(0x108)]||_0x1e44a5['symbol'],'price':_0x1e44a5[_0x384800(0xc6)],'volume':_0x1e44a5[_0x384800(0x11e)]||_0x1e44a5['volume']||0x1,'timestamp':_0x1e44a5['timestamp']||Date[_0x384800(0x94)]()});}[_0x387f6b(0xbe)](_0x32e001,_0x13aa2a){const _0x3f2dac=_0x387f6b;let _0x4d9d9d=this[_0x3f2dac(0xb3)]['get'](_0x32e001);!_0x4d9d9d&&(this['initialize'](_0x32e001),_0x4d9d9d=this['barHistory'][_0x3f2dac(0xc7)](_0x32e001));_0x4d9d9d[_0x3f2dac(0xbb)](_0x13aa2a);if(_0x4d9d9d['length']>0x1f4)_0x4d9d9d['shift']();const _0xf7d97e=_0x4d9d9d[_0x3f2dac(0x9a)]-0x1;if(_0x4d9d9d['length']<this['config'][_0x3f2dac(0xae)][_0x3f2dac(0x107)]*0x3)return null;const _0x575647=this['swingPoints'][_0x3f2dac(0xc7)](_0x32e001)['length'];this[_0x3f2dac(0x99)](_0x32e001,_0x4d9d9d,_0xf7d97e);const _0x3efde8=this[_0x3f2dac(0xe7)][_0x3f2dac(0xc7)](_0x32e001);if(_0x3efde8['length']>_0x575647){const _0x14d9d1=_0x3efde8[_0x3efde8['length']-0x1];this[_0x3f2dac(0xfd)](_0x3f2dac(0xbf),{'type':_0x3f2dac(0xf8),'message':'[2B]\x20NEW\x20SWING\x20'+_0x14d9d1[_0x3f2dac(0xa7)]['toUpperCase']()+_0x3f2dac(0x120)+_0x14d9d1[_0x3f2dac(0xc6)]['toFixed'](0x2)+_0x3f2dac(0x118)+_0x3efde8['length']});}const _0x5db259=this['_detectSweep'](_0x32e001,_0x4d9d9d,_0xf7d97e);_0x5db259&&this['emit'](_0x3f2dac(0xbf),{'type':'debug','message':_0x3f2dac(0xdb)+_0x5db259['sweepType']+_0x3f2dac(0x112)+_0x5db259[_0x3f2dac(0xb0)]+_0x3f2dac(0xb1)+_0x5db259[_0x3f2dac(0xa3)]['toFixed'](0x1)+_0x3f2dac(0xad)+(_0x5db259['qualityScore']*0x64)[_0x3f2dac(0x10e)](0x0)+'%'});const _0x2b699b=this[_0x3f2dac(0xf1)][_0x3f2dac(0xc7)](_0x32e001)[_0x3f2dac(0x9a)];this[_0x3f2dac(0xc4)](_0x32e001,_0xf7d97e);const _0x2a1e3e=this['liquidityZones'][_0x3f2dac(0xc7)](_0x32e001);if(_0x2a1e3e['length']>_0x2b699b){const _0x1416a3=_0x2a1e3e[_0x2a1e3e[_0x3f2dac(0x9a)]-0x1];this[_0x3f2dac(0xfd)]('log',{'type':_0x3f2dac(0xf8),'message':_0x3f2dac(0xa2)+_0x1416a3[_0x3f2dac(0xa7)][_0x3f2dac(0xeb)]()+'\x20@\x20'+_0x1416a3[_0x3f2dac(0xde)]()[_0x3f2dac(0x10e)](0x2)+_0x3f2dac(0x118)+_0x2a1e3e['length']});}if(_0x5db259&&_0x5db259['isValid']){this['emit']('log',{'type':'debug','message':'[2B]\x20Calling\x20_generateSignal\x20for\x20'+_0x5db259['sweepType']+'\x20sweep...'});const _0x186e07=this['_generateSignal'](_0x32e001,_0x13aa2a,_0xf7d97e,_0x5db259);return!_0x186e07&&this[_0x3f2dac(0xfd)]('log',{'type':'debug','message':'[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)'}),_0x186e07;}return null;}['_detectSwings'](_0x23199f,_0x54157a,_0x35607f){const _0x36e0e2=_0x387f6b,_0x1802d1=this[_0x36e0e2(0xbd)]['swing'][_0x36e0e2(0x107)],_0x56b0e9=this['config'][_0x36e0e2(0xae)][_0x36e0e2(0xf0)];if(_0x35607f<_0x1802d1*0x2)return;const _0x5b5953=this['swingPoints']['get'](_0x23199f),_0x5062b4=_0x35607f-_0x1802d1,_0x4874fb=_0x54157a[_0x5062b4];let _0x6f3591=!![],_0x2e413d=0x0;for(let _0x26c3e8=_0x5062b4-_0x1802d1;_0x26c3e8<=_0x5062b4+_0x1802d1;_0x26c3e8++){if(_0x26c3e8===_0x5062b4||_0x26c3e8<0x0||_0x26c3e8>=_0x54157a['length'])continue;if(_0x54157a[_0x26c3e8]['high']>=_0x4874fb['high']){_0x6f3591=![];break;}_0x2e413d++;}if(_0x6f3591&&_0x2e413d>=_0x56b0e9){const _0x12f9ce=_0x5b5953['find'](_0x3ff212=>_0x3ff212['barIndex']===_0x5062b4&&_0x3ff212[_0x36e0e2(0xa7)]===_0x36e0e2(0xca));!_0x12f9ce&&_0x5b5953['push'](new SwingPoint(_0x36e0e2(0xca),_0x4874fb[_0x36e0e2(0xca)],_0x5062b4,_0x4874fb['timestamp'],_0x2e413d));}let _0x52fd30=!![],_0x463e6a=0x0;for(let _0x4f0329=_0x5062b4-_0x1802d1;_0x4f0329<=_0x5062b4+_0x1802d1;_0x4f0329++){if(_0x4f0329===_0x5062b4||_0x4f0329<0x0||_0x4f0329>=_0x54157a[_0x36e0e2(0x9a)])continue;if(_0x54157a[_0x4f0329]['low']<=_0x4874fb[_0x36e0e2(0xb6)]){_0x52fd30=![];break;}_0x463e6a++;}if(_0x52fd30&&_0x463e6a>=_0x56b0e9){const _0x47f004=_0x5b5953[_0x36e0e2(0xc3)](_0x493e58=>_0x493e58['barIndex']===_0x5062b4&&_0x493e58[_0x36e0e2(0xa7)]==='low');!_0x47f004&&_0x5b5953[_0x36e0e2(0xbb)](new SwingPoint(_0x36e0e2(0xb6),_0x4874fb['low'],_0x5062b4,_0x4874fb['timestamp'],_0x463e6a));}const _0x50b240=this['config']['zone']['maxZoneAgeBars'];while(_0x5b5953[_0x36e0e2(0x9a)]>0x0&&_0x5b5953[0x0]['barIndex']<_0x35607f-_0x50b240){_0x5b5953[_0x36e0e2(0x104)]();}}['_updateZones'](_0x2a2c4d,_0xe55dbd){const _0x362870=_0x387f6b,_0x5a3771=this['swingPoints']['get'](_0x2a2c4d),_0x148b42=this[_0x362870(0xf1)]['get'](_0x2a2c4d),_0x28e386=this[_0x362870(0xbd)]['zone'][_0x362870(0x119)]*this[_0x362870(0x11d)],_0x5450ab=this[_0x362870(0xbd)]['zone']['maxZoneAgeBars'];for(let _0x16cab6=_0x148b42['length']-0x1;_0x16cab6>=0x0;_0x16cab6--){_0xe55dbd-_0x148b42[_0x16cab6][_0x362870(0xcc)]>_0x5450ab&&_0x148b42['splice'](_0x16cab6,0x1);}for(const _0x283af2 of _0x5a3771){let _0x529a4a=null;for(const _0x568307 of _0x148b42){if(_0x568307['containsPrice'](_0x283af2[_0x362870(0xc6)],this['config'][_0x362870(0x105)][_0x362870(0x119)],this[_0x362870(0x11d)])){_0x529a4a=_0x568307;break;}}if(_0x529a4a){_0x529a4a['touches']++;if(_0x283af2[_0x362870(0xc6)]>_0x529a4a[_0x362870(0xb7)])_0x529a4a['priceHigh']=_0x283af2['price'];if(_0x283af2[_0x362870(0xc6)]<_0x529a4a[_0x362870(0x100)])_0x529a4a['priceLow']=_0x283af2[_0x362870(0xc6)];_0x529a4a['qualityScore']=Math[_0x362870(0xbc)](0x1,0.3+_0x529a4a[_0x362870(0x93)]*0.15);}else{const _0xee0c5b=_0x283af2[_0x362870(0xa7)]===_0x362870(0xca)?ZoneType['RESISTANCE']:ZoneType['SUPPORT'],_0x14b0bb=new LiquidityZone(_0xee0c5b,_0x283af2['price']+_0x28e386/0x2,_0x283af2['price']-_0x28e386/0x2,_0x283af2['timestamp'],_0x283af2['barIndex']);_0x14b0bb['qualityScore']=0.3+_0x283af2[_0x362870(0xcd)]*0.1,_0x148b42['push'](_0x14b0bb);}}}['_detectSweep'](_0x56d127,_0x12ae8d,_0x211094){const _0x5b49b2=_0x387f6b,_0x5e9da4=this[_0x5b49b2(0xf1)]['get'](_0x56d127),_0x3d1c22=_0x12ae8d[_0x211094],_0x373c5d=_0x3d1c22[_0x5b49b2(0xf7)],_0x4196ce=this['config']['sweep'],_0x41f67b=this['config']['zone'];for(const _0x178fd0 of _0x5e9da4){if(_0x178fd0['lastUsedBarIndex']>=0x0&&_0x211094-_0x178fd0[_0x5b49b2(0x95)]<_0x41f67b['cooldownBars'])continue;const _0x39a4aa=_0x178fd0[_0x5b49b2(0xde)](),_0x258b68=Math['abs'](_0x373c5d-_0x39a4aa)/this['tickSize'];if(_0x258b68>_0x41f67b[_0x5b49b2(0xe1)])continue;const _0x5610ca=Math['max'](0x0,_0x211094-_0x4196ce[_0x5b49b2(0x126)]*0x2);for(let _0x32c0f6=_0x5610ca;_0x32c0f6<_0x211094;_0x32c0f6++){const _0x7ea897=_0x12ae8d[_0x32c0f6];if(_0x178fd0[_0x5b49b2(0xa7)]===ZoneType[_0x5b49b2(0xa0)]){const _0x3d533d=(_0x7ea897[_0x5b49b2(0xca)]-_0x178fd0['priceHigh'])/this['tickSize'];if(_0x3d533d>=_0x4196ce['minPenetrationTicks']&&_0x3d533d<=_0x4196ce[_0x5b49b2(0xb8)]){if(_0x373c5d<_0x178fd0[_0x5b49b2(0xb7)]){const _0x247752=_0x7ea897['high']-_0x7ea897['low'],_0x33cd8a=Math[_0x5b49b2(0x97)](_0x7ea897['close']-_0x7ea897[_0x5b49b2(0xf4)]),_0x589423=_0x247752>0x0?_0x33cd8a/_0x247752:0x0;if(_0x589423>=_0x4196ce[_0x5b49b2(0xcb)]){const _0x43c536=this[_0x5b49b2(0x102)](_0x12ae8d,_0x32c0f6,0x14);if(_0x43c536>=_0x4196ce['minVolumeRatio']){const _0x1402af=new SweepEvent(SweepType['HIGH_SWEEP'],_0x178fd0,_0x32c0f6,_0x32c0f6,_0x7ea897[_0x5b49b2(0xca)]);_0x1402af[_0x5b49b2(0xb4)]=_0x211094,_0x1402af[_0x5b49b2(0xa3)]=_0x3d533d,_0x1402af['durationBars']=_0x211094-_0x32c0f6,_0x1402af[_0x5b49b2(0x9d)]=_0x43c536,_0x1402af[_0x5b49b2(0xf9)]=this[_0x5b49b2(0xa5)](_0x1402af,_0x589423),_0x1402af[_0x5b49b2(0xb0)]=_0x1402af['qualityScore']>=_0x4196ce[_0x5b49b2(0x10d)];if(_0x1402af['isValid'])return _0x1402af;}}}}}if(_0x178fd0[_0x5b49b2(0xa7)]===ZoneType['SUPPORT']){const _0x21a81d=(_0x178fd0[_0x5b49b2(0x100)]-_0x7ea897['low'])/this['tickSize'];if(_0x21a81d>=_0x4196ce['minPenetrationTicks']&&_0x21a81d<=_0x4196ce[_0x5b49b2(0xb8)]){if(_0x373c5d>_0x178fd0[_0x5b49b2(0x100)]){const _0x1941bd=_0x7ea897[_0x5b49b2(0xca)]-_0x7ea897['low'],_0x3dd231=Math['abs'](_0x7ea897['close']-_0x7ea897[_0x5b49b2(0xf4)]),_0x5640dc=_0x1941bd>0x0?_0x3dd231/_0x1941bd:0x0;if(_0x5640dc>=_0x4196ce[_0x5b49b2(0xcb)]){const _0x2f7b88=this[_0x5b49b2(0x102)](_0x12ae8d,_0x32c0f6,0x14);if(_0x2f7b88>=_0x4196ce[_0x5b49b2(0xa1)]){const _0x5092a9=new SweepEvent(SweepType[_0x5b49b2(0xc1)],_0x178fd0,_0x32c0f6,_0x32c0f6,_0x7ea897['low']);_0x5092a9['exitBarIndex']=_0x211094,_0x5092a9[_0x5b49b2(0xa3)]=_0x21a81d,_0x5092a9['durationBars']=_0x211094-_0x32c0f6,_0x5092a9[_0x5b49b2(0x9d)]=_0x2f7b88,_0x5092a9['qualityScore']=this['_scoreSweep'](_0x5092a9,_0x5640dc),_0x5092a9['isValid']=_0x5092a9[_0x5b49b2(0xf9)]>=_0x4196ce['minQualityScore'];if(_0x5092a9[_0x5b49b2(0xb0)])return _0x5092a9;}}}}}}}return null;}[_0x387f6b(0x102)](_0x321f59,_0x2c8ad6,_0x53ed05){const _0x2b3cbc=_0x387f6b,_0x598ac4=Math['max'](0x0,_0x2c8ad6-_0x53ed05),_0x50d8b9=_0x321f59[_0x2b3cbc(0x9f)](_0x598ac4,_0x2c8ad6);if(_0x50d8b9[_0x2b3cbc(0x9a)]===0x0)return 0x1;const _0x5654bc=_0x50d8b9[_0x2b3cbc(0xaf)](_0x522589=>_0x522589[_0x2b3cbc(0x9c)])['sort']((_0x5c5aaa,_0x486ce6)=>_0x5c5aaa-_0x486ce6),_0x43e2fa=Math[_0x2b3cbc(0xdf)](_0x5654bc['length']/0x2),_0x203725=_0x5654bc[_0x43e2fa]||0x1;return _0x321f59[_0x2c8ad6]['volume']/_0x203725;}[_0x387f6b(0xa5)](_0x3272dd,_0x14b75a){const _0x3b294f=_0x387f6b;let _0x4a2ad1=0x0;const _0x6d1b68=0x4,_0x4c97f7=Math['abs'](_0x3272dd['penetrationTicks']-_0x6d1b68);return _0x4a2ad1+=Math[_0x3b294f(0x98)](0x0,0.3-_0x4c97f7*0.03),_0x4a2ad1+=Math['max'](0x0,0.25-_0x3272dd['durationBars']*0.05),_0x4a2ad1+=Math['min'](0.25,_0x3272dd[_0x3b294f(0x9d)]*0.1),_0x4a2ad1+=Math[_0x3b294f(0xbc)](0.2,_0x14b75a*0.4),Math[_0x3b294f(0xbc)](0x1,_0x4a2ad1);}['_generateSignal'](_0x211cdf,_0x5b4bd7,_0x369be5,_0x3b5751){const _0x3c9c47=_0x387f6b,_0x292e9b=Date[_0x3c9c47(0x94)]()-this['lastSignalTime'];if(_0x292e9b<this['config'][_0x3c9c47(0xdd)][_0x3c9c47(0xef)])return this['emit']('log',{'type':_0x3c9c47(0xf8),'message':_0x3c9c47(0xa9)+(_0x292e9b/0x3e8)['toFixed'](0x1)+'s\x20<\x20'+this[_0x3c9c47(0xbd)][_0x3c9c47(0xdd)][_0x3c9c47(0xef)]/0x3e8+'s)'}),null;const _0x38a806=this[_0x3c9c47(0xbd)][_0x3c9c47(0xdd)],_0x1ab730=_0x5b4bd7[_0x3c9c47(0xf7)],_0x4d2769=_0x3b5751[_0x3c9c47(0x11c)]===SweepType['HIGH_SWEEP']?'short':_0x3c9c47(0xe4);let _0x853a28,_0x2a12bd,_0x687422,_0x84a97a;_0x4d2769==='long'?(_0x853a28=_0x1ab730-_0x38a806['stopTicks']*this['tickSize'],_0x2a12bd=_0x1ab730+_0x38a806['targetTicks']*this[_0x3c9c47(0x11d)],_0x687422=_0x1ab730+_0x38a806['breakevenTicks']*this['tickSize'],_0x84a97a=_0x1ab730+_0x38a806['trailTriggerTicks']*this[_0x3c9c47(0x11d)]):(_0x853a28=_0x1ab730+_0x38a806[_0x3c9c47(0x117)]*this['tickSize'],_0x2a12bd=_0x1ab730-_0x38a806['targetTicks']*this['tickSize'],_0x687422=_0x1ab730-_0x38a806['breakevenTicks']*this['tickSize'],_0x84a97a=_0x1ab730-_0x38a806['trailTriggerTicks']*this['tickSize']);const _0x3e54d4=_0x38a806[_0x3c9c47(0xdc)]/_0x38a806[_0x3c9c47(0x117)],_0xf9b412=Math['min'](0x1,_0x3b5751['qualityScore']*0.5+_0x3b5751['zone'][_0x3c9c47(0xf9)]*0.3+(_0x3b5751[_0x3c9c47(0x9d)]>1.5?0.2:_0x3b5751['volumeRatio']*0.1));let _0x517e44=SignalStrength[_0x3c9c47(0x9e)];if(_0xf9b412>=0.8)_0x517e44=SignalStrength[_0x3c9c47(0xec)];else{if(_0xf9b412>=0.65)_0x517e44=SignalStrength['STRONG'];else{if(_0xf9b412<0.5)_0x517e44=SignalStrength['WEAK'];}}const _0xe0ea4b=0.5+(_0xf9b412-0.5)*0.4,_0x3aeddf=_0xe0ea4b*Math['abs'](_0x2a12bd-_0x1ab730)-(0x1-_0xe0ea4b)*Math[_0x3c9c47(0x97)](_0x1ab730-_0x853a28);_0x3b5751['zone'][_0x3c9c47(0x95)]=_0x369be5,_0x3b5751['zone'][_0x3c9c47(0x125)]=!![],_0x3b5751['zone']['sweptAt']=new Date(_0x5b4bd7[_0x3c9c47(0xda)]),this['lastSignalTime']=Date[_0x3c9c47(0x94)](),this[_0x3c9c47(0x127)][_0x3c9c47(0xe8)]++;const _0x439d4f={'id':uuidv4(),'timestamp':Date[_0x3c9c47(0x94)](),'symbol':_0x211cdf[_0x3c9c47(0x11b)]('.')[0x0]||_0x211cdf,'contractId':_0x211cdf,'side':_0x4d2769===_0x3c9c47(0xe4)?OrderSide['BID']:OrderSide['ASK'],'direction':_0x4d2769,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x517e44,'edge':_0x3aeddf,'confidence':_0xf9b412,'entry':_0x1ab730,'entryPrice':_0x1ab730,'stopLoss':_0x853a28,'takeProfit':_0x2a12bd,'riskReward':_0x3e54d4,'stopTicks':_0x38a806['stopTicks'],'targetTicks':_0x38a806[_0x3c9c47(0xdc)],'breakevenTicks':_0x38a806[_0x3c9c47(0x103)],'trailTriggerTicks':_0x38a806[_0x3c9c47(0x122)],'trailDistanceTicks':_0x38a806['trailDistanceTicks'],'beLevel':_0x687422,'trailTrigger':_0x84a97a,'sweepType':_0x3b5751[_0x3c9c47(0x11c)],'penetrationTicks':_0x3b5751[_0x3c9c47(0xa3)],'sweepDurationBars':_0x3b5751['durationBars'],'sweepQuality':_0x3b5751['qualityScore'],'volumeRatio':_0x3b5751[_0x3c9c47(0x9d)],'zoneType':_0x3b5751['zone']['type'],'zoneLevel':_0x3b5751['zone']['getLevel'](),'zoneTouches':_0x3b5751[_0x3c9c47(0x105)]['touches'],'zoneQuality':_0x3b5751['zone'][_0x3c9c47(0xf9)],'expires':Date[_0x3c9c47(0x94)]()+0xea60};return this['emit'](_0x3c9c47(0xed),{'side':_0x4d2769===_0x3c9c47(0xe4)?'buy':'sell','action':_0x3c9c47(0xf4),'reason':'2B\x20'+_0x3b5751['sweepType']+_0x3c9c47(0xc8)+_0x3b5751[_0x3c9c47(0xa3)]['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x3b5751[_0x3c9c47(0x9d)]['toFixed'](0x1)+_0x3c9c47(0xe6)+(_0x3b5751[_0x3c9c47(0xf9)]*0x64)['toFixed'](0x0)+'%',..._0x439d4f}),this[_0x3c9c47(0xfd)](_0x3c9c47(0xbf),{'type':_0x3c9c47(0xa8),'message':_0x3c9c47(0x101)+_0x4d2769['toUpperCase']()+'\x20@\x20'+_0x1ab730['toFixed'](0x2)+_0x3c9c47(0xd8)+_0x3b5751['sweepType']+_0x3c9c47(0xc8)+_0x3b5751['penetrationTicks']['toFixed'](0x1)+'t\x20Vol:'+_0x3b5751['volumeRatio'][_0x3c9c47(0x10e)](0x1)+'x\x20|\x20Conf:'+(_0xf9b412*0x64)['toFixed'](0x0)+'%'}),_0x439d4f;}[_0x387f6b(0xce)](_0x4aaecb,_0x4c2457){const _0x372f1c=_0x387f6b,_0xb0d065=this['barHistory']['get'](_0x4aaecb)||[],_0x5d9fb9=this['liquidityZones'][_0x372f1c(0xc7)](_0x4aaecb)||[],_0x3b20a9=this['swingPoints'][_0x372f1c(0xc7)](_0x4aaecb)||[];if(_0xb0d065[_0x372f1c(0x9a)]<0x5)return{'ready':![],'message':_0x372f1c(0xa6)+_0xb0d065[_0x372f1c(0x9a)]+'/5\x20bars'};const _0x18f308=_0x5d9fb9['map'](_0x1dee7e=>({'zone':_0x1dee7e,'distance':Math['abs'](_0x4c2457-_0x1dee7e['getLevel']())}))['sort']((_0x5680a2,_0x3bd8b1)=>_0x5680a2[_0x372f1c(0xd7)]-_0x3bd8b1[_0x372f1c(0xd7)]),_0x579774=_0x18f308[_0x372f1c(0xc3)](_0x57b413=>_0x57b413[_0x372f1c(0x105)]['type']===ZoneType['RESISTANCE']),_0x27bf00=_0x18f308['find'](_0x150aa8=>_0x150aa8['zone'][_0x372f1c(0xa7)]===ZoneType[_0x372f1c(0x10a)]);return{'ready':!![],'barsProcessed':_0xb0d065['length'],'swingsDetected':_0x3b20a9[_0x372f1c(0x9a)],'activeZones':_0x5d9fb9[_0x372f1c(0x9a)],'nearestResistance':_0x579774?_0x579774['zone']['getLevel']():null,'nearestSupport':_0x27bf00?_0x27bf00['zone'][_0x372f1c(0xde)]():null,'stopTicks':this['config'][_0x372f1c(0xdd)][_0x372f1c(0x117)],'targetTicks':this['config'][_0x372f1c(0xdd)][_0x372f1c(0xdc)],'strategy':_0x372f1c(0xfa)};}[_0x387f6b(0xaa)](_0x11abdc){const _0x2bf0e9=_0x387f6b;this['recentTrades'][_0x2bf0e9(0xbb)]({'netPnl':_0x11abdc,'timestamp':Date['now']()});if(this[_0x2bf0e9(0xfb)]['length']>0x64)this[_0x2bf0e9(0xfb)][_0x2bf0e9(0x104)]();_0x11abdc>0x0?this[_0x2bf0e9(0x127)]['wins']++:this[_0x2bf0e9(0x127)]['losses']++,this[_0x2bf0e9(0x127)]['trades']++,this['stats']['pnl']+=_0x11abdc,this[_0x2bf0e9(0xfd)](_0x2bf0e9(0xbf),{'type':_0x2bf0e9(0xf8),'message':_0x2bf0e9(0xd1)+(_0x11abdc>0x0?'WIN':_0x2bf0e9(0x9b))+'\x20$'+_0x11abdc[_0x2bf0e9(0x10e)](0x2)});}[_0x387f6b(0xd5)](_0x187b52){const _0x43e375=_0x387f6b;return this['barHistory'][_0x43e375(0xc7)](_0x187b52)||[];}['getStats'](){return this['stats'];}[_0x387f6b(0x106)](_0xd778e4){const _0x8911ac=_0x387f6b,_0x2ba776=this['barHistory']['get'](_0xd778e4)||[],_0x3e47cb=this[_0x8911ac(0xf1)]['get'](_0xd778e4)||[],_0x36bcf8=this[_0x8911ac(0xe7)]['get'](_0xd778e4)||[],_0xbb6624=this['currentBar'][_0x8911ac(0xc7)](_0xd778e4),_0x3ec16a=_0x2ba776[_0x2ba776['length']-0x1],_0x4373e3=_0x3ec16a?Date[_0x8911ac(0x94)]()-_0x3ec16a['timestamp']:null,_0x42b07e=_0x3e47cb[_0x8911ac(0xe9)](_0x5e7a04=>_0x5e7a04[_0x8911ac(0xa7)]===ZoneType[_0x8911ac(0xa0)])[_0x8911ac(0x9a)],_0x490272=_0x3e47cb['filter'](_0x451106=>_0x451106['type']===ZoneType[_0x8911ac(0x10a)])[_0x8911ac(0x9a)];return{'healthy':_0x2ba776['length']>=0x5,'barsTotal':_0x2ba776[_0x8911ac(0x9a)],'barsLast5Min':_0x2ba776[_0x8911ac(0xe9)](_0x2dfb9c=>Date['now']()-_0x2dfb9c['timestamp']<0x5*0x3c*0x3e8)[_0x8911ac(0x9a)],'swingsTotal':_0x36bcf8[_0x8911ac(0x9a)],'zonesResistance':_0x42b07e,'zonesSupport':_0x490272,'zonesTotal':_0x3e47cb[_0x8911ac(0x9a)],'currentBarTicks':_0xbb6624?_0xbb6624['tickCount']:0x0,'isAggregating':_0xbb6624&&_0xbb6624[_0x8911ac(0xe2)]>0x0,'timeSinceLastBarMs':_0x4373e3,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this['config']['execution']['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date[_0x8911ac(0x94)]())};}[_0x387f6b(0x121)](_0x186d87){const _0x3e84e8=_0x387f6b;this[_0x3e84e8(0xb3)]['set'](_0x186d87,[]),this['swingPoints'][_0x3e84e8(0xd0)](_0x186d87,[]),this['liquidityZones'][_0x3e84e8(0xd0)](_0x186d87,[]),this['activeSweeps']['set'](_0x186d87,[]),this['currentBar'][_0x3e84e8(0xc5)](_0x186d87),this['emit'](_0x3e84e8(0xbf),{'type':_0x3e84e8(0xa8),'message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x186d87});}['preloadBars'](_0x40c3d9,_0x22a5e4){const _0x9d4408=_0x387f6b;if(!_0x22a5e4||_0x22a5e4[_0x9d4408(0x9a)]===0x0){this[_0x9d4408(0xfd)](_0x9d4408(0xbf),{'type':_0x9d4408(0xf8),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this[_0x9d4408(0xb3)]['has'](_0x40c3d9)&&this[_0x9d4408(0xa4)](_0x40c3d9);const _0x5cebb9=[..._0x22a5e4][_0x9d4408(0xd3)]((_0xcf0fbb,_0x3ae055)=>_0xcf0fbb[_0x9d4408(0xda)]-_0x3ae055['timestamp']);this[_0x9d4408(0xfd)]('log',{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x5cebb9[_0x9d4408(0x9a)]+'\x20historical\x20bars...'});let _0x1e8c51=0x0;for(const _0x5ce701 of _0x5cebb9){const _0x6c4c=this[_0x9d4408(0xbe)](_0x40c3d9,_0x5ce701);if(_0x6c4c)_0x1e8c51++;}const _0x38fe86=this[_0x9d4408(0xb3)]['get'](_0x40c3d9)||[],_0x4632db=this['swingPoints']['get'](_0x40c3d9)||[],_0x262366=this[_0x9d4408(0xf1)]['get'](_0x40c3d9)||[];this[_0x9d4408(0xfd)]('log',{'type':'info','message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x38fe86[_0x9d4408(0x9a)]+_0x9d4408(0x111)+_0x4632db['length']+_0x9d4408(0xf5)+_0x262366[_0x9d4408(0x9a)]+'\x20zones'}),_0x1e8c51>0x0&&this['emit']('log',{'type':'debug','message':_0x9d4408(0xe3)+_0x1e8c51+'\x20historical\x20signals\x20detected\x20(ignored)'}),this['lastSignalTime']=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0xa967ca={}){const _0x265f35=_0x387f6b;super(),this['config']=_0xa967ca,this['strategy']=new HQX2BLiquiditySweep(_0xa967ca),this['strategy']['on']('signal',_0x664c32=>this['emit'](_0x265f35(0xed),_0x664c32)),this['strategy']['on']('log',_0x5edac7=>this['emit'](_0x265f35(0xbf),_0x5edac7));}[_0x387f6b(0x115)](_0x481a2f){const _0x9078ca=_0x387f6b;return this[_0x9078ca(0xf6)]['processTick'](_0x481a2f);}[_0x387f6b(0xff)](_0x1ee571){const _0x2d398c=_0x387f6b;return this[_0x2d398c(0xf6)]['onTick'](_0x1ee571);}[_0x387f6b(0xcf)](_0x55dbc8){const _0x44b6ce=_0x387f6b;return this['strategy'][_0x44b6ce(0xcf)](_0x55dbc8);}[_0x387f6b(0xbe)](_0x500248,_0x228e0b){const _0x147f59=_0x387f6b;return this[_0x147f59(0xf6)]['processBar'](_0x500248,_0x228e0b);}[_0x387f6b(0xa4)](_0x244c66,_0x569c09,_0x1dcb3e){const _0x1d7d75=_0x387f6b;return this['strategy'][_0x1d7d75(0xa4)](_0x244c66,_0x569c09,_0x1dcb3e);}[_0x387f6b(0xce)](_0x2b666d,_0x424af3){return this['strategy']['getAnalysisState'](_0x2b666d,_0x424af3);}['recordTradeResult'](_0x291b78){return this['strategy']['recordTradeResult'](_0x291b78);}['reset'](_0x2d1dea){const _0x2dd8f3=_0x387f6b;return this[_0x2dd8f3(0xf6)][_0x2dd8f3(0x121)](_0x2d1dea);}['getStats'](){const _0x179630=_0x387f6b;return this[_0x179630(0xf6)]['getStats']();}['getBarHistory'](_0x1ee70d){const _0x1aeb57=_0x387f6b;return this[_0x1aeb57(0xf6)][_0x1aeb57(0xd5)](_0x1ee70d);}['preloadBars'](_0x2c9a47,_0x570523){return this['strategy']['preloadBars'](_0x2c9a47,_0x570523);}[_0x387f6b(0x106)](_0x645717){const _0x2cd8ae=_0x387f6b;return this[_0x2cd8ae(0xf6)]['getHealthStatus'](_0x645717);}[_0x387f6b(0xb9)](_0x2e00be){return null;}}function _0x2ecc(){const _0x60bc87=['sweptAt','abs','max','_detectSwings','length','LOSS','volume','volumeRatio','MODERATE','slice','RESISTANCE','minVolumeRatio','[2B]\x20NEW\x20ZONE\x20','penetrationTicks','initialize','_scoreSweep','Collecting\x20data...\x20','type','info','[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20(','recordTradeResult','containsPrice','currentBar','t\x20|\x20Q:\x20','swing','map','isValid','\x20|\x20Pen:\x20','1768978TThOoN','barHistory','exitBarIndex','5405830PKUrQS','low','priceHigh','maxPenetrationTicks','generateSignal','createdAt','push','min','config','processBar','log','barIntervalMs','LOW_SWEEP','object','find','_updateZones','delete','price','get','\x20|\x20Pen:','1659702TzocJh','high','minBodyRatio','barIndex','strength','getAnalysisState','onTrade','set','[HQX-2B]\x20Trade\x20result:\x20','durationBars','sort','lastSignalTime','getBarHistory','125336HCyXIr','distance','\x20|\x20','enabled','timestamp','[2B]\x20SWEEP\x20','targetTicks','execution','getLevel','floor','getFullYear','maxZoneDistanceTicks','tickCount','[HQX-2B]\x20','long','startTime','x\x20|\x20Q:','swingPoints','signals','filter','229485KLBQRd','toUpperCase','VERY_STRONG','signal','isDST','cooldownMs','minStrength','liquidityZones','getUTCHours','287WvEpGJ','open','\x20swings,\x20','strategy','close','debug','qualityScore','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','recentTrades','362659oCshCj','emit',':\x20tick=','onTick','priceLow','[HQX-2B]\x20SIGNAL:\x20','_getVolumeRatio','breakevenTicks','shift','zone','getHealthStatus','lookbackBars','contractId','9dgwBru','SUPPORT','America/New_York','t,\x20BE=','minQualityScore','toFixed','isWithinSession',',\x20TF=1min','\x20bars,\x20','\x20|\x20Valid:\x20','isArray','getTimezoneOffset','processTick','228pYumOt','stopTicks','\x20|\x20Total:\x20','clusterToleranceTicks','_mergeConfig','split','sweepType','tickSize','size',',\x20value=','\x20@\x20','reset','trailTriggerTicks','12qHQdKe','1578730rTZFcc','swept','maxDurationBars','stats','touches','now','lastUsedBarIndex'];_0x2ecc=function(){return _0x60bc87;};return _0x2ecc();}module['exports']={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
1
+ const _0x35c3f9=_0x1213;(function(_0x5a92d1,_0x1139f3){const _0x22ba11=_0x1213,_0x230781=_0x5a92d1();while(!![]){try{const _0x2cf85f=-parseInt(_0x22ba11(0x93))/0x1+-parseInt(_0x22ba11(0xfa))/0x2*(parseInt(_0x22ba11(0x90))/0x3)+parseInt(_0x22ba11(0xde))/0x4+-parseInt(_0x22ba11(0x102))/0x5*(-parseInt(_0x22ba11(0x104))/0x6)+parseInt(_0x22ba11(0xf8))/0x7+parseInt(_0x22ba11(0x8a))/0x8*(parseInt(_0x22ba11(0xa8))/0x9)+-parseInt(_0x22ba11(0xb8))/0xa*(parseInt(_0x22ba11(0xba))/0xb);if(_0x2cf85f===_0x1139f3)break;else _0x230781['push'](_0x230781['shift']());}catch(_0x30be0f){_0x230781['push'](_0x230781['shift']());}}}(_0x292f,0x419db));const EventEmitter=require('events'),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x35c3f9(0xf1),'LOW_SWEEP':_0x35c3f9(0xa6)},ZoneType={'RESISTANCE':'resistance','SUPPORT':'support'},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.25,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.1,'minVolumeRatio':0.3,'minBodyRatio':0.05},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x1388,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':'America/New_York'}};class SwingPoint{constructor(_0x1eecdf,_0x58ff28,_0x33e0bf,_0x7e23c5,_0xe9347b=0x1){const _0x34c47=_0x35c3f9;this['type']=_0x1eecdf,this[_0x34c47(0xf6)]=_0x58ff28,this['barIndex']=_0x33e0bf,this[_0x34c47(0xbc)]=_0x7e23c5,this['strength']=_0xe9347b;}}function _0x1213(_0x3442c7,_0x50c81f){_0x3442c7=_0x3442c7-0x80;const _0x292f2e=_0x292f();let _0x1213e9=_0x292f2e[_0x3442c7];return _0x1213e9;}class LiquidityZone{constructor(_0x5da593,_0x32f3a4,_0x265081,_0x5a4140,_0x4480aa){const _0x498aa6=_0x35c3f9;this['id']=uuidv4(),this['type']=_0x5da593,this['priceHigh']=_0x32f3a4,this['priceLow']=_0x265081,this['createdAt']=_0x5a4140,this['barIndex']=_0x4480aa,this[_0x498aa6(0xbb)]=0x1,this['swept']=![],this['sweptAt']=null,this[_0x498aa6(0xef)]=-0x3e7,this['qualityScore']=0.5;}['containsPrice'](_0x17337f,_0x4be430,_0x4d5c88){const _0x4e9e01=_0x4be430*_0x4d5c88;return _0x17337f>=this['priceLow']-_0x4e9e01&&_0x17337f<=this['priceHigh']+_0x4e9e01;}[_0x35c3f9(0x9d)](){const _0x10c831=_0x35c3f9;return(this['priceHigh']+this[_0x10c831(0xc6)])/0x2;}}class SweepEvent{constructor(_0x18ec93,_0x1d6b95,_0x1c85fd,_0x2fd25e,_0x351687){const _0x381c2c=_0x35c3f9;this[_0x381c2c(0xdd)]=_0x18ec93,this[_0x381c2c(0x9b)]=_0x1d6b95,this['entryBarIndex']=_0x1c85fd,this['extremeBarIndex']=_0x2fd25e,this['extremePrice']=_0x351687,this[_0x381c2c(0x10a)]=null,this['isValid']=![],this['qualityScore']=0x0,this[_0x381c2c(0xb4)]=0x0,this['durationBars']=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x7a51bb={}){const _0x5b058b=_0x35c3f9;super(),this['config']=this['_mergeConfig'](DEFAULT_CONFIG,_0x7a51bb),this[_0x5b058b(0xb0)]=this[_0x5b058b(0xeb)]['tickSize'],this['tickValue']=this[_0x5b058b(0xeb)]['tickValue'],this['barHistory']=new Map(),this[_0x5b058b(0xa1)]=new Map(),this[_0x5b058b(0xec)]=new Map(),this[_0x5b058b(0xe0)]=new Map(),this['currentBar']=new Map(),this[_0x5b058b(0xb5)]=0xea60,this['lastSignalTime']=0x0,this['startTime']=Date['now'](),this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this['recentTrades']=[];}[_0x35c3f9(0x109)](_0x37cc11,_0x31987d){const _0x5c80e1={..._0x37cc11};for(const _0x58d258 in _0x31987d){typeof _0x31987d[_0x58d258]==='object'&&!Array['isArray'](_0x31987d[_0x58d258])?_0x5c80e1[_0x58d258]={..._0x37cc11[_0x58d258],..._0x31987d[_0x58d258]}:_0x5c80e1[_0x58d258]=_0x31987d[_0x58d258];}return _0x5c80e1;}[_0x35c3f9(0xa9)](_0x6773c8){const _0x166696=_0x35c3f9;if(!this[_0x166696(0xeb)]['session'][_0x166696(0xc7)])return!![];const _0xea2e88=new Date(_0x6773c8),_0x14a391=this[_0x166696(0x10b)](_0xea2e88)?-0x4:-0x5,_0x23a53d=_0xea2e88['getUTCHours'](),_0x30ae54=_0xea2e88['getUTCMinutes'](),_0x76c7b7=(_0x23a53d+_0x14a391+0x18)%0x18,{startHour:_0x54add7,startMinute:_0x307d80,endHour:_0x34bb18,endMinute:_0x5e1934}=this[_0x166696(0xeb)]['session'],_0x7be9c1=_0x76c7b7*0x3c+_0x30ae54,_0x15a916=_0x54add7*0x3c+_0x307d80,_0x5e9d91=_0x34bb18*0x3c+_0x5e1934;return _0x7be9c1>=_0x15a916&&_0x7be9c1<_0x5e9d91;}[_0x35c3f9(0x10b)](_0x4a125a){const _0x5ded77=_0x35c3f9,_0x5c124d=new Date(_0x4a125a['getFullYear'](),0x0,0x1),_0x1d9edd=new Date(_0x4a125a['getFullYear'](),0x6,0x1),_0x28f042=Math['max'](_0x5c124d[_0x5ded77(0xf0)](),_0x1d9edd['getTimezoneOffset']());return _0x4a125a['getTimezoneOffset']()<_0x28f042;}['initialize'](_0x358109,_0x5c84bd=0.25,_0x4a3120=0x5){const _0x17b070=_0x35c3f9;this['tickSize']=_0x5c84bd,this['tickValue']=_0x4a3120,this[_0x17b070(0xeb)][_0x17b070(0xb0)]=_0x5c84bd,this['config']['tickValue']=_0x4a3120,this['barHistory']['set'](_0x358109,[]),this['swingPoints']['set'](_0x358109,[]),this['liquidityZones'][_0x17b070(0x8d)](_0x358109,[]),this['activeSweeps']['set'](_0x358109,[]),this[_0x17b070(0xda)]['delete'](_0x358109),this[_0x17b070(0xdf)]('log',{'type':_0x17b070(0xcd),'message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x358109+':\x20tick='+_0x5c84bd+_0x17b070(0xd4)+_0x4a3120+_0x17b070(0x91)}),this['emit'](_0x17b070(0xfd),{'type':_0x17b070(0xcd),'message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x17b070(0xeb)][_0x17b070(0x9c)][_0x17b070(0xc9)]+'t,\x20Target='+this['config']['execution']['targetTicks']+'t,\x20BE='+this[_0x17b070(0xeb)][_0x17b070(0x9c)]['breakevenTicks']+'t,\x20Trail='+this[_0x17b070(0xeb)]['execution']['trailTriggerTicks']+'/'+this[_0x17b070(0xeb)][_0x17b070(0x9c)][_0x17b070(0xcb)]});}[_0x35c3f9(0xcc)](_0x38f024){const _0xd521d1=_0x35c3f9,{contractId:_0x398490,price:_0x1b9514,volume:_0x4085e5,timestamp:_0x46a2dd}=_0x38f024,_0x1f57bc=_0x46a2dd||Date['now'](),_0x1d25fd=_0x4085e5||0x1;if(!this[_0xd521d1(0xa9)](_0x1f57bc))return null;let _0x52e6e0=this[_0xd521d1(0xda)][_0xd521d1(0xa2)](_0x398490);const _0x35fc7a=Math['floor'](_0x1f57bc/this[_0xd521d1(0xb5)])*this['barIntervalMs'];if(!_0x52e6e0||_0x52e6e0[_0xd521d1(0xd8)]!==_0x35fc7a){if(_0x52e6e0){const _0x7fb52e={'timestamp':_0x52e6e0['startTime'],'open':_0x52e6e0[_0xd521d1(0x80)],'high':_0x52e6e0[_0xd521d1(0xf1)],'low':_0x52e6e0['low'],'close':_0x52e6e0[_0xd521d1(0xbf)],'volume':_0x52e6e0['volume']},_0x4f8795=this[_0xd521d1(0xad)](_0x398490,_0x7fb52e);return this[_0xd521d1(0xda)][_0xd521d1(0x8d)](_0x398490,{'startTime':_0x35fc7a,'open':_0x1b9514,'high':_0x1b9514,'low':_0x1b9514,'close':_0x1b9514,'volume':_0x1d25fd}),_0x4f8795;}else return this[_0xd521d1(0xda)]['set'](_0x398490,{'startTime':_0x35fc7a,'open':_0x1b9514,'high':_0x1b9514,'low':_0x1b9514,'close':_0x1b9514,'volume':_0x1d25fd}),null;}else return _0x52e6e0['high']=Math['max'](_0x52e6e0[_0xd521d1(0xf1)],_0x1b9514),_0x52e6e0[_0xd521d1(0xa6)]=Math['min'](_0x52e6e0['low'],_0x1b9514),_0x52e6e0['close']=_0x1b9514,_0x52e6e0['volume']+=_0x1d25fd,null;}[_0x35c3f9(0x92)](_0x56df0d){return this['processTick'](_0x56df0d);}['onTrade'](_0x452b74){const _0x1685ec=_0x35c3f9;return this[_0x1685ec(0xcc)]({'contractId':_0x452b74['contractId']||_0x452b74[_0x1685ec(0xfe)],'price':_0x452b74['price'],'volume':_0x452b74['size']||_0x452b74['volume']||0x1,'timestamp':_0x452b74[_0x1685ec(0xbc)]||Date['now']()});}['processBar'](_0x5ef24e,_0x415499){const _0x1e4892=_0x35c3f9;let _0x528b72=this['barHistory'][_0x1e4892(0xa2)](_0x5ef24e);!_0x528b72&&(this[_0x1e4892(0x86)](_0x5ef24e),_0x528b72=this[_0x1e4892(0xca)]['get'](_0x5ef24e));_0x528b72[_0x1e4892(0x10e)](_0x415499);if(_0x528b72[_0x1e4892(0xb1)]>0x1f4)_0x528b72['shift']();const _0x5d799c=_0x528b72[_0x1e4892(0xb1)]-0x1;if(_0x528b72['length']<this[_0x1e4892(0xeb)]['swing']['lookbackBars']*0x3)return null;const _0x465836=this['swingPoints']['get'](_0x5ef24e)['length'];this[_0x1e4892(0xa4)](_0x5ef24e,_0x528b72,_0x5d799c);const _0x39c2fb=this[_0x1e4892(0xa1)]['get'](_0x5ef24e);if(_0x39c2fb[_0x1e4892(0xb1)]>_0x465836){const _0x75feb0=_0x39c2fb[_0x39c2fb[_0x1e4892(0xb1)]-0x1];this['emit'](_0x1e4892(0xfd),{'type':_0x1e4892(0xb3),'message':'[2B]\x20NEW\x20SWING\x20'+_0x75feb0[_0x1e4892(0xa3)][_0x1e4892(0xe8)]()+_0x1e4892(0x110)+_0x75feb0['price'][_0x1e4892(0x108)](0x2)+'\x20|\x20Total:\x20'+_0x39c2fb[_0x1e4892(0xb1)]});}const _0x1532e7=this['_detectSweep'](_0x5ef24e,_0x528b72,_0x5d799c);_0x1532e7&&this[_0x1e4892(0xdf)]('log',{'type':_0x1e4892(0xb3),'message':'[2B]\x20SWEEP\x20'+_0x1532e7[_0x1e4892(0xdd)]+_0x1e4892(0x101)+_0x1532e7[_0x1e4892(0xf7)]+_0x1e4892(0xd9)+_0x1532e7['penetrationTicks']['toFixed'](0x1)+'t\x20|\x20Q:\x20'+(_0x1532e7[_0x1e4892(0xd7)]*0x64)[_0x1e4892(0x108)](0x0)+'%'});const _0xb61e=this['liquidityZones']['get'](_0x5ef24e)[_0x1e4892(0xb1)];this['_updateZones'](_0x5ef24e,_0x5d799c);const _0x5ed14f=this['liquidityZones'][_0x1e4892(0xa2)](_0x5ef24e);if(_0x5ed14f[_0x1e4892(0xb1)]>_0xb61e){const _0x8dfeab=_0x5ed14f[_0x5ed14f['length']-0x1];this[_0x1e4892(0xdf)]('log',{'type':'debug','message':_0x1e4892(0xdb)+_0x8dfeab['type']['toUpperCase']()+_0x1e4892(0x110)+_0x8dfeab[_0x1e4892(0x9d)]()[_0x1e4892(0x108)](0x2)+_0x1e4892(0xe9)+_0x5ed14f[_0x1e4892(0xb1)]});}if(_0x1532e7&&_0x1532e7['isValid']){this[_0x1e4892(0xdf)]('log',{'type':'debug','message':_0x1e4892(0xaf)+_0x1532e7[_0x1e4892(0xdd)]+'\x20sweep...'});const _0x1a5e56=this[_0x1e4892(0xe4)](_0x5ef24e,_0x415499,_0x5d799c,_0x1532e7);return!_0x1a5e56&&this[_0x1e4892(0xdf)]('log',{'type':_0x1e4892(0xb3),'message':_0x1e4892(0x84)}),_0x1a5e56;}return null;}[_0x35c3f9(0xa4)](_0x1e8fcb,_0xceb5c8,_0x52be00){const _0x519dd4=_0x35c3f9,_0x3254b1=this[_0x519dd4(0xeb)][_0x519dd4(0xea)][_0x519dd4(0x96)],_0xf8c08=this[_0x519dd4(0xeb)]['swing'][_0x519dd4(0x9e)];if(_0x52be00<_0x3254b1*0x2)return;const _0x47f007=this[_0x519dd4(0xa1)][_0x519dd4(0xa2)](_0x1e8fcb),_0x4e9df2=_0x52be00-_0x3254b1,_0x552914=_0xceb5c8[_0x4e9df2];let _0x8c01ac=!![],_0xa0e1ea=0x0;for(let _0x3af1a7=_0x4e9df2-_0x3254b1;_0x3af1a7<=_0x4e9df2+_0x3254b1;_0x3af1a7++){if(_0x3af1a7===_0x4e9df2||_0x3af1a7<0x0||_0x3af1a7>=_0xceb5c8['length'])continue;if(_0xceb5c8[_0x3af1a7]['high']>=_0x552914[_0x519dd4(0xf1)]){_0x8c01ac=![];break;}_0xa0e1ea++;}if(_0x8c01ac&&_0xa0e1ea>=_0xf8c08){const _0x51cb36=_0x47f007['find'](_0x2c235e=>_0x2c235e['barIndex']===_0x4e9df2&&_0x2c235e['type']===_0x519dd4(0xf1));!_0x51cb36&&_0x47f007[_0x519dd4(0x10e)](new SwingPoint('high',_0x552914['high'],_0x4e9df2,_0x552914[_0x519dd4(0xbc)],_0xa0e1ea));}let _0xaa19f5=!![],_0xb32331=0x0;for(let _0x458333=_0x4e9df2-_0x3254b1;_0x458333<=_0x4e9df2+_0x3254b1;_0x458333++){if(_0x458333===_0x4e9df2||_0x458333<0x0||_0x458333>=_0xceb5c8['length'])continue;if(_0xceb5c8[_0x458333]['low']<=_0x552914[_0x519dd4(0xa6)]){_0xaa19f5=![];break;}_0xb32331++;}if(_0xaa19f5&&_0xb32331>=_0xf8c08){const _0x5719de=_0x47f007[_0x519dd4(0xfb)](_0x33a653=>_0x33a653['barIndex']===_0x4e9df2&&_0x33a653[_0x519dd4(0xa3)]==='low');!_0x5719de&&_0x47f007['push'](new SwingPoint(_0x519dd4(0xa6),_0x552914['low'],_0x4e9df2,_0x552914[_0x519dd4(0xbc)],_0xb32331));}const _0x22d2ba=this[_0x519dd4(0xeb)]['zone'][_0x519dd4(0xc8)];while(_0x47f007['length']>0x0&&_0x47f007[0x0][_0x519dd4(0x97)]<_0x52be00-_0x22d2ba){_0x47f007['shift']();}}[_0x35c3f9(0x103)](_0x5879a9,_0x2bbe16){const _0x16f859=_0x35c3f9,_0x9c80f0=this['swingPoints']['get'](_0x5879a9),_0x2cc6ef=this[_0x16f859(0xec)]['get'](_0x5879a9),_0x58da1c=this[_0x16f859(0xeb)][_0x16f859(0x9b)]['clusterToleranceTicks']*this['tickSize'],_0x1c78ae=this[_0x16f859(0xeb)][_0x16f859(0x9b)]['maxZoneAgeBars'];for(let _0x28554d=_0x2cc6ef[_0x16f859(0xb1)]-0x1;_0x28554d>=0x0;_0x28554d--){_0x2bbe16-_0x2cc6ef[_0x28554d]['barIndex']>_0x1c78ae&&_0x2cc6ef['splice'](_0x28554d,0x1);}for(const _0x45b6f6 of _0x9c80f0){let _0x47c564=null;for(const _0x1865c5 of _0x2cc6ef){if(_0x1865c5[_0x16f859(0xdc)](_0x45b6f6[_0x16f859(0xf6)],this[_0x16f859(0xeb)][_0x16f859(0x9b)]['clusterToleranceTicks'],this['tickSize'])){_0x47c564=_0x1865c5;break;}}if(_0x47c564){_0x47c564['touches']++;if(_0x45b6f6['price']>_0x47c564['priceHigh'])_0x47c564[_0x16f859(0x10c)]=_0x45b6f6[_0x16f859(0xf6)];if(_0x45b6f6['price']<_0x47c564['priceLow'])_0x47c564['priceLow']=_0x45b6f6[_0x16f859(0xf6)];_0x47c564['qualityScore']=Math[_0x16f859(0xe3)](0x1,0.3+_0x47c564['touches']*0.15);}else{const _0x13f68b=_0x45b6f6[_0x16f859(0xa3)]===_0x16f859(0xf1)?ZoneType[_0x16f859(0x105)]:ZoneType[_0x16f859(0xf4)],_0x4b09fa=new LiquidityZone(_0x13f68b,_0x45b6f6['price']+_0x58da1c/0x2,_0x45b6f6['price']-_0x58da1c/0x2,_0x45b6f6['timestamp'],_0x45b6f6[_0x16f859(0x97)]);_0x4b09fa['qualityScore']=0.3+_0x45b6f6['strength']*0.1,_0x2cc6ef['push'](_0x4b09fa);}}}['_detectSweep'](_0x24d067,_0xcadc1f,_0xb88e3c){const _0x284223=_0x35c3f9,_0x2b48d2=this[_0x284223(0xec)][_0x284223(0xa2)](_0x24d067),_0x433b81=_0xcadc1f[_0xb88e3c],_0x1740ce=_0x433b81['close'],_0xee2e48=this[_0x284223(0xeb)][_0x284223(0x88)],_0x283be=this[_0x284223(0xeb)]['zone'];for(const _0x16ef69 of _0x2b48d2){if(_0x16ef69['lastUsedBarIndex']>=0x0&&_0xb88e3c-_0x16ef69[_0x284223(0xef)]<_0x283be['cooldownBars'])continue;const _0x1bd0f9=_0x16ef69['getLevel'](),_0x100a33=Math[_0x284223(0x9a)](_0x1740ce-_0x1bd0f9)/this[_0x284223(0xb0)];if(_0x100a33>_0x283be['maxZoneDistanceTicks'])continue;const _0x135e8d=Math['max'](0x0,_0xb88e3c-_0xee2e48[_0x284223(0x82)]*0x2);for(let _0x484352=_0x135e8d;_0x484352<_0xb88e3c;_0x484352++){const _0x5bbec1=_0xcadc1f[_0x484352];if(_0x16ef69['type']===ZoneType[_0x284223(0x105)]){const _0x1daf48=(_0x5bbec1['high']-_0x16ef69['priceHigh'])/this['tickSize'];if(_0x1daf48>=_0xee2e48[_0x284223(0xd5)]&&_0x1daf48<=_0xee2e48[_0x284223(0x8b)]){const _0x862f19=Math[_0x284223(0xe3)](_0x16ef69['priceHigh'],_0x16ef69['priceHigh']+_0x1daf48*this[_0x284223(0xb0)]);if(_0x1740ce<_0x862f19+this['tickSize']*0x2){const _0xf41082=_0x5bbec1[_0x284223(0xf1)]-_0x5bbec1['low'],_0x43e325=Math[_0x284223(0x9a)](_0x5bbec1[_0x284223(0xbf)]-_0x5bbec1[_0x284223(0x80)]),_0x3bf102=_0xf41082>0x0?_0x43e325/_0xf41082:0x0;if(_0x3bf102>=_0xee2e48['minBodyRatio']){const _0x15884=this[_0x284223(0x94)](_0xcadc1f,_0x484352,0x14);if(_0x15884>=_0xee2e48[_0x284223(0x8e)]){const _0xc52efa=new SweepEvent(SweepType['HIGH_SWEEP'],_0x16ef69,_0x484352,_0x484352,_0x5bbec1['high']);_0xc52efa[_0x284223(0x10a)]=_0xb88e3c,_0xc52efa['penetrationTicks']=_0x1daf48,_0xc52efa[_0x284223(0xd6)]=_0xb88e3c-_0x484352,_0xc52efa['volumeRatio']=_0x15884,_0xc52efa['qualityScore']=this['_scoreSweep'](_0xc52efa,_0x3bf102),_0xc52efa['isValid']=_0xc52efa[_0x284223(0xd7)]>=_0xee2e48['minQualityScore'];if(_0xc52efa['isValid'])return _0xc52efa;}}}}}if(_0x16ef69['type']===ZoneType[_0x284223(0xf4)]){const _0x3bab33=(_0x16ef69['priceLow']-_0x5bbec1[_0x284223(0xa6)])/this[_0x284223(0xb0)];if(_0x3bab33>=_0xee2e48['minPenetrationTicks']&&_0x3bab33<=_0xee2e48[_0x284223(0x8b)]){const _0x1e9e19=Math[_0x284223(0xb9)](_0x16ef69['priceLow'],_0x16ef69[_0x284223(0xc6)]-_0x3bab33*this[_0x284223(0xb0)]);if(_0x1740ce>_0x1e9e19-this['tickSize']*0x2){const _0x3f32d7=_0x5bbec1[_0x284223(0xf1)]-_0x5bbec1[_0x284223(0xa6)],_0x22d77b=Math[_0x284223(0x9a)](_0x5bbec1['close']-_0x5bbec1[_0x284223(0x80)]),_0x57bc3d=_0x3f32d7>0x0?_0x22d77b/_0x3f32d7:0x0;if(_0x57bc3d>=_0xee2e48[_0x284223(0xee)]){const _0x114936=this[_0x284223(0x94)](_0xcadc1f,_0x484352,0x14);if(_0x114936>=_0xee2e48['minVolumeRatio']){const _0x4c8edc=new SweepEvent(SweepType['LOW_SWEEP'],_0x16ef69,_0x484352,_0x484352,_0x5bbec1['low']);_0x4c8edc['exitBarIndex']=_0xb88e3c,_0x4c8edc['penetrationTicks']=_0x3bab33,_0x4c8edc[_0x284223(0xd6)]=_0xb88e3c-_0x484352,_0x4c8edc[_0x284223(0xc3)]=_0x114936,_0x4c8edc[_0x284223(0xd7)]=this[_0x284223(0xd3)](_0x4c8edc,_0x57bc3d),_0x4c8edc[_0x284223(0xf7)]=_0x4c8edc['qualityScore']>=_0xee2e48['minQualityScore'];if(_0x4c8edc[_0x284223(0xf7)])return _0x4c8edc;}}}}}}}return null;}['_getVolumeRatio'](_0x635ee1,_0x570516,_0x1710db){const _0xf02ec6=_0x35c3f9,_0x2b456b=Math['max'](0x0,_0x570516-_0x1710db),_0x355bd7=_0x635ee1['slice'](_0x2b456b,_0x570516);if(_0x355bd7['length']===0x0)return 0x1;const _0x1469a1=_0x355bd7['map'](_0x3282e0=>_0x3282e0['volume'])[_0xf02ec6(0xa5)]((_0x4e482f,_0x2e0c65)=>_0x4e482f-_0x2e0c65),_0x49b88c=Math[_0xf02ec6(0xe7)](_0x1469a1['length']/0x2),_0x18b39c=_0x1469a1[_0x49b88c]||0x1;return _0x635ee1[_0x570516][_0xf02ec6(0xc5)]/_0x18b39c;}[_0x35c3f9(0xd3)](_0x19db72,_0x361733){const _0x1dfdde=_0x35c3f9;let _0x22e617=0x0;const _0x1da3a4=0x4,_0x2aa434=Math['abs'](_0x19db72[_0x1dfdde(0xb4)]-_0x1da3a4);return _0x22e617+=Math[_0x1dfdde(0xb9)](0x0,0.3-_0x2aa434*0.03),_0x22e617+=Math['max'](0x0,0.25-_0x19db72['durationBars']*0.05),_0x22e617+=Math[_0x1dfdde(0xe3)](0.25,_0x19db72['volumeRatio']*0.1),_0x22e617+=Math[_0x1dfdde(0xe3)](0.2,_0x361733*0.4),Math[_0x1dfdde(0xe3)](0x1,_0x22e617);}[_0x35c3f9(0xe4)](_0x2a8d22,_0x5c148e,_0x19b712,_0x399ca6){const _0x4f34e7=_0x35c3f9,_0xbbec6e=Date['now']()-this['lastSignalTime'];if(_0xbbec6e<this['config']['execution'][_0x4f34e7(0x100)])return this[_0x4f34e7(0xdf)](_0x4f34e7(0xfd),{'type':_0x4f34e7(0xb3),'message':'[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20('+(_0xbbec6e/0x3e8)['toFixed'](0x1)+'s\x20<\x20'+this[_0x4f34e7(0xeb)]['execution'][_0x4f34e7(0x100)]/0x3e8+'s)'}),null;const _0xfebdf5=this[_0x4f34e7(0xeb)][_0x4f34e7(0x9c)],_0x2da01c=_0x5c148e[_0x4f34e7(0xbf)],_0xee442b=_0x399ca6[_0x4f34e7(0xdd)]===SweepType['HIGH_SWEEP']?_0x4f34e7(0xf9):_0x4f34e7(0xfc);let _0x5d19e0,_0x439324,_0x89dde8,_0x3ac884;_0xee442b==='long'?(_0x5d19e0=_0x2da01c-_0xfebdf5[_0x4f34e7(0xc9)]*this['tickSize'],_0x439324=_0x2da01c+_0xfebdf5[_0x4f34e7(0x95)]*this[_0x4f34e7(0xb0)],_0x89dde8=_0x2da01c+_0xfebdf5['breakevenTicks']*this[_0x4f34e7(0xb0)],_0x3ac884=_0x2da01c+_0xfebdf5[_0x4f34e7(0xd2)]*this[_0x4f34e7(0xb0)]):(_0x5d19e0=_0x2da01c+_0xfebdf5['stopTicks']*this[_0x4f34e7(0xb0)],_0x439324=_0x2da01c-_0xfebdf5['targetTicks']*this[_0x4f34e7(0xb0)],_0x89dde8=_0x2da01c-_0xfebdf5[_0x4f34e7(0x87)]*this['tickSize'],_0x3ac884=_0x2da01c-_0xfebdf5['trailTriggerTicks']*this['tickSize']);const _0x1c0a7a=_0xfebdf5['targetTicks']/_0xfebdf5[_0x4f34e7(0xc9)],_0x4ccae4=Math[_0x4f34e7(0xe3)](0x1,_0x399ca6[_0x4f34e7(0xd7)]*0.5+_0x399ca6[_0x4f34e7(0x9b)]['qualityScore']*0.3+(_0x399ca6[_0x4f34e7(0xc3)]>1.5?0.2:_0x399ca6[_0x4f34e7(0xc3)]*0.1));let _0x5526f8=SignalStrength['MODERATE'];if(_0x4ccae4>=0.8)_0x5526f8=SignalStrength['VERY_STRONG'];else{if(_0x4ccae4>=0.65)_0x5526f8=SignalStrength[_0x4f34e7(0xae)];else{if(_0x4ccae4<0.5)_0x5526f8=SignalStrength[_0x4f34e7(0x10d)];}}const _0x4527f5=0.5+(_0x4ccae4-0.5)*0.4,_0x25b7a4=_0x4527f5*Math[_0x4f34e7(0x9a)](_0x439324-_0x2da01c)-(0x1-_0x4527f5)*Math[_0x4f34e7(0x9a)](_0x2da01c-_0x5d19e0);_0x399ca6['zone'][_0x4f34e7(0xef)]=_0x19b712,_0x399ca6['zone']['swept']=!![],_0x399ca6['zone']['sweptAt']=new Date(_0x5c148e['timestamp']),this[_0x4f34e7(0x10f)]=Date[_0x4f34e7(0x85)](),this['stats']['signals']++;const _0x12cc67={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x2a8d22['split']('.')[0x0]||_0x2a8d22,'contractId':_0x2a8d22,'side':_0xee442b==='long'?OrderSide['BID']:OrderSide[_0x4f34e7(0xa7)],'direction':_0xee442b,'strategy':_0x4f34e7(0xb7),'strength':_0x5526f8,'edge':_0x25b7a4,'confidence':_0x4ccae4,'entry':_0x2da01c,'entryPrice':_0x2da01c,'stopLoss':_0x5d19e0,'takeProfit':_0x439324,'riskReward':_0x1c0a7a,'stopTicks':_0xfebdf5[_0x4f34e7(0xc9)],'targetTicks':_0xfebdf5[_0x4f34e7(0x95)],'breakevenTicks':_0xfebdf5[_0x4f34e7(0x87)],'trailTriggerTicks':_0xfebdf5['trailTriggerTicks'],'trailDistanceTicks':_0xfebdf5[_0x4f34e7(0xcb)],'beLevel':_0x89dde8,'trailTrigger':_0x3ac884,'sweepType':_0x399ca6[_0x4f34e7(0xdd)],'penetrationTicks':_0x399ca6[_0x4f34e7(0xb4)],'sweepDurationBars':_0x399ca6['durationBars'],'sweepQuality':_0x399ca6[_0x4f34e7(0xd7)],'volumeRatio':_0x399ca6[_0x4f34e7(0xc3)],'zoneType':_0x399ca6['zone'][_0x4f34e7(0xa3)],'zoneLevel':_0x399ca6[_0x4f34e7(0x9b)][_0x4f34e7(0x9d)](),'zoneTouches':_0x399ca6[_0x4f34e7(0x9b)]['touches'],'zoneQuality':_0x399ca6[_0x4f34e7(0x9b)][_0x4f34e7(0xd7)],'expires':Date['now']()+0xea60};return this['emit']('signal',{'side':_0xee442b===_0x4f34e7(0xfc)?_0x4f34e7(0xc4):_0x4f34e7(0xb6),'action':_0x4f34e7(0x80),'reason':'2B\x20'+_0x399ca6['sweepType']+'\x20|\x20Pen:'+_0x399ca6[_0x4f34e7(0xb4)][_0x4f34e7(0x108)](0x1)+_0x4f34e7(0x98)+_0x399ca6['volumeRatio']['toFixed'](0x1)+_0x4f34e7(0xf3)+(_0x399ca6[_0x4f34e7(0xd7)]*0x64)['toFixed'](0x0)+'%',..._0x12cc67}),this[_0x4f34e7(0xdf)](_0x4f34e7(0xfd),{'type':_0x4f34e7(0xcd),'message':'[HQX-2B]\x20SIGNAL:\x20'+_0xee442b['toUpperCase']()+'\x20@\x20'+_0x2da01c['toFixed'](0x2)+_0x4f34e7(0x9f)+_0x399ca6['sweepType']+_0x4f34e7(0xf2)+_0x399ca6['penetrationTicks'][_0x4f34e7(0x108)](0x1)+_0x4f34e7(0xe5)+_0x399ca6[_0x4f34e7(0xc3)][_0x4f34e7(0x108)](0x1)+'x\x20|\x20Conf:'+(_0x4ccae4*0x64)[_0x4f34e7(0x108)](0x0)+'%'}),_0x12cc67;}[_0x35c3f9(0xd0)](_0x17b619,_0x4debb2){const _0x166fd0=_0x35c3f9,_0x54056a=this[_0x166fd0(0xca)][_0x166fd0(0xa2)](_0x17b619)||[],_0x473cff=this[_0x166fd0(0xec)]['get'](_0x17b619)||[],_0x286742=this['swingPoints'][_0x166fd0(0xa2)](_0x17b619)||[];if(_0x54056a['length']<0x5)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x54056a['length']+'/5\x20bars'};const _0x2f61ce=_0x473cff[_0x166fd0(0xa0)](_0x5554c0=>({'zone':_0x5554c0,'distance':Math['abs'](_0x4debb2-_0x5554c0[_0x166fd0(0x9d)]())}))['sort']((_0x188fff,_0x1df62a)=>_0x188fff[_0x166fd0(0xc2)]-_0x1df62a['distance']),_0x31cbd1=_0x2f61ce['find'](_0x434379=>_0x434379[_0x166fd0(0x9b)]['type']===ZoneType[_0x166fd0(0x105)]),_0x57c3d4=_0x2f61ce[_0x166fd0(0xfb)](_0x2a5f9c=>_0x2a5f9c[_0x166fd0(0x9b)]['type']===ZoneType[_0x166fd0(0xf4)]);return{'ready':!![],'barsProcessed':_0x54056a['length'],'swingsDetected':_0x286742['length'],'activeZones':_0x473cff[_0x166fd0(0xb1)],'nearestResistance':_0x31cbd1?_0x31cbd1[_0x166fd0(0x9b)][_0x166fd0(0x9d)]():null,'nearestSupport':_0x57c3d4?_0x57c3d4['zone'][_0x166fd0(0x9d)]():null,'stopTicks':this['config']['execution'][_0x166fd0(0xc9)],'targetTicks':this[_0x166fd0(0xeb)]['execution']['targetTicks'],'strategy':_0x166fd0(0x107)};}[_0x35c3f9(0xf5)](_0x1002e3){const _0x458b0a=_0x35c3f9;this[_0x458b0a(0xcf)]['push']({'netPnl':_0x1002e3,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this[_0x458b0a(0xcf)][_0x458b0a(0x111)]();_0x1002e3>0x0?this[_0x458b0a(0x99)]['wins']++:this['stats'][_0x458b0a(0xed)]++,this['stats'][_0x458b0a(0xce)]++,this[_0x458b0a(0x99)]['pnl']+=_0x1002e3,this['emit'](_0x458b0a(0xfd),{'type':'debug','message':_0x458b0a(0xab)+(_0x1002e3>0x0?'WIN':'LOSS')+'\x20$'+_0x1002e3[_0x458b0a(0x108)](0x2)});}[_0x35c3f9(0x89)](_0x4cd541){const _0x1bff52=_0x35c3f9;return this['barHistory'][_0x1bff52(0xa2)](_0x4cd541)||[];}['getStats'](){const _0x3ddc28=_0x35c3f9;return this[_0x3ddc28(0x99)];}[_0x35c3f9(0xe2)](_0x4c6dc5){const _0x37201e=_0x35c3f9,_0xb8fc6b=this['barHistory'][_0x37201e(0xa2)](_0x4c6dc5)||[],_0x158f67=this[_0x37201e(0xec)]['get'](_0x4c6dc5)||[],_0x281f1e=this[_0x37201e(0xa1)]['get'](_0x4c6dc5)||[],_0x33d38d=this[_0x37201e(0xda)][_0x37201e(0xa2)](_0x4c6dc5),_0x9d3c78=_0xb8fc6b[_0xb8fc6b['length']-0x1],_0x1ec71d=_0x9d3c78?Date['now']()-_0x9d3c78['timestamp']:null,_0x391e40=_0x158f67[_0x37201e(0xc0)](_0x44ae27=>_0x44ae27[_0x37201e(0xa3)]===ZoneType['RESISTANCE'])['length'],_0x2c3816=_0x158f67[_0x37201e(0xc0)](_0x504fbf=>_0x504fbf['type']===ZoneType[_0x37201e(0xf4)])[_0x37201e(0xb1)];return{'healthy':_0xb8fc6b['length']>=0x5,'barsTotal':_0xb8fc6b[_0x37201e(0xb1)],'barsLast5Min':_0xb8fc6b['filter'](_0x1f2233=>Date[_0x37201e(0x85)]()-_0x1f2233[_0x37201e(0xbc)]<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x281f1e['length'],'zonesResistance':_0x391e40,'zonesSupport':_0x2c3816,'zonesTotal':_0x158f67[_0x37201e(0xb1)],'currentBarTicks':_0x33d38d?_0x33d38d[_0x37201e(0x81)]:0x0,'isAggregating':_0x33d38d&&_0x33d38d['tickCount']>0x0,'timeSinceLastBarMs':_0x1ec71d,'lastSignalTime':this[_0x37201e(0x10f)],'signalCooldownMs':this[_0x37201e(0xeb)][_0x37201e(0x9c)]['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date[_0x37201e(0x85)]())};}[_0x35c3f9(0xac)](_0x393a10){const _0x3c464f=_0x35c3f9;this[_0x3c464f(0xca)][_0x3c464f(0x8d)](_0x393a10,[]),this[_0x3c464f(0xa1)]['set'](_0x393a10,[]),this[_0x3c464f(0xec)][_0x3c464f(0x8d)](_0x393a10,[]),this[_0x3c464f(0xe0)]['set'](_0x393a10,[]),this[_0x3c464f(0xda)][_0x3c464f(0xe1)](_0x393a10),this['emit']('log',{'type':_0x3c464f(0xcd),'message':_0x3c464f(0xbd)+_0x393a10});}['preloadBars'](_0x3ca1c9,_0x3a9d2e){const _0x575ac5=_0x35c3f9;if(!_0x3a9d2e||_0x3a9d2e[_0x575ac5(0xb1)]===0x0){this[_0x575ac5(0xdf)](_0x575ac5(0xfd),{'type':'debug','message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory'][_0x575ac5(0xe6)](_0x3ca1c9)&&this['initialize'](_0x3ca1c9);const _0x4af3bf=[..._0x3a9d2e]['sort']((_0x144159,_0x52e966)=>_0x144159['timestamp']-_0x52e966[_0x575ac5(0xbc)]);this[_0x575ac5(0xdf)](_0x575ac5(0xfd),{'type':'info','message':_0x575ac5(0xb2)+_0x4af3bf['length']+'\x20historical\x20bars...'});let _0xaa7e8c=0x0;for(const _0x10ebbf of _0x4af3bf){const _0x53ea3a=this['processBar'](_0x3ca1c9,_0x10ebbf);if(_0x53ea3a)_0xaa7e8c++;}const _0x3c9c95=this[_0x575ac5(0xca)][_0x575ac5(0xa2)](_0x3ca1c9)||[],_0x2de561=this[_0x575ac5(0xa1)][_0x575ac5(0xa2)](_0x3ca1c9)||[],_0x13cf29=this[_0x575ac5(0xec)][_0x575ac5(0xa2)](_0x3ca1c9)||[];this['emit']('log',{'type':'info','message':_0x575ac5(0x8f)+_0x3c9c95['length']+'\x20bars,\x20'+_0x2de561[_0x575ac5(0xb1)]+_0x575ac5(0x106)+_0x13cf29['length']+_0x575ac5(0xff)}),_0xaa7e8c>0x0&&this[_0x575ac5(0xdf)](_0x575ac5(0xfd),{'type':_0x575ac5(0xb3),'message':'[HQX-2B]\x20'+_0xaa7e8c+_0x575ac5(0xbe)}),this[_0x575ac5(0x10f)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x10a243={}){const _0x546e51=_0x35c3f9;super(),this['config']=_0x10a243,this['strategy']=new HQX2BLiquiditySweep(_0x10a243),this['strategy']['on'](_0x546e51(0x8c),_0x5c2709=>this['emit'](_0x546e51(0x8c),_0x5c2709)),this[_0x546e51(0xd1)]['on']('log',_0x5648d5=>this[_0x546e51(0xdf)](_0x546e51(0xfd),_0x5648d5));}['processTick'](_0x10f7d5){const _0x1b4911=_0x35c3f9;return this[_0x1b4911(0xd1)][_0x1b4911(0xcc)](_0x10f7d5);}['onTick'](_0x383881){const _0x3977be=_0x35c3f9;return this[_0x3977be(0xd1)][_0x3977be(0x92)](_0x383881);}['onTrade'](_0x4ff93b){const _0x355fc9=_0x35c3f9;return this['strategy'][_0x355fc9(0x83)](_0x4ff93b);}[_0x35c3f9(0xad)](_0x2553c4,_0x503ca2){const _0x30c7db=_0x35c3f9;return this[_0x30c7db(0xd1)]['processBar'](_0x2553c4,_0x503ca2);}[_0x35c3f9(0x86)](_0x47d982,_0x35e189,_0x5efba8){const _0x399739=_0x35c3f9;return this['strategy'][_0x399739(0x86)](_0x47d982,_0x35e189,_0x5efba8);}['getAnalysisState'](_0x3fbaae,_0x116f5e){const _0x3dbd07=_0x35c3f9;return this['strategy'][_0x3dbd07(0xd0)](_0x3fbaae,_0x116f5e);}['recordTradeResult'](_0x3d2f84){const _0xf0d2f2=_0x35c3f9;return this[_0xf0d2f2(0xd1)]['recordTradeResult'](_0x3d2f84);}[_0x35c3f9(0xac)](_0x165c6f){const _0x312ca2=_0x35c3f9;return this[_0x312ca2(0xd1)][_0x312ca2(0xac)](_0x165c6f);}[_0x35c3f9(0xaa)](){const _0x4c2d05=_0x35c3f9;return this[_0x4c2d05(0xd1)][_0x4c2d05(0xaa)]();}['getBarHistory'](_0x3861d6){const _0x1954e8=_0x35c3f9;return this[_0x1954e8(0xd1)]['getBarHistory'](_0x3861d6);}['preloadBars'](_0xee10f3,_0x1f6eb6){const _0x2bfb17=_0x35c3f9;return this[_0x2bfb17(0xd1)][_0x2bfb17(0xc1)](_0xee10f3,_0x1f6eb6);}['getHealthStatus'](_0x595bcf){return this['strategy']['getHealthStatus'](_0x595bcf);}['generateSignal'](_0x43ae7c){return null;}}function _0x292f(){const _0x473352=['stopTicks','barHistory','trailDistanceTicks','processTick','info','trades','recentTrades','getAnalysisState','strategy','trailTriggerTicks','_scoreSweep',',\x20value=','minPenetrationTicks','durationBars','qualityScore','startTime','\x20|\x20Pen:\x20','currentBar','[2B]\x20NEW\x20ZONE\x20','containsPrice','sweepType','520440QcdvfG','emit','activeSweeps','delete','getHealthStatus','min','_generateSignal','t\x20Vol:','has','floor','toUpperCase','\x20|\x20Total:\x20','swing','config','liquidityZones','losses','minBodyRatio','lastUsedBarIndex','getTimezoneOffset','high','\x20|\x20Pen:','x\x20|\x20Q:','SUPPORT','recordTradeResult','price','isValid','506009OtBYxG','short','7322HZZBiP','find','long','log','symbol','\x20zones','cooldownMs','\x20|\x20Valid:\x20','405cyrcaB','_updateZones','22362BFkLZq','RESISTANCE','\x20swings,\x20','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','toFixed','_mergeConfig','exitBarIndex','isDST','priceHigh','WEAK','push','lastSignalTime','\x20@\x20','shift','open','tickCount','maxDurationBars','onTrade','[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)','now','initialize','breakevenTicks','sweep','getBarHistory','8SASPzp','maxPenetrationTicks','signal','set','minVolumeRatio','[HQX-2B]\x20Preload\x20complete:\x20','78LIuqWK',',\x20TF=1min','onTick','153301iOLlhy','_getVolumeRatio','targetTicks','lookbackBars','barIndex','t\x20|\x20Vol:','stats','abs','zone','execution','getLevel','minStrength','\x20|\x20','map','swingPoints','get','type','_detectSwings','sort','low','ASK','3520674lqejxI','isWithinSession','getStats','[HQX-2B]\x20Trade\x20result:\x20','reset','processBar','STRONG','[2B]\x20Calling\x20_generateSignal\x20for\x20','tickSize','length','[HQX-2B]\x20Preloading\x20','debug','penetrationTicks','barIntervalMs','sell','HQX_2B_LIQUIDITY_SWEEP','10PeZcEr','max','4160420EHYCWW','touches','timestamp','[HQX-2B]\x20Reset\x20state\x20for\x20','\x20historical\x20signals\x20detected\x20(ignored)','close','filter','preloadBars','distance','volumeRatio','buy','volume','priceLow','enabled','maxZoneAgeBars'];_0x292f=function(){return _0x473352;};return _0x292f();}module['exports']={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
@@ -1 +1 @@
1
- const _0x574846=_0x2aaf;(function(_0x49e593,_0xd5bbb){const _0x182fe8=_0x2aaf,_0x5e247b=_0x49e593();while(!![]){try{const _0x23b4df=-parseInt(_0x182fe8(0xff))/0x1+parseInt(_0x182fe8(0x128))/0x2+parseInt(_0x182fe8(0x129))/0x3*(parseInt(_0x182fe8(0xe1))/0x4)+parseInt(_0x182fe8(0x125))/0x5*(-parseInt(_0x182fe8(0x110))/0x6)+-parseInt(_0x182fe8(0xdc))/0x7+parseInt(_0x182fe8(0x10d))/0x8*(-parseInt(_0x182fe8(0xed))/0x9)+parseInt(_0x182fe8(0xf7))/0xa;if(_0x23b4df===_0xd5bbb)break;else _0x5e247b['push'](_0x5e247b['shift']());}catch(_0x43e1e5){_0x5e247b['push'](_0x5e247b['shift']());}}}(_0xe7f5,0xd3cce));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x574846(0x11f)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x9c23af={}){const _0x432530=_0x574846;super(),this['tickSize']=_0x9c23af[_0x432530(0x107)]||0.25,this[_0x432530(0xfe)]=_0x9c23af[_0x432530(0xfe)]||0x5,this['zscoreEntryThreshold']=1.5,this['zscoreExitThreshold']=0.5,this[_0x432530(0x139)]=0x32,this[_0x432530(0x113)]=0.7,this['kalmanProcessNoise']=0.01,this[_0x432530(0xd4)]=0.1,this[_0x432530(0x10e)]=0x64,this[_0x432530(0x12c)]=0x14,this['baseStopTicks']=0x8,this[_0x432530(0xe9)]=0x10,this[_0x432530(0x127)]=0x4,this[_0x432530(0x105)]=0.5,this['minConfidence']=0.55,this['weights']={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x432530(0x12a)]=new Map(),this[_0x432530(0x114)]=new Map(),this[_0x432530(0xf0)]=new Map(),this[_0x432530(0xfc)]=new Map(),this[_0x432530(0x133)]=new Map(),this[_0x432530(0x104)]=[],this['winStreak']=0x0,this[_0x432530(0xf1)]=0x0,this['lastSignalTime']=0x0,this['cooldownMs']=0x7530,this[_0x432530(0x10c)]=0x2710,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x574846(0xfb)](_0x38e8a5,_0x5cce21=0.25,_0x44bd84=0x5){const _0x121888=_0x574846;this[_0x121888(0x107)]=_0x5cce21,this[_0x121888(0xfe)]=_0x44bd84,this['barHistory']['set'](_0x38e8a5,[]),this['priceBuffer']['set'](_0x38e8a5,[]),this['volumeBuffer'][_0x121888(0xe8)](_0x38e8a5,[]),this[_0x121888(0x133)]['set'](_0x38e8a5,[]),this[_0x121888(0xfc)]['set'](_0x38e8a5,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x38e8a5+':\x20tick='+_0x5cce21+',\x20value='+_0x44bd84}),this[_0x121888(0x10f)](_0x121888(0xd3),{'type':'info','message':_0x121888(0x108)});}['processTick'](_0x9c374b){const {contractId:_0x26ec77,price:_0x1b2788,volume:_0x436bc4,side:_0xe1a0c2,timestamp:_0x1291a}=_0x9c374b,_0x30675d={'timestamp':_0x1291a||Date['now'](),'open':_0x1b2788,'high':_0x1b2788,'low':_0x1b2788,'close':_0x1b2788,'volume':_0x436bc4||0x1};return this['processBar'](_0x26ec77,_0x30675d);}[_0x574846(0x112)](_0x1b2861){return this['processTick'](_0x1b2861);}[_0x574846(0xca)](_0x48622c){const _0x587e37=_0x574846;return this['processTick']({'contractId':_0x48622c['contractId']||_0x48622c[_0x587e37(0xe2)],'price':_0x48622c['price'],'volume':_0x48622c['size']||_0x48622c['volume']||0x1,'side':_0x48622c[_0x587e37(0x134)],'timestamp':_0x48622c['timestamp']||Date['now']()});}[_0x574846(0x124)](_0x5d48ab,_0xd1cc00){const _0x5a96d6=_0x574846;let _0x4f7b92=this[_0x5a96d6(0x12a)][_0x5a96d6(0xe4)](_0x5d48ab);!_0x4f7b92&&(this['initialize'](_0x5d48ab),_0x4f7b92=this['barHistory']['get'](_0x5d48ab));_0x4f7b92['push'](_0xd1cc00);if(_0x4f7b92['length']>0x1f4)_0x4f7b92[_0x5a96d6(0x12b)]();const _0x200bf8=this[_0x5a96d6(0x114)][_0x5a96d6(0xe4)](_0x5d48ab);_0x200bf8['push'](_0xd1cc00['close']);if(_0x200bf8['length']>0xc8)_0x200bf8[_0x5a96d6(0x12b)]();const _0x193680=this['volumeBuffer']['get'](_0x5d48ab),_0x3d7e50=_0xd1cc00[_0x5a96d6(0x13c)]-_0xd1cc00['low'];let _0x4d6ede=_0xd1cc00['volume']*0.5,_0x5a71cf=_0xd1cc00['volume']*0.5;if(_0x3d7e50>0x0){const _0x54faf3=(_0xd1cc00['close']-_0xd1cc00['low'])/_0x3d7e50;_0x4d6ede=_0xd1cc00['volume']*_0x54faf3,_0x5a71cf=_0xd1cc00['volume']*(0x1-_0x54faf3);}_0x193680['push']({'buy':_0x4d6ede,'sell':_0x5a71cf});if(_0x193680['length']>0x64)_0x193680[_0x5a96d6(0x12b)]();if(_0x4f7b92['length']<0x32)return null;const _0x1ab3c8=this[_0x5a96d6(0x135)](_0x200bf8),_0x344bb6=this['_computeVPIN'](_0x193680),_0x3688b9=this[_0x5a96d6(0xd8)](_0x4f7b92),_0x22674c=this[_0x5a96d6(0xeb)](_0x5d48ab,_0xd1cc00[_0x5a96d6(0x126)]),{regime:_0x1cc967,params:_0x243671}=this['_detectVolatilityRegime'](_0x5d48ab,_0x4f7b92),_0x4e1878=this[_0x5a96d6(0x13b)](_0x4f7b92);return this[_0x5a96d6(0x123)](_0x5d48ab,_0xd1cc00[_0x5a96d6(0x126)],_0x1ab3c8,_0x344bb6,_0x3688b9,_0x22674c,_0x1cc967,_0x243671,_0x4e1878,_0x4f7b92);}[_0x574846(0x135)](_0xa3f93c,_0x1d860e=0x32){const _0x58e785=_0x574846;if(_0xa3f93c['length']<_0x1d860e)return 0x0;const _0x45082a=_0xa3f93c['slice'](-_0x1d860e),_0x254da2=_0x45082a['reduce']((_0x81a4e,_0x139b3d)=>_0x81a4e+_0x139b3d,0x0)/_0x1d860e,_0x8d6240=_0x45082a['reduce']((_0x361a69,_0x3c67fa)=>_0x361a69+Math['pow'](_0x3c67fa-_0x254da2,0x2),0x0)/_0x1d860e,_0x4a88fc=Math['sqrt'](_0x8d6240);if(_0x4a88fc<0.0001)return 0x0;const _0x2b6c7a=_0xa3f93c[_0xa3f93c[_0x58e785(0x12e)]-0x1];return(_0x2b6c7a-_0x254da2)/_0x4a88fc;}[_0x574846(0xef)](_0x5634bc){const _0x1d3160=_0x574846;if(_0x5634bc['length']<this[_0x1d3160(0x139)])return 0.5;const _0x54fbba=_0x5634bc[_0x1d3160(0x103)](-this[_0x1d3160(0x139)]);let _0x39d73a=0x0,_0x5f1e4f=0x0;for(const _0x5a670c of _0x54fbba){_0x39d73a+=_0x5a670c[_0x1d3160(0x117)],_0x5f1e4f+=_0x5a670c[_0x1d3160(0xd5)];}const _0x265bda=_0x39d73a+_0x5f1e4f;if(_0x265bda<0x1)return 0.5;return Math[_0x1d3160(0x131)](_0x39d73a-_0x5f1e4f)/_0x265bda;}['_computeKyleLambda'](_0x269d9a){const _0xe98788=_0x574846;if(_0x269d9a[_0xe98788(0x12e)]<0x14)return 0x0;const _0x1ce777=_0x269d9a['slice'](-0x14),_0x53a419=[],_0x45b0f6=[];for(let _0xc055f4=0x1;_0xc055f4<_0x1ce777['length'];_0xc055f4++){_0x53a419[_0xe98788(0x13d)](_0x1ce777[_0xc055f4][_0xe98788(0x126)]-_0x1ce777[_0xc055f4-0x1][_0xe98788(0x126)]),_0x45b0f6['push'](_0x1ce777[_0xc055f4]['volume']);}const _0x40b11c=_0x53a419['reduce']((_0x4362aa,_0x1c4b29)=>_0x4362aa+_0x1c4b29,0x0)/_0x53a419[_0xe98788(0x12e)],_0x23968f=_0x45b0f6[_0xe98788(0x100)]((_0x4889a3,_0x12c82c)=>_0x4889a3+_0x12c82c,0x0)/_0x45b0f6['length'];let _0x18c8e6=0x0,_0x469826=0x0;for(let _0x5d474b=0x0;_0x5d474b<_0x53a419['length'];_0x5d474b++){_0x18c8e6+=(_0x53a419[_0x5d474b]-_0x40b11c)*(_0x45b0f6[_0x5d474b]-_0x23968f),_0x469826+=Math['pow'](_0x45b0f6[_0x5d474b]-_0x23968f,0x2);}_0x18c8e6/=_0x53a419[_0xe98788(0x12e)],_0x469826/=_0x53a419[_0xe98788(0x12e)];if(_0x469826<0.0001)return 0x0;return Math['abs'](_0x18c8e6/_0x469826);}['_applyKalmanFilter'](_0x2b387e,_0x2bc328){const _0x413d6b=_0x574846;let _0x2e2fcc=this[_0x413d6b(0xfc)][_0x413d6b(0xe4)](_0x2b387e);if(!_0x2e2fcc)return _0x2e2fcc={'estimate':_0x2bc328,'errorCovariance':0x1},this[_0x413d6b(0xfc)]['set'](_0x2b387e,_0x2e2fcc),_0x2bc328;const _0xa07f3f=_0x2e2fcc[_0x413d6b(0x118)],_0x1a058f=_0x2e2fcc[_0x413d6b(0xdb)]+this['kalmanProcessNoise'],_0x244f8f=_0x1a058f/(_0x1a058f+this['kalmanMeasurementNoise']),_0x49b399=_0xa07f3f+_0x244f8f*(_0x2bc328-_0xa07f3f),_0x42a81f=(0x1-_0x244f8f)*_0x1a058f;return _0x2e2fcc[_0x413d6b(0x118)]=_0x49b399,_0x2e2fcc[_0x413d6b(0xdb)]=_0x42a81f,_0x49b399;}[_0x574846(0xf5)](_0x485353,_0x847e1f){const _0x28601d=_0x574846,_0x21251b=this['_calculateATR'](_0x847e1f),_0x36c4a8=_0x21251b/this[_0x28601d(0x107)];let _0x48142c=this[_0x28601d(0x133)]['get'](_0x485353);!_0x48142c&&(_0x48142c=[],this[_0x28601d(0x133)]['set'](_0x485353,_0x48142c));_0x48142c['push'](_0x21251b);if(_0x48142c['length']>0x1f4)_0x48142c['shift']();let _0x19d7a7=0.5;_0x48142c[_0x28601d(0x12e)]>=0x14&&(_0x19d7a7=_0x48142c['filter'](_0x3cb265=>_0x3cb265<=_0x21251b)['length']/_0x48142c[_0x28601d(0x12e)]);let _0x56f354,_0x2462d6;if(_0x19d7a7<0.25)_0x56f354=_0x28601d(0x116),_0x2462d6={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x19d7a7<0.75?(_0x56f354='normal',_0x2462d6={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x56f354=_0x28601d(0x13c),_0x2462d6={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x56f354,'params':_0x2462d6};}[_0x574846(0xdd)](_0xc3530b,_0x253793=0xe){const _0x1d74c4=_0x574846;if(_0xc3530b['length']<_0x253793+0x1)return 2.5;const _0x4cdb65=[];for(let _0x2ac401=_0xc3530b['length']-_0x253793;_0x2ac401<_0xc3530b[_0x1d74c4(0x12e)];_0x2ac401++){const _0x10ee9d=_0xc3530b[_0x2ac401],_0xbc0bde=_0xc3530b[_0x2ac401-0x1]['close'],_0x4756d9=Math[_0x1d74c4(0x120)](_0x10ee9d['high']-_0x10ee9d['low'],Math['abs'](_0x10ee9d[_0x1d74c4(0x13c)]-_0xbc0bde),Math[_0x1d74c4(0x131)](_0x10ee9d['low']-_0xbc0bde));_0x4cdb65['push'](_0x4756d9);}return _0x4cdb65['reduce']((_0x5dcc67,_0x200f65)=>_0x5dcc67+_0x200f65,0x0)/_0x4cdb65[_0x1d74c4(0x12e)];}[_0x574846(0x13b)](_0x17e29e){const _0x3242e2=_0x574846;if(_0x17e29e['length']<this[_0x3242e2(0x12c)])return 0x0;const _0x2da2cf=_0x17e29e['slice'](-this['ofiLookback']);let _0x41367e=0x0,_0x19fb67=0x0;for(const _0x560317 of _0x2da2cf){const _0xb266a2=_0x560317[_0x3242e2(0x13c)]-_0x560317['low'];if(_0xb266a2>0x0){const _0xee5fef=(_0x560317[_0x3242e2(0x126)]-_0x560317['low'])/_0xb266a2;_0x41367e+=_0xee5fef*_0x560317['volume'],_0x19fb67+=(0x1-_0xee5fef)*_0x560317[_0x3242e2(0xf4)];}}const _0x463757=_0x41367e+_0x19fb67;if(_0x463757<0x1)return 0x0;return(_0x41367e-_0x19fb67)/_0x463757;}['_generateSignal'](_0x299b56,_0xd9305d,_0x105389,_0x2fdbf2,_0x1c07b7,_0x34c8eb,_0x549d83,_0x356b4d,_0x2c5fdc,_0xdd26bb){const _0x52a91c=_0x574846,_0x5dcd9b=Math['abs'](_0x105389);if(_0x5dcd9b<_0x356b4d['zscoreThreshold'])return null;if(_0x2fdbf2>this[_0x52a91c(0x113)])return null;let _0x1c0923;if(_0x105389<-_0x356b4d[_0x52a91c(0x12f)])_0x1c0923=_0x52a91c(0xf3);else{if(_0x105389>_0x356b4d['zscoreThreshold'])_0x1c0923=_0x52a91c(0x13e);else return null;}const _0x5de0e9=_0x1c0923==='long'&&_0x2c5fdc>0.1||_0x1c0923===_0x52a91c(0x13e)&&_0x2c5fdc<-0.1,_0x3b8551=_0xd9305d-_0x34c8eb,_0x129719=_0x1c0923===_0x52a91c(0xf3)&&_0x3b8551<0x0||_0x1c0923===_0x52a91c(0x13e)&&_0x3b8551>0x0,_0x51ee42={'zscore':Math['min'](0x1,_0x5dcd9b/0x4),'vpin':0x1-_0x2fdbf2,'kyleLambda':_0x1c07b7>0.001?0.5:0.8,'kalman':_0x129719?0.8:0.4,'volatility':_0x549d83==='normal'?0.8:_0x549d83===_0x52a91c(0x116)?0.7:0.6,'ofi':_0x5de0e9?0.9:0.5,'composite':0x0};_0x51ee42[_0x52a91c(0xd0)]=_0x51ee42[_0x52a91c(0x115)]*this['weights']['zscore']+_0x51ee42['vpin']*this[_0x52a91c(0x119)][_0x52a91c(0x11b)]+_0x51ee42['kyleLambda']*this['weights']['kyleLambda']+_0x51ee42['kalman']*this[_0x52a91c(0x119)][_0x52a91c(0xee)]+_0x51ee42[_0x52a91c(0x11c)]*this[_0x52a91c(0x119)][_0x52a91c(0x11c)]+_0x51ee42[_0x52a91c(0x136)]*this['weights'][_0x52a91c(0x136)];const _0x5830d2=Math['min'](0x1,_0x51ee42[_0x52a91c(0xd0)]+_0x356b4d[_0x52a91c(0x11e)]);if(_0x5830d2<this[_0x52a91c(0xf8)])return null;if(Date[_0x52a91c(0x130)]()-this[_0x52a91c(0xcb)]<this[_0x52a91c(0xd6)])return null;const _0x350f08=Math[_0x52a91c(0xe0)](this['baseStopTicks']*_0x356b4d['stopMultiplier']),_0x1087e5=Math[_0x52a91c(0xe0)](this[_0x52a91c(0xe9)]*_0x356b4d['targetMultiplier']),_0x1c7235=Math[_0x52a91c(0x120)](0x6,Math['min'](0xc,_0x350f08)),_0x13969a=Math['max'](_0x1c7235*1.5,Math[_0x52a91c(0xd9)](0x18,_0x1087e5));let _0x3af560,_0x2f2c2a,_0x1bea8a,_0x2bd835;_0x1c0923==='long'?(_0x3af560=_0xd9305d-_0x1c7235*this['tickSize'],_0x2f2c2a=_0xd9305d+_0x13969a*this[_0x52a91c(0x107)],_0x1bea8a=_0xd9305d+this[_0x52a91c(0x127)]*this[_0x52a91c(0x107)],_0x2bd835=_0xd9305d+_0x13969a*this[_0x52a91c(0x105)]*this[_0x52a91c(0x107)]):(_0x3af560=_0xd9305d+_0x1c7235*this[_0x52a91c(0x107)],_0x2f2c2a=_0xd9305d-_0x13969a*this['tickSize'],_0x1bea8a=_0xd9305d-this['breakevenTicks']*this['tickSize'],_0x2bd835=_0xd9305d-_0x13969a*this['profitLockPct']*this[_0x52a91c(0x107)]);const _0x48f653=_0x13969a/_0x1c7235,_0xed111b=Math['round'](_0x13969a*0.5),_0x7ff7c7=Math[_0x52a91c(0xe0)](_0x1c7235*0.4);let _0x1372a9=SignalStrength[_0x52a91c(0xe6)];if(_0x5830d2>=0.85)_0x1372a9=SignalStrength['VERY_STRONG'];else{if(_0x5830d2>=0.75)_0x1372a9=SignalStrength['STRONG'];else{if(_0x5830d2<0.6)_0x1372a9=SignalStrength['WEAK'];}}const _0x305edf=0.5+(_0x5830d2-0.5)*0.4,_0xd8415b=_0x305edf*Math[_0x52a91c(0x131)](_0x2f2c2a-_0xd9305d)-(0x1-_0x305edf)*Math['abs'](_0xd9305d-_0x3af560);this[_0x52a91c(0xcb)]=Date['now'](),this[_0x52a91c(0xe5)][_0x52a91c(0x102)]++;const _0x4ce877={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x299b56[_0x52a91c(0x109)]('.')[0x0]||_0x299b56,'contractId':_0x299b56,'side':_0x1c0923===_0x52a91c(0xf3)?OrderSide[_0x52a91c(0x11d)]:OrderSide['ASK'],'direction':_0x1c0923,'strategy':_0x52a91c(0x138),'strength':_0x1372a9,'edge':_0xd8415b,'confidence':_0x5830d2,'entry':_0xd9305d,'entryPrice':_0xd9305d,'stopLoss':_0x3af560,'takeProfit':_0x2f2c2a,'riskReward':_0x48f653,'stopTicks':_0x1c7235,'targetTicks':_0x13969a,'trailTriggerTicks':_0xed111b,'trailDistanceTicks':_0x7ff7c7,'beBreakeven':_0x1bea8a,'profitLockLevel':_0x2bd835,'zScore':_0x105389,'zScoreExit':this[_0x52a91c(0xe7)],'vpinValue':_0x2fdbf2,'kyleLambda':_0x1c07b7,'kalmanEstimate':_0x34c8eb,'volatilityRegime':_0x549d83,'ofiValue':_0x2c5fdc,'models':_0x51ee42,'orderFlowConfirmed':_0x5de0e9,'kalmanConfirmed':_0x129719,'expires':Date['now']()+0xea60};return this['emit']('signal',{'side':_0x1c0923==='long'?_0x52a91c(0x117):_0x52a91c(0xd5),'action':_0x52a91c(0xf6),'reason':'Z='+_0x105389['toFixed'](0x2)+',\x20VPIN='+(_0x2fdbf2*0x64)[_0x52a91c(0xf2)](0x0)+_0x52a91c(0x11a)+(_0x2c5fdc*0x64)[_0x52a91c(0xf2)](0x0)+'%,\x20cf='+(_0x5830d2*0x64)[_0x52a91c(0xf2)](0x0)+'%',..._0x4ce877}),this[_0x52a91c(0x10f)](_0x52a91c(0xd3),{'type':_0x52a91c(0x111),'message':'[HQX]\x20SIGNAL:\x20'+_0x1c0923['toUpperCase']()+'\x20@\x20'+_0xd9305d['toFixed'](0x2)+_0x52a91c(0xf9)+_0x105389[_0x52a91c(0xf2)](0x2)+_0x52a91c(0x12d)+(_0x2fdbf2*0x64)['toFixed'](0x0)+_0x52a91c(0x137)+(_0x2c5fdc*0x64)[_0x52a91c(0xf2)](0x0)+'%\x20Kyle:'+_0x1c07b7[_0x52a91c(0xf2)](0x5)+_0x52a91c(0x10b)+_0x549d83+_0x52a91c(0xcd)+(_0x5830d2*0x64)[_0x52a91c(0xf2)](0x0)+'%'}),_0x4ce877;}['shouldExitByZScore'](_0x1f770a){const _0x4a6d8b=_0x574846,_0x24e074=this[_0x4a6d8b(0x114)][_0x4a6d8b(0xe4)](_0x1f770a);if(!_0x24e074||_0x24e074['length']<0x32)return![];const _0x46e675=this['_computeZScore'](_0x24e074);return Math['abs'](_0x46e675)<this[_0x4a6d8b(0xe7)];}['getModelValues'](_0x562f5f){const _0x351298=_0x574846,_0x108d0f=this['priceBuffer']['get'](_0x562f5f),_0x1e1e36=this[_0x351298(0xf0)][_0x351298(0xe4)](_0x562f5f),_0x45b153=this[_0x351298(0x12a)][_0x351298(0xe4)](_0x562f5f);if(!_0x108d0f||!_0x1e1e36||!_0x45b153||_0x45b153['length']<0x32)return null;const _0x430141=this[_0x351298(0x135)](_0x108d0f),_0x4dd256=this['_computeVPIN'](_0x1e1e36),_0x324aef=this[_0x351298(0xd8)](_0x45b153),_0x334dfa=this[_0x351298(0x13b)](_0x45b153);return{'zscore':Math['min'](0x1,Math['abs'](_0x430141)/0x4),'vpin':0x1-_0x4dd256,'kyleLambda':_0x324aef>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x351298(0x131)](_0x334dfa)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x430141,'vpin':_0x4dd256,'kyleLambda':_0x324aef,'ofi':_0x334dfa}};}[_0x574846(0x121)](_0x4dc27f,_0x23d5b5){const _0x105aad=_0x574846,_0x372e80=this[_0x105aad(0x12a)][_0x105aad(0xe4)](_0x4dc27f)||[];if(_0x372e80['length']<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x372e80['length']+'/50\x20bars'};const _0x384ca7=this['priceBuffer']['get'](_0x4dc27f)||[],_0x46ee9b=this[_0x105aad(0xf0)][_0x105aad(0xe4)](_0x4dc27f)||[],_0x4a9173=this['_computeZScore'](_0x384ca7),_0x22f635=this[_0x105aad(0xef)](_0x46ee9b),_0x125b68=this[_0x105aad(0x13b)](_0x372e80),_0x4b4e82=this['_computeKyleLambda'](_0x372e80),{regime:_0xcfd5e8,params:_0xa458f9}=this[_0x105aad(0xf5)](_0x4dc27f,_0x372e80);return{'ready':!![],'zScore':_0x4a9173,'vpin':_0x22f635,'ofi':_0x125b68,'kyleLambda':_0x4b4e82,'regime':_0xcfd5e8,'stopTicks':Math[_0x105aad(0xe0)](this[_0x105aad(0xde)]*_0xa458f9[_0x105aad(0xfd)]),'targetTicks':Math[_0x105aad(0xe0)](this['baseTargetTicks']*_0xa458f9[_0x105aad(0x101)]),'threshold':_0xa458f9[_0x105aad(0x12f)],'barsProcessed':_0x372e80['length'],'models':_0x105aad(0xfa)};}[_0x574846(0xda)](_0x3f0c43){const _0x5db666=_0x574846;this['recentTrades']['push']({'netPnl':_0x3f0c43,'timestamp':Date[_0x5db666(0x130)]()});if(this['recentTrades']['length']>0x64)this['recentTrades'][_0x5db666(0x12b)]();_0x3f0c43>0x0?(this['winStreak']++,this[_0x5db666(0xf1)]=0x0,this[_0x5db666(0xe5)]['wins']++):(this[_0x5db666(0xf1)]++,this[_0x5db666(0x13f)]=0x0,this[_0x5db666(0xe5)][_0x5db666(0xcf)]++),this['stats'][_0x5db666(0xd7)]++,this['stats']['pnl']+=_0x3f0c43,this[_0x5db666(0x10f)](_0x5db666(0xd3),{'type':'debug','message':_0x5db666(0xe3)+(_0x3f0c43>0x0?_0x5db666(0xec):_0x5db666(0x13a))+'\x20$'+_0x3f0c43[_0x5db666(0xf2)](0x2)+_0x5db666(0xd2)+(_0x3f0c43>0x0?this[_0x5db666(0x13f)]:-this[_0x5db666(0xf1)])});}[_0x574846(0xea)](_0x52e267){const _0xee4464=_0x574846;return this[_0xee4464(0x12a)]['get'](_0x52e267)||[];}['getStats'](){return this['stats'];}[_0x574846(0xce)](_0x91926d){const _0x97aca9=_0x574846;this[_0x97aca9(0x12a)]['set'](_0x91926d,[]),this['priceBuffer']['set'](_0x91926d,[]),this['volumeBuffer']['set'](_0x91926d,[]),this[_0x97aca9(0x133)][_0x97aca9(0xe8)](_0x91926d,[]),this['kalmanStates']['set'](_0x91926d,{'estimate':0x0,'errorCovariance':0x1}),this['emit'](_0x97aca9(0xd3),{'type':_0x97aca9(0x111),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x91926d});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x33993c={}){const _0x1bc047=_0x574846;super(),this['config']=_0x33993c,this[_0x1bc047(0x10a)]=new HQXUltraScalping(_0x33993c),this[_0x1bc047(0x10a)]['on'](_0x1bc047(0x132),_0x38f44a=>this['emit'](_0x1bc047(0x132),_0x38f44a)),this['strategy']['on']('log',_0x75d2f9=>this['emit'](_0x1bc047(0xd3),_0x75d2f9));}[_0x574846(0x106)](_0x210e0d){const _0x1f99fb=_0x574846;return this[_0x1f99fb(0x10a)][_0x1f99fb(0x106)](_0x210e0d);}[_0x574846(0x112)](_0x2c221c){const _0x44f924=_0x574846;return this[_0x44f924(0x10a)]['onTick'](_0x2c221c);}['onTrade'](_0x171366){const _0x50d37=_0x574846;return this[_0x50d37(0x10a)]['onTrade'](_0x171366);}[_0x574846(0x124)](_0x59d8ae,_0x1dd058){const _0x29a4e5=_0x574846;return this[_0x29a4e5(0x10a)][_0x29a4e5(0x124)](_0x59d8ae,_0x1dd058);}['initialize'](_0x454d68,_0x55632e,_0x2e4405){const _0x3d7eba=_0x574846;return this[_0x3d7eba(0x10a)]['initialize'](_0x454d68,_0x55632e,_0x2e4405);}[_0x574846(0x121)](_0x45de2b,_0x21de7d){const _0x18aedc=_0x574846;return this[_0x18aedc(0x10a)]['getAnalysisState'](_0x45de2b,_0x21de7d);}['recordTradeResult'](_0x90840c){const _0x3c242d=_0x574846;return this['strategy'][_0x3c242d(0xda)](_0x90840c);}[_0x574846(0xce)](_0x41c6e9){const _0x21fd64=_0x574846;return this['strategy'][_0x21fd64(0xce)](_0x41c6e9);}[_0x574846(0xdf)](){const _0x5d9963=_0x574846;return this['strategy'][_0x5d9963(0xdf)]();}['getBarHistory'](_0x3e2449){return this['strategy']['getBarHistory'](_0x3e2449);}['getModelValues'](_0x26bbcb){const _0x3d72f3=_0x574846;return this['strategy'][_0x3d72f3(0x122)](_0x26bbcb);}['shouldExitByZScore'](_0x2b0ec6){return this['strategy']['shouldExitByZScore'](_0x2b0ec6);}[_0x574846(0xcc)](_0x1782df){return null;}}module[_0x574846(0xd1)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};function _0x2aaf(_0x145c06,_0x43c8b0){_0x145c06=_0x145c06-0xca;const _0xe7f5da=_0xe7f5();let _0x2aaf13=_0xe7f5da[_0x145c06];return _0x2aaf13;}function _0xe7f5(){const _0x350c35=['shift','ofiLookback','\x20VPIN:','length','zscoreThreshold','now','abs','signal','atrHistory','side','_computeZScore','ofi','%\x20OFI:','HQX_ULTRA_SCALPING_6MODELS','vpinWindow','LOSS','_computeOrderFlowImbalance','high','push','short','winStreak','onTrade','lastSignalTime','generateSignal','\x20|\x20Conf:','reset','losses','composite','exports',',\x20streak:\x20','log','kalmanMeasurementNoise','sell','cooldownMs','trades','_computeKyleLambda','min','recordTradeResult','errorCovariance','1030169BjOfeB','_calculateATR','baseStopTicks','getStats','round','2197460uMgEWH','symbol','[HQX]\x20Trade\x20result:\x20','get','stats','MODERATE','zscoreExitThreshold','set','baseTargetTicks','getBarHistory','_applyKalmanFilter','WIN','637731lQKqyl','kalman','_computeVPIN','volumeBuffer','lossStreak','toFixed','long','volume','_detectVolatilityRegime','open','12697270KQNldJ','minConfidence','\x20|\x20Z:','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','initialize','kalmanStates','stopMultiplier','tickValue','730095GCtyhG','reduce','targetMultiplier','signals','slice','recentTrades','profitLockPct','processTick','tickSize','[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)','split','strategy','\x20Regime:','minHoldTimeMs','88ienqFH','volatilityLookback','emit','200874NBxZbZ','info','onTick','vpinToxicThreshold','priceBuffer','zscore','low','buy','estimate','weights','%,\x20OFI=','vpin','volatility','BID','confidenceBonus','uuid','max','getAnalysisState','getModelValues','_generateSignal','processBar','15urphFL','close','breakevenTicks','512450DLPVLl','6xemBKc','barHistory'];_0xe7f5=function(){return _0x350c35;};return _0xe7f5();}
1
+ function _0x38eb(_0x351938,_0x42abe6){_0x351938=_0x351938-0x1bc;const _0x16fdac=_0x16fd();let _0x38eb0b=_0x16fdac[_0x351938];return _0x38eb0b;}const _0x4097f1=_0x38eb;(function(_0x2724c5,_0x28b938){const _0x50eb2b=_0x38eb,_0xd2c3de=_0x2724c5();while(!![]){try{const _0x4e113f=-parseInt(_0x50eb2b(0x1e5))/0x1+-parseInt(_0x50eb2b(0x1bd))/0x2+-parseInt(_0x50eb2b(0x214))/0x3*(-parseInt(_0x50eb2b(0x215))/0x4)+-parseInt(_0x50eb2b(0x226))/0x5*(parseInt(_0x50eb2b(0x1c9))/0x6)+-parseInt(_0x50eb2b(0x1d7))/0x7*(parseInt(_0x50eb2b(0x201))/0x8)+-parseInt(_0x50eb2b(0x1f7))/0x9*(parseInt(_0x50eb2b(0x220))/0xa)+-parseInt(_0x50eb2b(0x1f8))/0xb*(-parseInt(_0x50eb2b(0x1da))/0xc);if(_0x4e113f===_0x28b938)break;else _0xd2c3de['push'](_0xd2c3de['shift']());}catch(_0x3eb96c){_0xd2c3de['push'](_0xd2c3de['shift']());}}}(_0x16fd,0xe4db8));function _0x16fd(){const _0x1dfe83=['round','profitLockPct','breakevenTicks','ofiLookback','abs','HQX_ULTRA_SCALPING_6MODELS','toUpperCase','kalmanMeasurementNoise','atrHistory','_applyKalmanFilter','log','_generateSignal','zscore','pow','11433KGwyRH','40kdKRBg','sell','baseStopTicks','events','stats','%\x20OFI:','LOSS','reset','composite','[HQX-UltraScalping]\x20Initialized\x20for\x20','slice','30GGUwWQ','long','lastSignalTime','buy','shouldExitByZScore','[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)','35YzcCyN','getAnalysisState','strategy','volumeBuffer','786416qFzPXN','processTick','volume','_computeKyleLambda','set','targetMultiplier','_calculateATR',',\x20VPIN=','ofi','tickValue','recordTradeResult','baseTargetTicks','1413780tLJrni','trades','minHoldTimeMs','reduce','filter','short','cooldownMs','exports','side','push','_computeVPIN','zscoreThreshold','length','processBar','8743yqoWga','_computeZScore','high','12SPdneM','emit','max','shift',':\x20tick=','get','recentTrades','vpinWindow','min','initialize','Collecting\x20data...\x20','651672wLKRSl','onTrade','toFixed','debug','vpin','close','vpinToxicThreshold','winStreak','_detectVolatilityRegime','info','low','/50\x20bars','getStats','stopMultiplier','priceBuffer','tickSize','lossStreak','weights','2311461eIXOze','53184340LEfSab','getModelValues','onTick','signals','now','barHistory','\x20Regime:','VERY_STRONG','zscoreExitThreshold','3016RAfWWX','signal','_computeOrderFlowImbalance','kalmanStates','getBarHistory'];_0x16fd=function(){return _0x1dfe83;};return _0x16fd();}const EventEmitter=require(_0x4097f1(0x218)),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x233fb5={}){const _0x7341c2=_0x4097f1;super(),this['tickSize']=_0x233fb5[_0x7341c2(0x1f4)]||0.25,this['tickValue']=_0x233fb5[_0x7341c2(0x1c6)]||0x5,this['zscoreEntryThreshold']=1.5,this['zscoreExitThreshold']=0.5,this['vpinWindow']=0x32,this[_0x7341c2(0x1eb)]=0.7,this['kalmanProcessNoise']=0.01,this[_0x7341c2(0x20d)]=0.1,this['volatilityLookback']=0x64,this[_0x7341c2(0x209)]=0x14,this['baseStopTicks']=0x8,this['baseTargetTicks']=0x10,this[_0x7341c2(0x208)]=0x4,this[_0x7341c2(0x207)]=0.5,this['minConfidence']=0.55,this[_0x7341c2(0x1f6)]={'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[_0x7341c2(0x1bc)]=new Map(),this['kalmanStates']=new Map(),this[_0x7341c2(0x20e)]=new Map(),this['recentTrades']=[],this['winStreak']=0x0,this['lossStreak']=0x0,this[_0x7341c2(0x222)]=0x0,this[_0x7341c2(0x1cf)]=0x7530,this[_0x7341c2(0x1cb)]=0x2710,this[_0x7341c2(0x219)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0x2d2cd9,_0x4020b8=0.25,_0x1752de=0x5){const _0x249b99=_0x4097f1;this[_0x249b99(0x1f4)]=_0x4020b8,this[_0x249b99(0x1c6)]=_0x1752de,this['barHistory'][_0x249b99(0x1c1)](_0x2d2cd9,[]),this[_0x249b99(0x1f3)][_0x249b99(0x1c1)](_0x2d2cd9,[]),this['volumeBuffer'][_0x249b99(0x1c1)](_0x2d2cd9,[]),this['atrHistory']['set'](_0x2d2cd9,[]),this['kalmanStates']['set'](_0x2d2cd9,{'estimate':0x0,'errorCovariance':0x1}),this[_0x249b99(0x1db)]('log',{'type':_0x249b99(0x1ee),'message':_0x249b99(0x21e)+_0x2d2cd9+_0x249b99(0x1de)+_0x4020b8+',\x20value='+_0x1752de}),this[_0x249b99(0x1db)]('log',{'type':_0x249b99(0x1ee),'message':_0x249b99(0x225)});}[_0x4097f1(0x1be)](_0x2a2f6d){const _0xf453ec=_0x4097f1,{contractId:_0x38fdf,price:_0x30782e,volume:_0x4c528c,side:_0x32f16e,timestamp:_0x60f2b0}=_0x2a2f6d,_0x2faf05={'timestamp':_0x60f2b0||Date[_0xf453ec(0x1fc)](),'open':_0x30782e,'high':_0x30782e,'low':_0x30782e,'close':_0x30782e,'volume':_0x4c528c||0x1};return this['processBar'](_0x38fdf,_0x2faf05);}[_0x4097f1(0x1fa)](_0x1150f7){return this['processTick'](_0x1150f7);}['onTrade'](_0x2a3c0e){const _0x2289eb=_0x4097f1;return this['processTick']({'contractId':_0x2a3c0e['contractId']||_0x2a3c0e['symbol'],'price':_0x2a3c0e['price'],'volume':_0x2a3c0e['size']||_0x2a3c0e[_0x2289eb(0x1bf)]||0x1,'side':_0x2a3c0e[_0x2289eb(0x1d1)],'timestamp':_0x2a3c0e['timestamp']||Date['now']()});}[_0x4097f1(0x1d6)](_0x50ab47,_0x1eaf78){const _0x1d1e26=_0x4097f1;let _0x4ddfb5=this['barHistory'][_0x1d1e26(0x1df)](_0x50ab47);!_0x4ddfb5&&(this['initialize'](_0x50ab47),_0x4ddfb5=this['barHistory']['get'](_0x50ab47));_0x4ddfb5[_0x1d1e26(0x1d2)](_0x1eaf78);if(_0x4ddfb5['length']>0x1f4)_0x4ddfb5[_0x1d1e26(0x1dd)]();const _0x13a311=this[_0x1d1e26(0x1f3)]['get'](_0x50ab47);_0x13a311[_0x1d1e26(0x1d2)](_0x1eaf78[_0x1d1e26(0x1ea)]);if(_0x13a311['length']>0xc8)_0x13a311['shift']();const _0x44dc2b=this['volumeBuffer']['get'](_0x50ab47),_0x282976=_0x1eaf78['high']-_0x1eaf78['low'];let _0x49e37e=_0x1eaf78[_0x1d1e26(0x1bf)]*0.5,_0x31c32f=_0x1eaf78[_0x1d1e26(0x1bf)]*0.5;if(_0x282976>0x0){const _0x57f264=(_0x1eaf78[_0x1d1e26(0x1ea)]-_0x1eaf78['low'])/_0x282976;_0x49e37e=_0x1eaf78['volume']*_0x57f264,_0x31c32f=_0x1eaf78[_0x1d1e26(0x1bf)]*(0x1-_0x57f264);}_0x44dc2b[_0x1d1e26(0x1d2)]({'buy':_0x49e37e,'sell':_0x31c32f});if(_0x44dc2b[_0x1d1e26(0x1d5)]>0x64)_0x44dc2b[_0x1d1e26(0x1dd)]();if(_0x4ddfb5[_0x1d1e26(0x1d5)]<0x32)return null;const _0x212f77=this['_computeZScore'](_0x13a311),_0xf4dbe9=this[_0x1d1e26(0x1d3)](_0x44dc2b),_0x4ef915=this[_0x1d1e26(0x1c0)](_0x4ddfb5),_0x1b450a=this[_0x1d1e26(0x20f)](_0x50ab47,_0x1eaf78[_0x1d1e26(0x1ea)]),{regime:_0x592a30,params:_0x130bae}=this[_0x1d1e26(0x1ed)](_0x50ab47,_0x4ddfb5),_0x522fdf=this[_0x1d1e26(0x203)](_0x4ddfb5);return this['_generateSignal'](_0x50ab47,_0x1eaf78[_0x1d1e26(0x1ea)],_0x212f77,_0xf4dbe9,_0x4ef915,_0x1b450a,_0x592a30,_0x130bae,_0x522fdf,_0x4ddfb5);}['_computeZScore'](_0x2542b1,_0x3f2bd3=0x32){const _0x209ce0=_0x4097f1;if(_0x2542b1[_0x209ce0(0x1d5)]<_0x3f2bd3)return 0x0;const _0x4ce8ea=_0x2542b1['slice'](-_0x3f2bd3),_0x289c6c=_0x4ce8ea[_0x209ce0(0x1cc)]((_0x253108,_0x37c7e4)=>_0x253108+_0x37c7e4,0x0)/_0x3f2bd3,_0x44cd08=_0x4ce8ea['reduce']((_0x36a560,_0x58d7b1)=>_0x36a560+Math[_0x209ce0(0x213)](_0x58d7b1-_0x289c6c,0x2),0x0)/_0x3f2bd3,_0x1383aa=Math['sqrt'](_0x44cd08);if(_0x1383aa<0.0001)return 0x0;const _0x239c5c=_0x2542b1[_0x2542b1['length']-0x1];return(_0x239c5c-_0x289c6c)/_0x1383aa;}['_computeVPIN'](_0x1349a9){const _0x12ff76=_0x4097f1;if(_0x1349a9[_0x12ff76(0x1d5)]<this[_0x12ff76(0x1e1)])return 0.5;const _0x157fd2=_0x1349a9[_0x12ff76(0x21f)](-this[_0x12ff76(0x1e1)]);let _0x3288ba=0x0,_0x443661=0x0;for(const _0x2eb80d of _0x157fd2){_0x3288ba+=_0x2eb80d['buy'],_0x443661+=_0x2eb80d[_0x12ff76(0x216)];}const _0x5b3975=_0x3288ba+_0x443661;if(_0x5b3975<0x1)return 0.5;return Math[_0x12ff76(0x20a)](_0x3288ba-_0x443661)/_0x5b3975;}['_computeKyleLambda'](_0x382f7d){const _0x36d039=_0x4097f1;if(_0x382f7d['length']<0x14)return 0x0;const _0x4c7792=_0x382f7d[_0x36d039(0x21f)](-0x14),_0x1e6093=[],_0x3c8936=[];for(let _0x3f532f=0x1;_0x3f532f<_0x4c7792[_0x36d039(0x1d5)];_0x3f532f++){_0x1e6093[_0x36d039(0x1d2)](_0x4c7792[_0x3f532f][_0x36d039(0x1ea)]-_0x4c7792[_0x3f532f-0x1][_0x36d039(0x1ea)]),_0x3c8936['push'](_0x4c7792[_0x3f532f]['volume']);}const _0x56d15d=_0x1e6093['reduce']((_0x302cf3,_0x449274)=>_0x302cf3+_0x449274,0x0)/_0x1e6093[_0x36d039(0x1d5)],_0x23d6a4=_0x3c8936[_0x36d039(0x1cc)]((_0x3c821e,_0x1c9c86)=>_0x3c821e+_0x1c9c86,0x0)/_0x3c8936['length'];let _0xd40e0e=0x0,_0x46522a=0x0;for(let _0x4f19d4=0x0;_0x4f19d4<_0x1e6093[_0x36d039(0x1d5)];_0x4f19d4++){_0xd40e0e+=(_0x1e6093[_0x4f19d4]-_0x56d15d)*(_0x3c8936[_0x4f19d4]-_0x23d6a4),_0x46522a+=Math['pow'](_0x3c8936[_0x4f19d4]-_0x23d6a4,0x2);}_0xd40e0e/=_0x1e6093[_0x36d039(0x1d5)],_0x46522a/=_0x1e6093['length'];if(_0x46522a<0.0001)return 0x0;return Math[_0x36d039(0x20a)](_0xd40e0e/_0x46522a);}['_applyKalmanFilter'](_0x9d03a1,_0x1b4a7c){const _0x8be412=_0x4097f1;let _0x2d3f01=this['kalmanStates']['get'](_0x9d03a1);if(!_0x2d3f01)return _0x2d3f01={'estimate':_0x1b4a7c,'errorCovariance':0x1},this[_0x8be412(0x204)]['set'](_0x9d03a1,_0x2d3f01),_0x1b4a7c;const _0x35cd7e=_0x2d3f01['estimate'],_0x47f58b=_0x2d3f01['errorCovariance']+this['kalmanProcessNoise'],_0x2918c9=_0x47f58b/(_0x47f58b+this['kalmanMeasurementNoise']),_0x4f341e=_0x35cd7e+_0x2918c9*(_0x1b4a7c-_0x35cd7e),_0x23e410=(0x1-_0x2918c9)*_0x47f58b;return _0x2d3f01['estimate']=_0x4f341e,_0x2d3f01['errorCovariance']=_0x23e410,_0x4f341e;}[_0x4097f1(0x1ed)](_0x34cdf6,_0xaba7e){const _0x3549ae=_0x4097f1,_0x3f065e=this[_0x3549ae(0x1c3)](_0xaba7e),_0x347499=_0x3f065e/this[_0x3549ae(0x1f4)];let _0xb8be6=this['atrHistory'][_0x3549ae(0x1df)](_0x34cdf6);!_0xb8be6&&(_0xb8be6=[],this[_0x3549ae(0x20e)][_0x3549ae(0x1c1)](_0x34cdf6,_0xb8be6));_0xb8be6[_0x3549ae(0x1d2)](_0x3f065e);if(_0xb8be6[_0x3549ae(0x1d5)]>0x1f4)_0xb8be6[_0x3549ae(0x1dd)]();let _0x43f7aa=0.5;_0xb8be6['length']>=0x14&&(_0x43f7aa=_0xb8be6[_0x3549ae(0x1cd)](_0x22aa40=>_0x22aa40<=_0x3f065e)['length']/_0xb8be6['length']);let _0x46da3a,_0x5f5cbe;if(_0x43f7aa<0.25)_0x46da3a=_0x3549ae(0x1ef),_0x5f5cbe={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x43f7aa<0.75?(_0x46da3a='normal',_0x5f5cbe={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x46da3a='high',_0x5f5cbe={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x46da3a,'params':_0x5f5cbe};}[_0x4097f1(0x1c3)](_0x4a73d5,_0x23d6f0=0xe){const _0x3232fb=_0x4097f1;if(_0x4a73d5[_0x3232fb(0x1d5)]<_0x23d6f0+0x1)return 2.5;const _0x160c1a=[];for(let _0xf3384c=_0x4a73d5['length']-_0x23d6f0;_0xf3384c<_0x4a73d5['length'];_0xf3384c++){const _0x35572e=_0x4a73d5[_0xf3384c],_0x3ce214=_0x4a73d5[_0xf3384c-0x1]['close'],_0x134d8a=Math['max'](_0x35572e[_0x3232fb(0x1d9)]-_0x35572e[_0x3232fb(0x1ef)],Math[_0x3232fb(0x20a)](_0x35572e[_0x3232fb(0x1d9)]-_0x3ce214),Math['abs'](_0x35572e['low']-_0x3ce214));_0x160c1a['push'](_0x134d8a);}return _0x160c1a['reduce']((_0x2848d9,_0x5a3bf1)=>_0x2848d9+_0x5a3bf1,0x0)/_0x160c1a['length'];}['_computeOrderFlowImbalance'](_0x4a4e5a){const _0x573d5c=_0x4097f1;if(_0x4a4e5a['length']<this[_0x573d5c(0x209)])return 0x0;const _0xe90902=_0x4a4e5a['slice'](-this['ofiLookback']);let _0x2664e7=0x0,_0x48fffc=0x0;for(const _0x26531c of _0xe90902){const _0x183aad=_0x26531c['high']-_0x26531c['low'];if(_0x183aad>0x0){const _0x399ac0=(_0x26531c[_0x573d5c(0x1ea)]-_0x26531c[_0x573d5c(0x1ef)])/_0x183aad;_0x2664e7+=_0x399ac0*_0x26531c[_0x573d5c(0x1bf)],_0x48fffc+=(0x1-_0x399ac0)*_0x26531c['volume'];}}const _0x1c721c=_0x2664e7+_0x48fffc;if(_0x1c721c<0x1)return 0x0;return(_0x2664e7-_0x48fffc)/_0x1c721c;}[_0x4097f1(0x211)](_0x4ec529,_0x21928d,_0x9536db,_0x3ea0da,_0x289eb0,_0x4dd09e,_0x571a5d,_0x2008fc,_0x5696ef,_0x42e28c){const _0x1732de=_0x4097f1,_0x2da684=Math['abs'](_0x9536db);if(_0x2da684<_0x2008fc['zscoreThreshold'])return null;if(_0x3ea0da>this['vpinToxicThreshold'])return null;let _0x4c1c5c;if(_0x9536db<-_0x2008fc['zscoreThreshold'])_0x4c1c5c=_0x1732de(0x221);else{if(_0x9536db>_0x2008fc[_0x1732de(0x1d4)])_0x4c1c5c='short';else return null;}const _0x383d9c=_0x4c1c5c==='long'&&_0x5696ef>0.1||_0x4c1c5c===_0x1732de(0x1ce)&&_0x5696ef<-0.1,_0x2b809b=_0x21928d-_0x4dd09e,_0x2acd73=_0x4c1c5c===_0x1732de(0x221)&&_0x2b809b<0x0||_0x4c1c5c===_0x1732de(0x1ce)&&_0x2b809b>0x0,_0x3c4972={'zscore':Math[_0x1732de(0x1e2)](0x1,_0x2da684/0x4),'vpin':0x1-_0x3ea0da,'kyleLambda':_0x289eb0>0.001?0.5:0.8,'kalman':_0x2acd73?0.8:0.4,'volatility':_0x571a5d==='normal'?0.8:_0x571a5d===_0x1732de(0x1ef)?0.7:0.6,'ofi':_0x383d9c?0.9:0.5,'composite':0x0};_0x3c4972[_0x1732de(0x21d)]=_0x3c4972[_0x1732de(0x212)]*this['weights']['zscore']+_0x3c4972[_0x1732de(0x1e9)]*this[_0x1732de(0x1f6)][_0x1732de(0x1e9)]+_0x3c4972['kyleLambda']*this['weights']['kyleLambda']+_0x3c4972['kalman']*this['weights']['kalman']+_0x3c4972['volatility']*this['weights']['volatility']+_0x3c4972['ofi']*this['weights'][_0x1732de(0x1c5)];const _0x37b5f2=Math['min'](0x1,_0x3c4972[_0x1732de(0x21d)]+_0x2008fc['confidenceBonus']);if(_0x37b5f2<this['minConfidence'])return null;if(Date['now']()-this['lastSignalTime']<this['cooldownMs'])return null;const _0x5c366b=Math[_0x1732de(0x206)](this[_0x1732de(0x217)]*_0x2008fc['stopMultiplier']),_0x379577=Math['round'](this['baseTargetTicks']*_0x2008fc['targetMultiplier']),_0x2ed40d=Math[_0x1732de(0x1dc)](0x6,Math['min'](0xc,_0x5c366b)),_0x15fb09=Math['max'](_0x2ed40d*1.5,Math['min'](0x18,_0x379577));let _0x5c8371,_0x14619e,_0x666b9c,_0x2dc41d;_0x4c1c5c==='long'?(_0x5c8371=_0x21928d-_0x2ed40d*this[_0x1732de(0x1f4)],_0x14619e=_0x21928d+_0x15fb09*this['tickSize'],_0x666b9c=_0x21928d+this['breakevenTicks']*this['tickSize'],_0x2dc41d=_0x21928d+_0x15fb09*this[_0x1732de(0x207)]*this['tickSize']):(_0x5c8371=_0x21928d+_0x2ed40d*this[_0x1732de(0x1f4)],_0x14619e=_0x21928d-_0x15fb09*this[_0x1732de(0x1f4)],_0x666b9c=_0x21928d-this[_0x1732de(0x208)]*this[_0x1732de(0x1f4)],_0x2dc41d=_0x21928d-_0x15fb09*this[_0x1732de(0x207)]*this['tickSize']);const _0x9b7715=_0x15fb09/_0x2ed40d,_0x480581=Math['round'](_0x15fb09*0.5),_0x1ea872=Math['round'](_0x2ed40d*0.4);let _0x5d8723=SignalStrength['MODERATE'];if(_0x37b5f2>=0.85)_0x5d8723=SignalStrength[_0x1732de(0x1ff)];else{if(_0x37b5f2>=0.75)_0x5d8723=SignalStrength['STRONG'];else{if(_0x37b5f2<0.6)_0x5d8723=SignalStrength['WEAK'];}}const _0x3fc84c=0.5+(_0x37b5f2-0.5)*0.4,_0xc2dc27=_0x3fc84c*Math['abs'](_0x14619e-_0x21928d)-(0x1-_0x3fc84c)*Math['abs'](_0x21928d-_0x5c8371);this[_0x1732de(0x222)]=Date['now'](),this[_0x1732de(0x219)][_0x1732de(0x1fb)]++;const _0x2ee6d5={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x4ec529['split']('.')[0x0]||_0x4ec529,'contractId':_0x4ec529,'side':_0x4c1c5c===_0x1732de(0x221)?OrderSide['BID']:OrderSide['ASK'],'direction':_0x4c1c5c,'strategy':_0x1732de(0x20b),'strength':_0x5d8723,'edge':_0xc2dc27,'confidence':_0x37b5f2,'entry':_0x21928d,'entryPrice':_0x21928d,'stopLoss':_0x5c8371,'takeProfit':_0x14619e,'riskReward':_0x9b7715,'stopTicks':_0x2ed40d,'targetTicks':_0x15fb09,'trailTriggerTicks':_0x480581,'trailDistanceTicks':_0x1ea872,'beBreakeven':_0x666b9c,'profitLockLevel':_0x2dc41d,'zScore':_0x9536db,'zScoreExit':this['zscoreExitThreshold'],'vpinValue':_0x3ea0da,'kyleLambda':_0x289eb0,'kalmanEstimate':_0x4dd09e,'volatilityRegime':_0x571a5d,'ofiValue':_0x5696ef,'models':_0x3c4972,'orderFlowConfirmed':_0x383d9c,'kalmanConfirmed':_0x2acd73,'expires':Date[_0x1732de(0x1fc)]()+0xea60};return this[_0x1732de(0x1db)](_0x1732de(0x202),{'side':_0x4c1c5c==='long'?_0x1732de(0x223):'sell','action':'open','reason':'Z='+_0x9536db['toFixed'](0x2)+_0x1732de(0x1c4)+(_0x3ea0da*0x64)[_0x1732de(0x1e7)](0x0)+'%,\x20OFI='+(_0x5696ef*0x64)[_0x1732de(0x1e7)](0x0)+'%,\x20cf='+(_0x37b5f2*0x64)['toFixed'](0x0)+'%',..._0x2ee6d5}),this['emit']('log',{'type':'info','message':'[HQX]\x20SIGNAL:\x20'+_0x4c1c5c[_0x1732de(0x20c)]()+'\x20@\x20'+_0x21928d['toFixed'](0x2)+'\x20|\x20Z:'+_0x9536db[_0x1732de(0x1e7)](0x2)+'\x20VPIN:'+(_0x3ea0da*0x64)[_0x1732de(0x1e7)](0x0)+_0x1732de(0x21a)+(_0x5696ef*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x289eb0[_0x1732de(0x1e7)](0x5)+_0x1732de(0x1fe)+_0x571a5d+'\x20|\x20Conf:'+(_0x37b5f2*0x64)[_0x1732de(0x1e7)](0x0)+'%'}),_0x2ee6d5;}[_0x4097f1(0x224)](_0x4a2740){const _0x519404=_0x4097f1,_0x404d02=this['priceBuffer'][_0x519404(0x1df)](_0x4a2740);if(!_0x404d02||_0x404d02['length']<0x32)return![];const _0x1328eb=this[_0x519404(0x1d8)](_0x404d02);return Math['abs'](_0x1328eb)<this[_0x519404(0x200)];}[_0x4097f1(0x1f9)](_0x8ade42){const _0x3961f7=_0x4097f1,_0x23ef9b=this[_0x3961f7(0x1f3)]['get'](_0x8ade42),_0x2df1f0=this[_0x3961f7(0x1bc)][_0x3961f7(0x1df)](_0x8ade42),_0x226995=this[_0x3961f7(0x1fd)][_0x3961f7(0x1df)](_0x8ade42);if(!_0x23ef9b||!_0x2df1f0||!_0x226995||_0x226995[_0x3961f7(0x1d5)]<0x32)return null;const _0x1e9173=this['_computeZScore'](_0x23ef9b),_0x17b8d8=this[_0x3961f7(0x1d3)](_0x2df1f0),_0x3e81ed=this[_0x3961f7(0x1c0)](_0x226995),_0xef9955=this[_0x3961f7(0x203)](_0x226995);return{'zscore':Math['min'](0x1,Math['abs'](_0x1e9173)/0x4),'vpin':0x1-_0x17b8d8,'kyleLambda':_0x3e81ed>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x3961f7(0x20a)](_0xef9955)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x1e9173,'vpin':_0x17b8d8,'kyleLambda':_0x3e81ed,'ofi':_0xef9955}};}[_0x4097f1(0x227)](_0x540c8b,_0x779f0d){const _0x14d620=_0x4097f1,_0xd41ec=this[_0x14d620(0x1fd)]['get'](_0x540c8b)||[];if(_0xd41ec['length']<0x32)return{'ready':![],'message':_0x14d620(0x1e4)+_0xd41ec[_0x14d620(0x1d5)]+_0x14d620(0x1f0)};const _0x58e10a=this[_0x14d620(0x1f3)]['get'](_0x540c8b)||[],_0x2c3f6a=this['volumeBuffer']['get'](_0x540c8b)||[],_0x251def=this[_0x14d620(0x1d8)](_0x58e10a),_0x3819cb=this['_computeVPIN'](_0x2c3f6a),_0x5ec3e3=this[_0x14d620(0x203)](_0xd41ec),_0x245178=this[_0x14d620(0x1c0)](_0xd41ec),{regime:_0x565309,params:_0x29668a}=this['_detectVolatilityRegime'](_0x540c8b,_0xd41ec);return{'ready':!![],'zScore':_0x251def,'vpin':_0x3819cb,'ofi':_0x5ec3e3,'kyleLambda':_0x245178,'regime':_0x565309,'stopTicks':Math[_0x14d620(0x206)](this[_0x14d620(0x217)]*_0x29668a[_0x14d620(0x1f2)]),'targetTicks':Math[_0x14d620(0x206)](this[_0x14d620(0x1c8)]*_0x29668a[_0x14d620(0x1c2)]),'threshold':_0x29668a[_0x14d620(0x1d4)],'barsProcessed':_0xd41ec[_0x14d620(0x1d5)],'models':'6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)'};}[_0x4097f1(0x1c7)](_0x516f69){const _0x5c6fbc=_0x4097f1;this[_0x5c6fbc(0x1e0)]['push']({'netPnl':_0x516f69,'timestamp':Date['now']()});if(this[_0x5c6fbc(0x1e0)]['length']>0x64)this[_0x5c6fbc(0x1e0)][_0x5c6fbc(0x1dd)]();_0x516f69>0x0?(this['winStreak']++,this['lossStreak']=0x0,this[_0x5c6fbc(0x219)]['wins']++):(this['lossStreak']++,this[_0x5c6fbc(0x1ec)]=0x0,this['stats']['losses']++),this[_0x5c6fbc(0x219)][_0x5c6fbc(0x1ca)]++,this[_0x5c6fbc(0x219)]['pnl']+=_0x516f69,this[_0x5c6fbc(0x1db)](_0x5c6fbc(0x210),{'type':_0x5c6fbc(0x1e8),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x516f69>0x0?'WIN':_0x5c6fbc(0x21b))+'\x20$'+_0x516f69[_0x5c6fbc(0x1e7)](0x2)+',\x20streak:\x20'+(_0x516f69>0x0?this['winStreak']:-this[_0x5c6fbc(0x1f5)])});}['getBarHistory'](_0x54ef8f){const _0x3d4093=_0x4097f1;return this[_0x3d4093(0x1fd)][_0x3d4093(0x1df)](_0x54ef8f)||[];}[_0x4097f1(0x1f1)](){const _0x1672cc=_0x4097f1;return this[_0x1672cc(0x219)];}['reset'](_0x46cbc6){const _0x4f5207=_0x4097f1;this['barHistory'][_0x4f5207(0x1c1)](_0x46cbc6,[]),this[_0x4f5207(0x1f3)][_0x4f5207(0x1c1)](_0x46cbc6,[]),this[_0x4f5207(0x1bc)]['set'](_0x46cbc6,[]),this['atrHistory']['set'](_0x46cbc6,[]),this['kalmanStates'][_0x4f5207(0x1c1)](_0x46cbc6,{'estimate':0x0,'errorCovariance':0x1}),this[_0x4f5207(0x1db)]('log',{'type':_0x4f5207(0x1ee),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x46cbc6});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x1916a4={}){const _0x459b56=_0x4097f1;super(),this['config']=_0x1916a4,this['strategy']=new HQXUltraScalping(_0x1916a4),this['strategy']['on'](_0x459b56(0x202),_0x17324a=>this[_0x459b56(0x1db)](_0x459b56(0x202),_0x17324a)),this[_0x459b56(0x228)]['on']('log',_0x18437a=>this[_0x459b56(0x1db)](_0x459b56(0x210),_0x18437a));}['processTick'](_0x154bcf){const _0x145791=_0x4097f1;return this[_0x145791(0x228)][_0x145791(0x1be)](_0x154bcf);}[_0x4097f1(0x1fa)](_0x410e82){const _0xef56bb=_0x4097f1;return this['strategy'][_0xef56bb(0x1fa)](_0x410e82);}['onTrade'](_0x2fa94c){const _0x252745=_0x4097f1;return this['strategy'][_0x252745(0x1e6)](_0x2fa94c);}['processBar'](_0x1ded25,_0x1429cc){const _0x49ac9f=_0x4097f1;return this['strategy'][_0x49ac9f(0x1d6)](_0x1ded25,_0x1429cc);}['initialize'](_0x27cdb0,_0x36fd70,_0x330d8d){const _0x144474=_0x4097f1;return this[_0x144474(0x228)][_0x144474(0x1e3)](_0x27cdb0,_0x36fd70,_0x330d8d);}['getAnalysisState'](_0x43dcd5,_0x2c9a76){return this['strategy']['getAnalysisState'](_0x43dcd5,_0x2c9a76);}[_0x4097f1(0x1c7)](_0x5718d3){return this['strategy']['recordTradeResult'](_0x5718d3);}[_0x4097f1(0x21c)](_0x2e2b8f){return this['strategy']['reset'](_0x2e2b8f);}['getStats'](){const _0x2e3386=_0x4097f1;return this[_0x2e3386(0x228)][_0x2e3386(0x1f1)]();}[_0x4097f1(0x205)](_0x1531da){const _0x4bf937=_0x4097f1;return this[_0x4bf937(0x228)][_0x4bf937(0x205)](_0x1531da);}[_0x4097f1(0x1f9)](_0xe00101){const _0x3ec055=_0x4097f1;return this['strategy'][_0x3ec055(0x1f9)](_0xe00101);}['shouldExitByZScore'](_0x206bd0){const _0x5252c6=_0x4097f1;return this['strategy'][_0x5252c6(0x224)](_0x206bd0);}['generateSignal'](_0x3a263f){return null;}}module[_0x4097f1(0x1d0)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.9.111",
3
+ "version": "2.9.113",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
package/src/lib/data.js CHANGED
@@ -171,11 +171,12 @@ class MarketDataFeed extends EventEmitter {
171
171
  }
172
172
 
173
173
  /**
174
- * Get historical tick bars from HISTORY_PLANT
174
+ * Get historical 1-minute bars from HISTORY_PLANT
175
+ * Fetches raw ticks and aggregates them into 1-minute OHLCV bars
175
176
  * @param {string} symbol - Symbol (e.g., 'MNQH6')
176
177
  * @param {string} exchange - Exchange (default: 'CME')
177
- * @param {number} barCount - Number of bars to fetch (default: 30)
178
- * @returns {Promise<Array>} Array of tick bar objects {timestamp, open, high, low, close, volume}
178
+ * @param {number} barCount - Number of 1-min bars to return (default: 30)
179
+ * @returns {Promise<Array>} Array of 1-min bar objects {timestamp, open, high, low, close, volume}
179
180
  */
180
181
  async getHistoricalBars(symbol, exchange = 'CME', barCount = 30) {
181
182
  if (!this.credentials) {
@@ -193,51 +194,55 @@ class MarketDataFeed extends EventEmitter {
193
194
  await historyConn.connect(historyConfig);
194
195
 
195
196
  return new Promise((resolve, reject) => {
196
- const bars = [];
197
+ const ticks = [];
197
198
  let isComplete = false;
198
199
 
200
+ // Request more ticks to cover barCount minutes (estimate ~1500 ticks/min for MNQ)
201
+ const ticksToRequest = Math.min(50000, barCount * 2000);
202
+
199
203
  const timeout = setTimeout(() => {
200
204
  if (!isComplete) {
201
205
  historyConn.disconnect();
202
- // Return what we have even on timeout
203
- resolve(bars);
206
+ // Aggregate what we have and return
207
+ const aggregatedBars = this._aggregateTicksTo1MinBars(ticks, barCount);
208
+ resolve(aggregatedBars);
204
209
  }
205
- }, 15000);
210
+ }, 20000);
206
211
 
207
- // Listen for bar data (template 207)
212
+ // Listen for tick data (template 207)
208
213
  historyConn.on('message', (msg) => {
209
214
  if (msg.templateId === RES.TICK_BAR_REPLAY) {
210
215
  try {
211
216
  const data = proto.decode('ResponseTickBarReplay', msg.data);
212
- const barObj = data.toJSON ? data.toJSON() : data;
217
+ const tickObj = data.toJSON ? data.toJSON() : data;
213
218
 
214
219
  // Check for error response
215
- if (barObj.rpCode && barObj.rpCode[0] !== '0') {
220
+ if (tickObj.rpCode && tickObj.rpCode[0] !== '0') {
216
221
  clearTimeout(timeout);
217
222
  isComplete = true;
218
223
  historyConn.disconnect();
219
- reject(new Error(`History request failed: ${barObj.rpCode.join(' - ')}`));
224
+ reject(new Error(`History request failed: ${tickObj.rpCode.join(' - ')}`));
220
225
  return;
221
226
  }
222
227
 
223
- // Add bar if it has price data (OHLCV format)
224
- if (barObj.closePrice !== undefined) {
225
- bars.push({
226
- timestamp: barObj.ssboe ? barObj.ssboe * 1000 : Date.now(),
227
- open: Number(barObj.openPrice) || Number(barObj.closePrice),
228
- high: Number(barObj.highPrice) || Number(barObj.closePrice),
229
- low: Number(barObj.lowPrice) || Number(barObj.closePrice),
230
- close: Number(barObj.closePrice),
231
- volume: Number(barObj.volume) || 1,
228
+ // Add tick if it has price data
229
+ if (tickObj.closePrice !== undefined) {
230
+ ticks.push({
231
+ timestamp: tickObj.ssboe ? tickObj.ssboe * 1000 : Date.now(),
232
+ price: Number(tickObj.closePrice),
233
+ volume: Number(tickObj.volume) || 1,
232
234
  });
233
235
  }
234
236
 
235
237
  // Check if this is the final response (rpCode = ['0'])
236
- if (barObj.rpCode && barObj.rpCode[0] === '0' && barObj.closePrice === undefined) {
238
+ if (tickObj.rpCode && tickObj.rpCode[0] === '0' && tickObj.closePrice === undefined) {
237
239
  clearTimeout(timeout);
238
240
  isComplete = true;
239
241
  historyConn.disconnect();
240
- resolve(bars);
242
+
243
+ // Aggregate ticks into 1-minute bars
244
+ const aggregatedBars = this._aggregateTicksTo1MinBars(ticks, barCount);
245
+ resolve(aggregatedBars);
241
246
  }
242
247
  } catch (e) {
243
248
  this.emit('debug', `History decode error: ${e.message}`);
@@ -247,25 +252,22 @@ class MarketDataFeed extends EventEmitter {
247
252
 
248
253
  // Login to HISTORY_PLANT
249
254
  historyConn.once('loggedIn', () => {
250
- // Request tick bar replay - limited count, most recent bars
251
- // startIndex/finishIndex are required, but userMaxCount + direction=LAST
252
- // will return only the most recent barCount bars
253
255
  const now = Math.floor(Date.now() / 1000);
254
- const startTime = now - (24 * 60 * 60); // 24 hours ago (wide range)
256
+ const startTime = now - (barCount * 2 * 60); // Request 2x the time needed
255
257
 
256
258
  historyConn.send('RequestTickBarReplay', {
257
259
  templateId: REQ.TICK_BAR_REPLAY, // 206
258
260
  userMsg: ['hqx-history'],
259
261
  symbol: symbol,
260
262
  exchange: exchange,
261
- barType: 1, // TICK_BAR
263
+ barType: 1, // TICK_BAR (only option for raw ticks)
262
264
  barSubType: 1, // REGULAR
263
265
  barTypeSpecifier: '1', // 1 tick per bar
264
- startIndex: startTime, // Required by Rithmic
265
- finishIndex: now, // Required by Rithmic
266
- userMaxCount: barCount, // Limit to barCount bars
267
- direction: 2, // LAST (most recent bars first)
268
- timeOrder: 1, // FORWARDS (return in chronological order)
266
+ startIndex: startTime, // Start time
267
+ finishIndex: now, // End time
268
+ userMaxCount: ticksToRequest, // Request enough ticks
269
+ direction: 2, // LAST (most recent first)
270
+ timeOrder: 1, // FORWARDS (chronological order)
269
271
  });
270
272
  });
271
273
 
@@ -283,6 +285,50 @@ class MarketDataFeed extends EventEmitter {
283
285
  }
284
286
  }
285
287
 
288
+ /**
289
+ * Aggregate raw ticks into 1-minute OHLCV bars
290
+ * @param {Array} ticks - Array of {timestamp, price, volume}
291
+ * @param {number} maxBars - Maximum number of bars to return
292
+ * @returns {Array} Array of 1-min bars {timestamp, open, high, low, close, volume}
293
+ */
294
+ _aggregateTicksTo1MinBars(ticks, maxBars) {
295
+ if (!ticks || ticks.length === 0) return [];
296
+
297
+ // Sort ticks by timestamp (oldest first)
298
+ const sortedTicks = [...ticks].sort((a, b) => a.timestamp - b.timestamp);
299
+
300
+ // Group ticks by minute
301
+ const barMap = new Map();
302
+ const barIntervalMs = 60000; // 1 minute
303
+
304
+ for (const tick of sortedTicks) {
305
+ const barStartTime = Math.floor(tick.timestamp / barIntervalMs) * barIntervalMs;
306
+
307
+ if (!barMap.has(barStartTime)) {
308
+ barMap.set(barStartTime, {
309
+ timestamp: barStartTime,
310
+ open: tick.price,
311
+ high: tick.price,
312
+ low: tick.price,
313
+ close: tick.price,
314
+ volume: tick.volume,
315
+ });
316
+ } else {
317
+ const bar = barMap.get(barStartTime);
318
+ bar.high = Math.max(bar.high, tick.price);
319
+ bar.low = Math.min(bar.low, tick.price);
320
+ bar.close = tick.price;
321
+ bar.volume += tick.volume;
322
+ }
323
+ }
324
+
325
+ // Convert to array and sort by timestamp
326
+ const bars = Array.from(barMap.values()).sort((a, b) => a.timestamp - b.timestamp);
327
+
328
+ // Return only the last maxBars bars
329
+ return bars.slice(-maxBars);
330
+ }
331
+
286
332
  /**
287
333
  * Handle incoming messages from TICKER_PLANT
288
334
  */
@@ -409,22 +409,11 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
409
409
  await marketFeed.connect(rithmicCredentials);
410
410
  await marketFeed.subscribe(symbolCode, contract.exchange || 'CME');
411
411
 
412
- // Preload historical bars for HQX-2B strategy only (bar-based strategy)
413
- // Note: HISTORY_PLANT may not be available on all accounts (e.g., paper trading)
414
- if (strategyId === 'hqx-2b' && strategy.preloadBars) {
415
- try {
416
- ui.addLog('system', 'Loading historical bars...');
417
- const historicalBars = await marketFeed.getHistoricalBars(symbolCode, contract.exchange || 'CME', 30);
418
- if (historicalBars && historicalBars.length > 0) {
419
- strategy.preloadBars(contractId, historicalBars);
420
- ui.addLog('system', `Loaded ${historicalBars.length} bars - ready!`);
421
- } else {
422
- ui.addLog('system', 'No historical data - warming up with live bars...');
423
- }
424
- } catch (histErr) {
425
- // HISTORY_PLANT not available (common on paper accounts)
426
- ui.addLog('system', 'Historical data not available - warming up with live bars...');
427
- }
412
+ // HQX-2B strategy warmup message
413
+ // Note: HISTORY_PLANT returns limited ticks (10k max = ~1 second of data)
414
+ // which is not enough for 1-min bar aggregation. Strategy warms up with live data.
415
+ if (strategyId === 'hqx-2b') {
416
+ ui.addLog('system', 'HQX-2B warming up - needs ~3 min for first signals...');
428
417
  }
429
418
  } catch (e) {
430
419
  ui.addLog('error', `Failed to connect: ${e.message}`);
@@ -124,7 +124,7 @@ class RithmicConnection extends EventEmitter {
124
124
  appVersion: this.config.appVersion || '1.0.0',
125
125
  systemName: this.config.systemName,
126
126
  infraType: INFRA_TYPE[infraType],
127
- macAddr: ['00:00:00:00:00:00'],
127
+ macAddr: [getMacAddress()],
128
128
  osVersion: os.release(),
129
129
  osPlatform: os.platform(),
130
130
  });