hedgequantx 2.9.131 → 2.9.133

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
- function _0x3c3f(){const _0x46117a=['lastSignalTime','getFullYear','\x20historical\x20bars...','tickValue','_updateZones','maxZoneAgeBars','tickSize','isValid','signals','SUPPORT','length','enabled','t,\x20Trail=','getStats','recentTrades','symbol','_getVolumeRatio','x\x20|\x20Conf:','close','exitBarIndex','low',':\x20tick=','_tickCount','barHistory','entryBarIndex','priceLow','priceHigh','processBar','minBodyRatio','onTick','activeSweeps','\x20@\x20','long','emit','liquidityZones','\x20closed\x20@\x20','clusterToleranceTicks','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','America/New_York','s\x20<\x20','trailDistanceTicks','\x20H:','isArray','uuid','cooldownBars','open','signal','get','barIndex','stats','contractId','getLevel','resistance','durationBars','filter','config','preloadBars','\x20|\x20O:','x\x20|\x20Q:','t,\x20Target=','[2B]\x20NEW\x20SWING\x20','minPenetrationTicks','\x20|\x20Bar\x20','maxDurationBars','price','type','BID','toUpperCase','_detectSwings','shift','short','3402636llhlyn','\x20|\x20Valid:\x20','min','penetrationTicks','now','wins','swept','HIGH_SWEEP','\x20zones','stopTicks','timestamp','sweepType','size','breakevenTicks','qualityScore','2B\x20','[SWING]\x20NEW\x20HIGH\x20@\x20','_mergeConfig','\x20|\x20Total:\x20','t,\x20BE=','extremePrice','set','find','10737041vgMdXj','high','[2B]\x20SWEEP\x20','\x20|\x20Pen:','floor','support','\x20swings,\x20','lookbackBars','info','reset','MODERATE','log','[SWING]\x20NEW\x20LOW\x20@\x20','[HQX-2B]\x20Initialized\x20for\x20','session','minStrength','26162992hJuefX','54HXgmBP','volume','[HQX-2B]\x20Reset\x20state\x20for\x20','sort','abs','[HQX-2B]\x20Trade\x20result:\x20','execution','68438ysmZZa','\x20L:','getBarHistory','push','lastUsedBarIndex','323357hZOlZD','trailTriggerTicks','targetTicks','_scoreSweep','swing','swingPoints','7839295fiKrBO','[BAR]\x20#','startTime','volumeRatio','LOW_SWEEP','touches','[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)','toFixed','debug','getTimezoneOffset','currentBar','minVolumeRatio','_detectSweep','\x20historical\x20signals\x20detected\x20(ignored)','barIntervalMs','WIN','Collecting\x20data...\x20','53204MyKQeC','distance','zone','strategy','processTick','getHealthStatus','max','strength','RESISTANCE','[2B]\x20NEW\x20ZONE\x20'];_0x3c3f=function(){return _0x46117a;};return _0x3c3f();}function _0x21a1(_0x212681,_0xebdd1f){_0x212681=_0x212681-0x134;const _0x3c3f23=_0x3c3f();let _0x21a1d7=_0x3c3f23[_0x212681];return _0x21a1d7;}const _0x2b7f26=_0x21a1;(function(_0x34201e,_0x46ebca){const _0x3608db=_0x21a1,_0x2b8f76=_0x34201e();while(!![]){try{const _0x52ce90=parseInt(_0x3608db(0x160))/0x1+parseInt(_0x3608db(0x15b))/0x2+-parseInt(_0x3608db(0x154))/0x3*(-parseInt(_0x3608db(0x177))/0x4)+parseInt(_0x3608db(0x166))/0x5+parseInt(_0x3608db(0x1c8))/0x6+parseInt(_0x3608db(0x143))/0x7+-parseInt(_0x3608db(0x153))/0x8;if(_0x52ce90===_0x46ebca)break;else _0x2b8f76['push'](_0x2b8f76['shift']());}catch(_0x4935c9){_0x2b8f76['push'](_0x2b8f76['shift']());}}}(_0x3c3f,0xf3078));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x2b7f26(0x1ac)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':_0x2b7f26(0x195)},ZoneType={'RESISTANCE':_0x2b7f26(0x1b5),'SUPPORT':_0x2b7f26(0x148)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x3,'minStrength':0x2,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x4,'minTouches':0x2,'maxZoneAgeBars':0xc8,'maxZoneDistanceTicks':0x28,'cooldownBars':0xa},'sweep':{'minPenetrationTicks':0.5,'maxPenetrationTicks':0x8,'maxDurationBars':0x5,'minQualityScore':0.25,'minVolumeRatio':0.5,'minBodyRatio':0.1},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x2710,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x2b7f26(0x1a7)}};class SwingPoint{constructor(_0xf0e236,_0x4f7e3a,_0x35704e,_0x179ee7,_0x3b2e8a=0x1){const _0x43a524=_0x2b7f26;this[_0x43a524(0x1c2)]=_0xf0e236,this['price']=_0x4f7e3a,this[_0x43a524(0x1b1)]=_0x35704e,this[_0x43a524(0x136)]=_0x179ee7,this['strength']=_0x3b2e8a;}}class LiquidityZone{constructor(_0x49e7e9,_0x1262c8,_0x1e3e37,_0x466614,_0xbae350){const _0x31182c=_0x2b7f26;this['id']=uuidv4(),this[_0x31182c(0x1c2)]=_0x49e7e9,this['priceHigh']=_0x1262c8,this['priceLow']=_0x1e3e37,this['createdAt']=_0x466614,this[_0x31182c(0x1b1)]=_0xbae350,this['touches']=0x1,this['swept']=![],this['sweptAt']=null,this['lastUsedBarIndex']=-0x3e7,this['qualityScore']=0.5;}['containsPrice'](_0x23d7f5,_0x1b2ec0,_0x2c2dd0){const _0xba3b4e=_0x2b7f26,_0x135abd=_0x1b2ec0*_0x2c2dd0;return _0x23d7f5>=this['priceLow']-_0x135abd&&_0x23d7f5<=this[_0xba3b4e(0x19b)]+_0x135abd;}['getLevel'](){const _0x3a5acc=_0x2b7f26;return(this[_0x3a5acc(0x19b)]+this[_0x3a5acc(0x19a)])/0x2;}}class SweepEvent{constructor(_0x53015d,_0x1812a1,_0x4cb18e,_0x9d3d34,_0x22a75d){const _0x3d52cb=_0x2b7f26;this[_0x3d52cb(0x137)]=_0x53015d,this[_0x3d52cb(0x179)]=_0x1812a1,this[_0x3d52cb(0x199)]=_0x4cb18e,this['extremeBarIndex']=_0x9d3d34,this[_0x3d52cb(0x140)]=_0x22a75d,this[_0x3d52cb(0x194)]=null,this[_0x3d52cb(0x188)]=![],this['qualityScore']=0x0,this['penetrationTicks']=0x0,this['durationBars']=0x0,this[_0x3d52cb(0x169)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x4e94a6={}){const _0x4414f4=_0x2b7f26;super(),this[_0x4414f4(0x1b8)]=this[_0x4414f4(0x13d)](DEFAULT_CONFIG,_0x4e94a6),this[_0x4414f4(0x187)]=this['config']['tickSize'],this['tickValue']=this[_0x4414f4(0x1b8)][_0x4414f4(0x184)],this['barHistory']=new Map(),this[_0x4414f4(0x165)]=new Map(),this[_0x4414f4(0x1a3)]=new Map(),this['activeSweeps']=new Map(),this['currentBar']=new Map(),this[_0x4414f4(0x174)]=0xea60,this['lastSignalTime']=0x0,this[_0x4414f4(0x168)]=Date['now'](),this[_0x4414f4(0x1b2)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x4414f4(0x18f)]=[];}['_mergeConfig'](_0x533215,_0x2b1aa7){const _0x35336f=_0x2b7f26,_0x3a939b={..._0x533215};for(const _0x4442a7 in _0x2b1aa7){typeof _0x2b1aa7[_0x4442a7]==='object'&&!Array[_0x35336f(0x1ab)](_0x2b1aa7[_0x4442a7])?_0x3a939b[_0x4442a7]={..._0x533215[_0x4442a7],..._0x2b1aa7[_0x4442a7]}:_0x3a939b[_0x4442a7]=_0x2b1aa7[_0x4442a7];}return _0x3a939b;}['isWithinSession'](_0x67c104){const _0x20325a=_0x2b7f26;if(!this['config'][_0x20325a(0x151)][_0x20325a(0x18c)])return!![];const _0x5d4431=new Date(_0x67c104),_0x5024f3=this['isDST'](_0x5d4431)?-0x4:-0x5,_0x49dd08=_0x5d4431['getUTCHours'](),_0x1e0bf6=_0x5d4431['getUTCMinutes'](),_0x4e6dd3=(_0x49dd08+_0x5024f3+0x18)%0x18,{startHour:_0x1d30ba,startMinute:_0x371c1c,endHour:_0x35ddc2,endMinute:_0x667736}=this[_0x20325a(0x1b8)][_0x20325a(0x151)],_0x1f1875=_0x4e6dd3*0x3c+_0x1e0bf6,_0x3ab779=_0x1d30ba*0x3c+_0x371c1c,_0x37a76b=_0x35ddc2*0x3c+_0x667736;return _0x1f1875>=_0x3ab779&&_0x1f1875<_0x37a76b;}['isDST'](_0x3849b9){const _0x986235=_0x2b7f26,_0x386a1a=new Date(_0x3849b9[_0x986235(0x182)](),0x0,0x1),_0x2ab044=new Date(_0x3849b9[_0x986235(0x182)](),0x6,0x1),_0x5f132d=Math['max'](_0x386a1a[_0x986235(0x16f)](),_0x2ab044[_0x986235(0x16f)]());return _0x3849b9['getTimezoneOffset']()<_0x5f132d;}['initialize'](_0x5b49f2,_0x1e887d=0.25,_0x1a1603=0x5){const _0x584914=_0x2b7f26;this['tickSize']=_0x1e887d,this['tickValue']=_0x1a1603,this[_0x584914(0x1b8)]['tickSize']=_0x1e887d,this['config'][_0x584914(0x184)]=_0x1a1603,this[_0x584914(0x198)][_0x584914(0x141)](_0x5b49f2,[]),this['swingPoints']['set'](_0x5b49f2,[]),this['liquidityZones']['set'](_0x5b49f2,[]),this[_0x584914(0x19f)]['set'](_0x5b49f2,[]),this[_0x584914(0x170)]['delete'](_0x5b49f2),this['emit']('log',{'type':'info','message':_0x584914(0x150)+_0x5b49f2+_0x584914(0x196)+_0x1e887d+',\x20value='+_0x1a1603+',\x20TF=1min'}),this[_0x584914(0x1a2)](_0x584914(0x14e),{'type':_0x584914(0x14b),'message':'[HQX-2B]\x20Params:\x20Stop='+this['config']['execution']['stopTicks']+_0x584914(0x1bc)+this['config'][_0x584914(0x15a)][_0x584914(0x162)]+_0x584914(0x13f)+this['config'][_0x584914(0x15a)][_0x584914(0x139)]+_0x584914(0x18d)+this['config'][_0x584914(0x15a)][_0x584914(0x161)]+'/'+this['config'][_0x584914(0x15a)][_0x584914(0x1a9)]});}[_0x2b7f26(0x17b)](_0x15adae){const _0x492a22=_0x2b7f26,{contractId:_0xd91c87,price:_0x470291,volume:_0x56b393,timestamp:_0xf8c6c5}=_0x15adae,_0x41511c=_0xf8c6c5||Date[_0x492a22(0x1cc)](),_0x1bf693=_0x56b393||0x1;if(!this['isWithinSession'](_0x41511c))return null;if(!this[_0x492a22(0x197)])this['_tickCount']=0x0;this[_0x492a22(0x197)]++;let _0x353b5c=this['currentBar']['get'](_0xd91c87);const _0x4fa15c=Math[_0x492a22(0x147)](_0x41511c/this['barIntervalMs'])*this[_0x492a22(0x174)];if(!_0x353b5c||_0x353b5c['startTime']!==_0x4fa15c){if(_0x353b5c){const _0x2a41bc={'timestamp':_0x353b5c['startTime'],'open':_0x353b5c['open'],'high':_0x353b5c[_0x492a22(0x144)],'low':_0x353b5c[_0x492a22(0x195)],'close':_0x353b5c[_0x492a22(0x193)],'volume':_0x353b5c[_0x492a22(0x155)]},_0x560d4e=this['barHistory']['get'](_0xd91c87)||[];this[_0x492a22(0x1a2)]('log',{'type':'debug','message':_0x492a22(0x167)+(_0x560d4e['length']+0x1)+_0x492a22(0x1a4)+_0x2a41bc[_0x492a22(0x193)]['toFixed'](0x2)+_0x492a22(0x1ba)+_0x2a41bc['open']['toFixed'](0x2)+_0x492a22(0x1aa)+_0x2a41bc[_0x492a22(0x144)]['toFixed'](0x2)+_0x492a22(0x15c)+_0x2a41bc['low'][_0x492a22(0x16d)](0x2)+'\x20Vol:'+_0x2a41bc[_0x492a22(0x155)]});const _0x2894bd=this[_0x492a22(0x19c)](_0xd91c87,_0x2a41bc);return this['currentBar'][_0x492a22(0x141)](_0xd91c87,{'startTime':_0x4fa15c,'open':_0x470291,'high':_0x470291,'low':_0x470291,'close':_0x470291,'volume':_0x1bf693}),_0x2894bd;}else return this[_0x492a22(0x170)]['set'](_0xd91c87,{'startTime':_0x4fa15c,'open':_0x470291,'high':_0x470291,'low':_0x470291,'close':_0x470291,'volume':_0x1bf693}),null;}else return _0x353b5c[_0x492a22(0x144)]=Math['max'](_0x353b5c['high'],_0x470291),_0x353b5c[_0x492a22(0x195)]=Math[_0x492a22(0x1ca)](_0x353b5c[_0x492a22(0x195)],_0x470291),_0x353b5c['close']=_0x470291,_0x353b5c['volume']+=_0x1bf693,null;}['onTick'](_0x321c3a){const _0x1d8ba3=_0x2b7f26;return this[_0x1d8ba3(0x17b)](_0x321c3a);}['onTrade'](_0x1b7389){const _0x993456=_0x2b7f26;return this['processTick']({'contractId':_0x1b7389[_0x993456(0x1b3)]||_0x1b7389[_0x993456(0x190)],'price':_0x1b7389['price'],'volume':_0x1b7389[_0x993456(0x138)]||_0x1b7389['volume']||0x1,'timestamp':_0x1b7389[_0x993456(0x136)]||Date['now']()});}['processBar'](_0x1a7a65,_0x164133){const _0x22bd32=_0x2b7f26;let _0x418086=this['barHistory'][_0x22bd32(0x1b0)](_0x1a7a65);!_0x418086&&(this['initialize'](_0x1a7a65),_0x418086=this['barHistory']['get'](_0x1a7a65));_0x418086['push'](_0x164133);if(_0x418086['length']>0x1f4)_0x418086[_0x22bd32(0x1c6)]();const _0x242f18=_0x418086[_0x22bd32(0x18b)]-0x1;if(_0x418086['length']<this[_0x22bd32(0x1b8)][_0x22bd32(0x164)][_0x22bd32(0x14a)]*0x3)return null;const _0x789f49=this[_0x22bd32(0x165)][_0x22bd32(0x1b0)](_0x1a7a65)['length'];this[_0x22bd32(0x1c5)](_0x1a7a65,_0x418086,_0x242f18);const _0x395caf=this['swingPoints']['get'](_0x1a7a65);if(_0x395caf[_0x22bd32(0x18b)]>_0x789f49){const _0x108e48=_0x395caf[_0x395caf['length']-0x1];this[_0x22bd32(0x1a2)]('log',{'type':_0x22bd32(0x16e),'message':_0x22bd32(0x1bd)+_0x108e48['type']['toUpperCase']()+'\x20@\x20'+_0x108e48[_0x22bd32(0x1c1)][_0x22bd32(0x16d)](0x2)+'\x20|\x20Total:\x20'+_0x395caf[_0x22bd32(0x18b)]});}const _0x175b47=this[_0x22bd32(0x172)](_0x1a7a65,_0x418086,_0x242f18);_0x175b47&&this[_0x22bd32(0x1a2)](_0x22bd32(0x14e),{'type':_0x22bd32(0x16e),'message':_0x22bd32(0x145)+_0x175b47[_0x22bd32(0x137)]+_0x22bd32(0x1c9)+_0x175b47['isValid']+'\x20|\x20Pen:\x20'+_0x175b47[_0x22bd32(0x1cb)]['toFixed'](0x1)+'t\x20|\x20Q:\x20'+(_0x175b47[_0x22bd32(0x13a)]*0x64)[_0x22bd32(0x16d)](0x0)+'%'});const _0x6a1a3e=this['liquidityZones']['get'](_0x1a7a65)[_0x22bd32(0x18b)];this['_updateZones'](_0x1a7a65,_0x242f18);const _0x5cad77=this['liquidityZones'][_0x22bd32(0x1b0)](_0x1a7a65);if(_0x5cad77[_0x22bd32(0x18b)]>_0x6a1a3e){const _0xbf1da6=_0x5cad77[_0x5cad77['length']-0x1];this['emit'](_0x22bd32(0x14e),{'type':'debug','message':_0x22bd32(0x180)+_0xbf1da6['type'][_0x22bd32(0x1c4)]()+_0x22bd32(0x1a0)+_0xbf1da6[_0x22bd32(0x1b4)]()['toFixed'](0x2)+_0x22bd32(0x13e)+_0x5cad77[_0x22bd32(0x18b)]});}if(_0x175b47&&_0x175b47[_0x22bd32(0x188)]){this['emit'](_0x22bd32(0x14e),{'type':_0x22bd32(0x16e),'message':'[2B]\x20Calling\x20_generateSignal\x20for\x20'+_0x175b47['sweepType']+'\x20sweep...'});const _0x13a970=this['_generateSignal'](_0x1a7a65,_0x164133,_0x242f18,_0x175b47);return!_0x13a970&&this[_0x22bd32(0x1a2)]('log',{'type':'debug','message':_0x22bd32(0x16c)}),_0x13a970;}return null;}['_detectSwings'](_0x544fec,_0x16a019,_0x273844){const _0x1b2bde=_0x2b7f26,_0x3a9928=this['config'][_0x1b2bde(0x164)]['lookbackBars'],_0x4bbfb7=this[_0x1b2bde(0x1b8)]['swing'][_0x1b2bde(0x152)];if(_0x273844<_0x3a9928*0x2)return;const _0x4e701f=this['swingPoints']['get'](_0x544fec),_0x140017=_0x273844-_0x3a9928,_0x257771=_0x16a019[_0x140017];_0x273844%0x5===0x0&&this[_0x1b2bde(0x1a2)]('log',{'type':'debug','message':'[SWING]\x20Checking\x20pivot\x20at\x20bar\x20'+_0x140017+'\x20|\x20H:'+_0x257771['high']['toFixed'](0x2)+_0x1b2bde(0x15c)+_0x257771[_0x1b2bde(0x195)][_0x1b2bde(0x16d)](0x2)+'\x20|\x20Total\x20swings:\x20'+_0x4e701f[_0x1b2bde(0x18b)]});let _0x280935=!![],_0x521908=0x0;for(let _0x1a6853=_0x140017-_0x3a9928;_0x1a6853<=_0x140017+_0x3a9928;_0x1a6853++){if(_0x1a6853===_0x140017||_0x1a6853<0x0||_0x1a6853>=_0x16a019[_0x1b2bde(0x18b)])continue;if(_0x16a019[_0x1a6853][_0x1b2bde(0x144)]>=_0x257771[_0x1b2bde(0x144)]){_0x280935=![];break;}_0x521908++;}if(_0x280935&&_0x521908>=_0x4bbfb7){const _0x5bed70=_0x4e701f[_0x1b2bde(0x142)](_0x337342=>_0x337342[_0x1b2bde(0x1b1)]===_0x140017&&_0x337342['type']===_0x1b2bde(0x144));!_0x5bed70&&(_0x4e701f['push'](new SwingPoint('high',_0x257771['high'],_0x140017,_0x257771[_0x1b2bde(0x136)],_0x521908)),this[_0x1b2bde(0x1a2)]('log',{'type':_0x1b2bde(0x16e),'message':_0x1b2bde(0x13c)+_0x257771[_0x1b2bde(0x144)]['toFixed'](0x2)+'\x20|\x20Bar\x20'+_0x140017+'\x20|\x20Strength:\x20'+_0x521908}));}let _0x26d6ea=!![],_0x4b3dfc=0x0;for(let _0x4227e3=_0x140017-_0x3a9928;_0x4227e3<=_0x140017+_0x3a9928;_0x4227e3++){if(_0x4227e3===_0x140017||_0x4227e3<0x0||_0x4227e3>=_0x16a019[_0x1b2bde(0x18b)])continue;if(_0x16a019[_0x4227e3][_0x1b2bde(0x195)]<=_0x257771['low']){_0x26d6ea=![];break;}_0x4b3dfc++;}if(_0x26d6ea&&_0x4b3dfc>=_0x4bbfb7){const _0x25746a=_0x4e701f[_0x1b2bde(0x142)](_0xedd508=>_0xedd508[_0x1b2bde(0x1b1)]===_0x140017&&_0xedd508[_0x1b2bde(0x1c2)]==='low');!_0x25746a&&(_0x4e701f[_0x1b2bde(0x15e)](new SwingPoint('low',_0x257771[_0x1b2bde(0x195)],_0x140017,_0x257771['timestamp'],_0x4b3dfc)),this[_0x1b2bde(0x1a2)]('log',{'type':'debug','message':_0x1b2bde(0x14f)+_0x257771['low'][_0x1b2bde(0x16d)](0x2)+_0x1b2bde(0x1bf)+_0x140017+'\x20|\x20Strength:\x20'+_0x4b3dfc}));}const _0x4aec4c=this['config']['zone']['maxZoneAgeBars'];while(_0x4e701f[_0x1b2bde(0x18b)]>0x0&&_0x4e701f[0x0]['barIndex']<_0x273844-_0x4aec4c){_0x4e701f[_0x1b2bde(0x1c6)]();}}[_0x2b7f26(0x185)](_0x196629,_0x2bfee0){const _0x31d1b0=_0x2b7f26,_0x25fba2=this['swingPoints'][_0x31d1b0(0x1b0)](_0x196629),_0x119925=this['liquidityZones']['get'](_0x196629),_0x3adb61=this['config']['zone']['clusterToleranceTicks']*this['tickSize'],_0x5e7d4e=this['config'][_0x31d1b0(0x179)][_0x31d1b0(0x186)];for(let _0x553991=_0x119925[_0x31d1b0(0x18b)]-0x1;_0x553991>=0x0;_0x553991--){_0x2bfee0-_0x119925[_0x553991][_0x31d1b0(0x1b1)]>_0x5e7d4e&&_0x119925['splice'](_0x553991,0x1);}for(const _0x451aa4 of _0x25fba2){let _0x38f244=null;for(const _0x5c15cc of _0x119925){if(_0x5c15cc['containsPrice'](_0x451aa4['price'],this[_0x31d1b0(0x1b8)]['zone'][_0x31d1b0(0x1a5)],this[_0x31d1b0(0x187)])){_0x38f244=_0x5c15cc;break;}}if(_0x38f244){_0x38f244[_0x31d1b0(0x16b)]++;if(_0x451aa4['price']>_0x38f244[_0x31d1b0(0x19b)])_0x38f244['priceHigh']=_0x451aa4[_0x31d1b0(0x1c1)];if(_0x451aa4['price']<_0x38f244[_0x31d1b0(0x19a)])_0x38f244[_0x31d1b0(0x19a)]=_0x451aa4['price'];_0x38f244['qualityScore']=Math[_0x31d1b0(0x1ca)](0x1,0.3+_0x38f244['touches']*0.15);}else{const _0x8620a6=_0x451aa4[_0x31d1b0(0x1c2)]===_0x31d1b0(0x144)?ZoneType['RESISTANCE']:ZoneType['SUPPORT'],_0xff29f5=new LiquidityZone(_0x8620a6,_0x451aa4['price']+_0x3adb61/0x2,_0x451aa4[_0x31d1b0(0x1c1)]-_0x3adb61/0x2,_0x451aa4['timestamp'],_0x451aa4[_0x31d1b0(0x1b1)]);_0xff29f5['qualityScore']=0.3+_0x451aa4[_0x31d1b0(0x17e)]*0.1,_0x119925['push'](_0xff29f5);}}}[_0x2b7f26(0x172)](_0x253098,_0x476147,_0x3b7b82){const _0x4d84aa=_0x2b7f26,_0x1f77d3=this[_0x4d84aa(0x1a3)]['get'](_0x253098),_0x5ee966=_0x476147[_0x3b7b82],_0x207ef8=_0x5ee966['close'],_0x177358=this['config']['sweep'],_0x3a40d3=this[_0x4d84aa(0x1b8)][_0x4d84aa(0x179)];for(const _0x2b4579 of _0x1f77d3){if(_0x2b4579['lastUsedBarIndex']>=0x0&&_0x3b7b82-_0x2b4579[_0x4d84aa(0x15f)]<_0x3a40d3[_0x4d84aa(0x1ad)])continue;const _0x48383d=_0x2b4579['getLevel'](),_0x55cbb9=Math[_0x4d84aa(0x158)](_0x207ef8-_0x48383d)/this['tickSize'];if(_0x55cbb9>_0x3a40d3['maxZoneDistanceTicks'])continue;const _0x3d2830=Math[_0x4d84aa(0x17d)](0x0,_0x3b7b82-_0x177358[_0x4d84aa(0x1c0)]*0x2);for(let _0x4f10fa=_0x3d2830;_0x4f10fa<_0x3b7b82;_0x4f10fa++){const _0x3ca6b8=_0x476147[_0x4f10fa];if(_0x2b4579['type']===ZoneType[_0x4d84aa(0x17f)]){const _0x67dbd=(_0x3ca6b8[_0x4d84aa(0x144)]-_0x2b4579['priceHigh'])/this['tickSize'];if(_0x67dbd>=_0x177358[_0x4d84aa(0x1be)]&&_0x67dbd<=_0x177358['maxPenetrationTicks']){const _0x51bc6f=Math['min'](_0x2b4579[_0x4d84aa(0x19b)],_0x2b4579['priceHigh']+_0x67dbd*this[_0x4d84aa(0x187)]);if(_0x207ef8<_0x51bc6f+this[_0x4d84aa(0x187)]*0x2){const _0x27a18e=_0x3ca6b8[_0x4d84aa(0x144)]-_0x3ca6b8[_0x4d84aa(0x195)],_0x56b9d0=Math['abs'](_0x3ca6b8[_0x4d84aa(0x193)]-_0x3ca6b8[_0x4d84aa(0x1ae)]),_0x456d0c=_0x27a18e>0x0?_0x56b9d0/_0x27a18e:0x0;if(_0x456d0c>=_0x177358['minBodyRatio']){const _0x3dd38c=this['_getVolumeRatio'](_0x476147,_0x4f10fa,0x14);if(_0x3dd38c>=_0x177358[_0x4d84aa(0x171)]){const _0x46adbf=new SweepEvent(SweepType[_0x4d84aa(0x1cf)],_0x2b4579,_0x4f10fa,_0x4f10fa,_0x3ca6b8['high']);_0x46adbf[_0x4d84aa(0x194)]=_0x3b7b82,_0x46adbf[_0x4d84aa(0x1cb)]=_0x67dbd,_0x46adbf['durationBars']=_0x3b7b82-_0x4f10fa,_0x46adbf[_0x4d84aa(0x169)]=_0x3dd38c,_0x46adbf[_0x4d84aa(0x13a)]=this['_scoreSweep'](_0x46adbf,_0x456d0c),_0x46adbf['isValid']=_0x46adbf['qualityScore']>=_0x177358['minQualityScore'];if(_0x46adbf['isValid'])return _0x46adbf;}}}}}if(_0x2b4579['type']===ZoneType[_0x4d84aa(0x18a)]){const _0x24bc95=(_0x2b4579['priceLow']-_0x3ca6b8['low'])/this[_0x4d84aa(0x187)];if(_0x24bc95>=_0x177358['minPenetrationTicks']&&_0x24bc95<=_0x177358['maxPenetrationTicks']){const _0x521aa4=Math[_0x4d84aa(0x17d)](_0x2b4579[_0x4d84aa(0x19a)],_0x2b4579['priceLow']-_0x24bc95*this[_0x4d84aa(0x187)]);if(_0x207ef8>_0x521aa4-this['tickSize']*0x2){const _0x42dd6c=_0x3ca6b8['high']-_0x3ca6b8[_0x4d84aa(0x195)],_0x4ccfeb=Math['abs'](_0x3ca6b8['close']-_0x3ca6b8['open']),_0x40bdb1=_0x42dd6c>0x0?_0x4ccfeb/_0x42dd6c:0x0;if(_0x40bdb1>=_0x177358[_0x4d84aa(0x19d)]){const _0x4ab1f4=this[_0x4d84aa(0x191)](_0x476147,_0x4f10fa,0x14);if(_0x4ab1f4>=_0x177358[_0x4d84aa(0x171)]){const _0x2bd8cb=new SweepEvent(SweepType[_0x4d84aa(0x16a)],_0x2b4579,_0x4f10fa,_0x4f10fa,_0x3ca6b8[_0x4d84aa(0x195)]);_0x2bd8cb['exitBarIndex']=_0x3b7b82,_0x2bd8cb[_0x4d84aa(0x1cb)]=_0x24bc95,_0x2bd8cb[_0x4d84aa(0x1b6)]=_0x3b7b82-_0x4f10fa,_0x2bd8cb['volumeRatio']=_0x4ab1f4,_0x2bd8cb[_0x4d84aa(0x13a)]=this['_scoreSweep'](_0x2bd8cb,_0x40bdb1),_0x2bd8cb['isValid']=_0x2bd8cb[_0x4d84aa(0x13a)]>=_0x177358['minQualityScore'];if(_0x2bd8cb[_0x4d84aa(0x188)])return _0x2bd8cb;}}}}}}}return null;}[_0x2b7f26(0x191)](_0x4757d5,_0x561020,_0x2a0d77){const _0x4b9126=_0x2b7f26,_0x40ed60=Math['max'](0x0,_0x561020-_0x2a0d77),_0x5ae0b1=_0x4757d5['slice'](_0x40ed60,_0x561020);if(_0x5ae0b1[_0x4b9126(0x18b)]===0x0)return 0x1;const _0xb09338=_0x5ae0b1['map'](_0x33c439=>_0x33c439[_0x4b9126(0x155)])[_0x4b9126(0x157)]((_0x49cb58,_0x287067)=>_0x49cb58-_0x287067),_0x1a3351=Math['floor'](_0xb09338[_0x4b9126(0x18b)]/0x2),_0x21aa93=_0xb09338[_0x1a3351]||0x1;return _0x4757d5[_0x561020][_0x4b9126(0x155)]/_0x21aa93;}[_0x2b7f26(0x163)](_0x4bc7e6,_0xcaadd6){const _0x4cb679=_0x2b7f26;let _0x322112=0x0;const _0x4b611b=0x4,_0x5a7039=Math['abs'](_0x4bc7e6['penetrationTicks']-_0x4b611b);return _0x322112+=Math['max'](0x0,0.3-_0x5a7039*0.03),_0x322112+=Math[_0x4cb679(0x17d)](0x0,0.25-_0x4bc7e6[_0x4cb679(0x1b6)]*0.05),_0x322112+=Math['min'](0.25,_0x4bc7e6[_0x4cb679(0x169)]*0.1),_0x322112+=Math[_0x4cb679(0x1ca)](0.2,_0xcaadd6*0.4),Math[_0x4cb679(0x1ca)](0x1,_0x322112);}['_generateSignal'](_0x56e5a8,_0x554186,_0xde732f,_0x3aa309){const _0x4a1b55=_0x2b7f26,_0xaee65a=Date['now']()-this['lastSignalTime'];if(_0xaee65a<this['config'][_0x4a1b55(0x15a)]['cooldownMs'])return this['emit']('log',{'type':_0x4a1b55(0x16e),'message':'[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20('+(_0xaee65a/0x3e8)[_0x4a1b55(0x16d)](0x1)+_0x4a1b55(0x1a8)+this[_0x4a1b55(0x1b8)]['execution']['cooldownMs']/0x3e8+'s)'}),null;const _0x12d293=this['config'][_0x4a1b55(0x15a)],_0x127e27=_0x554186[_0x4a1b55(0x193)],_0x24fdda=_0x3aa309[_0x4a1b55(0x137)]===SweepType[_0x4a1b55(0x1cf)]?_0x4a1b55(0x1c7):_0x4a1b55(0x1a1);let _0x36ad11,_0x426361,_0x53fc6c,_0x114aa9;_0x24fdda===_0x4a1b55(0x1a1)?(_0x36ad11=_0x127e27-_0x12d293[_0x4a1b55(0x135)]*this['tickSize'],_0x426361=_0x127e27+_0x12d293[_0x4a1b55(0x162)]*this['tickSize'],_0x53fc6c=_0x127e27+_0x12d293[_0x4a1b55(0x139)]*this[_0x4a1b55(0x187)],_0x114aa9=_0x127e27+_0x12d293[_0x4a1b55(0x161)]*this[_0x4a1b55(0x187)]):(_0x36ad11=_0x127e27+_0x12d293['stopTicks']*this['tickSize'],_0x426361=_0x127e27-_0x12d293[_0x4a1b55(0x162)]*this['tickSize'],_0x53fc6c=_0x127e27-_0x12d293['breakevenTicks']*this[_0x4a1b55(0x187)],_0x114aa9=_0x127e27-_0x12d293['trailTriggerTicks']*this['tickSize']);const _0x411a58=_0x12d293['targetTicks']/_0x12d293[_0x4a1b55(0x135)],_0x2ebe71=Math[_0x4a1b55(0x1ca)](0x1,_0x3aa309[_0x4a1b55(0x13a)]*0.5+_0x3aa309['zone'][_0x4a1b55(0x13a)]*0.3+(_0x3aa309[_0x4a1b55(0x169)]>1.5?0.2:_0x3aa309[_0x4a1b55(0x169)]*0.1));let _0x3bb9d5=SignalStrength[_0x4a1b55(0x14d)];if(_0x2ebe71>=0.8)_0x3bb9d5=SignalStrength['VERY_STRONG'];else{if(_0x2ebe71>=0.65)_0x3bb9d5=SignalStrength['STRONG'];else{if(_0x2ebe71<0.5)_0x3bb9d5=SignalStrength['WEAK'];}}const _0x33b12d=0.5+(_0x2ebe71-0.5)*0.4,_0x4b76ad=_0x33b12d*Math['abs'](_0x426361-_0x127e27)-(0x1-_0x33b12d)*Math['abs'](_0x127e27-_0x36ad11);_0x3aa309['zone'][_0x4a1b55(0x15f)]=_0xde732f,_0x3aa309[_0x4a1b55(0x179)][_0x4a1b55(0x1ce)]=!![],_0x3aa309['zone']['sweptAt']=new Date(_0x554186['timestamp']),this['lastSignalTime']=Date[_0x4a1b55(0x1cc)](),this['stats'][_0x4a1b55(0x189)]++;const _0x18b7f0={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x56e5a8['split']('.')[0x0]||_0x56e5a8,'contractId':_0x56e5a8,'side':_0x24fdda==='long'?OrderSide[_0x4a1b55(0x1c3)]:OrderSide['ASK'],'direction':_0x24fdda,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x3bb9d5,'edge':_0x4b76ad,'confidence':_0x2ebe71,'entry':_0x127e27,'entryPrice':_0x127e27,'stopLoss':_0x36ad11,'takeProfit':_0x426361,'riskReward':_0x411a58,'stopTicks':_0x12d293['stopTicks'],'targetTicks':_0x12d293[_0x4a1b55(0x162)],'breakevenTicks':_0x12d293['breakevenTicks'],'trailTriggerTicks':_0x12d293[_0x4a1b55(0x161)],'trailDistanceTicks':_0x12d293['trailDistanceTicks'],'beLevel':_0x53fc6c,'trailTrigger':_0x114aa9,'sweepType':_0x3aa309[_0x4a1b55(0x137)],'penetrationTicks':_0x3aa309[_0x4a1b55(0x1cb)],'sweepDurationBars':_0x3aa309['durationBars'],'sweepQuality':_0x3aa309['qualityScore'],'volumeRatio':_0x3aa309[_0x4a1b55(0x169)],'zoneType':_0x3aa309[_0x4a1b55(0x179)][_0x4a1b55(0x1c2)],'zoneLevel':_0x3aa309[_0x4a1b55(0x179)][_0x4a1b55(0x1b4)](),'zoneTouches':_0x3aa309[_0x4a1b55(0x179)]['touches'],'zoneQuality':_0x3aa309['zone'][_0x4a1b55(0x13a)],'expires':Date['now']()+0xea60};return this[_0x4a1b55(0x1a2)](_0x4a1b55(0x1af),{'side':_0x24fdda===_0x4a1b55(0x1a1)?'buy':'sell','action':_0x4a1b55(0x1ae),'reason':_0x4a1b55(0x13b)+_0x3aa309['sweepType']+_0x4a1b55(0x146)+_0x3aa309[_0x4a1b55(0x1cb)][_0x4a1b55(0x16d)](0x1)+'t\x20|\x20Vol:'+_0x3aa309[_0x4a1b55(0x169)]['toFixed'](0x1)+_0x4a1b55(0x1bb)+(_0x3aa309[_0x4a1b55(0x13a)]*0x64)['toFixed'](0x0)+'%',..._0x18b7f0}),this['emit']('log',{'type':_0x4a1b55(0x14b),'message':'[HQX-2B]\x20SIGNAL:\x20'+_0x24fdda['toUpperCase']()+_0x4a1b55(0x1a0)+_0x127e27['toFixed'](0x2)+'\x20|\x20'+_0x3aa309['sweepType']+'\x20|\x20Pen:'+_0x3aa309[_0x4a1b55(0x1cb)]['toFixed'](0x1)+'t\x20Vol:'+_0x3aa309[_0x4a1b55(0x169)][_0x4a1b55(0x16d)](0x1)+_0x4a1b55(0x192)+(_0x2ebe71*0x64)[_0x4a1b55(0x16d)](0x0)+'%'}),_0x18b7f0;}['getAnalysisState'](_0xb2426f,_0x298d64){const _0x23c7ed=_0x2b7f26,_0x31042d=this[_0x23c7ed(0x198)][_0x23c7ed(0x1b0)](_0xb2426f)||[],_0x3dd533=this[_0x23c7ed(0x1a3)][_0x23c7ed(0x1b0)](_0xb2426f)||[],_0x109922=this[_0x23c7ed(0x165)][_0x23c7ed(0x1b0)](_0xb2426f)||[];if(_0x31042d['length']<0x5)return{'ready':![],'message':_0x23c7ed(0x176)+_0x31042d[_0x23c7ed(0x18b)]+'/5\x20bars'};const _0x49cdc3=_0x3dd533['map'](_0x56409e=>({'zone':_0x56409e,'distance':Math['abs'](_0x298d64-_0x56409e['getLevel']())}))[_0x23c7ed(0x157)]((_0x39b439,_0x9f00c2)=>_0x39b439[_0x23c7ed(0x178)]-_0x9f00c2['distance']),_0x23e6cd=_0x49cdc3['find'](_0x399241=>_0x399241[_0x23c7ed(0x179)][_0x23c7ed(0x1c2)]===ZoneType[_0x23c7ed(0x17f)]),_0x58dc5e=_0x49cdc3['find'](_0x27617b=>_0x27617b[_0x23c7ed(0x179)]['type']===ZoneType[_0x23c7ed(0x18a)]);return{'ready':!![],'barsProcessed':_0x31042d[_0x23c7ed(0x18b)],'swingsDetected':_0x109922[_0x23c7ed(0x18b)],'activeZones':_0x3dd533[_0x23c7ed(0x18b)],'nearestResistance':_0x23e6cd?_0x23e6cd[_0x23c7ed(0x179)][_0x23c7ed(0x1b4)]():null,'nearestSupport':_0x58dc5e?_0x58dc5e[_0x23c7ed(0x179)]['getLevel']():null,'stopTicks':this[_0x23c7ed(0x1b8)]['execution'][_0x23c7ed(0x135)],'targetTicks':this[_0x23c7ed(0x1b8)][_0x23c7ed(0x15a)][_0x23c7ed(0x162)],'strategy':_0x23c7ed(0x1a6)};}['recordTradeResult'](_0x2d3fde){const _0x150ef0=_0x2b7f26;this['recentTrades']['push']({'netPnl':_0x2d3fde,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this['recentTrades'][_0x150ef0(0x1c6)]();_0x2d3fde>0x0?this['stats'][_0x150ef0(0x1cd)]++:this[_0x150ef0(0x1b2)]['losses']++,this['stats']['trades']++,this[_0x150ef0(0x1b2)]['pnl']+=_0x2d3fde,this[_0x150ef0(0x1a2)](_0x150ef0(0x14e),{'type':'debug','message':_0x150ef0(0x159)+(_0x2d3fde>0x0?_0x150ef0(0x175):'LOSS')+'\x20$'+_0x2d3fde[_0x150ef0(0x16d)](0x2)});}['getBarHistory'](_0x1ee8c3){const _0x2b034b=_0x2b7f26;return this[_0x2b034b(0x198)][_0x2b034b(0x1b0)](_0x1ee8c3)||[];}[_0x2b7f26(0x18e)](){return this['stats'];}[_0x2b7f26(0x17c)](_0x3bb748){const _0x22a336=_0x2b7f26,_0x6894c7=this['barHistory']['get'](_0x3bb748)||[],_0x3b3daf=this['liquidityZones']['get'](_0x3bb748)||[],_0x59f5cf=this[_0x22a336(0x165)][_0x22a336(0x1b0)](_0x3bb748)||[],_0x5b4451=this[_0x22a336(0x170)]['get'](_0x3bb748),_0xfe68f1=_0x6894c7[_0x6894c7['length']-0x1],_0x4a3504=_0xfe68f1?Date[_0x22a336(0x1cc)]()-_0xfe68f1[_0x22a336(0x136)]:null,_0x565141=_0x3b3daf[_0x22a336(0x1b7)](_0x42e970=>_0x42e970[_0x22a336(0x1c2)]===ZoneType[_0x22a336(0x17f)])[_0x22a336(0x18b)],_0x14f03a=_0x3b3daf[_0x22a336(0x1b7)](_0x2ce0ca=>_0x2ce0ca['type']===ZoneType['SUPPORT'])[_0x22a336(0x18b)];return{'healthy':_0x6894c7[_0x22a336(0x18b)]>=0x5,'barsTotal':_0x6894c7['length'],'barsLast5Min':_0x6894c7[_0x22a336(0x1b7)](_0x1846d9=>Date[_0x22a336(0x1cc)]()-_0x1846d9['timestamp']<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x59f5cf[_0x22a336(0x18b)],'zonesResistance':_0x565141,'zonesSupport':_0x14f03a,'zonesTotal':_0x3b3daf[_0x22a336(0x18b)],'currentBarTicks':_0x5b4451?_0x5b4451['tickCount']:0x0,'isAggregating':_0x5b4451&&_0x5b4451['tickCount']>0x0,'timeSinceLastBarMs':_0x4a3504,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this['config']['execution']['cooldownMs'],'uptime':Date['now']()-(this[_0x22a336(0x168)]||Date[_0x22a336(0x1cc)]())};}[_0x2b7f26(0x14c)](_0x5b62e2){const _0x126715=_0x2b7f26;this[_0x126715(0x198)]['set'](_0x5b62e2,[]),this[_0x126715(0x165)]['set'](_0x5b62e2,[]),this['liquidityZones']['set'](_0x5b62e2,[]),this[_0x126715(0x19f)][_0x126715(0x141)](_0x5b62e2,[]),this[_0x126715(0x170)]['delete'](_0x5b62e2),this[_0x126715(0x1a2)](_0x126715(0x14e),{'type':'info','message':_0x126715(0x156)+_0x5b62e2});}[_0x2b7f26(0x1b9)](_0x36cb98,_0x116ea5){const _0x313be6=_0x2b7f26;if(!_0x116ea5||_0x116ea5['length']===0x0){this[_0x313be6(0x1a2)](_0x313be6(0x14e),{'type':_0x313be6(0x16e),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this['barHistory']['has'](_0x36cb98)&&this['initialize'](_0x36cb98);const _0x2d7ec2=[..._0x116ea5]['sort']((_0x191a64,_0x53dbc1)=>_0x191a64[_0x313be6(0x136)]-_0x53dbc1[_0x313be6(0x136)]);this['emit'](_0x313be6(0x14e),{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x2d7ec2[_0x313be6(0x18b)]+_0x313be6(0x183)});let _0x4bc60d=0x0;for(const _0x3b14c0 of _0x2d7ec2){const _0x216325=this['processBar'](_0x36cb98,_0x3b14c0);if(_0x216325)_0x4bc60d++;}const _0x3874b2=this['barHistory']['get'](_0x36cb98)||[],_0x3cb9a2=this['swingPoints'][_0x313be6(0x1b0)](_0x36cb98)||[],_0x44de21=this[_0x313be6(0x1a3)]['get'](_0x36cb98)||[];this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x3874b2[_0x313be6(0x18b)]+'\x20bars,\x20'+_0x3cb9a2['length']+_0x313be6(0x149)+_0x44de21['length']+_0x313be6(0x134)}),_0x4bc60d>0x0&&this[_0x313be6(0x1a2)](_0x313be6(0x14e),{'type':_0x313be6(0x16e),'message':'[HQX-2B]\x20'+_0x4bc60d+_0x313be6(0x173)}),this[_0x313be6(0x181)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x1795ae={}){const _0x1172ce=_0x2b7f26;super(),this[_0x1172ce(0x1b8)]=_0x1795ae,this['strategy']=new HQX2BLiquiditySweep(_0x1795ae),this[_0x1172ce(0x17a)]['on']('signal',_0x3b318a=>this['emit'](_0x1172ce(0x1af),_0x3b318a)),this['strategy']['on']('log',_0x215b6f=>this[_0x1172ce(0x1a2)](_0x1172ce(0x14e),_0x215b6f));}[_0x2b7f26(0x17b)](_0x3c7e01){return this['strategy']['processTick'](_0x3c7e01);}[_0x2b7f26(0x19e)](_0x330c1c){const _0x3e6a28=_0x2b7f26;return this['strategy'][_0x3e6a28(0x19e)](_0x330c1c);}['onTrade'](_0x2bcae9){return this['strategy']['onTrade'](_0x2bcae9);}['processBar'](_0x33780f,_0x4571de){const _0x2fc38=_0x2b7f26;return this[_0x2fc38(0x17a)]['processBar'](_0x33780f,_0x4571de);}['initialize'](_0x37548e,_0x1f0b9b,_0x5771c8){const _0xadbebc=_0x2b7f26;return this[_0xadbebc(0x17a)]['initialize'](_0x37548e,_0x1f0b9b,_0x5771c8);}['getAnalysisState'](_0x167eff,_0x2422d2){return this['strategy']['getAnalysisState'](_0x167eff,_0x2422d2);}['recordTradeResult'](_0x18dd00){return this['strategy']['recordTradeResult'](_0x18dd00);}[_0x2b7f26(0x14c)](_0x48b033){const _0x428681=_0x2b7f26;return this['strategy'][_0x428681(0x14c)](_0x48b033);}['getStats'](){const _0x514c13=_0x2b7f26;return this['strategy'][_0x514c13(0x18e)]();}[_0x2b7f26(0x15d)](_0x33d969){const _0x39227a=_0x2b7f26;return this[_0x39227a(0x17a)]['getBarHistory'](_0x33d969);}['preloadBars'](_0x176233,_0x5e588e){const _0x40bc9b=_0x2b7f26;return this['strategy'][_0x40bc9b(0x1b9)](_0x176233,_0x5e588e);}[_0x2b7f26(0x17c)](_0x2bffe7){const _0x26930e=_0x2b7f26;return this[_0x26930e(0x17a)][_0x26930e(0x17c)](_0x2bffe7);}['generateSignal'](_0x4cde76){return null;}}module['exports']={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
1
+ function _0x4f16(_0x1214b8,_0x18e896){_0x1214b8=_0x1214b8-0x8d;const _0x20c70d=_0x20c7();let _0x4f1627=_0x20c70d[_0x1214b8];return _0x4f1627;}const _0x27887c=_0x4f16;(function(_0x45217f,_0x399198){const _0xccb945=_0x4f16,_0xd39802=_0x45217f();while(!![]){try{const _0xf82280=parseInt(_0xccb945(0xeb))/0x1+parseInt(_0xccb945(0xef))/0x2*(-parseInt(_0xccb945(0xfa))/0x3)+-parseInt(_0xccb945(0xe9))/0x4+parseInt(_0xccb945(0x117))/0x5*(-parseInt(_0xccb945(0x10c))/0x6)+parseInt(_0xccb945(0x128))/0x7+-parseInt(_0xccb945(0x105))/0x8*(parseInt(_0xccb945(0xa5))/0x9)+-parseInt(_0xccb945(0xdc))/0xa*(-parseInt(_0xccb945(0x98))/0xb);if(_0xf82280===_0x399198)break;else _0xd39802['push'](_0xd39802['shift']());}catch(_0x18a46e){_0xd39802['push'](_0xd39802['shift']());}}}(_0x20c7,0x963e3));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x27887c(0xe6)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':'low'},ZoneType={'RESISTANCE':_0x27887c(0xad),'SUPPORT':'support'},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x6,'minTouches':0x1,'maxZoneAgeBars':0xc8,'maxZoneDistanceTicks':0x3c,'cooldownBars':0x5},'sweep':{'minPenetrationTicks':0.25,'maxPenetrationTicks':0xc,'maxDurationBars':0x3,'minQualityScore':0.15,'minVolumeRatio':0.3,'minBodyRatio':0.05},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x3a98,'minHoldTimeMs':0x2710,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':'America/New_York'}};class SwingPoint{constructor(_0x345d70,_0x4a2bd1,_0x860d21,_0x504a63,_0x213231=0x1){const _0x5aa1ff=_0x27887c;this['type']=_0x345d70,this[_0x5aa1ff(0x10d)]=_0x4a2bd1,this['barIndex']=_0x860d21,this[_0x5aa1ff(0x12b)]=_0x504a63,this[_0x5aa1ff(0x11d)]=_0x213231;}}class LiquidityZone{constructor(_0x1f7f52,_0x4fe0aa,_0x5df5d6,_0x48bd58,_0x3ba692){const _0x5b3c17=_0x27887c;this['id']=uuidv4(),this[_0x5b3c17(0xf3)]=_0x1f7f52,this[_0x5b3c17(0x12a)]=_0x4fe0aa,this['priceLow']=_0x5df5d6,this['createdAt']=_0x48bd58,this[_0x5b3c17(0xd3)]=_0x3ba692,this[_0x5b3c17(0x8d)]=0x1,this['swept']=![],this[_0x5b3c17(0x10a)]=null,this['lastUsedBarIndex']=-0x3e7,this['qualityScore']=0.5;}[_0x27887c(0xb1)](_0x20fde3,_0x3d911a,_0x6b01fd){const _0xa0a354=_0x27887c,_0x269b78=_0x3d911a*_0x6b01fd;return _0x20fde3>=this[_0xa0a354(0xb8)]-_0x269b78&&_0x20fde3<=this['priceHigh']+_0x269b78;}['getLevel'](){return(this['priceHigh']+this['priceLow'])/0x2;}}class SweepEvent{constructor(_0x478487,_0x5065fa,_0x55ae12,_0x3e6539,_0x127e66){const _0x5c0a02=_0x27887c;this['sweepType']=_0x478487,this[_0x5c0a02(0x119)]=_0x5065fa,this[_0x5c0a02(0xd1)]=_0x55ae12,this['extremeBarIndex']=_0x3e6539,this[_0x5c0a02(0xd7)]=_0x127e66,this[_0x5c0a02(0x10b)]=null,this['isValid']=![],this['qualityScore']=0x0,this['penetrationTicks']=0x0,this['durationBars']=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x8a6fb7={}){const _0x2a76a8=_0x27887c;super(),this[_0x2a76a8(0xb0)]=this['_mergeConfig'](DEFAULT_CONFIG,_0x8a6fb7),this[_0x2a76a8(0xe1)]=this[_0x2a76a8(0xb0)]['tickSize'],this['tickValue']=this[_0x2a76a8(0xb0)][_0x2a76a8(0x113)],this[_0x2a76a8(0x132)]=new Map(),this['swingPoints']=new Map(),this[_0x2a76a8(0x11a)]=new Map(),this[_0x2a76a8(0x92)]=new Map(),this['currentBar']=new Map(),this[_0x2a76a8(0xc2)]=0xea60,this[_0x2a76a8(0x11b)]=0x0,this['startTime']=Date['now'](),this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this['recentTrades']=[];}['_mergeConfig'](_0x13babd,_0x17286a){const _0x25825b=_0x27887c,_0x1fe3c7={..._0x13babd};for(const _0x1d4310 in _0x17286a){typeof _0x17286a[_0x1d4310]===_0x25825b(0xa7)&&!Array['isArray'](_0x17286a[_0x1d4310])?_0x1fe3c7[_0x1d4310]={..._0x13babd[_0x1d4310],..._0x17286a[_0x1d4310]}:_0x1fe3c7[_0x1d4310]=_0x17286a[_0x1d4310];}return _0x1fe3c7;}[_0x27887c(0xc7)](_0x29bc7e){const _0x5ed4bf=_0x27887c;if(!this[_0x5ed4bf(0xb0)][_0x5ed4bf(0xfc)][_0x5ed4bf(0xc5)])return!![];const _0x5816bf=new Date(_0x29bc7e),_0x4a8d0a=this[_0x5ed4bf(0x118)](_0x5816bf)?-0x4:-0x5,_0x2af2af=_0x5816bf['getUTCHours'](),_0x1dad00=_0x5816bf[_0x5ed4bf(0xa3)](),_0x3ec5f8=(_0x2af2af+_0x4a8d0a+0x18)%0x18,{startHour:_0x4cb439,startMinute:_0x5196c6,endHour:_0x2b9ab3,endMinute:_0x5eae24}=this['config'][_0x5ed4bf(0xfc)],_0x5f1ab9=_0x3ec5f8*0x3c+_0x1dad00,_0x352012=_0x4cb439*0x3c+_0x5196c6,_0x283058=_0x2b9ab3*0x3c+_0x5eae24;return _0x5f1ab9>=_0x352012&&_0x5f1ab9<_0x283058;}['isDST'](_0x36d92e){const _0x1f604c=_0x27887c,_0x19a6ac=new Date(_0x36d92e['getFullYear'](),0x0,0x1),_0x2e5199=new Date(_0x36d92e[_0x1f604c(0x9d)](),0x6,0x1),_0x152251=Math['max'](_0x19a6ac[_0x1f604c(0xcc)](),_0x2e5199['getTimezoneOffset']());return _0x36d92e['getTimezoneOffset']()<_0x152251;}[_0x27887c(0x100)](_0x44dffd,_0x2efb71=0.25,_0x13e6c2=0x5){const _0x5e050f=_0x27887c;this[_0x5e050f(0xe1)]=_0x2efb71,this['tickValue']=_0x13e6c2,this[_0x5e050f(0xb0)][_0x5e050f(0xe1)]=_0x2efb71,this['config'][_0x5e050f(0x113)]=_0x13e6c2,this[_0x5e050f(0x132)]['set'](_0x44dffd,[]),this['swingPoints']['set'](_0x44dffd,[]),this['liquidityZones']['set'](_0x44dffd,[]),this['activeSweeps']['set'](_0x44dffd,[]),this[_0x5e050f(0xf9)]['delete'](_0x44dffd),this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x44dffd+_0x5e050f(0x12e)+_0x2efb71+_0x5e050f(0x12d)+_0x13e6c2+',\x20TF=1min'}),this['emit']('log',{'type':_0x5e050f(0xcf),'message':_0x5e050f(0xf8)+this[_0x5e050f(0xb0)]['execution']['stopTicks']+'t,\x20Target='+this['config'][_0x5e050f(0x10f)][_0x5e050f(0x108)]+_0x5e050f(0xa0)+this['config']['execution'][_0x5e050f(0x111)]+_0x5e050f(0x93)+this['config']['execution']['trailTriggerTicks']+'/'+this['config']['execution'][_0x5e050f(0xaa)]});}['processTick'](_0x268f26){const _0x54d7dd=_0x27887c,{contractId:_0x128755,price:_0x5290e6,volume:_0x202369,timestamp:_0x5926bd}=_0x268f26,_0x45ae8b=_0x5926bd||Date[_0x54d7dd(0x11c)](),_0x1c6f62=_0x202369||0x1;if(!this[_0x54d7dd(0xc7)](_0x45ae8b))return null;if(!this['_tickCount'])this[_0x54d7dd(0x8f)]=0x0;this[_0x54d7dd(0x8f)]++;let _0x5e9b42=this[_0x54d7dd(0xf9)]['get'](_0x128755);const _0x4ed502=Math['floor'](_0x45ae8b/this['barIntervalMs'])*this['barIntervalMs'];if(!_0x5e9b42||_0x5e9b42[_0x54d7dd(0x99)]!==_0x4ed502){if(_0x5e9b42){const _0x52321d={'timestamp':_0x5e9b42[_0x54d7dd(0x99)],'open':_0x5e9b42['open'],'high':_0x5e9b42[_0x54d7dd(0xb9)],'low':_0x5e9b42[_0x54d7dd(0x91)],'close':_0x5e9b42[_0x54d7dd(0xde)],'volume':_0x5e9b42[_0x54d7dd(0xee)]},_0x537d5a=this[_0x54d7dd(0x132)][_0x54d7dd(0x123)](_0x128755)||[];this[_0x54d7dd(0xa9)](_0x54d7dd(0xaf),{'type':_0x54d7dd(0x9b),'message':_0x54d7dd(0x103)+(_0x537d5a[_0x54d7dd(0xf4)]+0x1)+_0x54d7dd(0xcb)+_0x52321d['close']['toFixed'](0x2)+_0x54d7dd(0xd0)+_0x52321d[_0x54d7dd(0xa6)][_0x54d7dd(0x97)](0x2)+'\x20H:'+_0x52321d['high'][_0x54d7dd(0x97)](0x2)+'\x20L:'+_0x52321d['low'][_0x54d7dd(0x97)](0x2)+'\x20Vol:'+_0x52321d['volume']});const _0x5e5bf2=this['processBar'](_0x128755,_0x52321d);return this[_0x54d7dd(0xf9)][_0x54d7dd(0x124)](_0x128755,{'startTime':_0x4ed502,'open':_0x5290e6,'high':_0x5290e6,'low':_0x5290e6,'close':_0x5290e6,'volume':_0x1c6f62}),_0x5e5bf2;}else return this['currentBar'][_0x54d7dd(0x124)](_0x128755,{'startTime':_0x4ed502,'open':_0x5290e6,'high':_0x5290e6,'low':_0x5290e6,'close':_0x5290e6,'volume':_0x1c6f62}),null;}else return _0x5e9b42['high']=Math['max'](_0x5e9b42[_0x54d7dd(0xb9)],_0x5290e6),_0x5e9b42['low']=Math['min'](_0x5e9b42[_0x54d7dd(0x91)],_0x5290e6),_0x5e9b42['close']=_0x5290e6,_0x5e9b42[_0x54d7dd(0xee)]+=_0x1c6f62,null;}['onTick'](_0x427df8){return this['processTick'](_0x427df8);}[_0x27887c(0xfd)](_0x389c8b){const _0x3fcce5=_0x27887c;return this['processTick']({'contractId':_0x389c8b['contractId']||_0x389c8b[_0x3fcce5(0x12c)],'price':_0x389c8b['price'],'volume':_0x389c8b['size']||_0x389c8b[_0x3fcce5(0xee)]||0x1,'timestamp':_0x389c8b['timestamp']||Date[_0x3fcce5(0x11c)]()});}[_0x27887c(0xc8)](_0x3376f5,_0x277a60){const _0x2458d8=_0x27887c;let _0x242747=this[_0x2458d8(0x132)]['get'](_0x3376f5);!_0x242747&&(this[_0x2458d8(0x100)](_0x3376f5),_0x242747=this[_0x2458d8(0x132)]['get'](_0x3376f5));_0x242747[_0x2458d8(0xbf)](_0x277a60);if(_0x242747['length']>0x1f4)_0x242747['shift']();const _0x533ba7=_0x242747[_0x2458d8(0xf4)]-0x1;if(_0x242747[_0x2458d8(0xf4)]<this[_0x2458d8(0xb0)][_0x2458d8(0x9e)]['lookbackBars']+0x2)return null;const _0x267e5c=this['swingPoints']['get'](_0x3376f5)['length'];this[_0x2458d8(0xc0)](_0x3376f5,_0x242747,_0x533ba7);const _0x353cbd=this['swingPoints']['get'](_0x3376f5);if(_0x353cbd['length']>_0x267e5c){const _0x1efe36=_0x353cbd[_0x353cbd['length']-0x1];this['emit'](_0x2458d8(0xaf),{'type':_0x2458d8(0x9b),'message':_0x2458d8(0xf7)+_0x1efe36['type'][_0x2458d8(0xe8)]()+'\x20@\x20'+_0x1efe36['price'][_0x2458d8(0x97)](0x2)+_0x2458d8(0xe4)+_0x353cbd['length']});}const _0x50d152=this['_detectSweep'](_0x3376f5,_0x242747,_0x533ba7);_0x50d152&&this['emit'](_0x2458d8(0xaf),{'type':_0x2458d8(0x9b),'message':'[2B]\x20SWEEP\x20'+_0x50d152[_0x2458d8(0xdb)]+'\x20|\x20Valid:\x20'+_0x50d152['isValid']+_0x2458d8(0x116)+_0x50d152[_0x2458d8(0x104)]['toFixed'](0x1)+_0x2458d8(0x121)+(_0x50d152['qualityScore']*0x64)['toFixed'](0x0)+'%'});const _0x22029e=this[_0x2458d8(0x11a)]['get'](_0x3376f5)['length'];this['_updateZones'](_0x3376f5,_0x533ba7);const _0x4d7b87=this[_0x2458d8(0x11a)][_0x2458d8(0x123)](_0x3376f5);if(_0x4d7b87['length']>_0x22029e){const _0x5ec6ae=_0x4d7b87[_0x4d7b87[_0x2458d8(0xf4)]-0x1];this['emit']('log',{'type':'debug','message':_0x2458d8(0x109)+_0x5ec6ae[_0x2458d8(0xf3)][_0x2458d8(0xe8)]()+'\x20@\x20'+_0x5ec6ae[_0x2458d8(0xe5)]()['toFixed'](0x2)+'\x20|\x20Total:\x20'+_0x4d7b87[_0x2458d8(0xf4)]});}if(_0x50d152&&_0x50d152['isValid']){this[_0x2458d8(0xa9)](_0x2458d8(0xaf),{'type':_0x2458d8(0x9b),'message':_0x2458d8(0xf6)+_0x50d152['sweepType']+'\x20sweep...'});const _0x184bb4=this['_generateSignal'](_0x3376f5,_0x277a60,_0x533ba7,_0x50d152);return!_0x184bb4&&this[_0x2458d8(0xa9)]('log',{'type':'debug','message':'[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)'}),_0x184bb4;}return null;}['_detectSwings'](_0x116c6a,_0x97c483,_0x2937bc){const _0x3e993d=_0x27887c,_0x507691=this[_0x3e993d(0xb0)]['swing'][_0x3e993d(0xea)],_0x26827d=this['config'][_0x3e993d(0x9e)][_0x3e993d(0xda)];if(_0x2937bc<_0x507691*0x2)return;const _0x4be4ad=this[_0x3e993d(0x107)]['get'](_0x116c6a),_0x31cdb3=_0x2937bc-_0x507691,_0x203a86=_0x97c483[_0x31cdb3];_0x2937bc%0x5===0x0&&this[_0x3e993d(0xa9)]('log',{'type':'debug','message':_0x3e993d(0xfb)+_0x31cdb3+'\x20|\x20H:'+_0x203a86[_0x3e993d(0xb9)][_0x3e993d(0x97)](0x2)+'\x20L:'+_0x203a86['low'][_0x3e993d(0x97)](0x2)+_0x3e993d(0xca)+_0x4be4ad[_0x3e993d(0xf4)]});let _0x3d0c6a=!![],_0x1d1f31=0x0;for(let _0x5e8a8e=_0x31cdb3-_0x507691;_0x5e8a8e<=_0x31cdb3+_0x507691;_0x5e8a8e++){if(_0x5e8a8e===_0x31cdb3||_0x5e8a8e<0x0||_0x5e8a8e>=_0x97c483['length'])continue;if(_0x97c483[_0x5e8a8e][_0x3e993d(0xb9)]>=_0x203a86['high']){_0x3d0c6a=![];break;}_0x1d1f31++;}if(_0x3d0c6a&&_0x1d1f31>=_0x26827d){const _0x40f09f=_0x4be4ad[_0x3e993d(0xec)](_0xf1e8c0=>_0xf1e8c0[_0x3e993d(0xd3)]===_0x31cdb3&&_0xf1e8c0['type']==='high');!_0x40f09f&&(_0x4be4ad['push'](new SwingPoint('high',_0x203a86['high'],_0x31cdb3,_0x203a86['timestamp'],_0x1d1f31)),this['emit'](_0x3e993d(0xaf),{'type':_0x3e993d(0x9b),'message':_0x3e993d(0xe0)+_0x203a86[_0x3e993d(0xb9)]['toFixed'](0x2)+_0x3e993d(0xb5)+_0x31cdb3+_0x3e993d(0xd9)+_0x1d1f31}));}let _0x5a4b70=!![],_0x1a5a7c=0x0;for(let _0x2e1007=_0x31cdb3-_0x507691;_0x2e1007<=_0x31cdb3+_0x507691;_0x2e1007++){if(_0x2e1007===_0x31cdb3||_0x2e1007<0x0||_0x2e1007>=_0x97c483['length'])continue;if(_0x97c483[_0x2e1007]['low']<=_0x203a86[_0x3e993d(0x91)]){_0x5a4b70=![];break;}_0x1a5a7c++;}if(_0x5a4b70&&_0x1a5a7c>=_0x26827d){const _0x511e00=_0x4be4ad['find'](_0x2bb600=>_0x2bb600[_0x3e993d(0xd3)]===_0x31cdb3&&_0x2bb600[_0x3e993d(0xf3)]===_0x3e993d(0x91));!_0x511e00&&(_0x4be4ad[_0x3e993d(0xbf)](new SwingPoint('low',_0x203a86[_0x3e993d(0x91)],_0x31cdb3,_0x203a86['timestamp'],_0x1a5a7c)),this[_0x3e993d(0xa9)](_0x3e993d(0xaf),{'type':_0x3e993d(0x9b),'message':'[SWING]\x20NEW\x20LOW\x20@\x20'+_0x203a86['low']['toFixed'](0x2)+'\x20|\x20Bar\x20'+_0x31cdb3+'\x20|\x20Strength:\x20'+_0x1a5a7c}));}const _0x2cba84=this['config']['zone']['maxZoneAgeBars'];while(_0x4be4ad['length']>0x0&&_0x4be4ad[0x0][_0x3e993d(0xd3)]<_0x2937bc-_0x2cba84){_0x4be4ad['shift']();}}['_updateZones'](_0x5c8589,_0x4b876e){const _0x491e8d=_0x27887c,_0x46d749=this['swingPoints']['get'](_0x5c8589),_0x4c1653=this['liquidityZones']['get'](_0x5c8589),_0x5c08ca=this[_0x491e8d(0xb0)]['zone']['clusterToleranceTicks']*this['tickSize'],_0x2c67ea=this['config'][_0x491e8d(0x119)]['maxZoneAgeBars'];for(let _0xbf8bdb=_0x4c1653[_0x491e8d(0xf4)]-0x1;_0xbf8bdb>=0x0;_0xbf8bdb--){_0x4b876e-_0x4c1653[_0xbf8bdb]['barIndex']>_0x2c67ea&&_0x4c1653['splice'](_0xbf8bdb,0x1);}for(const _0x129708 of _0x46d749){let _0x12ce3b=null;for(const _0x1a7d4f of _0x4c1653){if(_0x1a7d4f['containsPrice'](_0x129708[_0x491e8d(0x10d)],this['config'][_0x491e8d(0x119)][_0x491e8d(0x129)],this[_0x491e8d(0xe1)])){_0x12ce3b=_0x1a7d4f;break;}}if(_0x12ce3b){_0x12ce3b['touches']++;if(_0x129708[_0x491e8d(0x10d)]>_0x12ce3b['priceHigh'])_0x12ce3b['priceHigh']=_0x129708[_0x491e8d(0x10d)];if(_0x129708[_0x491e8d(0x10d)]<_0x12ce3b['priceLow'])_0x12ce3b['priceLow']=_0x129708['price'];_0x12ce3b[_0x491e8d(0x101)]=Math['min'](0x1,0.3+_0x12ce3b[_0x491e8d(0x8d)]*0.15);}else{const _0x303546=_0x129708[_0x491e8d(0xf3)]==='high'?ZoneType['RESISTANCE']:ZoneType[_0x491e8d(0xb4)],_0x52abc1=new LiquidityZone(_0x303546,_0x129708['price']+_0x5c08ca/0x2,_0x129708['price']-_0x5c08ca/0x2,_0x129708[_0x491e8d(0x12b)],_0x129708['barIndex']);_0x52abc1[_0x491e8d(0x101)]=0.3+_0x129708['strength']*0.1,_0x4c1653['push'](_0x52abc1);}}}[_0x27887c(0x94)](_0x125b04,_0x35b9e3,_0xa84ee){const _0x2e1d2c=_0x27887c,_0x110c29=this[_0x2e1d2c(0x11a)]['get'](_0x125b04),_0x5505a0=_0x35b9e3[_0xa84ee],_0x229b67=_0x5505a0[_0x2e1d2c(0xde)],_0x151177=this[_0x2e1d2c(0xb0)]['sweep'],_0x17811b=this[_0x2e1d2c(0xb0)][_0x2e1d2c(0x119)];for(const _0x5472e9 of _0x110c29){if(_0x5472e9['lastUsedBarIndex']>=0x0&&_0xa84ee-_0x5472e9[_0x2e1d2c(0x96)]<_0x17811b['cooldownBars'])continue;const _0xfc11ab=_0x5472e9['getLevel'](),_0x3cc64d=Math[_0x2e1d2c(0xab)](_0x229b67-_0xfc11ab)/this['tickSize'];if(_0x3cc64d>_0x17811b['maxZoneDistanceTicks'])continue;const _0x433e31=Math[_0x2e1d2c(0xd4)](0x0,_0xa84ee-_0x151177['maxDurationBars']*0x2);for(let _0x47444b=_0x433e31;_0x47444b<_0xa84ee;_0x47444b++){const _0x1b7170=_0x35b9e3[_0x47444b];if(_0x5472e9[_0x2e1d2c(0xf3)]===ZoneType[_0x2e1d2c(0x131)]){const _0x1f156c=(_0x1b7170['high']-_0x5472e9[_0x2e1d2c(0x12a)])/this['tickSize'];if(_0x1f156c>=_0x151177['minPenetrationTicks']&&_0x1f156c<=_0x151177['maxPenetrationTicks']){const _0x313bf0=Math['min'](_0x5472e9['priceHigh'],_0x5472e9['priceHigh']+_0x1f156c*this[_0x2e1d2c(0xe1)]);if(_0x229b67<_0x313bf0+this['tickSize']*0x2){const _0x1e6f34=_0x1b7170[_0x2e1d2c(0xb9)]-_0x1b7170[_0x2e1d2c(0x91)],_0xbeaa9c=Math['abs'](_0x1b7170['close']-_0x1b7170[_0x2e1d2c(0xa6)]),_0x495064=_0x1e6f34>0x0?_0xbeaa9c/_0x1e6f34:0x0;if(_0x495064>=_0x151177['minBodyRatio']){const _0x5b0821=this['_getVolumeRatio'](_0x35b9e3,_0x47444b,0x14);if(_0x5b0821>=_0x151177['minVolumeRatio']){const _0x71b24a=new SweepEvent(SweepType[_0x2e1d2c(0x9f)],_0x5472e9,_0x47444b,_0x47444b,_0x1b7170['high']);_0x71b24a['exitBarIndex']=_0xa84ee,_0x71b24a[_0x2e1d2c(0x104)]=_0x1f156c,_0x71b24a['durationBars']=_0xa84ee-_0x47444b,_0x71b24a['volumeRatio']=_0x5b0821,_0x71b24a[_0x2e1d2c(0x101)]=this['_scoreSweep'](_0x71b24a,_0x495064),_0x71b24a['isValid']=_0x71b24a['qualityScore']>=_0x151177[_0x2e1d2c(0x11f)];if(_0x71b24a[_0x2e1d2c(0xd2)])return _0x71b24a;}}}}}if(_0x5472e9['type']===ZoneType[_0x2e1d2c(0xb4)]){const _0x31da05=(_0x5472e9['priceLow']-_0x1b7170['low'])/this[_0x2e1d2c(0xe1)];if(_0x31da05>=_0x151177['minPenetrationTicks']&&_0x31da05<=_0x151177[_0x2e1d2c(0xf2)]){const _0x1b1400=Math['max'](_0x5472e9['priceLow'],_0x5472e9['priceLow']-_0x31da05*this['tickSize']);if(_0x229b67>_0x1b1400-this[_0x2e1d2c(0xe1)]*0x2){const _0x5b786d=_0x1b7170['high']-_0x1b7170['low'],_0xcd0082=Math[_0x2e1d2c(0xab)](_0x1b7170['close']-_0x1b7170[_0x2e1d2c(0xa6)]),_0x33003e=_0x5b786d>0x0?_0xcd0082/_0x5b786d:0x0;if(_0x33003e>=_0x151177[_0x2e1d2c(0xba)]){const _0x39ad41=this[_0x2e1d2c(0xc4)](_0x35b9e3,_0x47444b,0x14);if(_0x39ad41>=_0x151177['minVolumeRatio']){const _0x16fae7=new SweepEvent(SweepType['LOW_SWEEP'],_0x5472e9,_0x47444b,_0x47444b,_0x1b7170[_0x2e1d2c(0x91)]);_0x16fae7['exitBarIndex']=_0xa84ee,_0x16fae7[_0x2e1d2c(0x104)]=_0x31da05,_0x16fae7['durationBars']=_0xa84ee-_0x47444b,_0x16fae7[_0x2e1d2c(0xcd)]=_0x39ad41,_0x16fae7[_0x2e1d2c(0x101)]=this['_scoreSweep'](_0x16fae7,_0x33003e),_0x16fae7[_0x2e1d2c(0xd2)]=_0x16fae7['qualityScore']>=_0x151177[_0x2e1d2c(0x11f)];if(_0x16fae7[_0x2e1d2c(0xd2)])return _0x16fae7;}}}}}}}return null;}['_getVolumeRatio'](_0x5dc92f,_0xa23d17,_0x364cf7){const _0x572e9e=_0x27887c,_0x193fae=Math['max'](0x0,_0xa23d17-_0x364cf7),_0x3995ba=_0x5dc92f[_0x572e9e(0x95)](_0x193fae,_0xa23d17);if(_0x3995ba[_0x572e9e(0xf4)]===0x0)return 0x1;const _0x43a488=_0x3995ba[_0x572e9e(0x112)](_0x2f6c9c=>_0x2f6c9c[_0x572e9e(0xee)])[_0x572e9e(0xf0)]((_0x25bf41,_0x449574)=>_0x25bf41-_0x449574),_0x123100=Math['floor'](_0x43a488[_0x572e9e(0xf4)]/0x2),_0x4db1d4=_0x43a488[_0x123100]||0x1;return _0x5dc92f[_0xa23d17][_0x572e9e(0xee)]/_0x4db1d4;}['_scoreSweep'](_0xf08f8b,_0x458814){const _0x3cea1b=_0x27887c;let _0x4a2524=0x0;const _0x1fd2ac=0x4,_0x2087e2=Math['abs'](_0xf08f8b[_0x3cea1b(0x104)]-_0x1fd2ac);return _0x4a2524+=Math['max'](0x0,0.3-_0x2087e2*0.03),_0x4a2524+=Math[_0x3cea1b(0xd4)](0x0,0.25-_0xf08f8b[_0x3cea1b(0x114)]*0.05),_0x4a2524+=Math['min'](0.25,_0xf08f8b['volumeRatio']*0.1),_0x4a2524+=Math['min'](0.2,_0x458814*0.4),Math['min'](0x1,_0x4a2524);}[_0x27887c(0x110)](_0x2bed02,_0x50662b,_0x21ec97,_0x58fb7f){const _0x357fd4=_0x27887c,_0x13e5a6=Date[_0x357fd4(0x11c)]()-this['lastSignalTime'];if(_0x13e5a6<this['config']['execution']['cooldownMs'])return this['emit'](_0x357fd4(0xaf),{'type':_0x357fd4(0x9b),'message':_0x357fd4(0xd6)+(_0x13e5a6/0x3e8)['toFixed'](0x1)+_0x357fd4(0xa8)+this[_0x357fd4(0xb0)][_0x357fd4(0x10f)][_0x357fd4(0xf5)]/0x3e8+'s)'}),null;const _0x28c107=this['config'][_0x357fd4(0x10f)],_0x12f271=_0x50662b[_0x357fd4(0xde)],_0x76865f=_0x58fb7f['sweepType']===SweepType[_0x357fd4(0x9f)]?_0x357fd4(0x120):_0x357fd4(0xe3);let _0x2369d6,_0x194ca1,_0x10dc37,_0x24c42e;_0x76865f===_0x357fd4(0xe3)?(_0x2369d6=_0x12f271-_0x28c107[_0x357fd4(0xce)]*this[_0x357fd4(0xe1)],_0x194ca1=_0x12f271+_0x28c107['targetTicks']*this[_0x357fd4(0xe1)],_0x10dc37=_0x12f271+_0x28c107[_0x357fd4(0x111)]*this[_0x357fd4(0xe1)],_0x24c42e=_0x12f271+_0x28c107['trailTriggerTicks']*this['tickSize']):(_0x2369d6=_0x12f271+_0x28c107['stopTicks']*this['tickSize'],_0x194ca1=_0x12f271-_0x28c107[_0x357fd4(0x108)]*this['tickSize'],_0x10dc37=_0x12f271-_0x28c107[_0x357fd4(0x111)]*this[_0x357fd4(0xe1)],_0x24c42e=_0x12f271-_0x28c107[_0x357fd4(0xa2)]*this['tickSize']);const _0x441b18=_0x28c107[_0x357fd4(0x108)]/_0x28c107['stopTicks'],_0x8406c7=Math[_0x357fd4(0x130)](0x1,_0x58fb7f[_0x357fd4(0x101)]*0.5+_0x58fb7f[_0x357fd4(0x119)]['qualityScore']*0.3+(_0x58fb7f[_0x357fd4(0xcd)]>1.5?0.2:_0x58fb7f[_0x357fd4(0xcd)]*0.1));let _0x53410d=SignalStrength[_0x357fd4(0xbc)];if(_0x8406c7>=0.8)_0x53410d=SignalStrength[_0x357fd4(0xed)];else{if(_0x8406c7>=0.65)_0x53410d=SignalStrength[_0x357fd4(0x8e)];else{if(_0x8406c7<0.5)_0x53410d=SignalStrength[_0x357fd4(0xc9)];}}const _0x12be08=0.5+(_0x8406c7-0.5)*0.4,_0x41f2f6=_0x12be08*Math[_0x357fd4(0xab)](_0x194ca1-_0x12f271)-(0x1-_0x12be08)*Math['abs'](_0x12f271-_0x2369d6);_0x58fb7f['zone'][_0x357fd4(0x96)]=_0x21ec97,_0x58fb7f[_0x357fd4(0x119)][_0x357fd4(0xe2)]=!![],_0x58fb7f[_0x357fd4(0x119)][_0x357fd4(0x10a)]=new Date(_0x50662b['timestamp']),this['lastSignalTime']=Date['now'](),this['stats']['signals']++;const _0x1d26cb={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x2bed02[_0x357fd4(0x106)]('.')[0x0]||_0x2bed02,'contractId':_0x2bed02,'side':_0x76865f===_0x357fd4(0xe3)?OrderSide['BID']:OrderSide['ASK'],'direction':_0x76865f,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x53410d,'edge':_0x41f2f6,'confidence':_0x8406c7,'entry':_0x12f271,'entryPrice':_0x12f271,'stopLoss':_0x2369d6,'takeProfit':_0x194ca1,'riskReward':_0x441b18,'stopTicks':_0x28c107[_0x357fd4(0xce)],'targetTicks':_0x28c107['targetTicks'],'breakevenTicks':_0x28c107['breakevenTicks'],'trailTriggerTicks':_0x28c107['trailTriggerTicks'],'trailDistanceTicks':_0x28c107[_0x357fd4(0xaa)],'beLevel':_0x10dc37,'trailTrigger':_0x24c42e,'sweepType':_0x58fb7f[_0x357fd4(0xdb)],'penetrationTicks':_0x58fb7f['penetrationTicks'],'sweepDurationBars':_0x58fb7f[_0x357fd4(0x114)],'sweepQuality':_0x58fb7f[_0x357fd4(0x101)],'volumeRatio':_0x58fb7f[_0x357fd4(0xcd)],'zoneType':_0x58fb7f['zone'][_0x357fd4(0xf3)],'zoneLevel':_0x58fb7f['zone'][_0x357fd4(0xe5)](),'zoneTouches':_0x58fb7f['zone'][_0x357fd4(0x8d)],'zoneQuality':_0x58fb7f[_0x357fd4(0x119)]['qualityScore'],'expires':Date['now']()+0xea60};return this['emit']('signal',{'side':_0x76865f==='long'?_0x357fd4(0xa4):_0x357fd4(0x115),'action':'open','reason':'2B\x20'+_0x58fb7f['sweepType']+'\x20|\x20Pen:'+_0x58fb7f['penetrationTicks'][_0x357fd4(0x97)](0x1)+_0x357fd4(0xf1)+_0x58fb7f[_0x357fd4(0xcd)]['toFixed'](0x1)+'x\x20|\x20Q:'+(_0x58fb7f[_0x357fd4(0x101)]*0x64)['toFixed'](0x0)+'%',..._0x1d26cb}),this[_0x357fd4(0xa9)]('log',{'type':_0x357fd4(0xcf),'message':_0x357fd4(0x125)+_0x76865f[_0x357fd4(0xe8)]()+_0x357fd4(0xd5)+_0x12f271['toFixed'](0x2)+'\x20|\x20'+_0x58fb7f[_0x357fd4(0xdb)]+'\x20|\x20Pen:'+_0x58fb7f['penetrationTicks']['toFixed'](0x1)+'t\x20Vol:'+_0x58fb7f['volumeRatio']['toFixed'](0x1)+'x\x20|\x20Conf:'+(_0x8406c7*0x64)['toFixed'](0x0)+'%'}),_0x1d26cb;}[_0x27887c(0x11e)](_0xbd28aa,_0x43e014){const _0x4b891f=_0x27887c,_0x429b51=this['barHistory']['get'](_0xbd28aa)||[],_0x73cc52=this[_0x4b891f(0x11a)][_0x4b891f(0x123)](_0xbd28aa)||[],_0xd8d658=this[_0x4b891f(0x107)]['get'](_0xbd28aa)||[];if(_0x429b51['length']<0x3)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x429b51['length']+_0x4b891f(0x102)};const _0x4ab000=_0x73cc52[_0x4b891f(0x112)](_0x325c3c=>({'zone':_0x325c3c,'distance':Math[_0x4b891f(0xab)](_0x43e014-_0x325c3c['getLevel']())}))['sort']((_0x337385,_0x263687)=>_0x337385['distance']-_0x263687[_0x4b891f(0x122)]),_0x4694ab=_0x4ab000[_0x4b891f(0xec)](_0x57e926=>_0x57e926[_0x4b891f(0x119)][_0x4b891f(0xf3)]===ZoneType[_0x4b891f(0x131)]),_0x5a9dbe=_0x4ab000['find'](_0x145263=>_0x145263['zone']['type']===ZoneType[_0x4b891f(0xb4)]);return{'ready':!![],'barsProcessed':_0x429b51['length'],'swingsDetected':_0xd8d658[_0x4b891f(0xf4)],'activeZones':_0x73cc52['length'],'nearestResistance':_0x4694ab?_0x4694ab['zone'][_0x4b891f(0xe5)]():null,'nearestSupport':_0x5a9dbe?_0x5a9dbe['zone']['getLevel']():null,'stopTicks':this['config'][_0x4b891f(0x10f)][_0x4b891f(0xce)],'targetTicks':this[_0x4b891f(0xb0)]['execution']['targetTicks'],'strategy':_0x4b891f(0xdf)};}['recordTradeResult'](_0x5ef5ef){const _0x1ef522=_0x27887c;this[_0x1ef522(0x10e)][_0x1ef522(0xbf)]({'netPnl':_0x5ef5ef,'timestamp':Date['now']()});if(this['recentTrades']['length']>0x64)this[_0x1ef522(0x10e)]['shift']();_0x5ef5ef>0x0?this['stats'][_0x1ef522(0x9a)]++:this['stats']['losses']++,this[_0x1ef522(0xb2)][_0x1ef522(0xbe)]++,this['stats'][_0x1ef522(0xd8)]+=_0x5ef5ef,this['emit']('log',{'type':'debug','message':_0x1ef522(0xbb)+(_0x5ef5ef>0x0?_0x1ef522(0xb7):_0x1ef522(0xb6))+'\x20$'+_0x5ef5ef[_0x1ef522(0x97)](0x2)});}[_0x27887c(0xae)](_0x4baedd){const _0x3efb2e=_0x27887c;return this['barHistory'][_0x3efb2e(0x123)](_0x4baedd)||[];}['getStats'](){return this['stats'];}[_0x27887c(0x12f)](_0x391695){const _0x5ec6be=_0x27887c,_0xef2216=this[_0x5ec6be(0x132)]['get'](_0x391695)||[],_0x45eb5d=this['liquidityZones'][_0x5ec6be(0x123)](_0x391695)||[],_0xfaacf4=this[_0x5ec6be(0x107)]['get'](_0x391695)||[],_0x1e2b60=this[_0x5ec6be(0xf9)][_0x5ec6be(0x123)](_0x391695),_0x54e049=_0xef2216[_0xef2216[_0x5ec6be(0xf4)]-0x1],_0x411627=_0x54e049?Date[_0x5ec6be(0x11c)]()-_0x54e049[_0x5ec6be(0x12b)]:null,_0x311292=_0x45eb5d['filter'](_0xb1659f=>_0xb1659f['type']===ZoneType[_0x5ec6be(0x131)])['length'],_0xc79214=_0x45eb5d[_0x5ec6be(0xa1)](_0x547d92=>_0x547d92['type']===ZoneType['SUPPORT'])[_0x5ec6be(0xf4)];return{'healthy':_0xef2216[_0x5ec6be(0xf4)]>=0x5,'barsTotal':_0xef2216['length'],'barsLast5Min':_0xef2216[_0x5ec6be(0xa1)](_0x5c7700=>Date['now']()-_0x5c7700[_0x5ec6be(0x12b)]<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0xfaacf4['length'],'zonesResistance':_0x311292,'zonesSupport':_0xc79214,'zonesTotal':_0x45eb5d['length'],'currentBarTicks':_0x1e2b60?_0x1e2b60['tickCount']:0x0,'isAggregating':_0x1e2b60&&_0x1e2b60['tickCount']>0x0,'timeSinceLastBarMs':_0x411627,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this[_0x5ec6be(0xb0)]['execution']['cooldownMs'],'uptime':Date[_0x5ec6be(0x11c)]()-(this[_0x5ec6be(0x99)]||Date[_0x5ec6be(0x11c)]())};}['reset'](_0x576d73){const _0x3fd7c6=_0x27887c;this['barHistory'][_0x3fd7c6(0x124)](_0x576d73,[]),this['swingPoints'][_0x3fd7c6(0x124)](_0x576d73,[]),this['liquidityZones'][_0x3fd7c6(0x124)](_0x576d73,[]),this['activeSweeps']['set'](_0x576d73,[]),this[_0x3fd7c6(0xf9)][_0x3fd7c6(0xbd)](_0x576d73),this['emit'](_0x3fd7c6(0xaf),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x576d73});}['preloadBars'](_0x52e0ac,_0x22b56e){const _0x2399ba=_0x27887c;if(!_0x22b56e||_0x22b56e[_0x2399ba(0xf4)]===0x0){this['emit']('log',{'type':'debug','message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this[_0x2399ba(0x132)][_0x2399ba(0xb3)](_0x52e0ac)&&this[_0x2399ba(0x100)](_0x52e0ac);const _0x417a2f=[..._0x22b56e]['sort']((_0x24a18c,_0x379497)=>_0x24a18c[_0x2399ba(0x12b)]-_0x379497[_0x2399ba(0x12b)]);this['emit'](_0x2399ba(0xaf),{'type':'info','message':_0x2399ba(0xc1)+_0x417a2f['length']+'\x20historical\x20bars...'});let _0x5decb5=0x0;for(const _0x1be23a of _0x417a2f){const _0x3f343f=this[_0x2399ba(0xc8)](_0x52e0ac,_0x1be23a);if(_0x3f343f)_0x5decb5++;}const _0x4b60bd=this['barHistory']['get'](_0x52e0ac)||[],_0x260b10=this[_0x2399ba(0x107)][_0x2399ba(0x123)](_0x52e0ac)||[],_0x3d59f5=this[_0x2399ba(0x11a)][_0x2399ba(0x123)](_0x52e0ac)||[];this[_0x2399ba(0xa9)]('log',{'type':_0x2399ba(0xcf),'message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x4b60bd['length']+_0x2399ba(0xc6)+_0x260b10['length']+_0x2399ba(0xfe)+_0x3d59f5[_0x2399ba(0xf4)]+'\x20zones'}),_0x5decb5>0x0&&this['emit']('log',{'type':_0x2399ba(0x9b),'message':'[HQX-2B]\x20'+_0x5decb5+_0x2399ba(0xc3)}),this[_0x2399ba(0x11b)]=0x0;}['createSyntheticZones'](_0x5e51de,_0x2d726a,_0x21e875=0x14){const _0x242dfc=_0x27887c;!this[_0x242dfc(0x11a)]['has'](_0x5e51de)&&this[_0x242dfc(0x100)](_0x5e51de);const _0x57ace3=this['liquidityZones'][_0x242dfc(0x123)](_0x5e51de),_0x1f78dc=this[_0x242dfc(0xe1)],_0x46c2a3=_0x21e875*_0x1f78dc,_0x59259e=_0x2d726a+_0x46c2a3,_0x551737=new LiquidityZone(ZoneType[_0x242dfc(0x131)],_0x59259e,this['barHistory'][_0x242dfc(0x123)](_0x5e51de)?.[_0x242dfc(0xf4)]||0x0,Date[_0x242dfc(0x11c)]());_0x551737[_0x242dfc(0x9c)](_0x59259e,this[_0x242dfc(0x132)]['get'](_0x5e51de)?.[_0x242dfc(0xf4)]||0x0),_0x57ace3[_0x242dfc(0xbf)](_0x551737);const _0x5e6e85=_0x2d726a-_0x46c2a3,_0x473336=new LiquidityZone(ZoneType['SUPPORT'],_0x5e6e85,this[_0x242dfc(0x132)][_0x242dfc(0x123)](_0x5e51de)?.['length']||0x0,Date[_0x242dfc(0x11c)]());return _0x473336['addTouch'](_0x5e6e85,this['barHistory'][_0x242dfc(0x123)](_0x5e51de)?.[_0x242dfc(0xf4)]||0x0),_0x57ace3[_0x242dfc(0xbf)](_0x473336),this['emit'](_0x242dfc(0xaf),{'type':_0x242dfc(0xcf),'message':'[HQX-2B]\x20Synthetic\x20zones:\x20R\x20@\x20'+_0x59259e['toFixed'](0x2)+'\x20|\x20S\x20@\x20'+_0x5e6e85['toFixed'](0x2)}),{'resistance':_0x59259e,'support':_0x5e6e85};}}class HQX2BStrategy extends EventEmitter{constructor(_0x4039e8={}){const _0x35bf81=_0x27887c;super(),this['config']=_0x4039e8,this['strategy']=new HQX2BLiquiditySweep(_0x4039e8),this[_0x35bf81(0xe7)]['on'](_0x35bf81(0x127),_0x591e47=>this[_0x35bf81(0xa9)]('signal',_0x591e47)),this['strategy']['on'](_0x35bf81(0xaf),_0x20b1b0=>this['emit']('log',_0x20b1b0));}['processTick'](_0x4e2eee){const _0x4f23ba=_0x27887c;return this[_0x4f23ba(0xe7)]['processTick'](_0x4e2eee);}[_0x27887c(0x126)](_0x256012){const _0x3785ba=_0x27887c;return this[_0x3785ba(0xe7)]['onTick'](_0x256012);}['onTrade'](_0x36eb70){const _0x368669=_0x27887c;return this[_0x368669(0xe7)]['onTrade'](_0x36eb70);}['processBar'](_0x4a4faa,_0x3b6b02){const _0x5d3972=_0x27887c;return this['strategy'][_0x5d3972(0xc8)](_0x4a4faa,_0x3b6b02);}[_0x27887c(0x100)](_0x23ac59,_0x39dc52,_0x3c584d){const _0x5c5d0c=_0x27887c;return this[_0x5c5d0c(0xe7)]['initialize'](_0x23ac59,_0x39dc52,_0x3c584d);}['getAnalysisState'](_0xa0cbdc,_0x5e5547){return this['strategy']['getAnalysisState'](_0xa0cbdc,_0x5e5547);}['recordTradeResult'](_0x1f4254){const _0x3a4189=_0x27887c;return this[_0x3a4189(0xe7)][_0x3a4189(0xdd)](_0x1f4254);}[_0x27887c(0x90)](_0xf75bd3){const _0x37e94d=_0x27887c;return this['strategy'][_0x37e94d(0x90)](_0xf75bd3);}[_0x27887c(0xac)](){const _0x292324=_0x27887c;return this[_0x292324(0xe7)]['getStats']();}['getBarHistory'](_0x683ba0){return this['strategy']['getBarHistory'](_0x683ba0);}['preloadBars'](_0x2d1067,_0x2a89d4){const _0x423cf9=_0x27887c;return this[_0x423cf9(0xe7)]['preloadBars'](_0x2d1067,_0x2a89d4);}[_0x27887c(0x12f)](_0x4e7665){const _0x221df8=_0x27887c;return this[_0x221df8(0xe7)]['getHealthStatus'](_0x4e7665);}['generateSignal'](_0x2c30f8){return null;}}function _0x20c7(){const _0x17f9f4=['processBar','WEAK','\x20|\x20Total\x20swings:\x20','\x20closed\x20@\x20','getTimezoneOffset','volumeRatio','stopTicks','info','\x20|\x20O:','entryBarIndex','isValid','barIndex','max','\x20@\x20','[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20(','extremePrice','pnl','\x20|\x20Strength:\x20','minStrength','sweepType','40FhmyGQ','recordTradeResult','close','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','[SWING]\x20NEW\x20HIGH\x20@\x20','tickSize','swept','long','\x20|\x20Total:\x20','getLevel','uuid','strategy','toUpperCase','3086764doIOOt','lookbackBars','430075KZBiXa','find','VERY_STRONG','volume','396254FnLiYL','sort','t\x20|\x20Vol:','maxPenetrationTicks','type','length','cooldownMs','[2B]\x20Calling\x20_generateSignal\x20for\x20','[2B]\x20NEW\x20SWING\x20','[HQX-2B]\x20Params:\x20Stop=','currentBar','9HbTvBY','[SWING]\x20Checking\x20pivot\x20at\x20bar\x20','session','onTrade','\x20swings,\x20','exports','initialize','qualityScore','/3\x20bars','[BAR]\x20#','penetrationTicks','6900912rcWGyt','split','swingPoints','targetTicks','[2B]\x20NEW\x20ZONE\x20','sweptAt','exitBarIndex','4242BumatB','price','recentTrades','execution','_generateSignal','breakevenTicks','map','tickValue','durationBars','sell','\x20|\x20Pen:\x20','5925AvUXWR','isDST','zone','liquidityZones','lastSignalTime','now','strength','getAnalysisState','minQualityScore','short','t\x20|\x20Q:\x20','distance','get','set','[HQX-2B]\x20SIGNAL:\x20','onTick','signal','2376143oBUWNX','clusterToleranceTicks','priceHigh','timestamp','symbol',',\x20value=',':\x20tick=','getHealthStatus','min','RESISTANCE','barHistory','touches','STRONG','_tickCount','reset','low','activeSweeps','t,\x20Trail=','_detectSweep','slice','lastUsedBarIndex','toFixed','8008968cNLIvc','startTime','wins','debug','addTouch','getFullYear','swing','HIGH_SWEEP','t,\x20BE=','filter','trailTriggerTicks','getUTCMinutes','buy','9gKetra','open','object','s\x20<\x20','emit','trailDistanceTicks','abs','getStats','resistance','getBarHistory','log','config','containsPrice','stats','has','SUPPORT','\x20|\x20Bar\x20','LOSS','WIN','priceLow','high','minBodyRatio','[HQX-2B]\x20Trade\x20result:\x20','MODERATE','delete','trades','push','_detectSwings','[HQX-2B]\x20Preloading\x20','barIntervalMs','\x20historical\x20signals\x20detected\x20(ignored)','_getVolumeRatio','enabled','\x20bars,\x20','isWithinSession'];_0x20c7=function(){return _0x17f9f4;};return _0x20c7();}module[_0x27887c(0xff)]={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
@@ -1 +1 @@
1
- const _0x3f38f4=_0x30a6;(function(_0x3c3e69,_0x1223f4){const _0x5e8f56=_0x30a6,_0xb5f6d7=_0x3c3e69();while(!![]){try{const _0x303347=-parseInt(_0x5e8f56(0x127))/0x1*(parseInt(_0x5e8f56(0x104))/0x2)+-parseInt(_0x5e8f56(0x113))/0x3+parseInt(_0x5e8f56(0x14b))/0x4+-parseInt(_0x5e8f56(0x126))/0x5+parseInt(_0x5e8f56(0xfa))/0x6+-parseInt(_0x5e8f56(0x139))/0x7*(-parseInt(_0x5e8f56(0x155))/0x8)+parseInt(_0x5e8f56(0x144))/0x9*(-parseInt(_0x5e8f56(0x159))/0xa);if(_0x303347===_0x1223f4)break;else _0xb5f6d7['push'](_0xb5f6d7['shift']());}catch(_0x5e1db9){_0xb5f6d7['push'](_0xb5f6d7['shift']());}}}(_0x492e,0xf0c16));const EventEmitter=require(_0x3f38f4(0x117)),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x3c54c6={}){const _0x5be687=_0x3f38f4;super(),this[_0x5be687(0x132)]=_0x3c54c6[_0x5be687(0x132)]||0.25,this['tickValue']=_0x3c54c6[_0x5be687(0xff)]||0x5,this[_0x5be687(0x10e)]=1.5,this[_0x5be687(0x135)]=0.5,this['vpinWindow']=0x32,this[_0x5be687(0x152)]=0.7,this[_0x5be687(0x14d)]=0.01,this['kalmanMeasurementNoise']=0.1,this[_0x5be687(0x140)]=0x64,this['ofiLookback']=0x14,this['baseStopTicks']=0x8,this[_0x5be687(0x120)]=0x10,this['breakevenTicks']=0x4,this['profitLockPct']=0.5,this['minConfidence']=0.55,this[_0x5be687(0x10a)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x5be687(0xfb)]=new Map(),this['priceBuffer']=new Map(),this['volumeBuffer']=new Map(),this['kalmanStates']=new Map(),this[_0x5be687(0x146)]=new Map(),this['recentTrades']=[],this[_0x5be687(0x142)]=0x0,this[_0x5be687(0x122)]=0x0,this[_0x5be687(0x145)]=0x0,this[_0x5be687(0x108)]=0x7530,this[_0x5be687(0x158)]=0x2710,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x3f38f4(0x136)](_0x464eb7,_0x5a9dff=0.25,_0x2fc97c=0x5){const _0x564b59=_0x3f38f4;this[_0x564b59(0x132)]=_0x5a9dff,this['tickValue']=_0x2fc97c,this['barHistory']['set'](_0x464eb7,[]),this[_0x564b59(0x11c)]['set'](_0x464eb7,[]),this[_0x564b59(0x125)][_0x564b59(0x11e)](_0x464eb7,[]),this['atrHistory'][_0x564b59(0x11e)](_0x464eb7,[]),this[_0x564b59(0x134)]['set'](_0x464eb7,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':_0x564b59(0x13e),'message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x464eb7+_0x564b59(0x11a)+_0x5a9dff+',\x20value='+_0x2fc97c}),this['emit'](_0x564b59(0x12f),{'type':'info','message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}['processTick'](_0x2d5017){const {contractId:_0x28f845,price:_0x88f637,volume:_0x7efaf6,side:_0x391eaf,timestamp:_0x3a6445}=_0x2d5017,_0x5e6b0b={'timestamp':_0x3a6445||Date['now'](),'open':_0x88f637,'high':_0x88f637,'low':_0x88f637,'close':_0x88f637,'volume':_0x7efaf6||0x1};return this['processBar'](_0x28f845,_0x5e6b0b);}[_0x3f38f4(0x105)](_0xa459d5){const _0x322b9e=_0x3f38f4;return this[_0x322b9e(0x130)](_0xa459d5);}['onTrade'](_0x5cf3bf){const _0xd0316b=_0x3f38f4;return this['processTick']({'contractId':_0x5cf3bf['contractId']||_0x5cf3bf['symbol'],'price':_0x5cf3bf['price'],'volume':_0x5cf3bf['size']||_0x5cf3bf['volume']||0x1,'side':_0x5cf3bf['side'],'timestamp':_0x5cf3bf[_0xd0316b(0x14c)]||Date[_0xd0316b(0x141)]()});}['processBar'](_0x50cd75,_0x58e8e3){const _0x4c230d=_0x3f38f4;let _0x590f41=this[_0x4c230d(0xfb)]['get'](_0x50cd75);!_0x590f41&&(this['initialize'](_0x50cd75),_0x590f41=this[_0x4c230d(0xfb)]['get'](_0x50cd75));_0x590f41[_0x4c230d(0x115)](_0x58e8e3);if(_0x590f41[_0x4c230d(0xf6)]>0x1f4)_0x590f41[_0x4c230d(0x10c)]();const _0x524a2d=this['priceBuffer'][_0x4c230d(0x10d)](_0x50cd75);_0x524a2d[_0x4c230d(0x115)](_0x58e8e3[_0x4c230d(0x150)]);if(_0x524a2d['length']>0xc8)_0x524a2d[_0x4c230d(0x10c)]();const _0xd29926=this['volumeBuffer']['get'](_0x50cd75),_0x55ca76=_0x58e8e3['high']-_0x58e8e3[_0x4c230d(0x13a)];let _0x2823ba=_0x58e8e3['volume']*0.5,_0x3a9aae=_0x58e8e3[_0x4c230d(0x119)]*0.5;if(_0x55ca76>0x0){const _0x362c99=(_0x58e8e3[_0x4c230d(0x150)]-_0x58e8e3[_0x4c230d(0x13a)])/_0x55ca76;_0x2823ba=_0x58e8e3['volume']*_0x362c99,_0x3a9aae=_0x58e8e3['volume']*(0x1-_0x362c99);}_0xd29926['push']({'buy':_0x2823ba,'sell':_0x3a9aae});if(_0xd29926['length']>0x64)_0xd29926[_0x4c230d(0x10c)]();if(_0x590f41[_0x4c230d(0xf6)]<0x32)return null;const _0x1325ba=this['_computeZScore'](_0x524a2d),_0x571dd6=this['_computeVPIN'](_0xd29926),_0x3b2656=this['_computeKyleLambda'](_0x590f41),_0x4756eb=this[_0x4c230d(0x147)](_0x50cd75,_0x58e8e3['close']),{regime:_0x2d97c8,params:_0x2a0174}=this[_0x4c230d(0x11d)](_0x50cd75,_0x590f41),_0x5047bc=this[_0x4c230d(0x13d)](_0x590f41);return this['_generateSignal'](_0x50cd75,_0x58e8e3['close'],_0x1325ba,_0x571dd6,_0x3b2656,_0x4756eb,_0x2d97c8,_0x2a0174,_0x5047bc,_0x590f41);}['_computeZScore'](_0x7deb7,_0x58db7a=0x32){const _0x414084=_0x3f38f4;if(_0x7deb7[_0x414084(0xf6)]<_0x58db7a)return 0x0;const _0x2e1682=_0x7deb7[_0x414084(0xf9)](-_0x58db7a),_0x318644=_0x2e1682[_0x414084(0xfe)]((_0xac1064,_0x2adf11)=>_0xac1064+_0x2adf11,0x0)/_0x58db7a,_0x254ca1=_0x2e1682[_0x414084(0xfe)]((_0x33805b,_0x2ed0d1)=>_0x33805b+Math['pow'](_0x2ed0d1-_0x318644,0x2),0x0)/_0x58db7a,_0x42d35e=Math['sqrt'](_0x254ca1);if(_0x42d35e<0.0001)return 0x0;const _0x88f22d=_0x7deb7[_0x7deb7['length']-0x1];return(_0x88f22d-_0x318644)/_0x42d35e;}[_0x3f38f4(0x157)](_0x211fb8){const _0x2b9432=_0x3f38f4;if(_0x211fb8['length']<this[_0x2b9432(0x137)])return 0.5;const _0x81e4de=_0x211fb8['slice'](-this[_0x2b9432(0x137)]);let _0x270492=0x0,_0x4a3949=0x0;for(const _0x36179f of _0x81e4de){_0x270492+=_0x36179f[_0x2b9432(0x129)],_0x4a3949+=_0x36179f[_0x2b9432(0x138)];}const _0x44a161=_0x270492+_0x4a3949;if(_0x44a161<0x1)return 0.5;return Math[_0x2b9432(0x12c)](_0x270492-_0x4a3949)/_0x44a161;}[_0x3f38f4(0x12e)](_0x2bb288){const _0x21dc46=_0x3f38f4;if(_0x2bb288[_0x21dc46(0xf6)]<0x14)return 0x0;const _0x114e7e=_0x2bb288[_0x21dc46(0xf9)](-0x14),_0x580449=[],_0x4d1abc=[];for(let _0x25a48c=0x1;_0x25a48c<_0x114e7e['length'];_0x25a48c++){_0x580449[_0x21dc46(0x115)](_0x114e7e[_0x25a48c][_0x21dc46(0x150)]-_0x114e7e[_0x25a48c-0x1]['close']),_0x4d1abc['push'](_0x114e7e[_0x25a48c][_0x21dc46(0x119)]);}const _0x1eed1c=_0x580449[_0x21dc46(0xfe)]((_0x551e0b,_0x79e264)=>_0x551e0b+_0x79e264,0x0)/_0x580449[_0x21dc46(0xf6)],_0x5d6f31=_0x4d1abc[_0x21dc46(0xfe)]((_0x19105f,_0x474e55)=>_0x19105f+_0x474e55,0x0)/_0x4d1abc[_0x21dc46(0xf6)];let _0x5bcef2=0x0,_0x52b84d=0x0;for(let _0x21c761=0x0;_0x21c761<_0x580449[_0x21dc46(0xf6)];_0x21c761++){_0x5bcef2+=(_0x580449[_0x21c761]-_0x1eed1c)*(_0x4d1abc[_0x21c761]-_0x5d6f31),_0x52b84d+=Math[_0x21dc46(0x154)](_0x4d1abc[_0x21c761]-_0x5d6f31,0x2);}_0x5bcef2/=_0x580449[_0x21dc46(0xf6)],_0x52b84d/=_0x580449['length'];if(_0x52b84d<0.0001)return 0x0;return Math['abs'](_0x5bcef2/_0x52b84d);}[_0x3f38f4(0x147)](_0xe221fa,_0x8dbb94){const _0x4dc809=_0x3f38f4;let _0x332c4e=this[_0x4dc809(0x134)][_0x4dc809(0x10d)](_0xe221fa);if(!_0x332c4e)return _0x332c4e={'estimate':_0x8dbb94,'errorCovariance':0x1},this[_0x4dc809(0x134)]['set'](_0xe221fa,_0x332c4e),_0x8dbb94;const _0x238ea1=_0x332c4e[_0x4dc809(0x128)],_0x2ce695=_0x332c4e['errorCovariance']+this['kalmanProcessNoise'],_0x1fb9a6=_0x2ce695/(_0x2ce695+this['kalmanMeasurementNoise']),_0x418ab9=_0x238ea1+_0x1fb9a6*(_0x8dbb94-_0x238ea1),_0xce5b9e=(0x1-_0x1fb9a6)*_0x2ce695;return _0x332c4e['estimate']=_0x418ab9,_0x332c4e[_0x4dc809(0x143)]=_0xce5b9e,_0x418ab9;}[_0x3f38f4(0x11d)](_0x26bd7b,_0x1640fe){const _0x34b40f=_0x3f38f4,_0x2726dd=this[_0x34b40f(0xf4)](_0x1640fe),_0x2b9bfe=_0x2726dd/this[_0x34b40f(0x132)];let _0x5b3cb2=this['atrHistory'][_0x34b40f(0x10d)](_0x26bd7b);!_0x5b3cb2&&(_0x5b3cb2=[],this['atrHistory'][_0x34b40f(0x11e)](_0x26bd7b,_0x5b3cb2));_0x5b3cb2[_0x34b40f(0x115)](_0x2726dd);if(_0x5b3cb2['length']>0x1f4)_0x5b3cb2[_0x34b40f(0x10c)]();let _0x4550ab=0.5;_0x5b3cb2[_0x34b40f(0xf6)]>=0x14&&(_0x4550ab=_0x5b3cb2[_0x34b40f(0x14f)](_0x389c46=>_0x389c46<=_0x2726dd)[_0x34b40f(0xf6)]/_0x5b3cb2['length']);let _0x322a81,_0x12da5f;if(_0x4550ab<0.25)_0x322a81='low',_0x12da5f={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x4550ab<0.75?(_0x322a81=_0x34b40f(0x13f),_0x12da5f={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x322a81=_0x34b40f(0xf3),_0x12da5f={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x322a81,'params':_0x12da5f};}[_0x3f38f4(0xf4)](_0x18e3e6,_0x4a2b73=0xe){const _0x212453=_0x3f38f4;if(_0x18e3e6[_0x212453(0xf6)]<_0x4a2b73+0x1)return 2.5;const _0x29de65=[];for(let _0x489b71=_0x18e3e6[_0x212453(0xf6)]-_0x4a2b73;_0x489b71<_0x18e3e6[_0x212453(0xf6)];_0x489b71++){const _0x2e0a47=_0x18e3e6[_0x489b71],_0x26dbf2=_0x18e3e6[_0x489b71-0x1]['close'],_0x3a3455=Math['max'](_0x2e0a47[_0x212453(0xf3)]-_0x2e0a47[_0x212453(0x13a)],Math['abs'](_0x2e0a47[_0x212453(0xf3)]-_0x26dbf2),Math['abs'](_0x2e0a47[_0x212453(0x13a)]-_0x26dbf2));_0x29de65['push'](_0x3a3455);}return _0x29de65[_0x212453(0xfe)]((_0xad4b3f,_0x5d77c7)=>_0xad4b3f+_0x5d77c7,0x0)/_0x29de65['length'];}[_0x3f38f4(0x13d)](_0x537d02){const _0x452547=_0x3f38f4;if(_0x537d02['length']<this['ofiLookback'])return 0x0;const _0xa1e75b=_0x537d02['slice'](-this['ofiLookback']);let _0xf2e98=0x0,_0x1a00ce=0x0;for(const _0x46657 of _0xa1e75b){const _0x1aeaaf=_0x46657[_0x452547(0xf3)]-_0x46657[_0x452547(0x13a)];if(_0x1aeaaf>0x0){const _0x3ad9ad=(_0x46657[_0x452547(0x150)]-_0x46657['low'])/_0x1aeaaf;_0xf2e98+=_0x3ad9ad*_0x46657[_0x452547(0x119)],_0x1a00ce+=(0x1-_0x3ad9ad)*_0x46657['volume'];}}const _0x54c894=_0xf2e98+_0x1a00ce;if(_0x54c894<0x1)return 0x0;return(_0xf2e98-_0x1a00ce)/_0x54c894;}[_0x3f38f4(0x14a)](_0x507b98,_0x3263f1,_0x2faa63,_0x1fab76,_0x3da40e,_0x596d19,_0x51c2b6,_0x52e7c0,_0x5b469b,_0x10653a){const _0x2ddf32=_0x3f38f4,_0x2441b5=Math['abs'](_0x2faa63);if(_0x2441b5<_0x52e7c0['zscoreThreshold'])return null;if(_0x1fab76>this['vpinToxicThreshold'])return null;let _0x1242ea;if(_0x2faa63<-_0x52e7c0['zscoreThreshold'])_0x1242ea='long';else{if(_0x2faa63>_0x52e7c0['zscoreThreshold'])_0x1242ea=_0x2ddf32(0xf7);else return null;}const _0x7db943=_0x1242ea===_0x2ddf32(0xfd)&&_0x5b469b>0.1||_0x1242ea===_0x2ddf32(0xf7)&&_0x5b469b<-0.1,_0x50fa47=_0x3263f1-_0x596d19,_0x1895a4=_0x1242ea===_0x2ddf32(0xfd)&&_0x50fa47<0x0||_0x1242ea===_0x2ddf32(0xf7)&&_0x50fa47>0x0,_0x4afb8d={'zscore':Math[_0x2ddf32(0x12b)](0x1,_0x2441b5/0x4),'vpin':0x1-_0x1fab76,'kyleLambda':_0x3da40e>0.001?0.5:0.8,'kalman':_0x1895a4?0.8:0.4,'volatility':_0x51c2b6===_0x2ddf32(0x13f)?0.8:_0x51c2b6==='low'?0.7:0.6,'ofi':_0x7db943?0.9:0.5,'composite':0x0};_0x4afb8d[_0x2ddf32(0xf5)]=_0x4afb8d['zscore']*this[_0x2ddf32(0x10a)]['zscore']+_0x4afb8d['vpin']*this[_0x2ddf32(0x10a)]['vpin']+_0x4afb8d['kyleLambda']*this['weights'][_0x2ddf32(0x106)]+_0x4afb8d['kalman']*this['weights'][_0x2ddf32(0x124)]+_0x4afb8d['volatility']*this['weights'][_0x2ddf32(0x15a)]+_0x4afb8d['ofi']*this['weights'][_0x2ddf32(0x15d)];const _0x256dc9=Math['min'](0x1,_0x4afb8d[_0x2ddf32(0xf5)]+_0x52e7c0[_0x2ddf32(0x156)]);if(_0x256dc9<this[_0x2ddf32(0x15c)])return null;if(Date['now']()-this['lastSignalTime']<this[_0x2ddf32(0x108)])return null;const _0x1ccb91=Math['round'](this[_0x2ddf32(0x15b)]*_0x52e7c0[_0x2ddf32(0x103)]),_0x5cc624=Math['round'](this['baseTargetTicks']*_0x52e7c0[_0x2ddf32(0x112)]),_0x44d2b0=Math[_0x2ddf32(0x10f)](0x6,Math['min'](0xc,_0x1ccb91)),_0x367001=Math['max'](_0x44d2b0*1.5,Math['min'](0x18,_0x5cc624));let _0x4408b9,_0x454d41,_0x1bfe33,_0x1d89bf;_0x1242ea==='long'?(_0x4408b9=_0x3263f1-_0x44d2b0*this['tickSize'],_0x454d41=_0x3263f1+_0x367001*this[_0x2ddf32(0x132)],_0x1bfe33=_0x3263f1+this[_0x2ddf32(0x14e)]*this[_0x2ddf32(0x132)],_0x1d89bf=_0x3263f1+_0x367001*this[_0x2ddf32(0xfc)]*this['tickSize']):(_0x4408b9=_0x3263f1+_0x44d2b0*this['tickSize'],_0x454d41=_0x3263f1-_0x367001*this['tickSize'],_0x1bfe33=_0x3263f1-this['breakevenTicks']*this[_0x2ddf32(0x132)],_0x1d89bf=_0x3263f1-_0x367001*this['profitLockPct']*this[_0x2ddf32(0x132)]);const _0x2df7f9=_0x367001/_0x44d2b0,_0x3e5215=Math[_0x2ddf32(0x133)](_0x367001*0.5),_0x19d283=Math['round'](_0x44d2b0*0.4);let _0x48825d=SignalStrength[_0x2ddf32(0x118)];if(_0x256dc9>=0.85)_0x48825d=SignalStrength[_0x2ddf32(0x13c)];else{if(_0x256dc9>=0.75)_0x48825d=SignalStrength['STRONG'];else{if(_0x256dc9<0.6)_0x48825d=SignalStrength['WEAK'];}}const _0x496c28=0.5+(_0x256dc9-0.5)*0.4,_0x21c395=_0x496c28*Math[_0x2ddf32(0x12c)](_0x454d41-_0x3263f1)-(0x1-_0x496c28)*Math[_0x2ddf32(0x12c)](_0x3263f1-_0x4408b9);this['lastSignalTime']=Date[_0x2ddf32(0x141)](),this[_0x2ddf32(0x11f)]['signals']++;const _0x253fba={'id':uuidv4(),'timestamp':Date[_0x2ddf32(0x141)](),'symbol':_0x507b98['split']('.')[0x0]||_0x507b98,'contractId':_0x507b98,'side':_0x1242ea==='long'?OrderSide['BID']:OrderSide['ASK'],'direction':_0x1242ea,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0x48825d,'edge':_0x21c395,'confidence':_0x256dc9,'entry':_0x3263f1,'entryPrice':_0x3263f1,'stopLoss':_0x4408b9,'takeProfit':_0x454d41,'riskReward':_0x2df7f9,'stopTicks':_0x44d2b0,'targetTicks':_0x367001,'trailTriggerTicks':_0x3e5215,'trailDistanceTicks':_0x19d283,'beBreakeven':_0x1bfe33,'profitLockLevel':_0x1d89bf,'zScore':_0x2faa63,'zScoreExit':this[_0x2ddf32(0x135)],'vpinValue':_0x1fab76,'kyleLambda':_0x3da40e,'kalmanEstimate':_0x596d19,'volatilityRegime':_0x51c2b6,'ofiValue':_0x5b469b,'models':_0x4afb8d,'orderFlowConfirmed':_0x7db943,'kalmanConfirmed':_0x1895a4,'expires':Date[_0x2ddf32(0x141)]()+0xea60};return this['emit'](_0x2ddf32(0x10b),{'side':_0x1242ea===_0x2ddf32(0xfd)?_0x2ddf32(0x129):'sell','action':'open','reason':'Z='+_0x2faa63['toFixed'](0x2)+_0x2ddf32(0x121)+(_0x1fab76*0x64)[_0x2ddf32(0x151)](0x0)+_0x2ddf32(0x111)+(_0x5b469b*0x64)['toFixed'](0x0)+'%,\x20cf='+(_0x256dc9*0x64)[_0x2ddf32(0x151)](0x0)+'%',..._0x253fba}),this['emit'](_0x2ddf32(0x12f),{'type':_0x2ddf32(0x13e),'message':_0x2ddf32(0x123)+_0x1242ea[_0x2ddf32(0x100)]()+'\x20@\x20'+_0x3263f1[_0x2ddf32(0x151)](0x2)+'\x20|\x20Z:'+_0x2faa63[_0x2ddf32(0x151)](0x2)+'\x20VPIN:'+(_0x1fab76*0x64)[_0x2ddf32(0x151)](0x0)+'%\x20OFI:'+(_0x5b469b*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x3da40e['toFixed'](0x5)+'\x20Regime:'+_0x51c2b6+'\x20|\x20Conf:'+(_0x256dc9*0x64)['toFixed'](0x0)+'%'}),_0x253fba;}[_0x3f38f4(0x107)](_0x3f100d){const _0x59d96e=_0x3f38f4,_0x464578=this[_0x59d96e(0x11c)][_0x59d96e(0x10d)](_0x3f100d);if(!_0x464578||_0x464578['length']<0x32)return![];const _0x3aa107=this[_0x59d96e(0x12a)](_0x464578);return Math[_0x59d96e(0x12c)](_0x3aa107)<this['zscoreExitThreshold'];}[_0x3f38f4(0xf8)](_0x3ca54b){const _0x127579=_0x3f38f4,_0x27b100=this['priceBuffer']['get'](_0x3ca54b),_0x27c0d3=this['volumeBuffer'][_0x127579(0x10d)](_0x3ca54b),_0x1af95c=this[_0x127579(0xfb)]['get'](_0x3ca54b);if(!_0x27b100||!_0x27c0d3||!_0x1af95c||_0x1af95c[_0x127579(0xf6)]<0x32)return null;const _0x596ec7=this['_computeZScore'](_0x27b100),_0x28214d=this[_0x127579(0x157)](_0x27c0d3),_0x4606b6=this['_computeKyleLambda'](_0x1af95c),_0x1d2055=this['_computeOrderFlowImbalance'](_0x1af95c);return{'zscore':Math['min'](0x1,Math['abs'](_0x596ec7)/0x4),'vpin':0x1-_0x28214d,'kyleLambda':_0x4606b6>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x1d2055)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x596ec7,'vpin':_0x28214d,'kyleLambda':_0x4606b6,'ofi':_0x1d2055}};}['getAnalysisState'](_0x1b5736,_0x2a931f){const _0x4e564d=_0x3f38f4,_0xb68db1=this['barHistory']['get'](_0x1b5736)||[];if(_0xb68db1[_0x4e564d(0xf6)]<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0xb68db1[_0x4e564d(0xf6)]+'/50\x20bars'};const _0x5592fa=this['priceBuffer']['get'](_0x1b5736)||[],_0x449d36=this['volumeBuffer']['get'](_0x1b5736)||[],_0x3e3124=this['_computeZScore'](_0x5592fa),_0x57a88c=this[_0x4e564d(0x157)](_0x449d36),_0x2e7e00=this[_0x4e564d(0x13d)](_0xb68db1),_0x5cb4e9=this['_computeKyleLambda'](_0xb68db1),{regime:_0x1035a4,params:_0x4b10bc}=this[_0x4e564d(0x11d)](_0x1b5736,_0xb68db1);return{'ready':!![],'zScore':_0x3e3124,'vpin':_0x57a88c,'ofi':_0x2e7e00,'kyleLambda':_0x5cb4e9,'regime':_0x1035a4,'stopTicks':Math['round'](this['baseStopTicks']*_0x4b10bc[_0x4e564d(0x103)]),'targetTicks':Math[_0x4e564d(0x133)](this['baseTargetTicks']*_0x4b10bc['targetMultiplier']),'threshold':_0x4b10bc['zscoreThreshold'],'barsProcessed':_0xb68db1[_0x4e564d(0xf6)],'models':'6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)'};}[_0x3f38f4(0x12d)](_0x450d04){const _0x52acbd=_0x3f38f4;this[_0x52acbd(0x116)]['push']({'netPnl':_0x450d04,'timestamp':Date[_0x52acbd(0x141)]()});if(this['recentTrades']['length']>0x64)this['recentTrades']['shift']();_0x450d04>0x0?(this[_0x52acbd(0x142)]++,this['lossStreak']=0x0,this[_0x52acbd(0x11f)]['wins']++):(this[_0x52acbd(0x122)]++,this['winStreak']=0x0,this['stats'][_0x52acbd(0xf2)]++),this[_0x52acbd(0x11f)][_0x52acbd(0x149)]++,this['stats']['pnl']+=_0x450d04,this['emit'](_0x52acbd(0x12f),{'type':_0x52acbd(0x102),'message':'[HQX]\x20Trade\x20result:\x20'+(_0x450d04>0x0?'WIN':'LOSS')+'\x20$'+_0x450d04['toFixed'](0x2)+',\x20streak:\x20'+(_0x450d04>0x0?this['winStreak']:-this[_0x52acbd(0x122)])});}['getBarHistory'](_0x2909f8){const _0x462d7e=_0x3f38f4;return this[_0x462d7e(0xfb)]['get'](_0x2909f8)||[];}['getStats'](){const _0x5987ba=_0x3f38f4;return this[_0x5987ba(0x11f)];}['reset'](_0x2f1c56){const _0x3a12f5=_0x3f38f4;this['barHistory'][_0x3a12f5(0x11e)](_0x2f1c56,[]),this['priceBuffer']['set'](_0x2f1c56,[]),this['volumeBuffer']['set'](_0x2f1c56,[]),this['atrHistory'][_0x3a12f5(0x11e)](_0x2f1c56,[]),this[_0x3a12f5(0x134)]['set'](_0x2f1c56,{'estimate':0x0,'errorCovariance':0x1}),this[_0x3a12f5(0x114)](_0x3a12f5(0x12f),{'type':'info','message':_0x3a12f5(0x153)+_0x2f1c56});}}function _0x492e(){const _0x223a4b=['long','reduce','tickValue','toUpperCase','onTrade','debug','stopMultiplier','96702fpQzch','onTick','kyleLambda','shouldExitByZScore','cooldownMs','getAnalysisState','weights','signal','shift','get','zscoreEntryThreshold','max','getStats','%,\x20OFI=','targetMultiplier','1411050IMIQCo','emit','push','recentTrades','events','MODERATE','volume',':\x20tick=','getBarHistory','priceBuffer','_detectVolatilityRegime','set','stats','baseTargetTicks',',\x20VPIN=','lossStreak','[HQX]\x20SIGNAL:\x20','kalman','volumeBuffer','3286540CgzlHt','12ZmjSmH','estimate','buy','_computeZScore','min','abs','recordTradeResult','_computeKyleLambda','log','processTick','strategy','tickSize','round','kalmanStates','zscoreExitThreshold','initialize','vpinWindow','sell','12355JODrZy','low','processBar','VERY_STRONG','_computeOrderFlowImbalance','info','normal','volatilityLookback','now','winStreak','errorCovariance','207iZSoLF','lastSignalTime','atrHistory','_applyKalmanFilter','reset','trades','_generateSignal','7487032MEshvr','timestamp','kalmanProcessNoise','breakevenTicks','filter','close','toFixed','vpinToxicThreshold','[HQX-UltraScalping]\x20Reset\x20state\x20for\x20','pow','8288qXISxq','confidenceBonus','_computeVPIN','minHoldTimeMs','1069340CnLiZe','volatility','baseStopTicks','minConfidence','ofi','losses','high','_calculateATR','composite','length','short','getModelValues','slice','8719128UInoaM','barHistory','profitLockPct'];_0x492e=function(){return _0x223a4b;};return _0x492e();}function _0x30a6(_0x385a7b,_0x44cee7){_0x385a7b=_0x385a7b-0xf2;const _0x492e31=_0x492e();let _0x30a6e4=_0x492e31[_0x385a7b];return _0x30a6e4;}class UltraScalpingStrategy extends EventEmitter{constructor(_0x5b81aa={}){const _0x45add5=_0x3f38f4;super(),this['config']=_0x5b81aa,this[_0x45add5(0x131)]=new HQXUltraScalping(_0x5b81aa),this[_0x45add5(0x131)]['on'](_0x45add5(0x10b),_0x136f3b=>this['emit']('signal',_0x136f3b)),this['strategy']['on']('log',_0x222daa=>this[_0x45add5(0x114)]('log',_0x222daa));}['processTick'](_0x17aa81){const _0x40989e=_0x3f38f4;return this[_0x40989e(0x131)][_0x40989e(0x130)](_0x17aa81);}[_0x3f38f4(0x105)](_0xb2a0d3){const _0x13c7ae=_0x3f38f4;return this['strategy'][_0x13c7ae(0x105)](_0xb2a0d3);}[_0x3f38f4(0x101)](_0x47cc66){return this['strategy']['onTrade'](_0x47cc66);}[_0x3f38f4(0x13b)](_0x1fec33,_0x2b69c5){const _0x6a528a=_0x3f38f4;return this[_0x6a528a(0x131)][_0x6a528a(0x13b)](_0x1fec33,_0x2b69c5);}['initialize'](_0x2aeb31,_0x5e8a23,_0x1364cb){return this['strategy']['initialize'](_0x2aeb31,_0x5e8a23,_0x1364cb);}[_0x3f38f4(0x109)](_0x2e5e45,_0x52fb80){return this['strategy']['getAnalysisState'](_0x2e5e45,_0x52fb80);}[_0x3f38f4(0x12d)](_0x40c722){const _0x537a0c=_0x3f38f4;return this[_0x537a0c(0x131)]['recordTradeResult'](_0x40c722);}['reset'](_0x5d82c7){const _0x32c500=_0x3f38f4;return this[_0x32c500(0x131)][_0x32c500(0x148)](_0x5d82c7);}[_0x3f38f4(0x110)](){return this['strategy']['getStats']();}[_0x3f38f4(0x11b)](_0x20cecd){return this['strategy']['getBarHistory'](_0x20cecd);}[_0x3f38f4(0xf8)](_0x5c9f6d){return this['strategy']['getModelValues'](_0x5c9f6d);}[_0x3f38f4(0x107)](_0x3f5e7c){const _0x167e98=_0x3f38f4;return this[_0x167e98(0x131)]['shouldExitByZScore'](_0x3f5e7c);}['generateSignal'](_0x139b38){return null;}}module['exports']={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
1
+ const _0x1746f9=_0x67cf;(function(_0x3d2fd7,_0x154471){const _0x25dbb9=_0x67cf,_0x17daf6=_0x3d2fd7();while(!![]){try{const _0x3ecd46=parseInt(_0x25dbb9(0x1b9))/0x1*(-parseInt(_0x25dbb9(0x192))/0x2)+parseInt(_0x25dbb9(0x1e0))/0x3+parseInt(_0x25dbb9(0x1b0))/0x4*(parseInt(_0x25dbb9(0x18e))/0x5)+-parseInt(_0x25dbb9(0x19d))/0x6+parseInt(_0x25dbb9(0x1be))/0x7+-parseInt(_0x25dbb9(0x191))/0x8+-parseInt(_0x25dbb9(0x1ed))/0x9*(parseInt(_0x25dbb9(0x1a1))/0xa);if(_0x3ecd46===_0x154471)break;else _0x17daf6['push'](_0x17daf6['shift']());}catch(_0x28cf95){_0x17daf6['push'](_0x17daf6['shift']());}}}(_0x36db,0xe7252));function _0x36db(){const _0x5b2c86=['trades','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','zscoreExitThreshold','info','toFixed','_computeZScore','slice','5893218ncQZzu','zscoreThreshold','recordTradeResult','generateSignal','emit','vpinWindow','breakevenTicks','profitLockPct','size','_applyKalmanFilter','split','low','length','BID','short','25OZDKzR','_calculateATR','volumeBuffer','2443744qfUzyb','1018738PNRkSH','\x20|\x20Z:','normal','kalmanStates','/50\x20bars','winStreak','close','pow','_computeVPIN','baseTargetTicks',',\x20VPIN=','1653240cioaZy','\x20@\x20','_computeOrderFlowImbalance','set','10CcprOf',':\x20tick=','shift','uuid','processTick','log','kalmanMeasurementNoise','max','min','tickValue','barHistory','baseStopTicks','volume','_computeKyleLambda','volatility','1474392uPFCED','errorCovariance','side','buy','pnl','exports','processBar','ofi','now','2jBdAge','config','atrHistory','getBarHistory','%,\x20OFI=','8413090OfENgV','round','stats','tickSize','vpin','HQX_ULTRA_SCALPING_6MODELS','LOSS','ASK','high','\x20|\x20Conf:','minConfidence','stopMultiplier','lossStreak','onTick','signal','WIN','get','%\x20Kyle:','open','reset','push','kalman','weights','targetMultiplier','estimate','priceBuffer','ofiLookback','recentTrades','reduce','lastSignalTime','long','abs','toUpperCase','initialize','469374upPcCM','strategy','timestamp','symbol','getAnalysisState','contractId'];_0x36db=function(){return _0x5b2c86;};return _0x36db();}const EventEmitter=require('events'),{v4:uuidv4}=require(_0x1746f9(0x1a4)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0x67cf(_0xb85477,_0x2bd4ab){_0xb85477=_0xb85477-0x18e;const _0x36db92=_0x36db();let _0x67cfa1=_0x36db92[_0xb85477];return _0x67cfa1;}class HQXUltraScalping extends EventEmitter{constructor(_0x5a43ad={}){const _0x258b23=_0x1746f9;super(),this[_0x258b23(0x1c1)]=_0x5a43ad['tickSize']||0.25,this['tickValue']=_0x5a43ad[_0x258b23(0x1aa)]||0x5,this['zscoreEntryThreshold']=1.5,this[_0x258b23(0x1e8)]=0.5,this['vpinWindow']=0x32,this['vpinToxicThreshold']=0.7,this['kalmanProcessNoise']=0.01,this[_0x258b23(0x1a7)]=0.1,this['volatilityLookback']=0x64,this[_0x258b23(0x1d8)]=0x14,this[_0x258b23(0x1ac)]=0x8,this[_0x258b23(0x19b)]=0x10,this['breakevenTicks']=0x4,this['profitLockPct']=0.5,this[_0x258b23(0x1c8)]=0.55,this[_0x258b23(0x1d4)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this['barHistory']=new Map(),this[_0x258b23(0x1d7)]=new Map(),this['volumeBuffer']=new Map(),this['kalmanStates']=new Map(),this[_0x258b23(0x1bb)]=new Map(),this['recentTrades']=[],this['winStreak']=0x0,this[_0x258b23(0x1ca)]=0x0,this['lastSignalTime']=0x0,this['cooldownMs']=0x7530,this['minHoldTimeMs']=0x2710,this[_0x258b23(0x1c0)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x1746f9(0x1df)](_0x2b546b,_0x5e5fd0=0.25,_0x65b5b3=0x5){const _0x2e3fff=_0x1746f9;this[_0x2e3fff(0x1c1)]=_0x5e5fd0,this[_0x2e3fff(0x1aa)]=_0x65b5b3,this['barHistory']['set'](_0x2b546b,[]),this['priceBuffer'][_0x2e3fff(0x1a0)](_0x2b546b,[]),this[_0x2e3fff(0x190)][_0x2e3fff(0x1a0)](_0x2b546b,[]),this[_0x2e3fff(0x1bb)]['set'](_0x2b546b,[]),this[_0x2e3fff(0x195)][_0x2e3fff(0x1a0)](_0x2b546b,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x2b546b+_0x2e3fff(0x1a2)+_0x5e5fd0+',\x20value='+_0x65b5b3}),this['emit'](_0x2e3fff(0x1a6),{'type':'info','message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}['processTick'](_0x448e59){const _0x429bba=_0x1746f9,{contractId:_0x4215b2,price:_0x15b794,volume:_0x9b4f4a,side:_0x395d45,timestamp:_0x4f9c45}=_0x448e59,_0x3f02ad={'timestamp':_0x4f9c45||Date[_0x429bba(0x1b8)](),'open':_0x15b794,'high':_0x15b794,'low':_0x15b794,'close':_0x15b794,'volume':_0x9b4f4a||0x1};return this['processBar'](_0x4215b2,_0x3f02ad);}['onTick'](_0x32092f){const _0x3092f9=_0x1746f9;return this[_0x3092f9(0x1a5)](_0x32092f);}['onTrade'](_0x42cbc9){const _0x368754=_0x1746f9;return this['processTick']({'contractId':_0x42cbc9[_0x368754(0x1e5)]||_0x42cbc9[_0x368754(0x1e3)],'price':_0x42cbc9['price'],'volume':_0x42cbc9[_0x368754(0x1f5)]||_0x42cbc9['volume']||0x1,'side':_0x42cbc9[_0x368754(0x1b2)],'timestamp':_0x42cbc9[_0x368754(0x1e2)]||Date['now']()});}[_0x1746f9(0x1b6)](_0x100e21,_0x77e2f7){const _0x33a552=_0x1746f9;let _0xed9fba=this['barHistory']['get'](_0x100e21);!_0xed9fba&&(this['initialize'](_0x100e21),_0xed9fba=this['barHistory'][_0x33a552(0x1ce)](_0x100e21));_0xed9fba[_0x33a552(0x1d2)](_0x77e2f7);if(_0xed9fba['length']>0x1f4)_0xed9fba[_0x33a552(0x1a3)]();const _0x21bc76=this[_0x33a552(0x1d7)][_0x33a552(0x1ce)](_0x100e21);_0x21bc76[_0x33a552(0x1d2)](_0x77e2f7['close']);if(_0x21bc76['length']>0xc8)_0x21bc76[_0x33a552(0x1a3)]();const _0x537280=this[_0x33a552(0x190)][_0x33a552(0x1ce)](_0x100e21),_0x3fc573=_0x77e2f7['high']-_0x77e2f7['low'];let _0x322235=_0x77e2f7['volume']*0.5,_0x42a157=_0x77e2f7['volume']*0.5;if(_0x3fc573>0x0){const _0x53dc8f=(_0x77e2f7[_0x33a552(0x198)]-_0x77e2f7['low'])/_0x3fc573;_0x322235=_0x77e2f7['volume']*_0x53dc8f,_0x42a157=_0x77e2f7[_0x33a552(0x1ad)]*(0x1-_0x53dc8f);}_0x537280[_0x33a552(0x1d2)]({'buy':_0x322235,'sell':_0x42a157});if(_0x537280[_0x33a552(0x1f9)]>0x64)_0x537280['shift']();if(_0xed9fba['length']<0x32)return null;const _0x190dba=this[_0x33a552(0x1eb)](_0x21bc76),_0x26aa2f=this['_computeVPIN'](_0x537280),_0x45b15a=this[_0x33a552(0x1ae)](_0xed9fba),_0xbca683=this[_0x33a552(0x1f6)](_0x100e21,_0x77e2f7[_0x33a552(0x198)]),{regime:_0x309920,params:_0x56501b}=this['_detectVolatilityRegime'](_0x100e21,_0xed9fba),_0x1c97e4=this['_computeOrderFlowImbalance'](_0xed9fba);return this['_generateSignal'](_0x100e21,_0x77e2f7['close'],_0x190dba,_0x26aa2f,_0x45b15a,_0xbca683,_0x309920,_0x56501b,_0x1c97e4,_0xed9fba);}[_0x1746f9(0x1eb)](_0x3fa3ee,_0x48ee30=0x32){const _0x17d5ec=_0x1746f9;if(_0x3fa3ee['length']<_0x48ee30)return 0x0;const _0x1d457c=_0x3fa3ee['slice'](-_0x48ee30),_0x26aab8=_0x1d457c['reduce']((_0x138d6b,_0x2050a6)=>_0x138d6b+_0x2050a6,0x0)/_0x48ee30,_0x36e196=_0x1d457c[_0x17d5ec(0x1da)]((_0xe3681d,_0x3383c6)=>_0xe3681d+Math['pow'](_0x3383c6-_0x26aab8,0x2),0x0)/_0x48ee30,_0xd496a6=Math['sqrt'](_0x36e196);if(_0xd496a6<0.0001)return 0x0;const _0x2ac490=_0x3fa3ee[_0x3fa3ee[_0x17d5ec(0x1f9)]-0x1];return(_0x2ac490-_0x26aab8)/_0xd496a6;}['_computeVPIN'](_0x5c82d6){const _0x1070f4=_0x1746f9;if(_0x5c82d6['length']<this['vpinWindow'])return 0.5;const _0x2fb113=_0x5c82d6['slice'](-this[_0x1070f4(0x1f2)]);let _0x4bef7c=0x0,_0x1a10bd=0x0;for(const _0x3443d7 of _0x2fb113){_0x4bef7c+=_0x3443d7['buy'],_0x1a10bd+=_0x3443d7['sell'];}const _0x42b0e8=_0x4bef7c+_0x1a10bd;if(_0x42b0e8<0x1)return 0.5;return Math[_0x1070f4(0x1dd)](_0x4bef7c-_0x1a10bd)/_0x42b0e8;}[_0x1746f9(0x1ae)](_0x5806b8){const _0x2fa6fd=_0x1746f9;if(_0x5806b8[_0x2fa6fd(0x1f9)]<0x14)return 0x0;const _0x2fa503=_0x5806b8[_0x2fa6fd(0x1ec)](-0x14),_0x5c27c5=[],_0x464fcd=[];for(let _0x48ad11=0x1;_0x48ad11<_0x2fa503['length'];_0x48ad11++){_0x5c27c5['push'](_0x2fa503[_0x48ad11][_0x2fa6fd(0x198)]-_0x2fa503[_0x48ad11-0x1][_0x2fa6fd(0x198)]),_0x464fcd['push'](_0x2fa503[_0x48ad11][_0x2fa6fd(0x1ad)]);}const _0x52bb5c=_0x5c27c5[_0x2fa6fd(0x1da)]((_0x1760a4,_0xf2b971)=>_0x1760a4+_0xf2b971,0x0)/_0x5c27c5['length'],_0x3d4396=_0x464fcd['reduce']((_0x350f2b,_0x4a3fa2)=>_0x350f2b+_0x4a3fa2,0x0)/_0x464fcd[_0x2fa6fd(0x1f9)];let _0x29ede4=0x0,_0x173362=0x0;for(let _0x458871=0x0;_0x458871<_0x5c27c5[_0x2fa6fd(0x1f9)];_0x458871++){_0x29ede4+=(_0x5c27c5[_0x458871]-_0x52bb5c)*(_0x464fcd[_0x458871]-_0x3d4396),_0x173362+=Math[_0x2fa6fd(0x199)](_0x464fcd[_0x458871]-_0x3d4396,0x2);}_0x29ede4/=_0x5c27c5['length'],_0x173362/=_0x5c27c5['length'];if(_0x173362<0.0001)return 0x0;return Math['abs'](_0x29ede4/_0x173362);}[_0x1746f9(0x1f6)](_0x3520b3,_0x1f7107){const _0x4f81bc=_0x1746f9;let _0x441306=this[_0x4f81bc(0x195)]['get'](_0x3520b3);if(!_0x441306)return _0x441306={'estimate':_0x1f7107,'errorCovariance':0x1},this[_0x4f81bc(0x195)]['set'](_0x3520b3,_0x441306),_0x1f7107;const _0x2404ec=_0x441306['estimate'],_0x2bb5c9=_0x441306[_0x4f81bc(0x1b1)]+this['kalmanProcessNoise'],_0x1f7a65=_0x2bb5c9/(_0x2bb5c9+this['kalmanMeasurementNoise']),_0xc20102=_0x2404ec+_0x1f7a65*(_0x1f7107-_0x2404ec),_0x12c715=(0x1-_0x1f7a65)*_0x2bb5c9;return _0x441306[_0x4f81bc(0x1d6)]=_0xc20102,_0x441306['errorCovariance']=_0x12c715,_0xc20102;}['_detectVolatilityRegime'](_0x2f8a88,_0x4ac355){const _0xbc41f3=_0x1746f9,_0x339988=this[_0xbc41f3(0x18f)](_0x4ac355),_0x5f24be=_0x339988/this[_0xbc41f3(0x1c1)];let _0x279952=this[_0xbc41f3(0x1bb)][_0xbc41f3(0x1ce)](_0x2f8a88);!_0x279952&&(_0x279952=[],this[_0xbc41f3(0x1bb)]['set'](_0x2f8a88,_0x279952));_0x279952['push'](_0x339988);if(_0x279952['length']>0x1f4)_0x279952['shift']();let _0x524aa7=0.5;_0x279952['length']>=0x14&&(_0x524aa7=_0x279952['filter'](_0x474dda=>_0x474dda<=_0x339988)[_0xbc41f3(0x1f9)]/_0x279952[_0xbc41f3(0x1f9)]);let _0x1b333b,_0x5c07e8;if(_0x524aa7<0.25)_0x1b333b=_0xbc41f3(0x1f8),_0x5c07e8={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x524aa7<0.75?(_0x1b333b='normal',_0x5c07e8={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x1b333b='high',_0x5c07e8={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x1b333b,'params':_0x5c07e8};}[_0x1746f9(0x18f)](_0x4d91e8,_0x4c7029=0xe){const _0x8a4551=_0x1746f9;if(_0x4d91e8[_0x8a4551(0x1f9)]<_0x4c7029+0x1)return 2.5;const _0x19725f=[];for(let _0x10b591=_0x4d91e8['length']-_0x4c7029;_0x10b591<_0x4d91e8[_0x8a4551(0x1f9)];_0x10b591++){const _0x1ed810=_0x4d91e8[_0x10b591],_0x1b4fa9=_0x4d91e8[_0x10b591-0x1][_0x8a4551(0x198)],_0x4d5246=Math[_0x8a4551(0x1a8)](_0x1ed810['high']-_0x1ed810['low'],Math['abs'](_0x1ed810[_0x8a4551(0x1c6)]-_0x1b4fa9),Math['abs'](_0x1ed810['low']-_0x1b4fa9));_0x19725f['push'](_0x4d5246);}return _0x19725f['reduce']((_0x5a31af,_0x24e199)=>_0x5a31af+_0x24e199,0x0)/_0x19725f['length'];}[_0x1746f9(0x19f)](_0xecd442){const _0x4cc928=_0x1746f9;if(_0xecd442['length']<this['ofiLookback'])return 0x0;const _0x338ca2=_0xecd442['slice'](-this[_0x4cc928(0x1d8)]);let _0x31544c=0x0,_0x3a324d=0x0;for(const _0x25422f of _0x338ca2){const _0x20f7d6=_0x25422f['high']-_0x25422f[_0x4cc928(0x1f8)];if(_0x20f7d6>0x0){const _0x242e63=(_0x25422f[_0x4cc928(0x198)]-_0x25422f['low'])/_0x20f7d6;_0x31544c+=_0x242e63*_0x25422f['volume'],_0x3a324d+=(0x1-_0x242e63)*_0x25422f['volume'];}}const _0x53a73b=_0x31544c+_0x3a324d;if(_0x53a73b<0x1)return 0x0;return(_0x31544c-_0x3a324d)/_0x53a73b;}['_generateSignal'](_0x520adb,_0x335e18,_0x3f79c6,_0x469f2b,_0x590dc4,_0x22d515,_0x1ea5ce,_0x58b603,_0x48c458,_0x35cb52){const _0x234464=_0x1746f9,_0x42c7eb=Math['abs'](_0x3f79c6);if(_0x42c7eb<_0x58b603['zscoreThreshold'])return null;if(_0x469f2b>this['vpinToxicThreshold'])return null;let _0x2b818f;if(_0x3f79c6<-_0x58b603[_0x234464(0x1ee)])_0x2b818f=_0x234464(0x1dc);else{if(_0x3f79c6>_0x58b603['zscoreThreshold'])_0x2b818f=_0x234464(0x1fb);else return null;}const _0x46de4e=_0x2b818f===_0x234464(0x1dc)&&_0x48c458>0.1||_0x2b818f===_0x234464(0x1fb)&&_0x48c458<-0.1,_0xb7c0e=_0x335e18-_0x22d515,_0x32fefd=_0x2b818f===_0x234464(0x1dc)&&_0xb7c0e<0x0||_0x2b818f===_0x234464(0x1fb)&&_0xb7c0e>0x0,_0x47a9bb={'zscore':Math[_0x234464(0x1a9)](0x1,_0x42c7eb/0x4),'vpin':0x1-_0x469f2b,'kyleLambda':_0x590dc4>0.001?0.5:0.8,'kalman':_0x32fefd?0.8:0.4,'volatility':_0x1ea5ce===_0x234464(0x194)?0.8:_0x1ea5ce==='low'?0.7:0.6,'ofi':_0x46de4e?0.9:0.5,'composite':0x0};_0x47a9bb['composite']=_0x47a9bb['zscore']*this[_0x234464(0x1d4)]['zscore']+_0x47a9bb[_0x234464(0x1c2)]*this['weights']['vpin']+_0x47a9bb['kyleLambda']*this[_0x234464(0x1d4)]['kyleLambda']+_0x47a9bb['kalman']*this[_0x234464(0x1d4)][_0x234464(0x1d3)]+_0x47a9bb['volatility']*this['weights'][_0x234464(0x1af)]+_0x47a9bb['ofi']*this['weights'][_0x234464(0x1b7)];const _0x3fadc8=Math['min'](0x1,_0x47a9bb['composite']+_0x58b603['confidenceBonus']);if(_0x3fadc8<this['minConfidence'])return null;if(Date[_0x234464(0x1b8)]()-this['lastSignalTime']<this['cooldownMs'])return null;const _0x1274b=Math['round'](this['baseStopTicks']*_0x58b603[_0x234464(0x1c9)]),_0x19e244=Math[_0x234464(0x1bf)](this[_0x234464(0x19b)]*_0x58b603[_0x234464(0x1d5)]),_0x498c63=Math['max'](0x6,Math[_0x234464(0x1a9)](0xc,_0x1274b)),_0x248400=Math[_0x234464(0x1a8)](_0x498c63*1.5,Math['min'](0x18,_0x19e244));let _0x810d1b,_0xd2df88,_0x905f77,_0x3b7432;_0x2b818f===_0x234464(0x1dc)?(_0x810d1b=_0x335e18-_0x498c63*this['tickSize'],_0xd2df88=_0x335e18+_0x248400*this['tickSize'],_0x905f77=_0x335e18+this[_0x234464(0x1f3)]*this['tickSize'],_0x3b7432=_0x335e18+_0x248400*this['profitLockPct']*this[_0x234464(0x1c1)]):(_0x810d1b=_0x335e18+_0x498c63*this['tickSize'],_0xd2df88=_0x335e18-_0x248400*this['tickSize'],_0x905f77=_0x335e18-this[_0x234464(0x1f3)]*this['tickSize'],_0x3b7432=_0x335e18-_0x248400*this[_0x234464(0x1f4)]*this['tickSize']);const _0x3c2a2f=_0x248400/_0x498c63,_0x3678eb=Math['round'](_0x248400*0.5),_0x36cd4d=Math[_0x234464(0x1bf)](_0x498c63*0.4);let _0x458abf=SignalStrength['MODERATE'];if(_0x3fadc8>=0.85)_0x458abf=SignalStrength['VERY_STRONG'];else{if(_0x3fadc8>=0.75)_0x458abf=SignalStrength['STRONG'];else{if(_0x3fadc8<0.6)_0x458abf=SignalStrength['WEAK'];}}const _0x31fdb7=0.5+(_0x3fadc8-0.5)*0.4,_0x4dbc1d=_0x31fdb7*Math[_0x234464(0x1dd)](_0xd2df88-_0x335e18)-(0x1-_0x31fdb7)*Math[_0x234464(0x1dd)](_0x335e18-_0x810d1b);this[_0x234464(0x1db)]=Date['now'](),this['stats']['signals']++;const _0xd35aa3={'id':uuidv4(),'timestamp':Date[_0x234464(0x1b8)](),'symbol':_0x520adb[_0x234464(0x1f7)]('.')[0x0]||_0x520adb,'contractId':_0x520adb,'side':_0x2b818f===_0x234464(0x1dc)?OrderSide[_0x234464(0x1fa)]:OrderSide[_0x234464(0x1c5)],'direction':_0x2b818f,'strategy':_0x234464(0x1c3),'strength':_0x458abf,'edge':_0x4dbc1d,'confidence':_0x3fadc8,'entry':_0x335e18,'entryPrice':_0x335e18,'stopLoss':_0x810d1b,'takeProfit':_0xd2df88,'riskReward':_0x3c2a2f,'stopTicks':_0x498c63,'targetTicks':_0x248400,'trailTriggerTicks':_0x3678eb,'trailDistanceTicks':_0x36cd4d,'beBreakeven':_0x905f77,'profitLockLevel':_0x3b7432,'zScore':_0x3f79c6,'zScoreExit':this['zscoreExitThreshold'],'vpinValue':_0x469f2b,'kyleLambda':_0x590dc4,'kalmanEstimate':_0x22d515,'volatilityRegime':_0x1ea5ce,'ofiValue':_0x48c458,'models':_0x47a9bb,'orderFlowConfirmed':_0x46de4e,'kalmanConfirmed':_0x32fefd,'expires':Date['now']()+0xea60};return this['emit'](_0x234464(0x1cc),{'side':_0x2b818f==='long'?_0x234464(0x1b3):'sell','action':_0x234464(0x1d0),'reason':'Z='+_0x3f79c6['toFixed'](0x2)+_0x234464(0x19c)+(_0x469f2b*0x64)[_0x234464(0x1ea)](0x0)+_0x234464(0x1bd)+(_0x48c458*0x64)['toFixed'](0x0)+'%,\x20cf='+(_0x3fadc8*0x64)['toFixed'](0x0)+'%',..._0xd35aa3}),this['emit']('log',{'type':_0x234464(0x1e9),'message':'[HQX]\x20SIGNAL:\x20'+_0x2b818f[_0x234464(0x1de)]()+_0x234464(0x19e)+_0x335e18['toFixed'](0x2)+_0x234464(0x193)+_0x3f79c6['toFixed'](0x2)+'\x20VPIN:'+(_0x469f2b*0x64)[_0x234464(0x1ea)](0x0)+'%\x20OFI:'+(_0x48c458*0x64)[_0x234464(0x1ea)](0x0)+_0x234464(0x1cf)+_0x590dc4[_0x234464(0x1ea)](0x5)+'\x20Regime:'+_0x1ea5ce+_0x234464(0x1c7)+(_0x3fadc8*0x64)[_0x234464(0x1ea)](0x0)+'%'}),_0xd35aa3;}['shouldExitByZScore'](_0x29427c){const _0x2e24f5=_0x1746f9,_0x1954c8=this[_0x2e24f5(0x1d7)]['get'](_0x29427c);if(!_0x1954c8||_0x1954c8['length']<0x32)return![];const _0xfe7f7d=this[_0x2e24f5(0x1eb)](_0x1954c8);return Math['abs'](_0xfe7f7d)<this[_0x2e24f5(0x1e8)];}['getModelValues'](_0x32e4ba){const _0x804109=_0x1746f9,_0x4e24c7=this['priceBuffer']['get'](_0x32e4ba),_0x46623b=this[_0x804109(0x190)]['get'](_0x32e4ba),_0x492ce1=this[_0x804109(0x1ab)][_0x804109(0x1ce)](_0x32e4ba);if(!_0x4e24c7||!_0x46623b||!_0x492ce1||_0x492ce1['length']<0x32)return null;const _0x2fc56e=this['_computeZScore'](_0x4e24c7),_0xeda654=this[_0x804109(0x19a)](_0x46623b),_0x49b3e5=this['_computeKyleLambda'](_0x492ce1),_0x36f353=this[_0x804109(0x19f)](_0x492ce1);return{'zscore':Math[_0x804109(0x1a9)](0x1,Math[_0x804109(0x1dd)](_0x2fc56e)/0x4),'vpin':0x1-_0xeda654,'kyleLambda':_0x49b3e5>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x804109(0x1dd)](_0x36f353)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x2fc56e,'vpin':_0xeda654,'kyleLambda':_0x49b3e5,'ofi':_0x36f353}};}[_0x1746f9(0x1e4)](_0x3ad9bf,_0x5ac53e){const _0x187fa3=_0x1746f9,_0x25bc3b=this[_0x187fa3(0x1ab)]['get'](_0x3ad9bf)||[];if(_0x25bc3b[_0x187fa3(0x1f9)]<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x25bc3b[_0x187fa3(0x1f9)]+_0x187fa3(0x196)};const _0x6917d0=this['priceBuffer'][_0x187fa3(0x1ce)](_0x3ad9bf)||[],_0x5a9bd0=this[_0x187fa3(0x190)][_0x187fa3(0x1ce)](_0x3ad9bf)||[],_0x3a5335=this['_computeZScore'](_0x6917d0),_0x486926=this[_0x187fa3(0x19a)](_0x5a9bd0),_0x1ec2f1=this[_0x187fa3(0x19f)](_0x25bc3b),_0x1e61b5=this[_0x187fa3(0x1ae)](_0x25bc3b),{regime:_0x557940,params:_0x377daa}=this['_detectVolatilityRegime'](_0x3ad9bf,_0x25bc3b);return{'ready':!![],'zScore':_0x3a5335,'vpin':_0x486926,'ofi':_0x1ec2f1,'kyleLambda':_0x1e61b5,'regime':_0x557940,'stopTicks':Math[_0x187fa3(0x1bf)](this[_0x187fa3(0x1ac)]*_0x377daa['stopMultiplier']),'targetTicks':Math[_0x187fa3(0x1bf)](this['baseTargetTicks']*_0x377daa['targetMultiplier']),'threshold':_0x377daa['zscoreThreshold'],'barsProcessed':_0x25bc3b[_0x187fa3(0x1f9)],'models':_0x187fa3(0x1e7)};}['recordTradeResult'](_0x2744c7){const _0x573aef=_0x1746f9;this['recentTrades'][_0x573aef(0x1d2)]({'netPnl':_0x2744c7,'timestamp':Date['now']()});if(this[_0x573aef(0x1d9)][_0x573aef(0x1f9)]>0x64)this[_0x573aef(0x1d9)]['shift']();_0x2744c7>0x0?(this[_0x573aef(0x197)]++,this['lossStreak']=0x0,this['stats']['wins']++):(this['lossStreak']++,this[_0x573aef(0x197)]=0x0,this['stats']['losses']++),this[_0x573aef(0x1c0)][_0x573aef(0x1e6)]++,this[_0x573aef(0x1c0)][_0x573aef(0x1b4)]+=_0x2744c7,this[_0x573aef(0x1f1)](_0x573aef(0x1a6),{'type':'debug','message':'[HQX]\x20Trade\x20result:\x20'+(_0x2744c7>0x0?_0x573aef(0x1cd):_0x573aef(0x1c4))+'\x20$'+_0x2744c7[_0x573aef(0x1ea)](0x2)+',\x20streak:\x20'+(_0x2744c7>0x0?this['winStreak']:-this['lossStreak'])});}[_0x1746f9(0x1bc)](_0x4928ce){const _0xfdb719=_0x1746f9;return this[_0xfdb719(0x1ab)]['get'](_0x4928ce)||[];}['getStats'](){return this['stats'];}['reset'](_0x22ee62){const _0x5a6b14=_0x1746f9;this['barHistory'][_0x5a6b14(0x1a0)](_0x22ee62,[]),this['priceBuffer'][_0x5a6b14(0x1a0)](_0x22ee62,[]),this['volumeBuffer'][_0x5a6b14(0x1a0)](_0x22ee62,[]),this[_0x5a6b14(0x1bb)]['set'](_0x22ee62,[]),this[_0x5a6b14(0x195)][_0x5a6b14(0x1a0)](_0x22ee62,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x22ee62});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x1a6888={}){const _0x17f7d5=_0x1746f9;super(),this[_0x17f7d5(0x1ba)]=_0x1a6888,this['strategy']=new HQXUltraScalping(_0x1a6888),this[_0x17f7d5(0x1e1)]['on']('signal',_0xde3f73=>this['emit']('signal',_0xde3f73)),this[_0x17f7d5(0x1e1)]['on']('log',_0x428e4f=>this[_0x17f7d5(0x1f1)](_0x17f7d5(0x1a6),_0x428e4f));}[_0x1746f9(0x1a5)](_0x56e7f0){const _0x344bc2=_0x1746f9;return this[_0x344bc2(0x1e1)][_0x344bc2(0x1a5)](_0x56e7f0);}[_0x1746f9(0x1cb)](_0x367642){return this['strategy']['onTick'](_0x367642);}['onTrade'](_0xaf0fd7){return this['strategy']['onTrade'](_0xaf0fd7);}[_0x1746f9(0x1b6)](_0x57daa5,_0x421f13){return this['strategy']['processBar'](_0x57daa5,_0x421f13);}['initialize'](_0x9f4b2d,_0x4b3240,_0x5e4246){const _0x1c46f3=_0x1746f9;return this[_0x1c46f3(0x1e1)]['initialize'](_0x9f4b2d,_0x4b3240,_0x5e4246);}[_0x1746f9(0x1e4)](_0x8c3608,_0x48c423){const _0x31b05a=_0x1746f9;return this[_0x31b05a(0x1e1)]['getAnalysisState'](_0x8c3608,_0x48c423);}[_0x1746f9(0x1ef)](_0x772829){const _0xca4138=_0x1746f9;return this['strategy'][_0xca4138(0x1ef)](_0x772829);}['reset'](_0x4b9f24){const _0x53f6b2=_0x1746f9;return this[_0x53f6b2(0x1e1)][_0x53f6b2(0x1d1)](_0x4b9f24);}['getStats'](){return this['strategy']['getStats']();}['getBarHistory'](_0x51fefb){const _0x2e3ee4=_0x1746f9;return this['strategy'][_0x2e3ee4(0x1bc)](_0x51fefb);}['getModelValues'](_0x3b8e36){return this['strategy']['getModelValues'](_0x3b8e36);}['shouldExitByZScore'](_0x5224c3){return this['strategy']['shouldExitByZScore'](_0x5224c3);}[_0x1746f9(0x1f0)](_0x5c5181){return null;}}module[_0x1746f9(0x1b5)]={'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.131",
3
+ "version": "2.9.133",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -395,11 +395,22 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
395
395
  await marketFeed.connect(rithmicCredentials);
396
396
  await marketFeed.subscribe(symbolCode, contract.exchange || 'CME');
397
397
 
398
- // HQX-2B strategy warmup message
399
- // Note: HISTORY_PLANT returns limited ticks (10k max = ~1 second of data)
400
- // which is not enough for 1-min bar aggregation. Strategy warms up with live data.
401
- if (strategyId === 'hqx-2b') {
402
- ui.addLog('system', 'HQX-2B warming up - needs ~3 min for first signals...');
398
+ // Load historical bars for instant warmup
399
+ if (strategy.preloadBars) {
400
+ ui.addLog('system', 'Loading historical data...');
401
+ try {
402
+ const histBars = await marketFeed.getHistoricalBars(symbolCode, contract.exchange || 'CME', 30);
403
+ if (histBars && histBars.length > 0) {
404
+ strategy.preloadBars(contractId, histBars);
405
+ ui.addLog('system', `Loaded ${histBars.length} historical bars - ready to trade!`);
406
+ sessionLogger.log('HISTORY', `Preloaded ${histBars.length} bars`);
407
+ } else {
408
+ ui.addLog('system', 'No history available - warming up with live data...');
409
+ }
410
+ } catch (histErr) {
411
+ ui.addLog('system', `History load failed: ${histErr.message} - using live data`);
412
+ sessionLogger.log('HISTORY', `Failed: ${histErr.message}`);
413
+ }
403
414
  }
404
415
  } catch (e) {
405
416
  ui.addLog('error', `Failed to connect: ${e.message}`);