hedgequantx 2.9.109 → 2.9.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/m/hqx-2b.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x6bd883=_0x1b28;(function(_0x7ab99b,_0x14856f){const _0x1c406c=_0x1b28,_0x3f9313=_0x7ab99b();while(!![]){try{const _0x2c5226=parseInt(_0x1c406c(0x13c))/0x1*(parseInt(_0x1c406c(0x17b))/0x2)+-parseInt(_0x1c406c(0x13a))/0x3+parseInt(_0x1c406c(0x187))/0x4*(parseInt(_0x1c406c(0x1ba))/0x5)+-parseInt(_0x1c406c(0x19a))/0x6*(-parseInt(_0x1c406c(0x194))/0x7)+-parseInt(_0x1c406c(0x177))/0x8*(parseInt(_0x1c406c(0x190))/0x9)+parseInt(_0x1c406c(0x17f))/0xa+parseInt(_0x1c406c(0x18a))/0xb*(-parseInt(_0x1c406c(0x148))/0xc);if(_0x2c5226===_0x14856f)break;else _0x3f9313['push'](_0x3f9313['shift']());}catch(_0x56d6e8){_0x3f9313['push'](_0x3f9313['shift']());}}}(_0x2269,0xdf148));const EventEmitter=require('events'),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':_0x6bd883(0x18f),'LOW_SWEEP':_0x6bd883(0x145)},ZoneType={'RESISTANCE':_0x6bd883(0x16c),'SUPPORT':_0x6bd883(0x142)},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.25,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.1,'minVolumeRatio':0.3,'minBodyRatio':0.05},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x1388,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x6bd883(0x186)}};function _0x2269(){const _0x1517a6=['minPenetrationTicks','t\x20Vol:','tickSize','get','touches','getUTCMinutes','\x20historical\x20bars...','barHistory','trailTriggerTicks','sweptAt','max','getUTCHours','targetTicks',',\x20value=','\x20|\x20Pen:','_generateSignal','swing','isValid','barIntervalMs','close','minQualityScore','price','VERY_STRONG','extremePrice','activeSweeps','tickValue','strength','zone','x\x20|\x20Q:','t\x20|\x20Q:\x20','volume','_getVolumeRatio','resistance','floor','volumeRatio','cooldownBars','recentTrades','long','push','execution','strategy','clusterToleranceTicks','stats','536WPOSjN','durationBars','maxZoneDistanceTicks','BID','184010qmMxrA','priceHigh','sweepType','STRONG','18143490UrkTOU','slice','getStats','\x20|\x20Pen:\x20','length','sort','trades','America/New_York','8ZWkURE','isWithinSession','lastUsedBarIndex','517IilhXr','[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20(','minVolumeRatio','symbol','\x20|\x20Total:\x20','high','232731zqVsQH','_mergeConfig','onTrade','[2B]\x20NEW\x20SWING\x20','1589emaoEJ','isArray','getBarHistory','min','exitBarIndex','RESISTANCE','32310kNcZxf','processBar','ASK','distance','barIndex','minBodyRatio','swept','type','trailDistanceTicks','stopTicks','\x20swings,\x20','maxZoneAgeBars','timestamp','breakevenTicks','penetrationTicks','lastSignalTime','getLevel','info','_scoreSweep','_updateZones','[HQX-2B]\x20Preloading\x20','swingPoints','HIGH_SWEEP','filter','config','open','abs','\x20@\x20','debug','HQX_2B_LIQUIDITY_SWEEP','delete','/5\x20bars','1391290eqaspJ','initialize','shift','signal','t\x20|\x20Vol:','LOSS','containsPrice','map','[HQX-2B]\x20Reset\x20state\x20for\x20','qualityScore','[2B]\x20SWEEP\x20','priceLow','getAnalysisState','cooldownMs','session','currentBar','_detectSwings','log','extremeBarIndex','onTick','toUpperCase','startTime','4196232xpAIuV','emit','13xnISXy','set','signals','liquidityZones','toFixed','processTick','support','now','isDST','low','object','pnl','190032TqnNRB','recordTradeResult','LOW_SWEEP','getTimezoneOffset'];_0x2269=function(){return _0x1517a6;};return _0x2269();}function _0x1b28(_0x19b825,_0x3e5ece){_0x19b825=_0x19b825-0x128;const _0x22691a=_0x2269();let _0x1b28f3=_0x22691a[_0x19b825];return _0x1b28f3;}class SwingPoint{constructor(_0xd582fe,_0x53f8df,_0x388d79,_0x719249,_0x3fe300=0x1){const _0x57c018=_0x6bd883;this[_0x57c018(0x1a1)]=_0xd582fe,this['price']=_0x53f8df,this[_0x57c018(0x19e)]=_0x388d79,this[_0x57c018(0x1a6)]=_0x719249,this['strength']=_0x3fe300;}}class LiquidityZone{constructor(_0x2094f9,_0x2d3106,_0xbbbadf,_0x19c525,_0x1902bf){const _0x1e7835=_0x6bd883;this['id']=uuidv4(),this['type']=_0x2094f9,this['priceHigh']=_0x2d3106,this['priceLow']=_0xbbbadf,this['createdAt']=_0x19c525,this['barIndex']=_0x1902bf,this[_0x1e7835(0x150)]=0x1,this[_0x1e7835(0x1a0)]=![],this[_0x1e7835(0x155)]=null,this['lastUsedBarIndex']=-0x3e7,this[_0x1e7835(0x12d)]=0.5;}[_0x6bd883(0x12a)](_0x2168fb,_0x2a628a,_0x11c0be){const _0x2154d2=_0x2a628a*_0x11c0be;return _0x2168fb>=this['priceLow']-_0x2154d2&&_0x2168fb<=this['priceHigh']+_0x2154d2;}['getLevel'](){const _0x316529=_0x6bd883;return(this[_0x316529(0x17c)]+this['priceLow'])/0x2;}}class SweepEvent{constructor(_0x2d91ed,_0x3c4faf,_0xe96c46,_0x1a980d,_0x3304e8){const _0x117230=_0x6bd883;this[_0x117230(0x17d)]=_0x2d91ed,this['zone']=_0x3c4faf,this['entryBarIndex']=_0xe96c46,this[_0x117230(0x136)]=_0x1a980d,this[_0x117230(0x163)]=_0x3304e8,this[_0x117230(0x198)]=null,this[_0x117230(0x15d)]=![],this['qualityScore']=0x0,this[_0x117230(0x1a8)]=0x0,this['durationBars']=0x0,this['volumeRatio']=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x28376d={}){const _0xb0deba=_0x6bd883;super(),this['config']=this['_mergeConfig'](DEFAULT_CONFIG,_0x28376d),this['tickSize']=this['config']['tickSize'],this['tickValue']=this[_0xb0deba(0x1b2)][_0xb0deba(0x165)],this[_0xb0deba(0x153)]=new Map(),this['swingPoints']=new Map(),this[_0xb0deba(0x13f)]=new Map(),this[_0xb0deba(0x164)]=new Map(),this['currentBar']=new Map(),this[_0xb0deba(0x15e)]=0xea60,this['lastSignalTime']=0x0,this['startTime']=Date[_0xb0deba(0x143)](),this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0xb0deba(0x170)]=[];}[_0x6bd883(0x191)](_0x127c7c,_0x3f8204){const _0x1fd84a=_0x6bd883,_0x6b4413={..._0x127c7c};for(const _0x47d930 in _0x3f8204){typeof _0x3f8204[_0x47d930]===_0x1fd84a(0x146)&&!Array[_0x1fd84a(0x195)](_0x3f8204[_0x47d930])?_0x6b4413[_0x47d930]={..._0x127c7c[_0x47d930],..._0x3f8204[_0x47d930]}:_0x6b4413[_0x47d930]=_0x3f8204[_0x47d930];}return _0x6b4413;}[_0x6bd883(0x188)](_0x2426a5){const _0x26a51a=_0x6bd883;if(!this['config'][_0x26a51a(0x132)]['enabled'])return!![];const _0x405cd3=new Date(_0x2426a5),_0x5b0c56=this['isDST'](_0x405cd3)?-0x4:-0x5,_0x54c6e1=_0x405cd3[_0x26a51a(0x157)](),_0x25e01f=_0x405cd3[_0x26a51a(0x151)](),_0x3dab3c=(_0x54c6e1+_0x5b0c56+0x18)%0x18,{startHour:_0x31dd26,startMinute:_0x26387d,endHour:_0x8ef801,endMinute:_0x23a2cd}=this[_0x26a51a(0x1b2)]['session'],_0x578b23=_0x3dab3c*0x3c+_0x25e01f,_0x35a5c9=_0x31dd26*0x3c+_0x26387d,_0x447a7f=_0x8ef801*0x3c+_0x23a2cd;return _0x578b23>=_0x35a5c9&&_0x578b23<_0x447a7f;}[_0x6bd883(0x144)](_0x85504a){const _0x35f301=_0x6bd883,_0x53109f=new Date(_0x85504a['getFullYear'](),0x0,0x1),_0x2e2fd3=new Date(_0x85504a['getFullYear'](),0x6,0x1),_0x98230d=Math['max'](_0x53109f[_0x35f301(0x14b)](),_0x2e2fd3['getTimezoneOffset']());return _0x85504a['getTimezoneOffset']()<_0x98230d;}[_0x6bd883(0x1bb)](_0x5961fd,_0x2c0456=0.25,_0x241ef0=0x5){const _0x79c2a4=_0x6bd883;this[_0x79c2a4(0x14e)]=_0x2c0456,this[_0x79c2a4(0x165)]=_0x241ef0,this[_0x79c2a4(0x1b2)][_0x79c2a4(0x14e)]=_0x2c0456,this[_0x79c2a4(0x1b2)]['tickValue']=_0x241ef0,this[_0x79c2a4(0x153)]['set'](_0x5961fd,[]),this['swingPoints'][_0x79c2a4(0x13d)](_0x5961fd,[]),this[_0x79c2a4(0x13f)]['set'](_0x5961fd,[]),this['activeSweeps']['set'](_0x5961fd,[]),this[_0x79c2a4(0x133)]['delete'](_0x5961fd),this['emit'](_0x79c2a4(0x135),{'type':_0x79c2a4(0x1ab),'message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x5961fd+':\x20tick='+_0x2c0456+_0x79c2a4(0x159)+_0x241ef0+',\x20TF=1min'}),this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x79c2a4(0x1b2)][_0x79c2a4(0x173)]['stopTicks']+'t,\x20Target='+this['config'][_0x79c2a4(0x173)]['targetTicks']+'t,\x20BE='+this[_0x79c2a4(0x1b2)]['execution'][_0x79c2a4(0x1a7)]+'t,\x20Trail='+this['config']['execution'][_0x79c2a4(0x154)]+'/'+this[_0x79c2a4(0x1b2)]['execution'][_0x79c2a4(0x1a2)]});}['processTick'](_0x4b7d71){const _0x4a2e9e=_0x6bd883,{contractId:_0x1f95ec,price:_0x56480d,volume:_0x40b469,timestamp:_0x521d92}=_0x4b7d71,_0x586627=_0x521d92||Date[_0x4a2e9e(0x143)](),_0x41ba19=_0x40b469||0x1;if(!this[_0x4a2e9e(0x188)](_0x586627))return null;let _0x2815d6=this[_0x4a2e9e(0x133)]['get'](_0x1f95ec);const _0x403614=Math[_0x4a2e9e(0x16d)](_0x586627/this[_0x4a2e9e(0x15e)])*this[_0x4a2e9e(0x15e)];if(!_0x2815d6||_0x2815d6[_0x4a2e9e(0x139)]!==_0x403614){if(_0x2815d6){const _0x32dd47={'timestamp':_0x2815d6['startTime'],'open':_0x2815d6[_0x4a2e9e(0x1b3)],'high':_0x2815d6[_0x4a2e9e(0x18f)],'low':_0x2815d6[_0x4a2e9e(0x145)],'close':_0x2815d6['close'],'volume':_0x2815d6['volume']},_0x516498=this[_0x4a2e9e(0x19b)](_0x1f95ec,_0x32dd47);return this['currentBar']['set'](_0x1f95ec,{'startTime':_0x403614,'open':_0x56480d,'high':_0x56480d,'low':_0x56480d,'close':_0x56480d,'volume':_0x41ba19}),_0x516498;}else return this['currentBar'][_0x4a2e9e(0x13d)](_0x1f95ec,{'startTime':_0x403614,'open':_0x56480d,'high':_0x56480d,'low':_0x56480d,'close':_0x56480d,'volume':_0x41ba19}),null;}else return _0x2815d6['high']=Math[_0x4a2e9e(0x156)](_0x2815d6[_0x4a2e9e(0x18f)],_0x56480d),_0x2815d6[_0x4a2e9e(0x145)]=Math['min'](_0x2815d6['low'],_0x56480d),_0x2815d6['close']=_0x56480d,_0x2815d6[_0x4a2e9e(0x16a)]+=_0x41ba19,null;}['onTick'](_0x238002){return this['processTick'](_0x238002);}['onTrade'](_0x519855){const _0x3ec686=_0x6bd883;return this[_0x3ec686(0x141)]({'contractId':_0x519855['contractId']||_0x519855[_0x3ec686(0x18d)],'price':_0x519855['price'],'volume':_0x519855['size']||_0x519855['volume']||0x1,'timestamp':_0x519855['timestamp']||Date['now']()});}['processBar'](_0x311b64,_0x334a7a){const _0x1cd56a=_0x6bd883;let _0x56b630=this['barHistory']['get'](_0x311b64);!_0x56b630&&(this[_0x1cd56a(0x1bb)](_0x311b64),_0x56b630=this['barHistory']['get'](_0x311b64));_0x56b630['push'](_0x334a7a);if(_0x56b630[_0x1cd56a(0x183)]>0x1f4)_0x56b630[_0x1cd56a(0x1bc)]();const _0x22846c=_0x56b630[_0x1cd56a(0x183)]-0x1;if(_0x56b630['length']<this[_0x1cd56a(0x1b2)]['swing']['lookbackBars']*0x3)return null;const _0x25f6d9=this[_0x1cd56a(0x1af)][_0x1cd56a(0x14f)](_0x311b64)['length'];this[_0x1cd56a(0x134)](_0x311b64,_0x56b630,_0x22846c);const _0x2c535e=this[_0x1cd56a(0x1af)]['get'](_0x311b64);if(_0x2c535e[_0x1cd56a(0x183)]>_0x25f6d9){const _0x526f56=_0x2c535e[_0x2c535e[_0x1cd56a(0x183)]-0x1];this[_0x1cd56a(0x13b)]('log',{'type':'debug','message':_0x1cd56a(0x193)+_0x526f56[_0x1cd56a(0x1a1)][_0x1cd56a(0x138)]()+'\x20@\x20'+_0x526f56['price']['toFixed'](0x2)+_0x1cd56a(0x18e)+_0x2c535e[_0x1cd56a(0x183)]});}const _0x8856c7=this['liquidityZones']['get'](_0x311b64)[_0x1cd56a(0x183)];this[_0x1cd56a(0x1ad)](_0x311b64,_0x22846c);const _0x30e41e=this[_0x1cd56a(0x13f)]['get'](_0x311b64);if(_0x30e41e[_0x1cd56a(0x183)]>_0x8856c7){const _0x582654=_0x30e41e[_0x30e41e['length']-0x1];this['emit'](_0x1cd56a(0x135),{'type':'debug','message':'[2B]\x20NEW\x20ZONE\x20'+_0x582654[_0x1cd56a(0x1a1)]['toUpperCase']()+_0x1cd56a(0x1b5)+_0x582654[_0x1cd56a(0x1aa)]()['toFixed'](0x2)+_0x1cd56a(0x18e)+_0x30e41e['length']});}const _0x256f09=this['_detectSweep'](_0x311b64,_0x56b630,_0x22846c);_0x256f09&&this['emit']('log',{'type':'debug','message':_0x1cd56a(0x12e)+_0x256f09['sweepType']+'\x20|\x20Valid:\x20'+_0x256f09['isValid']+_0x1cd56a(0x182)+_0x256f09['penetrationTicks']['toFixed'](0x1)+_0x1cd56a(0x169)+(_0x256f09[_0x1cd56a(0x12d)]*0x64)[_0x1cd56a(0x140)](0x0)+'%'});if(_0x256f09&&_0x256f09['isValid']){this[_0x1cd56a(0x13b)](_0x1cd56a(0x135),{'type':'debug','message':'[2B]\x20Calling\x20_generateSignal\x20for\x20'+_0x256f09[_0x1cd56a(0x17d)]+'\x20sweep...'});const _0x1c12dc=this[_0x1cd56a(0x15b)](_0x311b64,_0x334a7a,_0x22846c,_0x256f09);return!_0x1c12dc&&this['emit'](_0x1cd56a(0x135),{'type':'debug','message':'[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)'}),_0x1c12dc;}return null;}['_detectSwings'](_0x4d1fae,_0x414a54,_0x59ea16){const _0x6b4d33=_0x6bd883,_0x10390a=this['config'][_0x6b4d33(0x15c)]['lookbackBars'],_0x2f1fc7=this[_0x6b4d33(0x1b2)][_0x6b4d33(0x15c)]['minStrength'];if(_0x59ea16<_0x10390a*0x2)return;const _0x1f4889=this[_0x6b4d33(0x1af)]['get'](_0x4d1fae),_0x15b31d=_0x59ea16-_0x10390a,_0x539cb1=_0x414a54[_0x15b31d];let _0x14fd43=!![],_0x4e3d24=0x0;for(let _0x239f93=_0x15b31d-_0x10390a;_0x239f93<=_0x15b31d+_0x10390a;_0x239f93++){if(_0x239f93===_0x15b31d||_0x239f93<0x0||_0x239f93>=_0x414a54[_0x6b4d33(0x183)])continue;if(_0x414a54[_0x239f93][_0x6b4d33(0x18f)]>=_0x539cb1['high']){_0x14fd43=![];break;}_0x4e3d24++;}if(_0x14fd43&&_0x4e3d24>=_0x2f1fc7){const _0xfcab44=_0x1f4889['find'](_0x55c24b=>_0x55c24b['barIndex']===_0x15b31d&&_0x55c24b[_0x6b4d33(0x1a1)]==='high');!_0xfcab44&&_0x1f4889[_0x6b4d33(0x172)](new SwingPoint('high',_0x539cb1['high'],_0x15b31d,_0x539cb1['timestamp'],_0x4e3d24));}let _0x13a66c=!![],_0x4a29c8=0x0;for(let _0x25d79c=_0x15b31d-_0x10390a;_0x25d79c<=_0x15b31d+_0x10390a;_0x25d79c++){if(_0x25d79c===_0x15b31d||_0x25d79c<0x0||_0x25d79c>=_0x414a54['length'])continue;if(_0x414a54[_0x25d79c][_0x6b4d33(0x145)]<=_0x539cb1['low']){_0x13a66c=![];break;}_0x4a29c8++;}if(_0x13a66c&&_0x4a29c8>=_0x2f1fc7){const _0x2ced81=_0x1f4889['find'](_0x2c47d4=>_0x2c47d4[_0x6b4d33(0x19e)]===_0x15b31d&&_0x2c47d4['type']===_0x6b4d33(0x145));!_0x2ced81&&_0x1f4889[_0x6b4d33(0x172)](new SwingPoint(_0x6b4d33(0x145),_0x539cb1['low'],_0x15b31d,_0x539cb1['timestamp'],_0x4a29c8));}const _0x2b3026=this[_0x6b4d33(0x1b2)][_0x6b4d33(0x167)][_0x6b4d33(0x1a5)];while(_0x1f4889['length']>0x0&&_0x1f4889[0x0]['barIndex']<_0x59ea16-_0x2b3026){_0x1f4889[_0x6b4d33(0x1bc)]();}}[_0x6bd883(0x1ad)](_0x2b8fe6,_0xcc0711){const _0x3712a2=_0x6bd883,_0xe74d36=this[_0x3712a2(0x1af)][_0x3712a2(0x14f)](_0x2b8fe6),_0x3b7994=this[_0x3712a2(0x13f)][_0x3712a2(0x14f)](_0x2b8fe6),_0x550ebb=this[_0x3712a2(0x1b2)][_0x3712a2(0x167)][_0x3712a2(0x175)]*this['tickSize'],_0x11ff82=this['config'][_0x3712a2(0x167)]['maxZoneAgeBars'];for(let _0x4a8f9e=_0x3b7994[_0x3712a2(0x183)]-0x1;_0x4a8f9e>=0x0;_0x4a8f9e--){_0xcc0711-_0x3b7994[_0x4a8f9e]['barIndex']>_0x11ff82&&_0x3b7994['splice'](_0x4a8f9e,0x1);}for(const _0x48b474 of _0xe74d36){let _0x4c7363=null;for(const _0x38e8d1 of _0x3b7994){if(_0x38e8d1[_0x3712a2(0x12a)](_0x48b474[_0x3712a2(0x161)],this['config']['zone']['clusterToleranceTicks'],this[_0x3712a2(0x14e)])){_0x4c7363=_0x38e8d1;break;}}if(_0x4c7363){_0x4c7363['touches']++;if(_0x48b474['price']>_0x4c7363[_0x3712a2(0x17c)])_0x4c7363['priceHigh']=_0x48b474[_0x3712a2(0x161)];if(_0x48b474['price']<_0x4c7363[_0x3712a2(0x12f)])_0x4c7363[_0x3712a2(0x12f)]=_0x48b474[_0x3712a2(0x161)];_0x4c7363[_0x3712a2(0x12d)]=Math[_0x3712a2(0x197)](0x1,0.3+_0x4c7363['touches']*0.15);}else{const _0x29d502=_0x48b474[_0x3712a2(0x1a1)]===_0x3712a2(0x18f)?ZoneType['RESISTANCE']:ZoneType['SUPPORT'],_0x227d3b=new LiquidityZone(_0x29d502,_0x48b474[_0x3712a2(0x161)]+_0x550ebb/0x2,_0x48b474[_0x3712a2(0x161)]-_0x550ebb/0x2,_0x48b474[_0x3712a2(0x1a6)],_0x48b474[_0x3712a2(0x19e)]);_0x227d3b['qualityScore']=0.3+_0x48b474[_0x3712a2(0x166)]*0.1,_0x3b7994[_0x3712a2(0x172)](_0x227d3b);}}}['_detectSweep'](_0x3f80a4,_0x2efa83,_0x559316){const _0x77f2d6=_0x6bd883,_0x30f620=this[_0x77f2d6(0x13f)][_0x77f2d6(0x14f)](_0x3f80a4),_0xb4ab52=_0x2efa83[_0x559316],_0x2493b2=_0xb4ab52[_0x77f2d6(0x15f)],_0x27aba8=this[_0x77f2d6(0x1b2)]['sweep'],_0x35ee20=this['config']['zone'];for(const _0x5797a3 of _0x30f620){if(_0x5797a3[_0x77f2d6(0x189)]>=0x0&&_0x559316-_0x5797a3[_0x77f2d6(0x189)]<_0x35ee20[_0x77f2d6(0x16f)])continue;const _0x4a97f1=_0x5797a3['getLevel'](),_0x5b53bc=Math[_0x77f2d6(0x1b4)](_0x2493b2-_0x4a97f1)/this['tickSize'];if(_0x5b53bc>_0x35ee20[_0x77f2d6(0x179)])continue;const _0x4045e4=Math['max'](0x0,_0x559316-_0x27aba8['maxDurationBars']*0x2);for(let _0x598eac=_0x4045e4;_0x598eac<_0x559316;_0x598eac++){const _0x4c545e=_0x2efa83[_0x598eac];if(_0x5797a3['type']===ZoneType[_0x77f2d6(0x199)]){const _0x5d0513=(_0x4c545e['high']-_0x5797a3['priceHigh'])/this[_0x77f2d6(0x14e)];if(_0x5d0513>=_0x27aba8[_0x77f2d6(0x14c)]&&_0x5d0513<=_0x27aba8['maxPenetrationTicks']){if(_0x2493b2<_0x5797a3['priceHigh']){const _0x253cbd=_0x4c545e['high']-_0x4c545e[_0x77f2d6(0x145)],_0x40f2d0=Math[_0x77f2d6(0x1b4)](_0x4c545e['close']-_0x4c545e[_0x77f2d6(0x1b3)]),_0x2eca35=_0x253cbd>0x0?_0x40f2d0/_0x253cbd:0x0;if(_0x2eca35>=_0x27aba8['minBodyRatio']){const _0x380879=this['_getVolumeRatio'](_0x2efa83,_0x598eac,0x14);if(_0x380879>=_0x27aba8['minVolumeRatio']){const _0x5b9744=new SweepEvent(SweepType[_0x77f2d6(0x1b0)],_0x5797a3,_0x598eac,_0x598eac,_0x4c545e['high']);_0x5b9744['exitBarIndex']=_0x559316,_0x5b9744[_0x77f2d6(0x1a8)]=_0x5d0513,_0x5b9744['durationBars']=_0x559316-_0x598eac,_0x5b9744[_0x77f2d6(0x16e)]=_0x380879,_0x5b9744['qualityScore']=this['_scoreSweep'](_0x5b9744,_0x2eca35),_0x5b9744[_0x77f2d6(0x15d)]=_0x5b9744['qualityScore']>=_0x27aba8[_0x77f2d6(0x160)];if(_0x5b9744[_0x77f2d6(0x15d)])return _0x5b9744;}}}}}if(_0x5797a3[_0x77f2d6(0x1a1)]===ZoneType['SUPPORT']){const _0x523546=(_0x5797a3['priceLow']-_0x4c545e['low'])/this[_0x77f2d6(0x14e)];if(_0x523546>=_0x27aba8[_0x77f2d6(0x14c)]&&_0x523546<=_0x27aba8['maxPenetrationTicks']){if(_0x2493b2>_0x5797a3[_0x77f2d6(0x12f)]){const _0x593a96=_0x4c545e[_0x77f2d6(0x18f)]-_0x4c545e['low'],_0x56e581=Math[_0x77f2d6(0x1b4)](_0x4c545e['close']-_0x4c545e[_0x77f2d6(0x1b3)]),_0x5d4341=_0x593a96>0x0?_0x56e581/_0x593a96:0x0;if(_0x5d4341>=_0x27aba8[_0x77f2d6(0x19f)]){const _0x2f53f4=this[_0x77f2d6(0x16b)](_0x2efa83,_0x598eac,0x14);if(_0x2f53f4>=_0x27aba8[_0x77f2d6(0x18c)]){const _0x3c8605=new SweepEvent(SweepType[_0x77f2d6(0x14a)],_0x5797a3,_0x598eac,_0x598eac,_0x4c545e[_0x77f2d6(0x145)]);_0x3c8605[_0x77f2d6(0x198)]=_0x559316,_0x3c8605[_0x77f2d6(0x1a8)]=_0x523546,_0x3c8605['durationBars']=_0x559316-_0x598eac,_0x3c8605['volumeRatio']=_0x2f53f4,_0x3c8605['qualityScore']=this[_0x77f2d6(0x1ac)](_0x3c8605,_0x5d4341),_0x3c8605[_0x77f2d6(0x15d)]=_0x3c8605[_0x77f2d6(0x12d)]>=_0x27aba8['minQualityScore'];if(_0x3c8605[_0x77f2d6(0x15d)])return _0x3c8605;}}}}}}}return null;}['_getVolumeRatio'](_0x36c5da,_0x2a5286,_0x5da978){const _0x1118f0=_0x6bd883,_0x23cbc4=Math['max'](0x0,_0x2a5286-_0x5da978),_0x2be2de=_0x36c5da[_0x1118f0(0x180)](_0x23cbc4,_0x2a5286);if(_0x2be2de['length']===0x0)return 0x1;const _0x4929c2=_0x2be2de[_0x1118f0(0x12b)](_0x30fb0b=>_0x30fb0b[_0x1118f0(0x16a)])[_0x1118f0(0x184)]((_0x45c64f,_0x1ecda5)=>_0x45c64f-_0x1ecda5),_0x5895aa=Math[_0x1118f0(0x16d)](_0x4929c2[_0x1118f0(0x183)]/0x2),_0x43b6c1=_0x4929c2[_0x5895aa]||0x1;return _0x36c5da[_0x2a5286]['volume']/_0x43b6c1;}['_scoreSweep'](_0x2044bb,_0x56d79f){const _0xbd538a=_0x6bd883;let _0x39b248=0x0;const _0x9a8e86=0x4,_0x589c59=Math['abs'](_0x2044bb['penetrationTicks']-_0x9a8e86);return _0x39b248+=Math['max'](0x0,0.3-_0x589c59*0.03),_0x39b248+=Math[_0xbd538a(0x156)](0x0,0.25-_0x2044bb['durationBars']*0.05),_0x39b248+=Math[_0xbd538a(0x197)](0.25,_0x2044bb['volumeRatio']*0.1),_0x39b248+=Math[_0xbd538a(0x197)](0.2,_0x56d79f*0.4),Math[_0xbd538a(0x197)](0x1,_0x39b248);}['_generateSignal'](_0x5c2233,_0x3c2b17,_0x4c2d7b,_0x4f605a){const _0x418ea4=_0x6bd883,_0x2c19bc=Date['now']()-this['lastSignalTime'];if(_0x2c19bc<this['config']['execution']['cooldownMs'])return this[_0x418ea4(0x13b)](_0x418ea4(0x135),{'type':'debug','message':_0x418ea4(0x18b)+(_0x2c19bc/0x3e8)['toFixed'](0x1)+'s\x20<\x20'+this['config'][_0x418ea4(0x173)]['cooldownMs']/0x3e8+'s)'}),null;const _0x111684=this['config']['execution'],_0x5ed780=_0x3c2b17['close'],_0x4905d7=_0x4f605a['sweepType']===SweepType[_0x418ea4(0x1b0)]?'short':'long';let _0x446789,_0x4bc9ee,_0x2e6dcf,_0x463b60;_0x4905d7===_0x418ea4(0x171)?(_0x446789=_0x5ed780-_0x111684[_0x418ea4(0x1a3)]*this[_0x418ea4(0x14e)],_0x4bc9ee=_0x5ed780+_0x111684[_0x418ea4(0x158)]*this['tickSize'],_0x2e6dcf=_0x5ed780+_0x111684['breakevenTicks']*this[_0x418ea4(0x14e)],_0x463b60=_0x5ed780+_0x111684['trailTriggerTicks']*this[_0x418ea4(0x14e)]):(_0x446789=_0x5ed780+_0x111684[_0x418ea4(0x1a3)]*this['tickSize'],_0x4bc9ee=_0x5ed780-_0x111684['targetTicks']*this[_0x418ea4(0x14e)],_0x2e6dcf=_0x5ed780-_0x111684['breakevenTicks']*this[_0x418ea4(0x14e)],_0x463b60=_0x5ed780-_0x111684[_0x418ea4(0x154)]*this[_0x418ea4(0x14e)]);const _0xa95765=_0x111684[_0x418ea4(0x158)]/_0x111684[_0x418ea4(0x1a3)],_0x19aea1=Math[_0x418ea4(0x197)](0x1,_0x4f605a[_0x418ea4(0x12d)]*0.5+_0x4f605a[_0x418ea4(0x167)][_0x418ea4(0x12d)]*0.3+(_0x4f605a[_0x418ea4(0x16e)]>1.5?0.2:_0x4f605a[_0x418ea4(0x16e)]*0.1));let _0x289a65=SignalStrength['MODERATE'];if(_0x19aea1>=0.8)_0x289a65=SignalStrength[_0x418ea4(0x162)];else{if(_0x19aea1>=0.65)_0x289a65=SignalStrength[_0x418ea4(0x17e)];else{if(_0x19aea1<0.5)_0x289a65=SignalStrength['WEAK'];}}const _0x473d71=0.5+(_0x19aea1-0.5)*0.4,_0x4e3a6e=_0x473d71*Math[_0x418ea4(0x1b4)](_0x4bc9ee-_0x5ed780)-(0x1-_0x473d71)*Math[_0x418ea4(0x1b4)](_0x5ed780-_0x446789);_0x4f605a[_0x418ea4(0x167)]['lastUsedBarIndex']=_0x4c2d7b,_0x4f605a['zone'][_0x418ea4(0x1a0)]=!![],_0x4f605a[_0x418ea4(0x167)]['sweptAt']=new Date(_0x3c2b17[_0x418ea4(0x1a6)]),this[_0x418ea4(0x1a9)]=Date['now'](),this[_0x418ea4(0x176)][_0x418ea4(0x13e)]++;const _0x463c2a={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x5c2233['split']('.')[0x0]||_0x5c2233,'contractId':_0x5c2233,'side':_0x4905d7===_0x418ea4(0x171)?OrderSide[_0x418ea4(0x17a)]:OrderSide[_0x418ea4(0x19c)],'direction':_0x4905d7,'strategy':_0x418ea4(0x1b7),'strength':_0x289a65,'edge':_0x4e3a6e,'confidence':_0x19aea1,'entry':_0x5ed780,'entryPrice':_0x5ed780,'stopLoss':_0x446789,'takeProfit':_0x4bc9ee,'riskReward':_0xa95765,'stopTicks':_0x111684[_0x418ea4(0x1a3)],'targetTicks':_0x111684['targetTicks'],'breakevenTicks':_0x111684[_0x418ea4(0x1a7)],'trailTriggerTicks':_0x111684[_0x418ea4(0x154)],'trailDistanceTicks':_0x111684['trailDistanceTicks'],'beLevel':_0x2e6dcf,'trailTrigger':_0x463b60,'sweepType':_0x4f605a['sweepType'],'penetrationTicks':_0x4f605a[_0x418ea4(0x1a8)],'sweepDurationBars':_0x4f605a[_0x418ea4(0x178)],'sweepQuality':_0x4f605a['qualityScore'],'volumeRatio':_0x4f605a[_0x418ea4(0x16e)],'zoneType':_0x4f605a[_0x418ea4(0x167)]['type'],'zoneLevel':_0x4f605a['zone']['getLevel'](),'zoneTouches':_0x4f605a['zone']['touches'],'zoneQuality':_0x4f605a['zone'][_0x418ea4(0x12d)],'expires':Date['now']()+0xea60};return this['emit'](_0x418ea4(0x1bd),{'side':_0x4905d7===_0x418ea4(0x171)?'buy':'sell','action':_0x418ea4(0x1b3),'reason':'2B\x20'+_0x4f605a[_0x418ea4(0x17d)]+'\x20|\x20Pen:'+_0x4f605a['penetrationTicks']['toFixed'](0x1)+_0x418ea4(0x128)+_0x4f605a[_0x418ea4(0x16e)]['toFixed'](0x1)+_0x418ea4(0x168)+(_0x4f605a['qualityScore']*0x64)['toFixed'](0x0)+'%',..._0x463c2a}),this['emit'](_0x418ea4(0x135),{'type':_0x418ea4(0x1ab),'message':'[HQX-2B]\x20SIGNAL:\x20'+_0x4905d7[_0x418ea4(0x138)]()+_0x418ea4(0x1b5)+_0x5ed780['toFixed'](0x2)+'\x20|\x20'+_0x4f605a['sweepType']+_0x418ea4(0x15a)+_0x4f605a[_0x418ea4(0x1a8)]['toFixed'](0x1)+_0x418ea4(0x14d)+_0x4f605a['volumeRatio'][_0x418ea4(0x140)](0x1)+'x\x20|\x20Conf:'+(_0x19aea1*0x64)['toFixed'](0x0)+'%'}),_0x463c2a;}[_0x6bd883(0x130)](_0x2225e1,_0x180094){const _0x2c129a=_0x6bd883,_0x2af404=this[_0x2c129a(0x153)][_0x2c129a(0x14f)](_0x2225e1)||[],_0x1f3cee=this[_0x2c129a(0x13f)]['get'](_0x2225e1)||[],_0x189d80=this[_0x2c129a(0x1af)]['get'](_0x2225e1)||[];if(_0x2af404['length']<0x5)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x2af404['length']+_0x2c129a(0x1b9)};const _0x27f432=_0x1f3cee[_0x2c129a(0x12b)](_0x50b506=>({'zone':_0x50b506,'distance':Math[_0x2c129a(0x1b4)](_0x180094-_0x50b506['getLevel']())}))[_0x2c129a(0x184)]((_0x2d6138,_0x194817)=>_0x2d6138[_0x2c129a(0x19d)]-_0x194817['distance']),_0x273b03=_0x27f432['find'](_0x38f0ea=>_0x38f0ea['zone']['type']===ZoneType['RESISTANCE']),_0x5ee4ed=_0x27f432['find'](_0x146b3d=>_0x146b3d['zone'][_0x2c129a(0x1a1)]===ZoneType['SUPPORT']);return{'ready':!![],'barsProcessed':_0x2af404[_0x2c129a(0x183)],'swingsDetected':_0x189d80['length'],'activeZones':_0x1f3cee['length'],'nearestResistance':_0x273b03?_0x273b03[_0x2c129a(0x167)]['getLevel']():null,'nearestSupport':_0x5ee4ed?_0x5ee4ed[_0x2c129a(0x167)]['getLevel']():null,'stopTicks':this[_0x2c129a(0x1b2)]['execution']['stopTicks'],'targetTicks':this['config']['execution'][_0x2c129a(0x158)],'strategy':'HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)'};}[_0x6bd883(0x149)](_0x23e5f1){const _0x1a17f8=_0x6bd883;this[_0x1a17f8(0x170)][_0x1a17f8(0x172)]({'netPnl':_0x23e5f1,'timestamp':Date['now']()});if(this[_0x1a17f8(0x170)]['length']>0x64)this[_0x1a17f8(0x170)][_0x1a17f8(0x1bc)]();_0x23e5f1>0x0?this['stats']['wins']++:this[_0x1a17f8(0x176)]['losses']++,this['stats'][_0x1a17f8(0x185)]++,this[_0x1a17f8(0x176)][_0x1a17f8(0x147)]+=_0x23e5f1,this[_0x1a17f8(0x13b)]('log',{'type':_0x1a17f8(0x1b6),'message':'[HQX-2B]\x20Trade\x20result:\x20'+(_0x23e5f1>0x0?'WIN':_0x1a17f8(0x129))+'\x20$'+_0x23e5f1['toFixed'](0x2)});}[_0x6bd883(0x196)](_0x2a56a5){const _0x2e5271=_0x6bd883;return this[_0x2e5271(0x153)][_0x2e5271(0x14f)](_0x2a56a5)||[];}[_0x6bd883(0x181)](){const _0x490317=_0x6bd883;return this[_0x490317(0x176)];}['getHealthStatus'](_0x1e5605){const _0x54482f=_0x6bd883,_0x18d252=this['barHistory']['get'](_0x1e5605)||[],_0x5221b3=this['liquidityZones']['get'](_0x1e5605)||[],_0x177d37=this['swingPoints'][_0x54482f(0x14f)](_0x1e5605)||[],_0x139f92=this[_0x54482f(0x133)][_0x54482f(0x14f)](_0x1e5605),_0x5321dd=_0x18d252[_0x18d252[_0x54482f(0x183)]-0x1],_0x755d0d=_0x5321dd?Date['now']()-_0x5321dd[_0x54482f(0x1a6)]:null,_0x3198f3=_0x5221b3['filter'](_0x39e347=>_0x39e347[_0x54482f(0x1a1)]===ZoneType['RESISTANCE'])['length'],_0x4a4bf5=_0x5221b3['filter'](_0x2b170c=>_0x2b170c['type']===ZoneType['SUPPORT'])[_0x54482f(0x183)];return{'healthy':_0x18d252[_0x54482f(0x183)]>=0x5,'barsTotal':_0x18d252['length'],'barsLast5Min':_0x18d252[_0x54482f(0x1b1)](_0x196b4e=>Date[_0x54482f(0x143)]()-_0x196b4e[_0x54482f(0x1a6)]<0x5*0x3c*0x3e8)['length'],'swingsTotal':_0x177d37[_0x54482f(0x183)],'zonesResistance':_0x3198f3,'zonesSupport':_0x4a4bf5,'zonesTotal':_0x5221b3[_0x54482f(0x183)],'currentBarTicks':_0x139f92?_0x139f92['tickCount']:0x0,'isAggregating':_0x139f92&&_0x139f92['tickCount']>0x0,'timeSinceLastBarMs':_0x755d0d,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this[_0x54482f(0x1b2)]['execution'][_0x54482f(0x131)],'uptime':Date[_0x54482f(0x143)]()-(this[_0x54482f(0x139)]||Date['now']())};}['reset'](_0x3469ea){const _0x3a64f4=_0x6bd883;this[_0x3a64f4(0x153)][_0x3a64f4(0x13d)](_0x3469ea,[]),this['swingPoints']['set'](_0x3469ea,[]),this[_0x3a64f4(0x13f)]['set'](_0x3469ea,[]),this[_0x3a64f4(0x164)]['set'](_0x3469ea,[]),this[_0x3a64f4(0x133)][_0x3a64f4(0x1b8)](_0x3469ea),this['emit']('log',{'type':_0x3a64f4(0x1ab),'message':_0x3a64f4(0x12c)+_0x3469ea});}['preloadBars'](_0x37e8a0,_0x10004e){const _0x553c60=_0x6bd883;if(!_0x10004e||_0x10004e[_0x553c60(0x183)]===0x0){this[_0x553c60(0x13b)]('log',{'type':'debug','message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this[_0x553c60(0x153)]['has'](_0x37e8a0)&&this[_0x553c60(0x1bb)](_0x37e8a0);const _0x5d0fce=[..._0x10004e]['sort']((_0x12f85d,_0x529d3e)=>_0x12f85d[_0x553c60(0x1a6)]-_0x529d3e['timestamp']);this[_0x553c60(0x13b)](_0x553c60(0x135),{'type':'info','message':_0x553c60(0x1ae)+_0x5d0fce[_0x553c60(0x183)]+_0x553c60(0x152)});let _0x5b4c16=0x0;for(const _0x400832 of _0x5d0fce){const _0x433146=this['processBar'](_0x37e8a0,_0x400832);if(_0x433146)_0x5b4c16++;}const _0x3a76ee=this['barHistory'][_0x553c60(0x14f)](_0x37e8a0)||[],_0x4107d1=this[_0x553c60(0x1af)][_0x553c60(0x14f)](_0x37e8a0)||[],_0x539a70=this['liquidityZones']['get'](_0x37e8a0)||[];this['emit'](_0x553c60(0x135),{'type':_0x553c60(0x1ab),'message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x3a76ee[_0x553c60(0x183)]+'\x20bars,\x20'+_0x4107d1[_0x553c60(0x183)]+_0x553c60(0x1a4)+_0x539a70['length']+'\x20zones'}),_0x5b4c16>0x0&&this['emit']('log',{'type':'debug','message':'[HQX-2B]\x20'+_0x5b4c16+'\x20historical\x20signals\x20detected\x20(ignored)'}),this['lastSignalTime']=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x4e9476={}){const _0x59b944=_0x6bd883;super(),this[_0x59b944(0x1b2)]=_0x4e9476,this['strategy']=new HQX2BLiquiditySweep(_0x4e9476),this[_0x59b944(0x174)]['on'](_0x59b944(0x1bd),_0x27e551=>this['emit'](_0x59b944(0x1bd),_0x27e551)),this[_0x59b944(0x174)]['on'](_0x59b944(0x135),_0x32868c=>this[_0x59b944(0x13b)](_0x59b944(0x135),_0x32868c));}[_0x6bd883(0x141)](_0x2fc9b3){const _0x4599cd=_0x6bd883;return this[_0x4599cd(0x174)][_0x4599cd(0x141)](_0x2fc9b3);}['onTick'](_0x5b4ed2){const _0x4d6142=_0x6bd883;return this[_0x4d6142(0x174)][_0x4d6142(0x137)](_0x5b4ed2);}[_0x6bd883(0x192)](_0x584f36){const _0x2cd319=_0x6bd883;return this[_0x2cd319(0x174)][_0x2cd319(0x192)](_0x584f36);}[_0x6bd883(0x19b)](_0x54ee63,_0x14d266){const _0x68ea79=_0x6bd883;return this[_0x68ea79(0x174)][_0x68ea79(0x19b)](_0x54ee63,_0x14d266);}['initialize'](_0x441735,_0xb7564a,_0x4a944e){const _0x13f056=_0x6bd883;return this[_0x13f056(0x174)][_0x13f056(0x1bb)](_0x441735,_0xb7564a,_0x4a944e);}[_0x6bd883(0x130)](_0x2c52a2,_0x4ec048){const _0x548c83=_0x6bd883;return this[_0x548c83(0x174)]['getAnalysisState'](_0x2c52a2,_0x4ec048);}[_0x6bd883(0x149)](_0x58414d){const _0x2dceb6=_0x6bd883;return this[_0x2dceb6(0x174)][_0x2dceb6(0x149)](_0x58414d);}['reset'](_0x539dfa){const _0x2cb79a=_0x6bd883;return this[_0x2cb79a(0x174)]['reset'](_0x539dfa);}['getStats'](){return this['strategy']['getStats']();}['getBarHistory'](_0x3ff480){return this['strategy']['getBarHistory'](_0x3ff480);}['preloadBars'](_0x363dfb,_0x5624cd){return this['strategy']['preloadBars'](_0x363dfb,_0x5624cd);}['getHealthStatus'](_0xe079ed){return this['strategy']['getHealthStatus'](_0xe079ed);}['generateSignal'](_0x16bf39){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
|
+
const _0x387f6b=_0x233b;(function(_0x2261ea,_0x2bcbbd){const _0x53db05=_0x233b,_0x319ece=_0x2261ea();while(!![]){try{const _0x3c9a46=parseInt(_0x53db05(0xb2))/0x1+-parseInt(_0x53db05(0x124))/0x2+-parseInt(_0x53db05(0xc9))/0x3*(parseInt(_0x53db05(0x123))/0x4)+-parseInt(_0x53db05(0xea))/0x5*(-parseInt(_0x53db05(0x116))/0x6)+-parseInt(_0x53db05(0xf3))/0x7*(parseInt(_0x53db05(0xd6))/0x8)+parseInt(_0x53db05(0x109))/0x9*(parseInt(_0x53db05(0xb5))/0xa)+-parseInt(_0x53db05(0xfc))/0xb;if(_0x3c9a46===_0x2bcbbd)break;else _0x319ece['push'](_0x319ece['shift']());}catch(_0x1b371b){_0x319ece['push'](_0x319ece['shift']());}}}(_0x2ecc,0xe2df0));function _0x233b(_0x4c82d6,_0x328663){_0x4c82d6=_0x4c82d6-0x93;const _0x2ecc7e=_0x2ecc();let _0x233ba5=_0x2ecc7e[_0x4c82d6];return _0x233ba5;}const EventEmitter=require('events'),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4},SweepType={'HIGH_SWEEP':'high','LOW_SWEEP':_0x387f6b(0xb6)},ZoneType={'RESISTANCE':'resistance','SUPPORT':'support'},DEFAULT_CONFIG={'tickSize':0.25,'tickValue':0x5,'swing':{'lookbackBars':0x1,'minStrength':0x1,'confirmationBars':0x1},'zone':{'clusterToleranceTicks':0x8,'minTouches':0x1,'maxZoneAgeBars':0x1f4,'maxZoneDistanceTicks':0x50,'cooldownBars':0x3},'sweep':{'minPenetrationTicks':0.25,'maxPenetrationTicks':0x14,'maxDurationBars':0xa,'minQualityScore':0.1,'minVolumeRatio':0.3,'minBodyRatio':0.05},'execution':{'stopTicks':0xa,'targetTicks':0x28,'breakevenTicks':0x4,'trailTriggerTicks':0x8,'trailDistanceTicks':0x4,'cooldownMs':0x1388,'minHoldTimeMs':0x1388,'slippageTicks':0x1,'commissionPerSide':0x2},'session':{'enabled':![],'startHour':0x9,'startMinute':0x1e,'endHour':0x10,'endMinute':0x0,'timezone':_0x387f6b(0x10b)}};class SwingPoint{constructor(_0x4b5dc1,_0x48923a,_0x559ed9,_0x22313a,_0x13c5e4=0x1){const _0x287264=_0x387f6b;this['type']=_0x4b5dc1,this['price']=_0x48923a,this['barIndex']=_0x559ed9,this['timestamp']=_0x22313a,this[_0x287264(0xcd)]=_0x13c5e4;}}class LiquidityZone{constructor(_0xe51a62,_0x52ddb0,_0x3b41df,_0x1ce3c3,_0x302dc7){const _0x1d85e2=_0x387f6b;this['id']=uuidv4(),this['type']=_0xe51a62,this['priceHigh']=_0x52ddb0,this[_0x1d85e2(0x100)]=_0x3b41df,this[_0x1d85e2(0xba)]=_0x1ce3c3,this['barIndex']=_0x302dc7,this['touches']=0x1,this['swept']=![],this[_0x1d85e2(0x96)]=null,this['lastUsedBarIndex']=-0x3e7,this['qualityScore']=0.5;}[_0x387f6b(0xab)](_0x457a4f,_0x458a03,_0x4b79cf){const _0x27769a=_0x387f6b,_0x411e33=_0x458a03*_0x4b79cf;return _0x457a4f>=this[_0x27769a(0x100)]-_0x411e33&&_0x457a4f<=this[_0x27769a(0xb7)]+_0x411e33;}['getLevel'](){const _0x23a498=_0x387f6b;return(this['priceHigh']+this[_0x23a498(0x100)])/0x2;}}class SweepEvent{constructor(_0x213d6b,_0x5aecd9,_0x3a0ba8,_0x5189fb,_0x51c6ba){const _0x28ae01=_0x387f6b;this[_0x28ae01(0x11c)]=_0x213d6b,this[_0x28ae01(0x105)]=_0x5aecd9,this['entryBarIndex']=_0x3a0ba8,this['extremeBarIndex']=_0x5189fb,this['extremePrice']=_0x51c6ba,this[_0x28ae01(0xb4)]=null,this['isValid']=![],this['qualityScore']=0x0,this[_0x28ae01(0xa3)]=0x0,this[_0x28ae01(0xd2)]=0x0,this[_0x28ae01(0x9d)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x12bbba={}){const _0x406e05=_0x387f6b;super(),this['config']=this['_mergeConfig'](DEFAULT_CONFIG,_0x12bbba),this[_0x406e05(0x11d)]=this['config'][_0x406e05(0x11d)],this['tickValue']=this[_0x406e05(0xbd)]['tickValue'],this['barHistory']=new Map(),this[_0x406e05(0xe7)]=new Map(),this[_0x406e05(0xf1)]=new Map(),this['activeSweeps']=new Map(),this[_0x406e05(0xac)]=new Map(),this[_0x406e05(0xc0)]=0xea60,this[_0x406e05(0xd4)]=0x0,this[_0x406e05(0xe5)]=Date['now'](),this[_0x406e05(0x127)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this[_0x406e05(0xfb)]=[];}[_0x387f6b(0x11a)](_0xb5822d,_0x6d6b7e){const _0x1efdcf=_0x387f6b,_0x42a373={..._0xb5822d};for(const _0x72e6df in _0x6d6b7e){typeof _0x6d6b7e[_0x72e6df]===_0x1efdcf(0xc2)&&!Array[_0x1efdcf(0x113)](_0x6d6b7e[_0x72e6df])?_0x42a373[_0x72e6df]={..._0xb5822d[_0x72e6df],..._0x6d6b7e[_0x72e6df]}:_0x42a373[_0x72e6df]=_0x6d6b7e[_0x72e6df];}return _0x42a373;}[_0x387f6b(0x10f)](_0xf288be){const _0xa59c71=_0x387f6b;if(!this['config']['session'][_0xa59c71(0xd9)])return!![];const _0x59eb9a=new Date(_0xf288be),_0x101cfb=this[_0xa59c71(0xee)](_0x59eb9a)?-0x4:-0x5,_0x3c1acb=_0x59eb9a[_0xa59c71(0xf2)](),_0x410118=_0x59eb9a['getUTCMinutes'](),_0x5401c4=(_0x3c1acb+_0x101cfb+0x18)%0x18,{startHour:_0x29f0f5,startMinute:_0x39f2db,endHour:_0x588961,endMinute:_0x12b541}=this['config']['session'],_0x55c322=_0x5401c4*0x3c+_0x410118,_0x171ba0=_0x29f0f5*0x3c+_0x39f2db,_0xf9c212=_0x588961*0x3c+_0x12b541;return _0x55c322>=_0x171ba0&&_0x55c322<_0xf9c212;}[_0x387f6b(0xee)](_0x42ff52){const _0x96ebdd=_0x387f6b,_0x20e6eb=new Date(_0x42ff52[_0x96ebdd(0xe0)](),0x0,0x1),_0x47feb2=new Date(_0x42ff52['getFullYear'](),0x6,0x1),_0x28c054=Math['max'](_0x20e6eb['getTimezoneOffset'](),_0x47feb2[_0x96ebdd(0x114)]());return _0x42ff52['getTimezoneOffset']()<_0x28c054;}['initialize'](_0x4ab254,_0x33ed2d=0.25,_0x3cace4=0x5){const _0x425d80=_0x387f6b;this['tickSize']=_0x33ed2d,this['tickValue']=_0x3cace4,this[_0x425d80(0xbd)]['tickSize']=_0x33ed2d,this['config']['tickValue']=_0x3cace4,this['barHistory']['set'](_0x4ab254,[]),this[_0x425d80(0xe7)][_0x425d80(0xd0)](_0x4ab254,[]),this['liquidityZones']['set'](_0x4ab254,[]),this['activeSweeps']['set'](_0x4ab254,[]),this['currentBar']['delete'](_0x4ab254),this[_0x425d80(0xfd)](_0x425d80(0xbf),{'type':'info','message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x4ab254+_0x425d80(0xfe)+_0x33ed2d+_0x425d80(0x11f)+_0x3cace4+_0x425d80(0x110)}),this[_0x425d80(0xfd)]('log',{'type':_0x425d80(0xa8),'message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x425d80(0xbd)][_0x425d80(0xdd)][_0x425d80(0x117)]+'t,\x20Target='+this[_0x425d80(0xbd)]['execution']['targetTicks']+_0x425d80(0x10c)+this['config']['execution']['breakevenTicks']+'t,\x20Trail='+this['config']['execution'][_0x425d80(0x122)]+'/'+this['config']['execution']['trailDistanceTicks']});}['processTick'](_0x3310d9){const _0x407299=_0x387f6b,{contractId:_0x1a87ac,price:_0x101777,volume:_0xdd0492,timestamp:_0x23df41}=_0x3310d9,_0x54d631=_0x23df41||Date['now'](),_0x5c80d0=_0xdd0492||0x1;if(!this[_0x407299(0x10f)](_0x54d631))return null;let _0x314581=this['currentBar']['get'](_0x1a87ac);const _0xc8943b=Math[_0x407299(0xdf)](_0x54d631/this[_0x407299(0xc0)])*this['barIntervalMs'];if(!_0x314581||_0x314581[_0x407299(0xe5)]!==_0xc8943b){if(_0x314581){const _0x48c446={'timestamp':_0x314581['startTime'],'open':_0x314581['open'],'high':_0x314581['high'],'low':_0x314581[_0x407299(0xb6)],'close':_0x314581['close'],'volume':_0x314581[_0x407299(0x9c)]},_0xd0df2=this['processBar'](_0x1a87ac,_0x48c446);return this['currentBar'][_0x407299(0xd0)](_0x1a87ac,{'startTime':_0xc8943b,'open':_0x101777,'high':_0x101777,'low':_0x101777,'close':_0x101777,'volume':_0x5c80d0}),_0xd0df2;}else return this[_0x407299(0xac)][_0x407299(0xd0)](_0x1a87ac,{'startTime':_0xc8943b,'open':_0x101777,'high':_0x101777,'low':_0x101777,'close':_0x101777,'volume':_0x5c80d0}),null;}else return _0x314581[_0x407299(0xca)]=Math['max'](_0x314581['high'],_0x101777),_0x314581['low']=Math['min'](_0x314581[_0x407299(0xb6)],_0x101777),_0x314581['close']=_0x101777,_0x314581['volume']+=_0x5c80d0,null;}[_0x387f6b(0xff)](_0xc95c84){const _0x28bb76=_0x387f6b;return this[_0x28bb76(0x115)](_0xc95c84);}[_0x387f6b(0xcf)](_0x1e44a5){const _0x384800=_0x387f6b;return this['processTick']({'contractId':_0x1e44a5[_0x384800(0x108)]||_0x1e44a5['symbol'],'price':_0x1e44a5[_0x384800(0xc6)],'volume':_0x1e44a5[_0x384800(0x11e)]||_0x1e44a5['volume']||0x1,'timestamp':_0x1e44a5['timestamp']||Date[_0x384800(0x94)]()});}[_0x387f6b(0xbe)](_0x32e001,_0x13aa2a){const _0x3f2dac=_0x387f6b;let _0x4d9d9d=this[_0x3f2dac(0xb3)]['get'](_0x32e001);!_0x4d9d9d&&(this['initialize'](_0x32e001),_0x4d9d9d=this['barHistory'][_0x3f2dac(0xc7)](_0x32e001));_0x4d9d9d[_0x3f2dac(0xbb)](_0x13aa2a);if(_0x4d9d9d['length']>0x1f4)_0x4d9d9d['shift']();const _0xf7d97e=_0x4d9d9d[_0x3f2dac(0x9a)]-0x1;if(_0x4d9d9d['length']<this['config'][_0x3f2dac(0xae)][_0x3f2dac(0x107)]*0x3)return null;const _0x575647=this['swingPoints'][_0x3f2dac(0xc7)](_0x32e001)['length'];this[_0x3f2dac(0x99)](_0x32e001,_0x4d9d9d,_0xf7d97e);const _0x3efde8=this[_0x3f2dac(0xe7)][_0x3f2dac(0xc7)](_0x32e001);if(_0x3efde8['length']>_0x575647){const _0x14d9d1=_0x3efde8[_0x3efde8['length']-0x1];this[_0x3f2dac(0xfd)](_0x3f2dac(0xbf),{'type':_0x3f2dac(0xf8),'message':'[2B]\x20NEW\x20SWING\x20'+_0x14d9d1[_0x3f2dac(0xa7)]['toUpperCase']()+_0x3f2dac(0x120)+_0x14d9d1[_0x3f2dac(0xc6)]['toFixed'](0x2)+_0x3f2dac(0x118)+_0x3efde8['length']});}const _0x5db259=this['_detectSweep'](_0x32e001,_0x4d9d9d,_0xf7d97e);_0x5db259&&this['emit'](_0x3f2dac(0xbf),{'type':'debug','message':_0x3f2dac(0xdb)+_0x5db259['sweepType']+_0x3f2dac(0x112)+_0x5db259[_0x3f2dac(0xb0)]+_0x3f2dac(0xb1)+_0x5db259[_0x3f2dac(0xa3)]['toFixed'](0x1)+_0x3f2dac(0xad)+(_0x5db259['qualityScore']*0x64)[_0x3f2dac(0x10e)](0x0)+'%'});const _0x2b699b=this[_0x3f2dac(0xf1)][_0x3f2dac(0xc7)](_0x32e001)[_0x3f2dac(0x9a)];this[_0x3f2dac(0xc4)](_0x32e001,_0xf7d97e);const _0x2a1e3e=this['liquidityZones'][_0x3f2dac(0xc7)](_0x32e001);if(_0x2a1e3e['length']>_0x2b699b){const _0x1416a3=_0x2a1e3e[_0x2a1e3e[_0x3f2dac(0x9a)]-0x1];this[_0x3f2dac(0xfd)]('log',{'type':_0x3f2dac(0xf8),'message':_0x3f2dac(0xa2)+_0x1416a3[_0x3f2dac(0xa7)][_0x3f2dac(0xeb)]()+'\x20@\x20'+_0x1416a3[_0x3f2dac(0xde)]()[_0x3f2dac(0x10e)](0x2)+_0x3f2dac(0x118)+_0x2a1e3e['length']});}if(_0x5db259&&_0x5db259['isValid']){this['emit']('log',{'type':'debug','message':'[2B]\x20Calling\x20_generateSignal\x20for\x20'+_0x5db259['sweepType']+'\x20sweep...'});const _0x186e07=this['_generateSignal'](_0x32e001,_0x13aa2a,_0xf7d97e,_0x5db259);return!_0x186e07&&this[_0x3f2dac(0xfd)]('log',{'type':'debug','message':'[2B]\x20_generateSignal\x20returned\x20null\x20(likely\x20cooldown)'}),_0x186e07;}return null;}['_detectSwings'](_0x23199f,_0x54157a,_0x35607f){const _0x36e0e2=_0x387f6b,_0x1802d1=this[_0x36e0e2(0xbd)]['swing'][_0x36e0e2(0x107)],_0x56b0e9=this['config'][_0x36e0e2(0xae)][_0x36e0e2(0xf0)];if(_0x35607f<_0x1802d1*0x2)return;const _0x5b5953=this['swingPoints']['get'](_0x23199f),_0x5062b4=_0x35607f-_0x1802d1,_0x4874fb=_0x54157a[_0x5062b4];let _0x6f3591=!![],_0x2e413d=0x0;for(let _0x26c3e8=_0x5062b4-_0x1802d1;_0x26c3e8<=_0x5062b4+_0x1802d1;_0x26c3e8++){if(_0x26c3e8===_0x5062b4||_0x26c3e8<0x0||_0x26c3e8>=_0x54157a['length'])continue;if(_0x54157a[_0x26c3e8]['high']>=_0x4874fb['high']){_0x6f3591=![];break;}_0x2e413d++;}if(_0x6f3591&&_0x2e413d>=_0x56b0e9){const _0x12f9ce=_0x5b5953['find'](_0x3ff212=>_0x3ff212['barIndex']===_0x5062b4&&_0x3ff212[_0x36e0e2(0xa7)]===_0x36e0e2(0xca));!_0x12f9ce&&_0x5b5953['push'](new SwingPoint(_0x36e0e2(0xca),_0x4874fb[_0x36e0e2(0xca)],_0x5062b4,_0x4874fb['timestamp'],_0x2e413d));}let _0x52fd30=!![],_0x463e6a=0x0;for(let _0x4f0329=_0x5062b4-_0x1802d1;_0x4f0329<=_0x5062b4+_0x1802d1;_0x4f0329++){if(_0x4f0329===_0x5062b4||_0x4f0329<0x0||_0x4f0329>=_0x54157a[_0x36e0e2(0x9a)])continue;if(_0x54157a[_0x4f0329]['low']<=_0x4874fb[_0x36e0e2(0xb6)]){_0x52fd30=![];break;}_0x463e6a++;}if(_0x52fd30&&_0x463e6a>=_0x56b0e9){const _0x47f004=_0x5b5953[_0x36e0e2(0xc3)](_0x493e58=>_0x493e58['barIndex']===_0x5062b4&&_0x493e58[_0x36e0e2(0xa7)]==='low');!_0x47f004&&_0x5b5953[_0x36e0e2(0xbb)](new SwingPoint(_0x36e0e2(0xb6),_0x4874fb['low'],_0x5062b4,_0x4874fb['timestamp'],_0x463e6a));}const _0x50b240=this['config']['zone']['maxZoneAgeBars'];while(_0x5b5953[_0x36e0e2(0x9a)]>0x0&&_0x5b5953[0x0]['barIndex']<_0x35607f-_0x50b240){_0x5b5953[_0x36e0e2(0x104)]();}}['_updateZones'](_0x2a2c4d,_0xe55dbd){const _0x362870=_0x387f6b,_0x5a3771=this['swingPoints']['get'](_0x2a2c4d),_0x148b42=this[_0x362870(0xf1)]['get'](_0x2a2c4d),_0x28e386=this[_0x362870(0xbd)]['zone'][_0x362870(0x119)]*this[_0x362870(0x11d)],_0x5450ab=this[_0x362870(0xbd)]['zone']['maxZoneAgeBars'];for(let _0x16cab6=_0x148b42['length']-0x1;_0x16cab6>=0x0;_0x16cab6--){_0xe55dbd-_0x148b42[_0x16cab6][_0x362870(0xcc)]>_0x5450ab&&_0x148b42['splice'](_0x16cab6,0x1);}for(const _0x283af2 of _0x5a3771){let _0x529a4a=null;for(const _0x568307 of _0x148b42){if(_0x568307['containsPrice'](_0x283af2[_0x362870(0xc6)],this['config'][_0x362870(0x105)][_0x362870(0x119)],this[_0x362870(0x11d)])){_0x529a4a=_0x568307;break;}}if(_0x529a4a){_0x529a4a['touches']++;if(_0x283af2[_0x362870(0xc6)]>_0x529a4a[_0x362870(0xb7)])_0x529a4a['priceHigh']=_0x283af2['price'];if(_0x283af2[_0x362870(0xc6)]<_0x529a4a[_0x362870(0x100)])_0x529a4a['priceLow']=_0x283af2[_0x362870(0xc6)];_0x529a4a['qualityScore']=Math[_0x362870(0xbc)](0x1,0.3+_0x529a4a[_0x362870(0x93)]*0.15);}else{const _0xee0c5b=_0x283af2[_0x362870(0xa7)]===_0x362870(0xca)?ZoneType['RESISTANCE']:ZoneType['SUPPORT'],_0x14b0bb=new LiquidityZone(_0xee0c5b,_0x283af2['price']+_0x28e386/0x2,_0x283af2['price']-_0x28e386/0x2,_0x283af2['timestamp'],_0x283af2['barIndex']);_0x14b0bb['qualityScore']=0.3+_0x283af2[_0x362870(0xcd)]*0.1,_0x148b42['push'](_0x14b0bb);}}}['_detectSweep'](_0x56d127,_0x12ae8d,_0x211094){const _0x5b49b2=_0x387f6b,_0x5e9da4=this[_0x5b49b2(0xf1)]['get'](_0x56d127),_0x3d1c22=_0x12ae8d[_0x211094],_0x373c5d=_0x3d1c22[_0x5b49b2(0xf7)],_0x4196ce=this['config']['sweep'],_0x41f67b=this['config']['zone'];for(const _0x178fd0 of _0x5e9da4){if(_0x178fd0['lastUsedBarIndex']>=0x0&&_0x211094-_0x178fd0[_0x5b49b2(0x95)]<_0x41f67b['cooldownBars'])continue;const _0x39a4aa=_0x178fd0[_0x5b49b2(0xde)](),_0x258b68=Math['abs'](_0x373c5d-_0x39a4aa)/this['tickSize'];if(_0x258b68>_0x41f67b[_0x5b49b2(0xe1)])continue;const _0x5610ca=Math['max'](0x0,_0x211094-_0x4196ce[_0x5b49b2(0x126)]*0x2);for(let _0x32c0f6=_0x5610ca;_0x32c0f6<_0x211094;_0x32c0f6++){const _0x7ea897=_0x12ae8d[_0x32c0f6];if(_0x178fd0[_0x5b49b2(0xa7)]===ZoneType[_0x5b49b2(0xa0)]){const _0x3d533d=(_0x7ea897[_0x5b49b2(0xca)]-_0x178fd0['priceHigh'])/this['tickSize'];if(_0x3d533d>=_0x4196ce['minPenetrationTicks']&&_0x3d533d<=_0x4196ce[_0x5b49b2(0xb8)]){if(_0x373c5d<_0x178fd0[_0x5b49b2(0xb7)]){const _0x247752=_0x7ea897['high']-_0x7ea897['low'],_0x33cd8a=Math[_0x5b49b2(0x97)](_0x7ea897['close']-_0x7ea897[_0x5b49b2(0xf4)]),_0x589423=_0x247752>0x0?_0x33cd8a/_0x247752:0x0;if(_0x589423>=_0x4196ce[_0x5b49b2(0xcb)]){const _0x43c536=this[_0x5b49b2(0x102)](_0x12ae8d,_0x32c0f6,0x14);if(_0x43c536>=_0x4196ce['minVolumeRatio']){const _0x1402af=new SweepEvent(SweepType['HIGH_SWEEP'],_0x178fd0,_0x32c0f6,_0x32c0f6,_0x7ea897[_0x5b49b2(0xca)]);_0x1402af[_0x5b49b2(0xb4)]=_0x211094,_0x1402af[_0x5b49b2(0xa3)]=_0x3d533d,_0x1402af['durationBars']=_0x211094-_0x32c0f6,_0x1402af[_0x5b49b2(0x9d)]=_0x43c536,_0x1402af[_0x5b49b2(0xf9)]=this[_0x5b49b2(0xa5)](_0x1402af,_0x589423),_0x1402af[_0x5b49b2(0xb0)]=_0x1402af['qualityScore']>=_0x4196ce[_0x5b49b2(0x10d)];if(_0x1402af['isValid'])return _0x1402af;}}}}}if(_0x178fd0[_0x5b49b2(0xa7)]===ZoneType['SUPPORT']){const _0x21a81d=(_0x178fd0[_0x5b49b2(0x100)]-_0x7ea897['low'])/this['tickSize'];if(_0x21a81d>=_0x4196ce['minPenetrationTicks']&&_0x21a81d<=_0x4196ce[_0x5b49b2(0xb8)]){if(_0x373c5d>_0x178fd0[_0x5b49b2(0x100)]){const _0x1941bd=_0x7ea897[_0x5b49b2(0xca)]-_0x7ea897['low'],_0x3dd231=Math['abs'](_0x7ea897['close']-_0x7ea897[_0x5b49b2(0xf4)]),_0x5640dc=_0x1941bd>0x0?_0x3dd231/_0x1941bd:0x0;if(_0x5640dc>=_0x4196ce[_0x5b49b2(0xcb)]){const _0x2f7b88=this[_0x5b49b2(0x102)](_0x12ae8d,_0x32c0f6,0x14);if(_0x2f7b88>=_0x4196ce[_0x5b49b2(0xa1)]){const _0x5092a9=new SweepEvent(SweepType[_0x5b49b2(0xc1)],_0x178fd0,_0x32c0f6,_0x32c0f6,_0x7ea897['low']);_0x5092a9['exitBarIndex']=_0x211094,_0x5092a9[_0x5b49b2(0xa3)]=_0x21a81d,_0x5092a9['durationBars']=_0x211094-_0x32c0f6,_0x5092a9[_0x5b49b2(0x9d)]=_0x2f7b88,_0x5092a9['qualityScore']=this['_scoreSweep'](_0x5092a9,_0x5640dc),_0x5092a9['isValid']=_0x5092a9[_0x5b49b2(0xf9)]>=_0x4196ce['minQualityScore'];if(_0x5092a9[_0x5b49b2(0xb0)])return _0x5092a9;}}}}}}}return null;}[_0x387f6b(0x102)](_0x321f59,_0x2c8ad6,_0x53ed05){const _0x2b3cbc=_0x387f6b,_0x598ac4=Math['max'](0x0,_0x2c8ad6-_0x53ed05),_0x50d8b9=_0x321f59[_0x2b3cbc(0x9f)](_0x598ac4,_0x2c8ad6);if(_0x50d8b9[_0x2b3cbc(0x9a)]===0x0)return 0x1;const _0x5654bc=_0x50d8b9[_0x2b3cbc(0xaf)](_0x522589=>_0x522589[_0x2b3cbc(0x9c)])['sort']((_0x5c5aaa,_0x486ce6)=>_0x5c5aaa-_0x486ce6),_0x43e2fa=Math[_0x2b3cbc(0xdf)](_0x5654bc['length']/0x2),_0x203725=_0x5654bc[_0x43e2fa]||0x1;return _0x321f59[_0x2c8ad6]['volume']/_0x203725;}[_0x387f6b(0xa5)](_0x3272dd,_0x14b75a){const _0x3b294f=_0x387f6b;let _0x4a2ad1=0x0;const _0x6d1b68=0x4,_0x4c97f7=Math['abs'](_0x3272dd['penetrationTicks']-_0x6d1b68);return _0x4a2ad1+=Math[_0x3b294f(0x98)](0x0,0.3-_0x4c97f7*0.03),_0x4a2ad1+=Math['max'](0x0,0.25-_0x3272dd['durationBars']*0.05),_0x4a2ad1+=Math['min'](0.25,_0x3272dd[_0x3b294f(0x9d)]*0.1),_0x4a2ad1+=Math[_0x3b294f(0xbc)](0.2,_0x14b75a*0.4),Math[_0x3b294f(0xbc)](0x1,_0x4a2ad1);}['_generateSignal'](_0x211cdf,_0x5b4bd7,_0x369be5,_0x3b5751){const _0x3c9c47=_0x387f6b,_0x292e9b=Date[_0x3c9c47(0x94)]()-this['lastSignalTime'];if(_0x292e9b<this['config'][_0x3c9c47(0xdd)][_0x3c9c47(0xef)])return this['emit']('log',{'type':_0x3c9c47(0xf8),'message':_0x3c9c47(0xa9)+(_0x292e9b/0x3e8)['toFixed'](0x1)+'s\x20<\x20'+this[_0x3c9c47(0xbd)][_0x3c9c47(0xdd)][_0x3c9c47(0xef)]/0x3e8+'s)'}),null;const _0x38a806=this[_0x3c9c47(0xbd)][_0x3c9c47(0xdd)],_0x1ab730=_0x5b4bd7[_0x3c9c47(0xf7)],_0x4d2769=_0x3b5751[_0x3c9c47(0x11c)]===SweepType['HIGH_SWEEP']?'short':_0x3c9c47(0xe4);let _0x853a28,_0x2a12bd,_0x687422,_0x84a97a;_0x4d2769==='long'?(_0x853a28=_0x1ab730-_0x38a806['stopTicks']*this['tickSize'],_0x2a12bd=_0x1ab730+_0x38a806['targetTicks']*this[_0x3c9c47(0x11d)],_0x687422=_0x1ab730+_0x38a806['breakevenTicks']*this['tickSize'],_0x84a97a=_0x1ab730+_0x38a806['trailTriggerTicks']*this[_0x3c9c47(0x11d)]):(_0x853a28=_0x1ab730+_0x38a806[_0x3c9c47(0x117)]*this['tickSize'],_0x2a12bd=_0x1ab730-_0x38a806['targetTicks']*this['tickSize'],_0x687422=_0x1ab730-_0x38a806['breakevenTicks']*this['tickSize'],_0x84a97a=_0x1ab730-_0x38a806['trailTriggerTicks']*this['tickSize']);const _0x3e54d4=_0x38a806[_0x3c9c47(0xdc)]/_0x38a806[_0x3c9c47(0x117)],_0xf9b412=Math['min'](0x1,_0x3b5751['qualityScore']*0.5+_0x3b5751['zone'][_0x3c9c47(0xf9)]*0.3+(_0x3b5751[_0x3c9c47(0x9d)]>1.5?0.2:_0x3b5751['volumeRatio']*0.1));let _0x517e44=SignalStrength[_0x3c9c47(0x9e)];if(_0xf9b412>=0.8)_0x517e44=SignalStrength[_0x3c9c47(0xec)];else{if(_0xf9b412>=0.65)_0x517e44=SignalStrength['STRONG'];else{if(_0xf9b412<0.5)_0x517e44=SignalStrength['WEAK'];}}const _0xe0ea4b=0.5+(_0xf9b412-0.5)*0.4,_0x3aeddf=_0xe0ea4b*Math['abs'](_0x2a12bd-_0x1ab730)-(0x1-_0xe0ea4b)*Math[_0x3c9c47(0x97)](_0x1ab730-_0x853a28);_0x3b5751['zone'][_0x3c9c47(0x95)]=_0x369be5,_0x3b5751['zone'][_0x3c9c47(0x125)]=!![],_0x3b5751['zone']['sweptAt']=new Date(_0x5b4bd7[_0x3c9c47(0xda)]),this['lastSignalTime']=Date[_0x3c9c47(0x94)](),this[_0x3c9c47(0x127)][_0x3c9c47(0xe8)]++;const _0x439d4f={'id':uuidv4(),'timestamp':Date[_0x3c9c47(0x94)](),'symbol':_0x211cdf[_0x3c9c47(0x11b)]('.')[0x0]||_0x211cdf,'contractId':_0x211cdf,'side':_0x4d2769===_0x3c9c47(0xe4)?OrderSide['BID']:OrderSide['ASK'],'direction':_0x4d2769,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x517e44,'edge':_0x3aeddf,'confidence':_0xf9b412,'entry':_0x1ab730,'entryPrice':_0x1ab730,'stopLoss':_0x853a28,'takeProfit':_0x2a12bd,'riskReward':_0x3e54d4,'stopTicks':_0x38a806['stopTicks'],'targetTicks':_0x38a806[_0x3c9c47(0xdc)],'breakevenTicks':_0x38a806[_0x3c9c47(0x103)],'trailTriggerTicks':_0x38a806[_0x3c9c47(0x122)],'trailDistanceTicks':_0x38a806['trailDistanceTicks'],'beLevel':_0x687422,'trailTrigger':_0x84a97a,'sweepType':_0x3b5751[_0x3c9c47(0x11c)],'penetrationTicks':_0x3b5751[_0x3c9c47(0xa3)],'sweepDurationBars':_0x3b5751['durationBars'],'sweepQuality':_0x3b5751['qualityScore'],'volumeRatio':_0x3b5751[_0x3c9c47(0x9d)],'zoneType':_0x3b5751['zone']['type'],'zoneLevel':_0x3b5751['zone']['getLevel'](),'zoneTouches':_0x3b5751[_0x3c9c47(0x105)]['touches'],'zoneQuality':_0x3b5751['zone'][_0x3c9c47(0xf9)],'expires':Date[_0x3c9c47(0x94)]()+0xea60};return this['emit'](_0x3c9c47(0xed),{'side':_0x4d2769===_0x3c9c47(0xe4)?'buy':'sell','action':_0x3c9c47(0xf4),'reason':'2B\x20'+_0x3b5751['sweepType']+_0x3c9c47(0xc8)+_0x3b5751[_0x3c9c47(0xa3)]['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x3b5751[_0x3c9c47(0x9d)]['toFixed'](0x1)+_0x3c9c47(0xe6)+(_0x3b5751[_0x3c9c47(0xf9)]*0x64)['toFixed'](0x0)+'%',..._0x439d4f}),this[_0x3c9c47(0xfd)](_0x3c9c47(0xbf),{'type':_0x3c9c47(0xa8),'message':_0x3c9c47(0x101)+_0x4d2769['toUpperCase']()+'\x20@\x20'+_0x1ab730['toFixed'](0x2)+_0x3c9c47(0xd8)+_0x3b5751['sweepType']+_0x3c9c47(0xc8)+_0x3b5751['penetrationTicks']['toFixed'](0x1)+'t\x20Vol:'+_0x3b5751['volumeRatio'][_0x3c9c47(0x10e)](0x1)+'x\x20|\x20Conf:'+(_0xf9b412*0x64)['toFixed'](0x0)+'%'}),_0x439d4f;}[_0x387f6b(0xce)](_0x4aaecb,_0x4c2457){const _0x372f1c=_0x387f6b,_0xb0d065=this['barHistory']['get'](_0x4aaecb)||[],_0x5d9fb9=this['liquidityZones'][_0x372f1c(0xc7)](_0x4aaecb)||[],_0x3b20a9=this['swingPoints'][_0x372f1c(0xc7)](_0x4aaecb)||[];if(_0xb0d065[_0x372f1c(0x9a)]<0x5)return{'ready':![],'message':_0x372f1c(0xa6)+_0xb0d065[_0x372f1c(0x9a)]+'/5\x20bars'};const _0x18f308=_0x5d9fb9['map'](_0x1dee7e=>({'zone':_0x1dee7e,'distance':Math['abs'](_0x4c2457-_0x1dee7e['getLevel']())}))['sort']((_0x5680a2,_0x3bd8b1)=>_0x5680a2[_0x372f1c(0xd7)]-_0x3bd8b1[_0x372f1c(0xd7)]),_0x579774=_0x18f308[_0x372f1c(0xc3)](_0x57b413=>_0x57b413[_0x372f1c(0x105)]['type']===ZoneType['RESISTANCE']),_0x27bf00=_0x18f308['find'](_0x150aa8=>_0x150aa8['zone'][_0x372f1c(0xa7)]===ZoneType[_0x372f1c(0x10a)]);return{'ready':!![],'barsProcessed':_0xb0d065['length'],'swingsDetected':_0x3b20a9[_0x372f1c(0x9a)],'activeZones':_0x5d9fb9[_0x372f1c(0x9a)],'nearestResistance':_0x579774?_0x579774['zone']['getLevel']():null,'nearestSupport':_0x27bf00?_0x27bf00['zone'][_0x372f1c(0xde)]():null,'stopTicks':this['config'][_0x372f1c(0xdd)][_0x372f1c(0x117)],'targetTicks':this['config'][_0x372f1c(0xdd)][_0x372f1c(0xdc)],'strategy':_0x372f1c(0xfa)};}[_0x387f6b(0xaa)](_0x11abdc){const _0x2bf0e9=_0x387f6b;this['recentTrades'][_0x2bf0e9(0xbb)]({'netPnl':_0x11abdc,'timestamp':Date['now']()});if(this[_0x2bf0e9(0xfb)]['length']>0x64)this[_0x2bf0e9(0xfb)][_0x2bf0e9(0x104)]();_0x11abdc>0x0?this[_0x2bf0e9(0x127)]['wins']++:this[_0x2bf0e9(0x127)]['losses']++,this[_0x2bf0e9(0x127)]['trades']++,this['stats']['pnl']+=_0x11abdc,this[_0x2bf0e9(0xfd)](_0x2bf0e9(0xbf),{'type':_0x2bf0e9(0xf8),'message':_0x2bf0e9(0xd1)+(_0x11abdc>0x0?'WIN':_0x2bf0e9(0x9b))+'\x20$'+_0x11abdc[_0x2bf0e9(0x10e)](0x2)});}[_0x387f6b(0xd5)](_0x187b52){const _0x43e375=_0x387f6b;return this['barHistory'][_0x43e375(0xc7)](_0x187b52)||[];}['getStats'](){return this['stats'];}[_0x387f6b(0x106)](_0xd778e4){const _0x8911ac=_0x387f6b,_0x2ba776=this['barHistory']['get'](_0xd778e4)||[],_0x3e47cb=this[_0x8911ac(0xf1)]['get'](_0xd778e4)||[],_0x36bcf8=this[_0x8911ac(0xe7)]['get'](_0xd778e4)||[],_0xbb6624=this['currentBar'][_0x8911ac(0xc7)](_0xd778e4),_0x3ec16a=_0x2ba776[_0x2ba776['length']-0x1],_0x4373e3=_0x3ec16a?Date[_0x8911ac(0x94)]()-_0x3ec16a['timestamp']:null,_0x42b07e=_0x3e47cb[_0x8911ac(0xe9)](_0x5e7a04=>_0x5e7a04[_0x8911ac(0xa7)]===ZoneType[_0x8911ac(0xa0)])[_0x8911ac(0x9a)],_0x490272=_0x3e47cb['filter'](_0x451106=>_0x451106['type']===ZoneType[_0x8911ac(0x10a)])[_0x8911ac(0x9a)];return{'healthy':_0x2ba776['length']>=0x5,'barsTotal':_0x2ba776[_0x8911ac(0x9a)],'barsLast5Min':_0x2ba776[_0x8911ac(0xe9)](_0x2dfb9c=>Date['now']()-_0x2dfb9c['timestamp']<0x5*0x3c*0x3e8)[_0x8911ac(0x9a)],'swingsTotal':_0x36bcf8[_0x8911ac(0x9a)],'zonesResistance':_0x42b07e,'zonesSupport':_0x490272,'zonesTotal':_0x3e47cb[_0x8911ac(0x9a)],'currentBarTicks':_0xbb6624?_0xbb6624['tickCount']:0x0,'isAggregating':_0xbb6624&&_0xbb6624[_0x8911ac(0xe2)]>0x0,'timeSinceLastBarMs':_0x4373e3,'lastSignalTime':this['lastSignalTime'],'signalCooldownMs':this['config']['execution']['cooldownMs'],'uptime':Date['now']()-(this['startTime']||Date[_0x8911ac(0x94)]())};}[_0x387f6b(0x121)](_0x186d87){const _0x3e84e8=_0x387f6b;this[_0x3e84e8(0xb3)]['set'](_0x186d87,[]),this['swingPoints'][_0x3e84e8(0xd0)](_0x186d87,[]),this['liquidityZones'][_0x3e84e8(0xd0)](_0x186d87,[]),this['activeSweeps']['set'](_0x186d87,[]),this['currentBar'][_0x3e84e8(0xc5)](_0x186d87),this['emit'](_0x3e84e8(0xbf),{'type':_0x3e84e8(0xa8),'message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x186d87});}['preloadBars'](_0x40c3d9,_0x22a5e4){const _0x9d4408=_0x387f6b;if(!_0x22a5e4||_0x22a5e4[_0x9d4408(0x9a)]===0x0){this[_0x9d4408(0xfd)](_0x9d4408(0xbf),{'type':_0x9d4408(0xf8),'message':'[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload'});return;}!this[_0x9d4408(0xb3)]['has'](_0x40c3d9)&&this[_0x9d4408(0xa4)](_0x40c3d9);const _0x5cebb9=[..._0x22a5e4][_0x9d4408(0xd3)]((_0xcf0fbb,_0x3ae055)=>_0xcf0fbb[_0x9d4408(0xda)]-_0x3ae055['timestamp']);this[_0x9d4408(0xfd)]('log',{'type':'info','message':'[HQX-2B]\x20Preloading\x20'+_0x5cebb9[_0x9d4408(0x9a)]+'\x20historical\x20bars...'});let _0x1e8c51=0x0;for(const _0x5ce701 of _0x5cebb9){const _0x6c4c=this[_0x9d4408(0xbe)](_0x40c3d9,_0x5ce701);if(_0x6c4c)_0x1e8c51++;}const _0x38fe86=this[_0x9d4408(0xb3)]['get'](_0x40c3d9)||[],_0x4632db=this['swingPoints']['get'](_0x40c3d9)||[],_0x262366=this[_0x9d4408(0xf1)]['get'](_0x40c3d9)||[];this[_0x9d4408(0xfd)]('log',{'type':'info','message':'[HQX-2B]\x20Preload\x20complete:\x20'+_0x38fe86[_0x9d4408(0x9a)]+_0x9d4408(0x111)+_0x4632db['length']+_0x9d4408(0xf5)+_0x262366[_0x9d4408(0x9a)]+'\x20zones'}),_0x1e8c51>0x0&&this['emit']('log',{'type':'debug','message':_0x9d4408(0xe3)+_0x1e8c51+'\x20historical\x20signals\x20detected\x20(ignored)'}),this['lastSignalTime']=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0xa967ca={}){const _0x265f35=_0x387f6b;super(),this['config']=_0xa967ca,this['strategy']=new HQX2BLiquiditySweep(_0xa967ca),this['strategy']['on']('signal',_0x664c32=>this['emit'](_0x265f35(0xed),_0x664c32)),this['strategy']['on']('log',_0x5edac7=>this['emit'](_0x265f35(0xbf),_0x5edac7));}[_0x387f6b(0x115)](_0x481a2f){const _0x9078ca=_0x387f6b;return this[_0x9078ca(0xf6)]['processTick'](_0x481a2f);}[_0x387f6b(0xff)](_0x1ee571){const _0x2d398c=_0x387f6b;return this[_0x2d398c(0xf6)]['onTick'](_0x1ee571);}[_0x387f6b(0xcf)](_0x55dbc8){const _0x44b6ce=_0x387f6b;return this['strategy'][_0x44b6ce(0xcf)](_0x55dbc8);}[_0x387f6b(0xbe)](_0x500248,_0x228e0b){const _0x147f59=_0x387f6b;return this[_0x147f59(0xf6)]['processBar'](_0x500248,_0x228e0b);}[_0x387f6b(0xa4)](_0x244c66,_0x569c09,_0x1dcb3e){const _0x1d7d75=_0x387f6b;return this['strategy'][_0x1d7d75(0xa4)](_0x244c66,_0x569c09,_0x1dcb3e);}[_0x387f6b(0xce)](_0x2b666d,_0x424af3){return this['strategy']['getAnalysisState'](_0x2b666d,_0x424af3);}['recordTradeResult'](_0x291b78){return this['strategy']['recordTradeResult'](_0x291b78);}['reset'](_0x2d1dea){const _0x2dd8f3=_0x387f6b;return this[_0x2dd8f3(0xf6)][_0x2dd8f3(0x121)](_0x2d1dea);}['getStats'](){const _0x179630=_0x387f6b;return this[_0x179630(0xf6)]['getStats']();}['getBarHistory'](_0x1ee70d){const _0x1aeb57=_0x387f6b;return this[_0x1aeb57(0xf6)][_0x1aeb57(0xd5)](_0x1ee70d);}['preloadBars'](_0x2c9a47,_0x570523){return this['strategy']['preloadBars'](_0x2c9a47,_0x570523);}[_0x387f6b(0x106)](_0x645717){const _0x2cd8ae=_0x387f6b;return this[_0x2cd8ae(0xf6)]['getHealthStatus'](_0x645717);}[_0x387f6b(0xb9)](_0x2e00be){return null;}}function _0x2ecc(){const _0x60bc87=['sweptAt','abs','max','_detectSwings','length','LOSS','volume','volumeRatio','MODERATE','slice','RESISTANCE','minVolumeRatio','[2B]\x20NEW\x20ZONE\x20','penetrationTicks','initialize','_scoreSweep','Collecting\x20data...\x20','type','info','[2B]\x20Signal\x20blocked\x20by\x20cooldown\x20(','recordTradeResult','containsPrice','currentBar','t\x20|\x20Q:\x20','swing','map','isValid','\x20|\x20Pen:\x20','1768978TThOoN','barHistory','exitBarIndex','5405830PKUrQS','low','priceHigh','maxPenetrationTicks','generateSignal','createdAt','push','min','config','processBar','log','barIntervalMs','LOW_SWEEP','object','find','_updateZones','delete','price','get','\x20|\x20Pen:','1659702TzocJh','high','minBodyRatio','barIndex','strength','getAnalysisState','onTrade','set','[HQX-2B]\x20Trade\x20result:\x20','durationBars','sort','lastSignalTime','getBarHistory','125336HCyXIr','distance','\x20|\x20','enabled','timestamp','[2B]\x20SWEEP\x20','targetTicks','execution','getLevel','floor','getFullYear','maxZoneDistanceTicks','tickCount','[HQX-2B]\x20','long','startTime','x\x20|\x20Q:','swingPoints','signals','filter','229485KLBQRd','toUpperCase','VERY_STRONG','signal','isDST','cooldownMs','minStrength','liquidityZones','getUTCHours','287WvEpGJ','open','\x20swings,\x20','strategy','close','debug','qualityScore','HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)','recentTrades','362659oCshCj','emit',':\x20tick=','onTick','priceLow','[HQX-2B]\x20SIGNAL:\x20','_getVolumeRatio','breakevenTicks','shift','zone','getHealthStatus','lookbackBars','contractId','9dgwBru','SUPPORT','America/New_York','t,\x20BE=','minQualityScore','toFixed','isWithinSession',',\x20TF=1min','\x20bars,\x20','\x20|\x20Valid:\x20','isArray','getTimezoneOffset','processTick','228pYumOt','stopTicks','\x20|\x20Total:\x20','clusterToleranceTicks','_mergeConfig','split','sweepType','tickSize','size',',\x20value=','\x20@\x20','reset','trailTriggerTicks','12qHQdKe','1578730rTZFcc','swept','maxDurationBars','stats','touches','now','lastUsedBarIndex'];_0x2ecc=function(){return _0x60bc87;};return _0x2ecc();}module['exports']={'HQX2BLiquiditySweep':HQX2BLiquiditySweep,'HQX2BStrategy':HQX2BStrategy,'M2':HQX2BStrategy,'S2':HQX2BLiquiditySweep,'OrderSide':OrderSide,'SignalStrength':SignalStrength,'SweepType':SweepType,'ZoneType':ZoneType,'DEFAULT_CONFIG':DEFAULT_CONFIG};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x275bdf=_0x3870;(function(_0x4cf09d,_0x242db3){const _0x4c4c11=_0x3870,_0x7c04c4=_0x4cf09d();while(!![]){try{const _0x4bc5d3=-parseInt(_0x4c4c11(0x195))/0x1*(-parseInt(_0x4c4c11(0x1fa))/0x2)+-parseInt(_0x4c4c11(0x1c9))/0x3+parseInt(_0x4c4c11(0x1c5))/0x4*(parseInt(_0x4c4c11(0x1d3))/0x5)+parseInt(_0x4c4c11(0x1bb))/0x6+-parseInt(_0x4c4c11(0x1c8))/0x7+-parseInt(_0x4c4c11(0x1e5))/0x8*(-parseInt(_0x4c4c11(0x1d4))/0x9)+parseInt(_0x4c4c11(0x1c0))/0xa*(-parseInt(_0x4c4c11(0x1f4))/0xb);if(_0x4bc5d3===_0x242db3)break;else _0x7c04c4['push'](_0x7c04c4['shift']());}catch(_0x5ec1d3){_0x7c04c4['push'](_0x7c04c4['shift']());}}}(_0xa6d2,0x95d84));const EventEmitter=require(_0x275bdf(0x1b8)),{v4:uuidv4}=require('uuid'),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};function _0x3870(_0x64082e,_0x2e8caf){_0x64082e=_0x64082e-0x194;const _0xa6d287=_0xa6d2();let _0x3870d9=_0xa6d287[_0x64082e];return _0x3870d9;}class HQXUltraScalping extends EventEmitter{constructor(_0x42b1ab={}){const _0x4dbd3d=_0x275bdf;super(),this[_0x4dbd3d(0x1f6)]=_0x42b1ab[_0x4dbd3d(0x1f6)]||0.25,this[_0x4dbd3d(0x1b1)]=_0x42b1ab['tickValue']||0x5,this['zscoreEntryThreshold']=1.5,this['zscoreExitThreshold']=0.5,this['vpinWindow']=0x32,this['vpinToxicThreshold']=0.7,this[_0x4dbd3d(0x1aa)]=0.01,this['kalmanMeasurementNoise']=0.1,this['volatilityLookback']=0x64,this[_0x4dbd3d(0x1c3)]=0x14,this['baseStopTicks']=0x8,this[_0x4dbd3d(0x1ef)]=0x10,this['breakevenTicks']=0x4,this[_0x4dbd3d(0x1c7)]=0.5,this[_0x4dbd3d(0x1ad)]=0.55,this[_0x4dbd3d(0x1b5)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this['barHistory']=new Map(),this['priceBuffer']=new Map(),this['volumeBuffer']=new Map(),this[_0x4dbd3d(0x1cf)]=new Map(),this[_0x4dbd3d(0x1d0)]=new Map(),this['recentTrades']=[],this[_0x4dbd3d(0x1c1)]=0x0,this['lossStreak']=0x0,this[_0x4dbd3d(0x19b)]=0x0,this['cooldownMs']=0x7530,this[_0x4dbd3d(0x1ed)]=0x2710,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}['initialize'](_0x548902,_0x1cd5a3=0.25,_0x44185e=0x5){const _0x8b6348=_0x275bdf;this['tickSize']=_0x1cd5a3,this[_0x8b6348(0x1b1)]=_0x44185e,this[_0x8b6348(0x1a0)]['set'](_0x548902,[]),this['priceBuffer']['set'](_0x548902,[]),this['volumeBuffer']['set'](_0x548902,[]),this[_0x8b6348(0x1d0)]['set'](_0x548902,[]),this[_0x8b6348(0x1cf)][_0x8b6348(0x1f8)](_0x548902,{'estimate':0x0,'errorCovariance':0x1}),this['emit'](_0x8b6348(0x1b0),{'type':_0x8b6348(0x1fb),'message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x548902+':\x20tick='+_0x1cd5a3+',\x20value='+_0x44185e}),this['emit'](_0x8b6348(0x1b0),{'type':_0x8b6348(0x1fb),'message':'[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)'});}['processTick'](_0x26ea89){const _0x46ba5b=_0x275bdf,{contractId:_0x3804f9,price:_0x55b3d1,volume:_0x249082,side:_0x183a53,timestamp:_0x5e5f51}=_0x26ea89,_0x383cbc={'timestamp':_0x5e5f51||Date[_0x46ba5b(0x1d1)](),'open':_0x55b3d1,'high':_0x55b3d1,'low':_0x55b3d1,'close':_0x55b3d1,'volume':_0x249082||0x1};return this['processBar'](_0x3804f9,_0x383cbc);}[_0x275bdf(0x1bc)](_0x942f7){const _0xa3edb6=_0x275bdf;return this[_0xa3edb6(0x1dc)](_0x942f7);}['onTrade'](_0x2d4be8){const _0x489fd0=_0x275bdf;return this['processTick']({'contractId':_0x2d4be8['contractId']||_0x2d4be8[_0x489fd0(0x1cb)],'price':_0x2d4be8['price'],'volume':_0x2d4be8['size']||_0x2d4be8[_0x489fd0(0x1b6)]||0x1,'side':_0x2d4be8['side'],'timestamp':_0x2d4be8['timestamp']||Date[_0x489fd0(0x1d1)]()});}['processBar'](_0x4790a9,_0x480bc0){const _0x10287b=_0x275bdf;let _0x15a962=this[_0x10287b(0x1a0)][_0x10287b(0x1c6)](_0x4790a9);!_0x15a962&&(this[_0x10287b(0x1a2)](_0x4790a9),_0x15a962=this['barHistory'][_0x10287b(0x1c6)](_0x4790a9));_0x15a962['push'](_0x480bc0);if(_0x15a962[_0x10287b(0x1d5)]>0x1f4)_0x15a962['shift']();const _0x583017=this[_0x10287b(0x1ce)][_0x10287b(0x1c6)](_0x4790a9);_0x583017[_0x10287b(0x1b4)](_0x480bc0['close']);if(_0x583017[_0x10287b(0x1d5)]>0xc8)_0x583017['shift']();const _0x44da10=this['volumeBuffer']['get'](_0x4790a9),_0x478f3b=_0x480bc0['high']-_0x480bc0['low'];let _0x7eab4a=_0x480bc0['volume']*0.5,_0x12eb23=_0x480bc0[_0x10287b(0x1b6)]*0.5;if(_0x478f3b>0x0){const _0x4e39ec=(_0x480bc0['close']-_0x480bc0[_0x10287b(0x1a3)])/_0x478f3b;_0x7eab4a=_0x480bc0[_0x10287b(0x1b6)]*_0x4e39ec,_0x12eb23=_0x480bc0['volume']*(0x1-_0x4e39ec);}_0x44da10['push']({'buy':_0x7eab4a,'sell':_0x12eb23});if(_0x44da10[_0x10287b(0x1d5)]>0x64)_0x44da10['shift']();if(_0x15a962[_0x10287b(0x1d5)]<0x32)return null;const _0x333481=this[_0x10287b(0x1fd)](_0x583017),_0x3e6976=this['_computeVPIN'](_0x44da10),_0x3f0c53=this['_computeKyleLambda'](_0x15a962),_0x342575=this['_applyKalmanFilter'](_0x4790a9,_0x480bc0['close']),{regime:_0x59bbb1,params:_0x570de4}=this[_0x10287b(0x1f2)](_0x4790a9,_0x15a962),_0xeb9978=this[_0x10287b(0x1ee)](_0x15a962);return this[_0x10287b(0x19c)](_0x4790a9,_0x480bc0[_0x10287b(0x1e2)],_0x333481,_0x3e6976,_0x3f0c53,_0x342575,_0x59bbb1,_0x570de4,_0xeb9978,_0x15a962);}[_0x275bdf(0x1fd)](_0x11fd0f,_0x15925f=0x32){const _0x2eb95c=_0x275bdf;if(_0x11fd0f[_0x2eb95c(0x1d5)]<_0x15925f)return 0x0;const _0x5c20d7=_0x11fd0f[_0x2eb95c(0x1d8)](-_0x15925f),_0xce67e2=_0x5c20d7['reduce']((_0x48d506,_0x4dd99b)=>_0x48d506+_0x4dd99b,0x0)/_0x15925f,_0x3c6647=_0x5c20d7[_0x2eb95c(0x1e0)]((_0x5548ee,_0x4dedb7)=>_0x5548ee+Math['pow'](_0x4dedb7-_0xce67e2,0x2),0x0)/_0x15925f,_0x3e47eb=Math['sqrt'](_0x3c6647);if(_0x3e47eb<0.0001)return 0x0;const _0x1c5aa3=_0x11fd0f[_0x11fd0f['length']-0x1];return(_0x1c5aa3-_0xce67e2)/_0x3e47eb;}['_computeVPIN'](_0x33fbb9){const _0x1734bf=_0x275bdf;if(_0x33fbb9['length']<this['vpinWindow'])return 0.5;const _0x20107c=_0x33fbb9[_0x1734bf(0x1d8)](-this['vpinWindow']);let _0x577646=0x0,_0x431fee=0x0;for(const _0xd8aac3 of _0x20107c){_0x577646+=_0xd8aac3['buy'],_0x431fee+=_0xd8aac3['sell'];}const _0x3210c7=_0x577646+_0x431fee;if(_0x3210c7<0x1)return 0.5;return Math['abs'](_0x577646-_0x431fee)/_0x3210c7;}[_0x275bdf(0x1c4)](_0x4a0167){const _0x1b95ce=_0x275bdf;if(_0x4a0167['length']<0x14)return 0x0;const _0xf67c45=_0x4a0167['slice'](-0x14),_0x507447=[],_0x7752a8=[];for(let _0x53f442=0x1;_0x53f442<_0xf67c45['length'];_0x53f442++){_0x507447[_0x1b95ce(0x1b4)](_0xf67c45[_0x53f442][_0x1b95ce(0x1e2)]-_0xf67c45[_0x53f442-0x1]['close']),_0x7752a8['push'](_0xf67c45[_0x53f442]['volume']);}const _0x563196=_0x507447['reduce']((_0x110fb0,_0x217067)=>_0x110fb0+_0x217067,0x0)/_0x507447['length'],_0x409200=_0x7752a8[_0x1b95ce(0x1e0)]((_0x3a5768,_0x27039f)=>_0x3a5768+_0x27039f,0x0)/_0x7752a8['length'];let _0xa83877=0x0,_0x291947=0x0;for(let _0x14257e=0x0;_0x14257e<_0x507447['length'];_0x14257e++){_0xa83877+=(_0x507447[_0x14257e]-_0x563196)*(_0x7752a8[_0x14257e]-_0x409200),_0x291947+=Math[_0x1b95ce(0x1b2)](_0x7752a8[_0x14257e]-_0x409200,0x2);}_0xa83877/=_0x507447[_0x1b95ce(0x1d5)],_0x291947/=_0x507447['length'];if(_0x291947<0.0001)return 0x0;return Math[_0x1b95ce(0x1db)](_0xa83877/_0x291947);}['_applyKalmanFilter'](_0x4795bb,_0x496486){const _0x4ec948=_0x275bdf;let _0x40a75=this['kalmanStates']['get'](_0x4795bb);if(!_0x40a75)return _0x40a75={'estimate':_0x496486,'errorCovariance':0x1},this['kalmanStates'][_0x4ec948(0x1f8)](_0x4795bb,_0x40a75),_0x496486;const _0x47e2d9=_0x40a75['estimate'],_0x3d4443=_0x40a75['errorCovariance']+this[_0x4ec948(0x1aa)],_0x32f7ee=_0x3d4443/(_0x3d4443+this[_0x4ec948(0x194)]),_0x2f2ae2=_0x47e2d9+_0x32f7ee*(_0x496486-_0x47e2d9),_0x195d86=(0x1-_0x32f7ee)*_0x3d4443;return _0x40a75['estimate']=_0x2f2ae2,_0x40a75['errorCovariance']=_0x195d86,_0x2f2ae2;}[_0x275bdf(0x1f2)](_0x9bdf27,_0x43fd18){const _0x347a5f=_0x275bdf,_0x13a5da=this[_0x347a5f(0x1e3)](_0x43fd18),_0x53130b=_0x13a5da/this[_0x347a5f(0x1f6)];let _0x393b22=this[_0x347a5f(0x1d0)]['get'](_0x9bdf27);!_0x393b22&&(_0x393b22=[],this[_0x347a5f(0x1d0)]['set'](_0x9bdf27,_0x393b22));_0x393b22['push'](_0x13a5da);if(_0x393b22[_0x347a5f(0x1d5)]>0x1f4)_0x393b22[_0x347a5f(0x1cd)]();let _0x2a6218=0.5;_0x393b22[_0x347a5f(0x1d5)]>=0x14&&(_0x2a6218=_0x393b22[_0x347a5f(0x1a8)](_0x5f24dd=>_0x5f24dd<=_0x13a5da)['length']/_0x393b22['length']);let _0xafd7ce,_0x3967e3;if(_0x2a6218<0.25)_0xafd7ce=_0x347a5f(0x1a3),_0x3967e3={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x2a6218<0.75?(_0xafd7ce='normal',_0x3967e3={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0xafd7ce=_0x347a5f(0x1f5),_0x3967e3={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0xafd7ce,'params':_0x3967e3};}[_0x275bdf(0x1e3)](_0x3d3675,_0x3f3991=0xe){const _0x35f08a=_0x275bdf;if(_0x3d3675['length']<_0x3f3991+0x1)return 2.5;const _0x440100=[];for(let _0x59092a=_0x3d3675['length']-_0x3f3991;_0x59092a<_0x3d3675[_0x35f08a(0x1d5)];_0x59092a++){const _0x400418=_0x3d3675[_0x59092a],_0x4ce7e3=_0x3d3675[_0x59092a-0x1]['close'],_0x2e7f14=Math['max'](_0x400418[_0x35f08a(0x1f5)]-_0x400418[_0x35f08a(0x1a3)],Math[_0x35f08a(0x1db)](_0x400418[_0x35f08a(0x1f5)]-_0x4ce7e3),Math['abs'](_0x400418[_0x35f08a(0x1a3)]-_0x4ce7e3));_0x440100[_0x35f08a(0x1b4)](_0x2e7f14);}return _0x440100['reduce']((_0x4a9bc6,_0x6a357c)=>_0x4a9bc6+_0x6a357c,0x0)/_0x440100['length'];}[_0x275bdf(0x1ee)](_0x41b8db){const _0x3a3d3b=_0x275bdf;if(_0x41b8db[_0x3a3d3b(0x1d5)]<this[_0x3a3d3b(0x1c3)])return 0x0;const _0xc9df0c=_0x41b8db[_0x3a3d3b(0x1d8)](-this[_0x3a3d3b(0x1c3)]);let _0x386de4=0x0,_0x6882a1=0x0;for(const _0x4d79b1 of _0xc9df0c){const _0x376a32=_0x4d79b1[_0x3a3d3b(0x1f5)]-_0x4d79b1[_0x3a3d3b(0x1a3)];if(_0x376a32>0x0){const _0x4602ac=(_0x4d79b1[_0x3a3d3b(0x1e2)]-_0x4d79b1[_0x3a3d3b(0x1a3)])/_0x376a32;_0x386de4+=_0x4602ac*_0x4d79b1['volume'],_0x6882a1+=(0x1-_0x4602ac)*_0x4d79b1[_0x3a3d3b(0x1b6)];}}const _0xe68b51=_0x386de4+_0x6882a1;if(_0xe68b51<0x1)return 0x0;return(_0x386de4-_0x6882a1)/_0xe68b51;}[_0x275bdf(0x19c)](_0x8b4fcb,_0x5b54e2,_0x5c8341,_0x2de9c5,_0x52f8fb,_0x4aefcf,_0x21db8d,_0x31c88e,_0x34503b,_0xec9d9d){const _0x2331f1=_0x275bdf,_0x343e70=Math[_0x2331f1(0x1db)](_0x5c8341);if(_0x343e70<_0x31c88e[_0x2331f1(0x1de)])return null;if(_0x2de9c5>this['vpinToxicThreshold'])return null;let _0x340b41;if(_0x5c8341<-_0x31c88e['zscoreThreshold'])_0x340b41=_0x2331f1(0x1ca);else{if(_0x5c8341>_0x31c88e['zscoreThreshold'])_0x340b41='short';else return null;}const _0x28e223=_0x340b41===_0x2331f1(0x1ca)&&_0x34503b>0.1||_0x340b41===_0x2331f1(0x1e6)&&_0x34503b<-0.1,_0x5cbb95=_0x5b54e2-_0x4aefcf,_0x275b54=_0x340b41==='long'&&_0x5cbb95<0x0||_0x340b41==='short'&&_0x5cbb95>0x0,_0x18c5dc={'zscore':Math['min'](0x1,_0x343e70/0x4),'vpin':0x1-_0x2de9c5,'kyleLambda':_0x52f8fb>0.001?0.5:0.8,'kalman':_0x275b54?0.8:0.4,'volatility':_0x21db8d===_0x2331f1(0x19a)?0.8:_0x21db8d===_0x2331f1(0x1a3)?0.7:0.6,'ofi':_0x28e223?0.9:0.5,'composite':0x0};_0x18c5dc[_0x2331f1(0x1d6)]=_0x18c5dc['zscore']*this['weights']['zscore']+_0x18c5dc[_0x2331f1(0x19e)]*this[_0x2331f1(0x1b5)][_0x2331f1(0x19e)]+_0x18c5dc['kyleLambda']*this['weights']['kyleLambda']+_0x18c5dc['kalman']*this[_0x2331f1(0x1b5)][_0x2331f1(0x1e7)]+_0x18c5dc[_0x2331f1(0x1a9)]*this['weights']['volatility']+_0x18c5dc[_0x2331f1(0x1a5)]*this['weights'][_0x2331f1(0x1a5)];const _0x5eb783=Math['min'](0x1,_0x18c5dc[_0x2331f1(0x1d6)]+_0x31c88e['confidenceBonus']);if(_0x5eb783<this[_0x2331f1(0x1ad)])return null;if(Date[_0x2331f1(0x1d1)]()-this[_0x2331f1(0x19b)]<this['cooldownMs'])return null;const _0x3e1a3d=Math['round'](this[_0x2331f1(0x1ea)]*_0x31c88e['stopMultiplier']),_0x3cacb9=Math['round'](this[_0x2331f1(0x1ef)]*_0x31c88e['targetMultiplier']),_0x23c738=Math['max'](0x6,Math[_0x2331f1(0x1e8)](0xc,_0x3e1a3d)),_0x5a6a9a=Math[_0x2331f1(0x196)](_0x23c738*1.5,Math['min'](0x18,_0x3cacb9));let _0x1e7eb4,_0x293aa6,_0x3bc9dd,_0x3a8f1b;_0x340b41==='long'?(_0x1e7eb4=_0x5b54e2-_0x23c738*this[_0x2331f1(0x1f6)],_0x293aa6=_0x5b54e2+_0x5a6a9a*this['tickSize'],_0x3bc9dd=_0x5b54e2+this['breakevenTicks']*this[_0x2331f1(0x1f6)],_0x3a8f1b=_0x5b54e2+_0x5a6a9a*this[_0x2331f1(0x1c7)]*this[_0x2331f1(0x1f6)]):(_0x1e7eb4=_0x5b54e2+_0x23c738*this[_0x2331f1(0x1f6)],_0x293aa6=_0x5b54e2-_0x5a6a9a*this[_0x2331f1(0x1f6)],_0x3bc9dd=_0x5b54e2-this[_0x2331f1(0x1be)]*this['tickSize'],_0x3a8f1b=_0x5b54e2-_0x5a6a9a*this['profitLockPct']*this[_0x2331f1(0x1f6)]);const _0x4cf6ad=_0x5a6a9a/_0x23c738,_0x331e02=Math[_0x2331f1(0x1cc)](_0x5a6a9a*0.5),_0x11cd72=Math[_0x2331f1(0x1cc)](_0x23c738*0.4);let _0x20b83a=SignalStrength['MODERATE'];if(_0x5eb783>=0.85)_0x20b83a=SignalStrength['VERY_STRONG'];else{if(_0x5eb783>=0.75)_0x20b83a=SignalStrength[_0x2331f1(0x19f)];else{if(_0x5eb783<0.6)_0x20b83a=SignalStrength['WEAK'];}}const _0x2ed6d2=0.5+(_0x5eb783-0.5)*0.4,_0x5d523c=_0x2ed6d2*Math['abs'](_0x293aa6-_0x5b54e2)-(0x1-_0x2ed6d2)*Math[_0x2331f1(0x1db)](_0x5b54e2-_0x1e7eb4);this['lastSignalTime']=Date[_0x2331f1(0x1d1)](),this[_0x2331f1(0x1d2)][_0x2331f1(0x1fe)]++;const _0x1fc139={'id':uuidv4(),'timestamp':Date[_0x2331f1(0x1d1)](),'symbol':_0x8b4fcb[_0x2331f1(0x19d)]('.')[0x0]||_0x8b4fcb,'contractId':_0x8b4fcb,'side':_0x340b41===_0x2331f1(0x1ca)?OrderSide[_0x2331f1(0x1af)]:OrderSide['ASK'],'direction':_0x340b41,'strategy':'HQX_ULTRA_SCALPING_6MODELS','strength':_0x20b83a,'edge':_0x5d523c,'confidence':_0x5eb783,'entry':_0x5b54e2,'entryPrice':_0x5b54e2,'stopLoss':_0x1e7eb4,'takeProfit':_0x293aa6,'riskReward':_0x4cf6ad,'stopTicks':_0x23c738,'targetTicks':_0x5a6a9a,'trailTriggerTicks':_0x331e02,'trailDistanceTicks':_0x11cd72,'beBreakeven':_0x3bc9dd,'profitLockLevel':_0x3a8f1b,'zScore':_0x5c8341,'zScoreExit':this[_0x2331f1(0x1d7)],'vpinValue':_0x2de9c5,'kyleLambda':_0x52f8fb,'kalmanEstimate':_0x4aefcf,'volatilityRegime':_0x21db8d,'ofiValue':_0x34503b,'models':_0x18c5dc,'orderFlowConfirmed':_0x28e223,'kalmanConfirmed':_0x275b54,'expires':Date[_0x2331f1(0x1d1)]()+0xea60};return this['emit'](_0x2331f1(0x199),{'side':_0x340b41==='long'?'buy':'sell','action':_0x2331f1(0x1b7),'reason':'Z='+_0x5c8341['toFixed'](0x2)+',\x20VPIN='+(_0x2de9c5*0x64)[_0x2331f1(0x1e4)](0x0)+'%,\x20OFI='+(_0x34503b*0x64)['toFixed'](0x0)+_0x2331f1(0x1e9)+(_0x5eb783*0x64)['toFixed'](0x0)+'%',..._0x1fc139}),this[_0x2331f1(0x1f9)]('log',{'type':'info','message':'[HQX]\x20SIGNAL:\x20'+_0x340b41['toUpperCase']()+'\x20@\x20'+_0x5b54e2['toFixed'](0x2)+_0x2331f1(0x1ac)+_0x5c8341[_0x2331f1(0x1e4)](0x2)+'\x20VPIN:'+(_0x2de9c5*0x64)['toFixed'](0x0)+_0x2331f1(0x1a1)+(_0x34503b*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x52f8fb[_0x2331f1(0x1e4)](0x5)+_0x2331f1(0x1f0)+_0x21db8d+'\x20|\x20Conf:'+(_0x5eb783*0x64)[_0x2331f1(0x1e4)](0x0)+'%'}),_0x1fc139;}['shouldExitByZScore'](_0x2e5a58){const _0x992f55=_0x275bdf,_0x3ce184=this[_0x992f55(0x1ce)]['get'](_0x2e5a58);if(!_0x3ce184||_0x3ce184['length']<0x32)return![];const _0x546aff=this[_0x992f55(0x1fd)](_0x3ce184);return Math[_0x992f55(0x1db)](_0x546aff)<this[_0x992f55(0x1d7)];}[_0x275bdf(0x1df)](_0x27d81d){const _0x262711=_0x275bdf,_0x38d417=this[_0x262711(0x1ce)][_0x262711(0x1c6)](_0x27d81d),_0x54a280=this['volumeBuffer'][_0x262711(0x1c6)](_0x27d81d),_0x38eba1=this['barHistory'][_0x262711(0x1c6)](_0x27d81d);if(!_0x38d417||!_0x54a280||!_0x38eba1||_0x38eba1['length']<0x32)return null;const _0x5ca5a3=this[_0x262711(0x1fd)](_0x38d417),_0x3a922f=this['_computeVPIN'](_0x54a280),_0x31c01d=this[_0x262711(0x1c4)](_0x38eba1),_0x22cd1f=this[_0x262711(0x1ee)](_0x38eba1);return{'zscore':Math[_0x262711(0x1e8)](0x1,Math['abs'](_0x5ca5a3)/0x4),'vpin':0x1-_0x3a922f,'kyleLambda':_0x31c01d>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math['abs'](_0x22cd1f)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x5ca5a3,'vpin':_0x3a922f,'kyleLambda':_0x31c01d,'ofi':_0x22cd1f}};}[_0x275bdf(0x1b3)](_0x6e62d2,_0xe9fe13){const _0x1439bd=_0x275bdf,_0x4b9c91=this['barHistory']['get'](_0x6e62d2)||[];if(_0x4b9c91[_0x1439bd(0x1d5)]<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x4b9c91['length']+'/50\x20bars'};const _0x11bb1e=this[_0x1439bd(0x1ce)][_0x1439bd(0x1c6)](_0x6e62d2)||[],_0x523cca=this['volumeBuffer'][_0x1439bd(0x1c6)](_0x6e62d2)||[],_0x36e2b7=this[_0x1439bd(0x1fd)](_0x11bb1e),_0x366c2a=this['_computeVPIN'](_0x523cca),_0x19815c=this[_0x1439bd(0x1ee)](_0x4b9c91),_0x30726a=this[_0x1439bd(0x1c4)](_0x4b9c91),{regime:_0x1cbbe7,params:_0x35a1c7}=this[_0x1439bd(0x1f2)](_0x6e62d2,_0x4b9c91);return{'ready':!![],'zScore':_0x36e2b7,'vpin':_0x366c2a,'ofi':_0x19815c,'kyleLambda':_0x30726a,'regime':_0x1cbbe7,'stopTicks':Math['round'](this[_0x1439bd(0x1ea)]*_0x35a1c7[_0x1439bd(0x1a6)]),'targetTicks':Math['round'](this[_0x1439bd(0x1ef)]*_0x35a1c7['targetMultiplier']),'threshold':_0x35a1c7[_0x1439bd(0x1de)],'barsProcessed':_0x4b9c91['length'],'models':_0x1439bd(0x1bd)};}[_0x275bdf(0x1a7)](_0x41fb15){const _0x2fca78=_0x275bdf;this[_0x2fca78(0x1e1)]['push']({'netPnl':_0x41fb15,'timestamp':Date['now']()});if(this[_0x2fca78(0x1e1)]['length']>0x64)this[_0x2fca78(0x1e1)]['shift']();_0x41fb15>0x0?(this['winStreak']++,this['lossStreak']=0x0,this['stats']['wins']++):(this[_0x2fca78(0x1d9)]++,this['winStreak']=0x0,this[_0x2fca78(0x1d2)]['losses']++),this[_0x2fca78(0x1d2)][_0x2fca78(0x1ba)]++,this[_0x2fca78(0x1d2)][_0x2fca78(0x1fc)]+=_0x41fb15,this[_0x2fca78(0x1f9)]('log',{'type':_0x2fca78(0x1f7),'message':_0x2fca78(0x1ae)+(_0x41fb15>0x0?_0x2fca78(0x1ec):_0x2fca78(0x1a4))+'\x20$'+_0x41fb15['toFixed'](0x2)+_0x2fca78(0x1dd)+(_0x41fb15>0x0?this[_0x2fca78(0x1c1)]:-this[_0x2fca78(0x1d9)])});}[_0x275bdf(0x198)](_0x2ba891){const _0x48d2c5=_0x275bdf;return this[_0x48d2c5(0x1a0)][_0x48d2c5(0x1c6)](_0x2ba891)||[];}['getStats'](){return this['stats'];}[_0x275bdf(0x1f1)](_0x1d98b9){const _0x6e6981=_0x275bdf;this['barHistory'][_0x6e6981(0x1f8)](_0x1d98b9,[]),this['priceBuffer']['set'](_0x1d98b9,[]),this[_0x6e6981(0x1bf)][_0x6e6981(0x1f8)](_0x1d98b9,[]),this[_0x6e6981(0x1d0)]['set'](_0x1d98b9,[]),this['kalmanStates']['set'](_0x1d98b9,{'estimate':0x0,'errorCovariance':0x1}),this[_0x6e6981(0x1f9)](_0x6e6981(0x1b0),{'type':_0x6e6981(0x1fb),'message':_0x6e6981(0x1c2)+_0x1d98b9});}}function _0xa6d2(){const _0x4e9718=['symbol','round','shift','priceBuffer','kalmanStates','atrHistory','now','stats','5CcVNKv','18iDmliM','length','composite','zscoreExitThreshold','slice','lossStreak','getStats','abs','processTick',',\x20streak:\x20','zscoreThreshold','getModelValues','reduce','recentTrades','close','_calculateATR','toFixed','3181592FrfQqz','short','kalman','min','%,\x20cf=','baseStopTicks','generateSignal','WIN','minHoldTimeMs','_computeOrderFlowImbalance','baseTargetTicks','\x20Regime:','reset','_detectVolatilityRegime','exports','11dKOmXe','high','tickSize','debug','set','emit','195882uiVDca','info','pnl','_computeZScore','signals','kalmanMeasurementNoise','1UPHnHB','max','strategy','getBarHistory','signal','normal','lastSignalTime','_generateSignal','split','vpin','STRONG','barHistory','%\x20OFI:','initialize','low','LOSS','ofi','stopMultiplier','recordTradeResult','filter','volatility','kalmanProcessNoise','shouldExitByZScore','\x20|\x20Z:','minConfidence','[HQX]\x20Trade\x20result:\x20','BID','log','tickValue','pow','getAnalysisState','push','weights','volume','open','events','processBar','trades','7114542uHXgvK','onTick','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','breakevenTicks','volumeBuffer','13662610fDllqS','winStreak','[HQX-UltraScalping]\x20Reset\x20state\x20for\x20','ofiLookback','_computeKyleLambda','2831444QVPgou','get','profitLockPct','3878686jPBuHj','758502LIyzZV','long'];_0xa6d2=function(){return _0x4e9718;};return _0xa6d2();}class UltraScalpingStrategy extends EventEmitter{constructor(_0x56aefd={}){const _0x5481b7=_0x275bdf;super(),this['config']=_0x56aefd,this['strategy']=new HQXUltraScalping(_0x56aefd),this[_0x5481b7(0x197)]['on'](_0x5481b7(0x199),_0x46d639=>this['emit'](_0x5481b7(0x199),_0x46d639)),this[_0x5481b7(0x197)]['on']('log',_0x142be6=>this['emit']('log',_0x142be6));}[_0x275bdf(0x1dc)](_0x18d014){const _0x486b23=_0x275bdf;return this[_0x486b23(0x197)][_0x486b23(0x1dc)](_0x18d014);}['onTick'](_0x46ca3a){return this['strategy']['onTick'](_0x46ca3a);}['onTrade'](_0x3e3fe9){return this['strategy']['onTrade'](_0x3e3fe9);}['processBar'](_0x2ef801,_0x56e216){const _0x4f3e9d=_0x275bdf;return this['strategy'][_0x4f3e9d(0x1b9)](_0x2ef801,_0x56e216);}[_0x275bdf(0x1a2)](_0x41399e,_0x4b72c2,_0x5836f0){const _0x5023ee=_0x275bdf;return this['strategy'][_0x5023ee(0x1a2)](_0x41399e,_0x4b72c2,_0x5836f0);}['getAnalysisState'](_0x122857,_0x264f13){const _0x511b37=_0x275bdf;return this[_0x511b37(0x197)][_0x511b37(0x1b3)](_0x122857,_0x264f13);}[_0x275bdf(0x1a7)](_0x3a8798){const _0x415e87=_0x275bdf;return this['strategy'][_0x415e87(0x1a7)](_0x3a8798);}['reset'](_0x55d5bc){const _0x57f4db=_0x275bdf;return this['strategy'][_0x57f4db(0x1f1)](_0x55d5bc);}[_0x275bdf(0x1da)](){return this['strategy']['getStats']();}['getBarHistory'](_0x1f443a){return this['strategy']['getBarHistory'](_0x1f443a);}['getModelValues'](_0x13b908){const _0x93d1ba=_0x275bdf;return this[_0x93d1ba(0x197)]['getModelValues'](_0x13b908);}['shouldExitByZScore'](_0x4f3d0c){const _0x820e1f=_0x275bdf;return this['strategy'][_0x820e1f(0x1ab)](_0x4f3d0c);}[_0x275bdf(0x1eb)](_0x5e075e){return null;}}module[_0x275bdf(0x1f3)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
|
|
1
|
+
const _0x574846=_0x2aaf;(function(_0x49e593,_0xd5bbb){const _0x182fe8=_0x2aaf,_0x5e247b=_0x49e593();while(!![]){try{const _0x23b4df=-parseInt(_0x182fe8(0xff))/0x1+parseInt(_0x182fe8(0x128))/0x2+parseInt(_0x182fe8(0x129))/0x3*(parseInt(_0x182fe8(0xe1))/0x4)+parseInt(_0x182fe8(0x125))/0x5*(-parseInt(_0x182fe8(0x110))/0x6)+-parseInt(_0x182fe8(0xdc))/0x7+parseInt(_0x182fe8(0x10d))/0x8*(-parseInt(_0x182fe8(0xed))/0x9)+parseInt(_0x182fe8(0xf7))/0xa;if(_0x23b4df===_0xd5bbb)break;else _0x5e247b['push'](_0x5e247b['shift']());}catch(_0x43e1e5){_0x5e247b['push'](_0x5e247b['shift']());}}}(_0xe7f5,0xd3cce));const EventEmitter=require('events'),{v4:uuidv4}=require(_0x574846(0x11f)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x9c23af={}){const _0x432530=_0x574846;super(),this['tickSize']=_0x9c23af[_0x432530(0x107)]||0.25,this[_0x432530(0xfe)]=_0x9c23af[_0x432530(0xfe)]||0x5,this['zscoreEntryThreshold']=1.5,this['zscoreExitThreshold']=0.5,this[_0x432530(0x139)]=0x32,this[_0x432530(0x113)]=0.7,this['kalmanProcessNoise']=0.01,this[_0x432530(0xd4)]=0.1,this[_0x432530(0x10e)]=0x64,this[_0x432530(0x12c)]=0x14,this['baseStopTicks']=0x8,this[_0x432530(0xe9)]=0x10,this[_0x432530(0x127)]=0x4,this[_0x432530(0x105)]=0.5,this['minConfidence']=0.55,this['weights']={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x432530(0x12a)]=new Map(),this[_0x432530(0x114)]=new Map(),this[_0x432530(0xf0)]=new Map(),this[_0x432530(0xfc)]=new Map(),this[_0x432530(0x133)]=new Map(),this[_0x432530(0x104)]=[],this['winStreak']=0x0,this[_0x432530(0xf1)]=0x0,this['lastSignalTime']=0x0,this['cooldownMs']=0x7530,this[_0x432530(0x10c)]=0x2710,this['stats']={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x574846(0xfb)](_0x38e8a5,_0x5cce21=0.25,_0x44bd84=0x5){const _0x121888=_0x574846;this[_0x121888(0x107)]=_0x5cce21,this[_0x121888(0xfe)]=_0x44bd84,this['barHistory']['set'](_0x38e8a5,[]),this['priceBuffer']['set'](_0x38e8a5,[]),this['volumeBuffer'][_0x121888(0xe8)](_0x38e8a5,[]),this[_0x121888(0x133)]['set'](_0x38e8a5,[]),this[_0x121888(0xfc)]['set'](_0x38e8a5,{'estimate':0x0,'errorCovariance':0x1}),this['emit']('log',{'type':'info','message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x38e8a5+':\x20tick='+_0x5cce21+',\x20value='+_0x44bd84}),this[_0x121888(0x10f)](_0x121888(0xd3),{'type':'info','message':_0x121888(0x108)});}['processTick'](_0x9c374b){const {contractId:_0x26ec77,price:_0x1b2788,volume:_0x436bc4,side:_0xe1a0c2,timestamp:_0x1291a}=_0x9c374b,_0x30675d={'timestamp':_0x1291a||Date['now'](),'open':_0x1b2788,'high':_0x1b2788,'low':_0x1b2788,'close':_0x1b2788,'volume':_0x436bc4||0x1};return this['processBar'](_0x26ec77,_0x30675d);}[_0x574846(0x112)](_0x1b2861){return this['processTick'](_0x1b2861);}[_0x574846(0xca)](_0x48622c){const _0x587e37=_0x574846;return this['processTick']({'contractId':_0x48622c['contractId']||_0x48622c[_0x587e37(0xe2)],'price':_0x48622c['price'],'volume':_0x48622c['size']||_0x48622c['volume']||0x1,'side':_0x48622c[_0x587e37(0x134)],'timestamp':_0x48622c['timestamp']||Date['now']()});}[_0x574846(0x124)](_0x5d48ab,_0xd1cc00){const _0x5a96d6=_0x574846;let _0x4f7b92=this[_0x5a96d6(0x12a)][_0x5a96d6(0xe4)](_0x5d48ab);!_0x4f7b92&&(this['initialize'](_0x5d48ab),_0x4f7b92=this['barHistory']['get'](_0x5d48ab));_0x4f7b92['push'](_0xd1cc00);if(_0x4f7b92['length']>0x1f4)_0x4f7b92[_0x5a96d6(0x12b)]();const _0x200bf8=this[_0x5a96d6(0x114)][_0x5a96d6(0xe4)](_0x5d48ab);_0x200bf8['push'](_0xd1cc00['close']);if(_0x200bf8['length']>0xc8)_0x200bf8[_0x5a96d6(0x12b)]();const _0x193680=this['volumeBuffer']['get'](_0x5d48ab),_0x3d7e50=_0xd1cc00[_0x5a96d6(0x13c)]-_0xd1cc00['low'];let _0x4d6ede=_0xd1cc00['volume']*0.5,_0x5a71cf=_0xd1cc00['volume']*0.5;if(_0x3d7e50>0x0){const _0x54faf3=(_0xd1cc00['close']-_0xd1cc00['low'])/_0x3d7e50;_0x4d6ede=_0xd1cc00['volume']*_0x54faf3,_0x5a71cf=_0xd1cc00['volume']*(0x1-_0x54faf3);}_0x193680['push']({'buy':_0x4d6ede,'sell':_0x5a71cf});if(_0x193680['length']>0x64)_0x193680[_0x5a96d6(0x12b)]();if(_0x4f7b92['length']<0x32)return null;const _0x1ab3c8=this[_0x5a96d6(0x135)](_0x200bf8),_0x344bb6=this['_computeVPIN'](_0x193680),_0x3688b9=this[_0x5a96d6(0xd8)](_0x4f7b92),_0x22674c=this[_0x5a96d6(0xeb)](_0x5d48ab,_0xd1cc00[_0x5a96d6(0x126)]),{regime:_0x1cc967,params:_0x243671}=this['_detectVolatilityRegime'](_0x5d48ab,_0x4f7b92),_0x4e1878=this[_0x5a96d6(0x13b)](_0x4f7b92);return this[_0x5a96d6(0x123)](_0x5d48ab,_0xd1cc00[_0x5a96d6(0x126)],_0x1ab3c8,_0x344bb6,_0x3688b9,_0x22674c,_0x1cc967,_0x243671,_0x4e1878,_0x4f7b92);}[_0x574846(0x135)](_0xa3f93c,_0x1d860e=0x32){const _0x58e785=_0x574846;if(_0xa3f93c['length']<_0x1d860e)return 0x0;const _0x45082a=_0xa3f93c['slice'](-_0x1d860e),_0x254da2=_0x45082a['reduce']((_0x81a4e,_0x139b3d)=>_0x81a4e+_0x139b3d,0x0)/_0x1d860e,_0x8d6240=_0x45082a['reduce']((_0x361a69,_0x3c67fa)=>_0x361a69+Math['pow'](_0x3c67fa-_0x254da2,0x2),0x0)/_0x1d860e,_0x4a88fc=Math['sqrt'](_0x8d6240);if(_0x4a88fc<0.0001)return 0x0;const _0x2b6c7a=_0xa3f93c[_0xa3f93c[_0x58e785(0x12e)]-0x1];return(_0x2b6c7a-_0x254da2)/_0x4a88fc;}[_0x574846(0xef)](_0x5634bc){const _0x1d3160=_0x574846;if(_0x5634bc['length']<this[_0x1d3160(0x139)])return 0.5;const _0x54fbba=_0x5634bc[_0x1d3160(0x103)](-this[_0x1d3160(0x139)]);let _0x39d73a=0x0,_0x5f1e4f=0x0;for(const _0x5a670c of _0x54fbba){_0x39d73a+=_0x5a670c[_0x1d3160(0x117)],_0x5f1e4f+=_0x5a670c[_0x1d3160(0xd5)];}const _0x265bda=_0x39d73a+_0x5f1e4f;if(_0x265bda<0x1)return 0.5;return Math[_0x1d3160(0x131)](_0x39d73a-_0x5f1e4f)/_0x265bda;}['_computeKyleLambda'](_0x269d9a){const _0xe98788=_0x574846;if(_0x269d9a[_0xe98788(0x12e)]<0x14)return 0x0;const _0x1ce777=_0x269d9a['slice'](-0x14),_0x53a419=[],_0x45b0f6=[];for(let _0xc055f4=0x1;_0xc055f4<_0x1ce777['length'];_0xc055f4++){_0x53a419[_0xe98788(0x13d)](_0x1ce777[_0xc055f4][_0xe98788(0x126)]-_0x1ce777[_0xc055f4-0x1][_0xe98788(0x126)]),_0x45b0f6['push'](_0x1ce777[_0xc055f4]['volume']);}const _0x40b11c=_0x53a419['reduce']((_0x4362aa,_0x1c4b29)=>_0x4362aa+_0x1c4b29,0x0)/_0x53a419[_0xe98788(0x12e)],_0x23968f=_0x45b0f6[_0xe98788(0x100)]((_0x4889a3,_0x12c82c)=>_0x4889a3+_0x12c82c,0x0)/_0x45b0f6['length'];let _0x18c8e6=0x0,_0x469826=0x0;for(let _0x5d474b=0x0;_0x5d474b<_0x53a419['length'];_0x5d474b++){_0x18c8e6+=(_0x53a419[_0x5d474b]-_0x40b11c)*(_0x45b0f6[_0x5d474b]-_0x23968f),_0x469826+=Math['pow'](_0x45b0f6[_0x5d474b]-_0x23968f,0x2);}_0x18c8e6/=_0x53a419[_0xe98788(0x12e)],_0x469826/=_0x53a419[_0xe98788(0x12e)];if(_0x469826<0.0001)return 0x0;return Math['abs'](_0x18c8e6/_0x469826);}['_applyKalmanFilter'](_0x2b387e,_0x2bc328){const _0x413d6b=_0x574846;let _0x2e2fcc=this[_0x413d6b(0xfc)][_0x413d6b(0xe4)](_0x2b387e);if(!_0x2e2fcc)return _0x2e2fcc={'estimate':_0x2bc328,'errorCovariance':0x1},this[_0x413d6b(0xfc)]['set'](_0x2b387e,_0x2e2fcc),_0x2bc328;const _0xa07f3f=_0x2e2fcc[_0x413d6b(0x118)],_0x1a058f=_0x2e2fcc[_0x413d6b(0xdb)]+this['kalmanProcessNoise'],_0x244f8f=_0x1a058f/(_0x1a058f+this['kalmanMeasurementNoise']),_0x49b399=_0xa07f3f+_0x244f8f*(_0x2bc328-_0xa07f3f),_0x42a81f=(0x1-_0x244f8f)*_0x1a058f;return _0x2e2fcc[_0x413d6b(0x118)]=_0x49b399,_0x2e2fcc[_0x413d6b(0xdb)]=_0x42a81f,_0x49b399;}[_0x574846(0xf5)](_0x485353,_0x847e1f){const _0x28601d=_0x574846,_0x21251b=this['_calculateATR'](_0x847e1f),_0x36c4a8=_0x21251b/this[_0x28601d(0x107)];let _0x48142c=this[_0x28601d(0x133)]['get'](_0x485353);!_0x48142c&&(_0x48142c=[],this[_0x28601d(0x133)]['set'](_0x485353,_0x48142c));_0x48142c['push'](_0x21251b);if(_0x48142c['length']>0x1f4)_0x48142c['shift']();let _0x19d7a7=0.5;_0x48142c[_0x28601d(0x12e)]>=0x14&&(_0x19d7a7=_0x48142c['filter'](_0x3cb265=>_0x3cb265<=_0x21251b)['length']/_0x48142c[_0x28601d(0x12e)]);let _0x56f354,_0x2462d6;if(_0x19d7a7<0.25)_0x56f354=_0x28601d(0x116),_0x2462d6={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x19d7a7<0.75?(_0x56f354='normal',_0x2462d6={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x56f354=_0x28601d(0x13c),_0x2462d6={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x56f354,'params':_0x2462d6};}[_0x574846(0xdd)](_0xc3530b,_0x253793=0xe){const _0x1d74c4=_0x574846;if(_0xc3530b['length']<_0x253793+0x1)return 2.5;const _0x4cdb65=[];for(let _0x2ac401=_0xc3530b['length']-_0x253793;_0x2ac401<_0xc3530b[_0x1d74c4(0x12e)];_0x2ac401++){const _0x10ee9d=_0xc3530b[_0x2ac401],_0xbc0bde=_0xc3530b[_0x2ac401-0x1]['close'],_0x4756d9=Math[_0x1d74c4(0x120)](_0x10ee9d['high']-_0x10ee9d['low'],Math['abs'](_0x10ee9d[_0x1d74c4(0x13c)]-_0xbc0bde),Math[_0x1d74c4(0x131)](_0x10ee9d['low']-_0xbc0bde));_0x4cdb65['push'](_0x4756d9);}return _0x4cdb65['reduce']((_0x5dcc67,_0x200f65)=>_0x5dcc67+_0x200f65,0x0)/_0x4cdb65[_0x1d74c4(0x12e)];}[_0x574846(0x13b)](_0x17e29e){const _0x3242e2=_0x574846;if(_0x17e29e['length']<this[_0x3242e2(0x12c)])return 0x0;const _0x2da2cf=_0x17e29e['slice'](-this['ofiLookback']);let _0x41367e=0x0,_0x19fb67=0x0;for(const _0x560317 of _0x2da2cf){const _0xb266a2=_0x560317[_0x3242e2(0x13c)]-_0x560317['low'];if(_0xb266a2>0x0){const _0xee5fef=(_0x560317[_0x3242e2(0x126)]-_0x560317['low'])/_0xb266a2;_0x41367e+=_0xee5fef*_0x560317['volume'],_0x19fb67+=(0x1-_0xee5fef)*_0x560317[_0x3242e2(0xf4)];}}const _0x463757=_0x41367e+_0x19fb67;if(_0x463757<0x1)return 0x0;return(_0x41367e-_0x19fb67)/_0x463757;}['_generateSignal'](_0x299b56,_0xd9305d,_0x105389,_0x2fdbf2,_0x1c07b7,_0x34c8eb,_0x549d83,_0x356b4d,_0x2c5fdc,_0xdd26bb){const _0x52a91c=_0x574846,_0x5dcd9b=Math['abs'](_0x105389);if(_0x5dcd9b<_0x356b4d['zscoreThreshold'])return null;if(_0x2fdbf2>this[_0x52a91c(0x113)])return null;let _0x1c0923;if(_0x105389<-_0x356b4d[_0x52a91c(0x12f)])_0x1c0923=_0x52a91c(0xf3);else{if(_0x105389>_0x356b4d['zscoreThreshold'])_0x1c0923=_0x52a91c(0x13e);else return null;}const _0x5de0e9=_0x1c0923==='long'&&_0x2c5fdc>0.1||_0x1c0923===_0x52a91c(0x13e)&&_0x2c5fdc<-0.1,_0x3b8551=_0xd9305d-_0x34c8eb,_0x129719=_0x1c0923===_0x52a91c(0xf3)&&_0x3b8551<0x0||_0x1c0923===_0x52a91c(0x13e)&&_0x3b8551>0x0,_0x51ee42={'zscore':Math['min'](0x1,_0x5dcd9b/0x4),'vpin':0x1-_0x2fdbf2,'kyleLambda':_0x1c07b7>0.001?0.5:0.8,'kalman':_0x129719?0.8:0.4,'volatility':_0x549d83==='normal'?0.8:_0x549d83===_0x52a91c(0x116)?0.7:0.6,'ofi':_0x5de0e9?0.9:0.5,'composite':0x0};_0x51ee42[_0x52a91c(0xd0)]=_0x51ee42[_0x52a91c(0x115)]*this['weights']['zscore']+_0x51ee42['vpin']*this[_0x52a91c(0x119)][_0x52a91c(0x11b)]+_0x51ee42['kyleLambda']*this['weights']['kyleLambda']+_0x51ee42['kalman']*this[_0x52a91c(0x119)][_0x52a91c(0xee)]+_0x51ee42[_0x52a91c(0x11c)]*this[_0x52a91c(0x119)][_0x52a91c(0x11c)]+_0x51ee42[_0x52a91c(0x136)]*this['weights'][_0x52a91c(0x136)];const _0x5830d2=Math['min'](0x1,_0x51ee42[_0x52a91c(0xd0)]+_0x356b4d[_0x52a91c(0x11e)]);if(_0x5830d2<this[_0x52a91c(0xf8)])return null;if(Date[_0x52a91c(0x130)]()-this[_0x52a91c(0xcb)]<this[_0x52a91c(0xd6)])return null;const _0x350f08=Math[_0x52a91c(0xe0)](this['baseStopTicks']*_0x356b4d['stopMultiplier']),_0x1087e5=Math[_0x52a91c(0xe0)](this[_0x52a91c(0xe9)]*_0x356b4d['targetMultiplier']),_0x1c7235=Math[_0x52a91c(0x120)](0x6,Math['min'](0xc,_0x350f08)),_0x13969a=Math['max'](_0x1c7235*1.5,Math[_0x52a91c(0xd9)](0x18,_0x1087e5));let _0x3af560,_0x2f2c2a,_0x1bea8a,_0x2bd835;_0x1c0923==='long'?(_0x3af560=_0xd9305d-_0x1c7235*this['tickSize'],_0x2f2c2a=_0xd9305d+_0x13969a*this[_0x52a91c(0x107)],_0x1bea8a=_0xd9305d+this[_0x52a91c(0x127)]*this[_0x52a91c(0x107)],_0x2bd835=_0xd9305d+_0x13969a*this[_0x52a91c(0x105)]*this[_0x52a91c(0x107)]):(_0x3af560=_0xd9305d+_0x1c7235*this[_0x52a91c(0x107)],_0x2f2c2a=_0xd9305d-_0x13969a*this['tickSize'],_0x1bea8a=_0xd9305d-this['breakevenTicks']*this['tickSize'],_0x2bd835=_0xd9305d-_0x13969a*this['profitLockPct']*this[_0x52a91c(0x107)]);const _0x48f653=_0x13969a/_0x1c7235,_0xed111b=Math['round'](_0x13969a*0.5),_0x7ff7c7=Math[_0x52a91c(0xe0)](_0x1c7235*0.4);let _0x1372a9=SignalStrength[_0x52a91c(0xe6)];if(_0x5830d2>=0.85)_0x1372a9=SignalStrength['VERY_STRONG'];else{if(_0x5830d2>=0.75)_0x1372a9=SignalStrength['STRONG'];else{if(_0x5830d2<0.6)_0x1372a9=SignalStrength['WEAK'];}}const _0x305edf=0.5+(_0x5830d2-0.5)*0.4,_0xd8415b=_0x305edf*Math[_0x52a91c(0x131)](_0x2f2c2a-_0xd9305d)-(0x1-_0x305edf)*Math['abs'](_0xd9305d-_0x3af560);this[_0x52a91c(0xcb)]=Date['now'](),this[_0x52a91c(0xe5)][_0x52a91c(0x102)]++;const _0x4ce877={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x299b56[_0x52a91c(0x109)]('.')[0x0]||_0x299b56,'contractId':_0x299b56,'side':_0x1c0923===_0x52a91c(0xf3)?OrderSide[_0x52a91c(0x11d)]:OrderSide['ASK'],'direction':_0x1c0923,'strategy':_0x52a91c(0x138),'strength':_0x1372a9,'edge':_0xd8415b,'confidence':_0x5830d2,'entry':_0xd9305d,'entryPrice':_0xd9305d,'stopLoss':_0x3af560,'takeProfit':_0x2f2c2a,'riskReward':_0x48f653,'stopTicks':_0x1c7235,'targetTicks':_0x13969a,'trailTriggerTicks':_0xed111b,'trailDistanceTicks':_0x7ff7c7,'beBreakeven':_0x1bea8a,'profitLockLevel':_0x2bd835,'zScore':_0x105389,'zScoreExit':this[_0x52a91c(0xe7)],'vpinValue':_0x2fdbf2,'kyleLambda':_0x1c07b7,'kalmanEstimate':_0x34c8eb,'volatilityRegime':_0x549d83,'ofiValue':_0x2c5fdc,'models':_0x51ee42,'orderFlowConfirmed':_0x5de0e9,'kalmanConfirmed':_0x129719,'expires':Date['now']()+0xea60};return this['emit']('signal',{'side':_0x1c0923==='long'?_0x52a91c(0x117):_0x52a91c(0xd5),'action':_0x52a91c(0xf6),'reason':'Z='+_0x105389['toFixed'](0x2)+',\x20VPIN='+(_0x2fdbf2*0x64)[_0x52a91c(0xf2)](0x0)+_0x52a91c(0x11a)+(_0x2c5fdc*0x64)[_0x52a91c(0xf2)](0x0)+'%,\x20cf='+(_0x5830d2*0x64)[_0x52a91c(0xf2)](0x0)+'%',..._0x4ce877}),this[_0x52a91c(0x10f)](_0x52a91c(0xd3),{'type':_0x52a91c(0x111),'message':'[HQX]\x20SIGNAL:\x20'+_0x1c0923['toUpperCase']()+'\x20@\x20'+_0xd9305d['toFixed'](0x2)+_0x52a91c(0xf9)+_0x105389[_0x52a91c(0xf2)](0x2)+_0x52a91c(0x12d)+(_0x2fdbf2*0x64)['toFixed'](0x0)+_0x52a91c(0x137)+(_0x2c5fdc*0x64)[_0x52a91c(0xf2)](0x0)+'%\x20Kyle:'+_0x1c07b7[_0x52a91c(0xf2)](0x5)+_0x52a91c(0x10b)+_0x549d83+_0x52a91c(0xcd)+(_0x5830d2*0x64)[_0x52a91c(0xf2)](0x0)+'%'}),_0x4ce877;}['shouldExitByZScore'](_0x1f770a){const _0x4a6d8b=_0x574846,_0x24e074=this[_0x4a6d8b(0x114)][_0x4a6d8b(0xe4)](_0x1f770a);if(!_0x24e074||_0x24e074['length']<0x32)return![];const _0x46e675=this['_computeZScore'](_0x24e074);return Math['abs'](_0x46e675)<this[_0x4a6d8b(0xe7)];}['getModelValues'](_0x562f5f){const _0x351298=_0x574846,_0x108d0f=this['priceBuffer']['get'](_0x562f5f),_0x1e1e36=this[_0x351298(0xf0)][_0x351298(0xe4)](_0x562f5f),_0x45b153=this[_0x351298(0x12a)][_0x351298(0xe4)](_0x562f5f);if(!_0x108d0f||!_0x1e1e36||!_0x45b153||_0x45b153['length']<0x32)return null;const _0x430141=this[_0x351298(0x135)](_0x108d0f),_0x4dd256=this['_computeVPIN'](_0x1e1e36),_0x324aef=this[_0x351298(0xd8)](_0x45b153),_0x334dfa=this[_0x351298(0x13b)](_0x45b153);return{'zscore':Math['min'](0x1,Math['abs'](_0x430141)/0x4),'vpin':0x1-_0x4dd256,'kyleLambda':_0x324aef>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x351298(0x131)](_0x334dfa)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x430141,'vpin':_0x4dd256,'kyleLambda':_0x324aef,'ofi':_0x334dfa}};}[_0x574846(0x121)](_0x4dc27f,_0x23d5b5){const _0x105aad=_0x574846,_0x372e80=this[_0x105aad(0x12a)][_0x105aad(0xe4)](_0x4dc27f)||[];if(_0x372e80['length']<0x32)return{'ready':![],'message':'Collecting\x20data...\x20'+_0x372e80['length']+'/50\x20bars'};const _0x384ca7=this['priceBuffer']['get'](_0x4dc27f)||[],_0x46ee9b=this[_0x105aad(0xf0)][_0x105aad(0xe4)](_0x4dc27f)||[],_0x4a9173=this['_computeZScore'](_0x384ca7),_0x22f635=this[_0x105aad(0xef)](_0x46ee9b),_0x125b68=this[_0x105aad(0x13b)](_0x372e80),_0x4b4e82=this['_computeKyleLambda'](_0x372e80),{regime:_0xcfd5e8,params:_0xa458f9}=this[_0x105aad(0xf5)](_0x4dc27f,_0x372e80);return{'ready':!![],'zScore':_0x4a9173,'vpin':_0x22f635,'ofi':_0x125b68,'kyleLambda':_0x4b4e82,'regime':_0xcfd5e8,'stopTicks':Math[_0x105aad(0xe0)](this[_0x105aad(0xde)]*_0xa458f9[_0x105aad(0xfd)]),'targetTicks':Math[_0x105aad(0xe0)](this['baseTargetTicks']*_0xa458f9[_0x105aad(0x101)]),'threshold':_0xa458f9[_0x105aad(0x12f)],'barsProcessed':_0x372e80['length'],'models':_0x105aad(0xfa)};}[_0x574846(0xda)](_0x3f0c43){const _0x5db666=_0x574846;this['recentTrades']['push']({'netPnl':_0x3f0c43,'timestamp':Date[_0x5db666(0x130)]()});if(this['recentTrades']['length']>0x64)this['recentTrades'][_0x5db666(0x12b)]();_0x3f0c43>0x0?(this['winStreak']++,this[_0x5db666(0xf1)]=0x0,this[_0x5db666(0xe5)]['wins']++):(this[_0x5db666(0xf1)]++,this[_0x5db666(0x13f)]=0x0,this[_0x5db666(0xe5)][_0x5db666(0xcf)]++),this['stats'][_0x5db666(0xd7)]++,this['stats']['pnl']+=_0x3f0c43,this[_0x5db666(0x10f)](_0x5db666(0xd3),{'type':'debug','message':_0x5db666(0xe3)+(_0x3f0c43>0x0?_0x5db666(0xec):_0x5db666(0x13a))+'\x20$'+_0x3f0c43[_0x5db666(0xf2)](0x2)+_0x5db666(0xd2)+(_0x3f0c43>0x0?this[_0x5db666(0x13f)]:-this[_0x5db666(0xf1)])});}[_0x574846(0xea)](_0x52e267){const _0xee4464=_0x574846;return this[_0xee4464(0x12a)]['get'](_0x52e267)||[];}['getStats'](){return this['stats'];}[_0x574846(0xce)](_0x91926d){const _0x97aca9=_0x574846;this[_0x97aca9(0x12a)]['set'](_0x91926d,[]),this['priceBuffer']['set'](_0x91926d,[]),this['volumeBuffer']['set'](_0x91926d,[]),this[_0x97aca9(0x133)][_0x97aca9(0xe8)](_0x91926d,[]),this['kalmanStates']['set'](_0x91926d,{'estimate':0x0,'errorCovariance':0x1}),this['emit'](_0x97aca9(0xd3),{'type':_0x97aca9(0x111),'message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0x91926d});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x33993c={}){const _0x1bc047=_0x574846;super(),this['config']=_0x33993c,this[_0x1bc047(0x10a)]=new HQXUltraScalping(_0x33993c),this[_0x1bc047(0x10a)]['on'](_0x1bc047(0x132),_0x38f44a=>this['emit'](_0x1bc047(0x132),_0x38f44a)),this['strategy']['on']('log',_0x75d2f9=>this['emit'](_0x1bc047(0xd3),_0x75d2f9));}[_0x574846(0x106)](_0x210e0d){const _0x1f99fb=_0x574846;return this[_0x1f99fb(0x10a)][_0x1f99fb(0x106)](_0x210e0d);}[_0x574846(0x112)](_0x2c221c){const _0x44f924=_0x574846;return this[_0x44f924(0x10a)]['onTick'](_0x2c221c);}['onTrade'](_0x171366){const _0x50d37=_0x574846;return this[_0x50d37(0x10a)]['onTrade'](_0x171366);}[_0x574846(0x124)](_0x59d8ae,_0x1dd058){const _0x29a4e5=_0x574846;return this[_0x29a4e5(0x10a)][_0x29a4e5(0x124)](_0x59d8ae,_0x1dd058);}['initialize'](_0x454d68,_0x55632e,_0x2e4405){const _0x3d7eba=_0x574846;return this[_0x3d7eba(0x10a)]['initialize'](_0x454d68,_0x55632e,_0x2e4405);}[_0x574846(0x121)](_0x45de2b,_0x21de7d){const _0x18aedc=_0x574846;return this[_0x18aedc(0x10a)]['getAnalysisState'](_0x45de2b,_0x21de7d);}['recordTradeResult'](_0x90840c){const _0x3c242d=_0x574846;return this['strategy'][_0x3c242d(0xda)](_0x90840c);}[_0x574846(0xce)](_0x41c6e9){const _0x21fd64=_0x574846;return this['strategy'][_0x21fd64(0xce)](_0x41c6e9);}[_0x574846(0xdf)](){const _0x5d9963=_0x574846;return this['strategy'][_0x5d9963(0xdf)]();}['getBarHistory'](_0x3e2449){return this['strategy']['getBarHistory'](_0x3e2449);}['getModelValues'](_0x26bbcb){const _0x3d72f3=_0x574846;return this['strategy'][_0x3d72f3(0x122)](_0x26bbcb);}['shouldExitByZScore'](_0x2b0ec6){return this['strategy']['shouldExitByZScore'](_0x2b0ec6);}[_0x574846(0xcc)](_0x1782df){return null;}}module[_0x574846(0xd1)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};function _0x2aaf(_0x145c06,_0x43c8b0){_0x145c06=_0x145c06-0xca;const _0xe7f5da=_0xe7f5();let _0x2aaf13=_0xe7f5da[_0x145c06];return _0x2aaf13;}function _0xe7f5(){const _0x350c35=['shift','ofiLookback','\x20VPIN:','length','zscoreThreshold','now','abs','signal','atrHistory','side','_computeZScore','ofi','%\x20OFI:','HQX_ULTRA_SCALPING_6MODELS','vpinWindow','LOSS','_computeOrderFlowImbalance','high','push','short','winStreak','onTrade','lastSignalTime','generateSignal','\x20|\x20Conf:','reset','losses','composite','exports',',\x20streak:\x20','log','kalmanMeasurementNoise','sell','cooldownMs','trades','_computeKyleLambda','min','recordTradeResult','errorCovariance','1030169BjOfeB','_calculateATR','baseStopTicks','getStats','round','2197460uMgEWH','symbol','[HQX]\x20Trade\x20result:\x20','get','stats','MODERATE','zscoreExitThreshold','set','baseTargetTicks','getBarHistory','_applyKalmanFilter','WIN','637731lQKqyl','kalman','_computeVPIN','volumeBuffer','lossStreak','toFixed','long','volume','_detectVolatilityRegime','open','12697270KQNldJ','minConfidence','\x20|\x20Z:','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','initialize','kalmanStates','stopMultiplier','tickValue','730095GCtyhG','reduce','targetMultiplier','signals','slice','recentTrades','profitLockPct','processTick','tickSize','[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)','split','strategy','\x20Regime:','minHoldTimeMs','88ienqFH','volatilityLookback','emit','200874NBxZbZ','info','onTick','vpinToxicThreshold','priceBuffer','zscore','low','buy','estimate','weights','%,\x20OFI=','vpin','volatility','BID','confidenceBonus','uuid','max','getAnalysisState','getModelValues','_generateSignal','processBar','15urphFL','close','breakevenTicks','512450DLPVLl','6xemBKc','barHistory'];_0xe7f5=function(){return _0x350c35;};return _0xe7f5();}
|