hedgequantx 2.9.104 → 2.9.106
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 _0xe9f20f=_0x4ccb;(function(_0x165b9b,_0x1bb239){const _0x204a55=_0x4ccb,_0x3a7f1f=_0x165b9b();while(!![]){try{const _0x304b4d=parseInt(_0x204a55(0xfe))/0x1*(-parseInt(_0x204a55(0x13b))/0x2)+-parseInt(_0x204a55(0x10f))/0x3+parseInt(_0x204a55(0x134))/0x4*(parseInt(_0x204a55(0x10a))/0x5)+parseInt(_0x204a55(0x164))/0x6+parseInt(_0x204a55(0x106))/0x7*(parseInt(_0x204a55(0xeb))/0x8)+-parseInt(_0x204a55(0xe8))/0x9*(parseInt(_0x204a55(0xe2))/0xa)+parseInt(_0x204a55(0x132))/0xb*(-parseInt(_0x204a55(0x139))/0xc);if(_0x304b4d===_0x1bb239)break;else _0x3a7f1f['push'](_0x3a7f1f['shift']());}catch(_0x4a47aa){_0x3a7f1f['push'](_0x3a7f1f['shift']());}}}(_0x30a4,0x5ebc6));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':_0xe9f20f(0x15e),'LOW_SWEEP':_0xe9f20f(0x116)},ZoneType={'RESISTANCE':_0xe9f20f(0xf3),'SUPPORT':_0xe9f20f(0xe0)},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':_0xe9f20f(0x14f)}};class SwingPoint{constructor(_0x2b01a7,_0x5e9e29,_0x55f916,_0x3bf14d,_0x26e76a=0x1){const _0x248d38=_0xe9f20f;this['type']=_0x2b01a7,this[_0x248d38(0x102)]=_0x5e9e29,this['barIndex']=_0x55f916,this[_0x248d38(0x141)]=_0x3bf14d,this[_0x248d38(0x13d)]=_0x26e76a;}}function _0x30a4(){const _0x529bb6=['\x20bars,\x20','getAnalysisState','support','symbol','4090odtSXM','getUTCHours','has','processTick','x\x20|\x20Q:','_generateSignal','17037cRazoI','maxZoneAgeBars','size','351664HqcynT','volumeRatio','stats','emit','isValid','[HQX-2B]\x20SIGNAL:\x20','floor','createdAt','resistance','open','[HQX-2B]\x20No\x20historical\x20bars\x20to\x20preload','info','tickCount','barHistory','reset','lookbackBars','close','toUpperCase','penetrationTicks','121QVtERm','_updateZones','map','maxDurationBars','price','minBodyRatio','onTick','length','91euWRqR','\x20zones','object','getBarHistory','5puwMet','distance','now','entryBarIndex','liquidityZones','527376evCsSD','_detectSweep','tickValue','_scoreSweep','LOSS','trailDistanceTicks','trailTriggerTicks','low','\x20swings,\x20','sweptAt','targetTicks',':\x20tick=','zone','RESISTANCE','LOW_SWEEP','SUPPORT','tickSize','/5\x20bars','shift','preloadBars','ASK','[2B]\x20SWEEP\x20','[HQX-2B]\x20Trade\x20result:\x20','lastSignalTime','barIntervalMs','type','currentBar','isDST','getHealthStatus','generateSignal','config','lastUsedBarIndex','set','getFullYear','touches','22968rylGpH','processBar','2795516mqSmMf','swingPoints','push','\x20|\x20','toFixed','1812xBvQSD','_getVolumeRatio','868pURVsV','maxZoneDistanceTicks','strength','containsPrice','short','clusterToleranceTicks','timestamp','t,\x20Target=','abs','cooldownMs','minPenetrationTicks','t,\x20Trail=','log','max','find','signal','long','\x20|\x20Total:\x20','priceLow','initialize','America/New_York','minQualityScore',',\x20TF=1min','\x20historical\x20bars...','t\x20Vol:','priceHigh','sort','enabled','MODERATE','trades','getTimezoneOffset','debug','stopTicks','\x20@\x20','contractId','high','recordTradeResult','sweepType','strategy','get','extremeBarIndex','2613216kvByLI','maxPenetrationTicks','[HQX-2B]\x20Preloading\x20','volume','swing','exitBarIndex','delete','2B\x20','execution','BID','Collecting\x20data...\x20','swept','\x20|\x20Pen:','min','_detectSwings','barIndex','breakevenTicks','[HQX-2B]\x20Preload\x20complete:\x20','qualityScore','getLevel','filter'];_0x30a4=function(){return _0x529bb6;};return _0x30a4();}class LiquidityZone{constructor(_0x224987,_0x12a1b2,_0x140203,_0x45f4ce,_0x41ed22){const _0x270a8b=_0xe9f20f;this['id']=uuidv4(),this['type']=_0x224987,this['priceHigh']=_0x12a1b2,this[_0x270a8b(0x14d)]=_0x140203,this[_0x270a8b(0xf2)]=_0x45f4ce,this['barIndex']=_0x41ed22,this['touches']=0x1,this[_0x270a8b(0xd4)]=![],this['sweptAt']=null,this[_0x270a8b(0x12e)]=-0x3e7,this[_0x270a8b(0xdb)]=0.5;}['containsPrice'](_0x22241f,_0x1cf8da,_0x4cd927){const _0x16ce21=_0xe9f20f,_0x2d4332=_0x1cf8da*_0x4cd927;return _0x22241f>=this[_0x16ce21(0x14d)]-_0x2d4332&&_0x22241f<=this['priceHigh']+_0x2d4332;}['getLevel'](){const _0x496d1e=_0xe9f20f;return(this[_0x496d1e(0x154)]+this[_0x496d1e(0x14d)])/0x2;}}function _0x4ccb(_0x1f907e,_0x2377e2){_0x1f907e=_0x1f907e-0xce;const _0x30a4dc=_0x30a4();let _0x4ccbe1=_0x30a4dc[_0x1f907e];return _0x4ccbe1;}class SweepEvent{constructor(_0x512a48,_0x35f462,_0x302d38,_0x29edd5,_0x4e058a){const _0x5c9c12=_0xe9f20f;this[_0x5c9c12(0x160)]=_0x512a48,this['zone']=_0x35f462,this[_0x5c9c12(0x10d)]=_0x302d38,this[_0x5c9c12(0x163)]=_0x29edd5,this['extremePrice']=_0x4e058a,this[_0x5c9c12(0xce)]=null,this[_0x5c9c12(0xef)]=![],this[_0x5c9c12(0xdb)]=0x0,this[_0x5c9c12(0xfd)]=0x0,this['durationBars']=0x0,this[_0x5c9c12(0xec)]=0x1;}}class HQX2BLiquiditySweep extends EventEmitter{constructor(_0x20d856={}){const _0x3ac472=_0xe9f20f;super(),this[_0x3ac472(0x12d)]=this['_mergeConfig'](DEFAULT_CONFIG,_0x20d856),this[_0x3ac472(0x11f)]=this[_0x3ac472(0x12d)][_0x3ac472(0x11f)],this['tickValue']=this[_0x3ac472(0x12d)]['tickValue'],this['barHistory']=new Map(),this[_0x3ac472(0x135)]=new Map(),this[_0x3ac472(0x10e)]=new Map(),this['activeSweeps']=new Map(),this[_0x3ac472(0x129)]=new Map(),this['barIntervalMs']=0xea60,this[_0x3ac472(0x126)]=0x0,this['startTime']=Date['now'](),this[_0x3ac472(0xed)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0},this['recentTrades']=[];}['_mergeConfig'](_0xd30c84,_0x2216b9){const _0x190ef8=_0xe9f20f,_0x239fed={..._0xd30c84};for(const _0x5e7ede in _0x2216b9){typeof _0x2216b9[_0x5e7ede]===_0x190ef8(0x108)&&!Array['isArray'](_0x2216b9[_0x5e7ede])?_0x239fed[_0x5e7ede]={..._0xd30c84[_0x5e7ede],..._0x2216b9[_0x5e7ede]}:_0x239fed[_0x5e7ede]=_0x2216b9[_0x5e7ede];}return _0x239fed;}['isWithinSession'](_0x253744){const _0x19d91a=_0xe9f20f;if(!this['config']['session'][_0x19d91a(0x156)])return!![];const _0x2ac9fc=new Date(_0x253744),_0x2c22e2=this[_0x19d91a(0x12a)](_0x2ac9fc)?-0x4:-0x5,_0x29fb6d=_0x2ac9fc[_0x19d91a(0xe3)](),_0x325e0f=_0x2ac9fc['getUTCMinutes'](),_0x4686ad=(_0x29fb6d+_0x2c22e2+0x18)%0x18,{startHour:_0x45c59f,startMinute:_0x355263,endHour:_0x4b0bde,endMinute:_0x130fd5}=this['config']['session'],_0x427537=_0x4686ad*0x3c+_0x325e0f,_0x12b3cd=_0x45c59f*0x3c+_0x355263,_0x4a5d10=_0x4b0bde*0x3c+_0x130fd5;return _0x427537>=_0x12b3cd&&_0x427537<_0x4a5d10;}['isDST'](_0x424abc){const _0x5f5813=_0xe9f20f,_0x4e2213=new Date(_0x424abc['getFullYear'](),0x0,0x1),_0x3239fc=new Date(_0x424abc[_0x5f5813(0x130)](),0x6,0x1),_0x5d0925=Math['max'](_0x4e2213['getTimezoneOffset'](),_0x3239fc[_0x5f5813(0x159)]());return _0x424abc[_0x5f5813(0x159)]()<_0x5d0925;}['initialize'](_0x13251c,_0x581d44=0.25,_0x36336b=0x5){const _0x1c6944=_0xe9f20f;this['tickSize']=_0x581d44,this[_0x1c6944(0x111)]=_0x36336b,this[_0x1c6944(0x12d)]['tickSize']=_0x581d44,this['config'][_0x1c6944(0x111)]=_0x36336b,this[_0x1c6944(0xf8)][_0x1c6944(0x12f)](_0x13251c,[]),this[_0x1c6944(0x135)]['set'](_0x13251c,[]),this['liquidityZones'][_0x1c6944(0x12f)](_0x13251c,[]),this['activeSweeps']['set'](_0x13251c,[]),this[_0x1c6944(0x129)][_0x1c6944(0xcf)](_0x13251c),this['emit']('log',{'type':_0x1c6944(0xf6),'message':'[HQX-2B]\x20Initialized\x20for\x20'+_0x13251c+_0x1c6944(0x11a)+_0x581d44+',\x20value='+_0x36336b+_0x1c6944(0x151)}),this['emit']('log',{'type':'info','message':'[HQX-2B]\x20Params:\x20Stop='+this[_0x1c6944(0x12d)]['execution']['stopTicks']+_0x1c6944(0x142)+this[_0x1c6944(0x12d)]['execution'][_0x1c6944(0x119)]+'t,\x20BE='+this[_0x1c6944(0x12d)][_0x1c6944(0xd1)][_0x1c6944(0xd9)]+_0x1c6944(0x146)+this['config'][_0x1c6944(0xd1)]['trailTriggerTicks']+'/'+this['config'][_0x1c6944(0xd1)]['trailDistanceTicks']});}[_0xe9f20f(0xe5)](_0x5665f6){const _0x361c9a=_0xe9f20f,{contractId:_0x5d3781,price:_0x57110c,volume:_0x31f961,timestamp:_0x51a452}=_0x5665f6,_0x4bd6e8=_0x51a452||Date['now'](),_0x597f7b=_0x31f961||0x1;if(!this['isWithinSession'](_0x4bd6e8))return null;let _0x2f6a76=this[_0x361c9a(0x129)]['get'](_0x5d3781);const _0x474f27=Math['floor'](_0x4bd6e8/this[_0x361c9a(0x127)])*this['barIntervalMs'];if(!_0x2f6a76||_0x2f6a76['startTime']!==_0x474f27){if(_0x2f6a76){const _0x511231={'timestamp':_0x2f6a76['startTime'],'open':_0x2f6a76['open'],'high':_0x2f6a76[_0x361c9a(0x15e)],'low':_0x2f6a76[_0x361c9a(0x116)],'close':_0x2f6a76['close'],'volume':_0x2f6a76['volume']},_0x467bac=this[_0x361c9a(0x133)](_0x5d3781,_0x511231);return this[_0x361c9a(0x129)][_0x361c9a(0x12f)](_0x5d3781,{'startTime':_0x474f27,'open':_0x57110c,'high':_0x57110c,'low':_0x57110c,'close':_0x57110c,'volume':_0x597f7b}),_0x467bac;}else return this[_0x361c9a(0x129)][_0x361c9a(0x12f)](_0x5d3781,{'startTime':_0x474f27,'open':_0x57110c,'high':_0x57110c,'low':_0x57110c,'close':_0x57110c,'volume':_0x597f7b}),null;}else return _0x2f6a76[_0x361c9a(0x15e)]=Math['max'](_0x2f6a76[_0x361c9a(0x15e)],_0x57110c),_0x2f6a76[_0x361c9a(0x116)]=Math['min'](_0x2f6a76['low'],_0x57110c),_0x2f6a76[_0x361c9a(0xfb)]=_0x57110c,_0x2f6a76['volume']+=_0x597f7b,null;}['onTick'](_0x5d5df0){const _0x476dce=_0xe9f20f;return this[_0x476dce(0xe5)](_0x5d5df0);}['onTrade'](_0x37f14a){const _0x36231f=_0xe9f20f;return this[_0x36231f(0xe5)]({'contractId':_0x37f14a[_0x36231f(0x15d)]||_0x37f14a[_0x36231f(0xe1)],'price':_0x37f14a[_0x36231f(0x102)],'volume':_0x37f14a[_0x36231f(0xea)]||_0x37f14a[_0x36231f(0x167)]||0x1,'timestamp':_0x37f14a['timestamp']||Date[_0x36231f(0x10c)]()});}[_0xe9f20f(0x133)](_0x1c4dec,_0x3b443c){const _0x3df781=_0xe9f20f;let _0x4a76e4=this['barHistory'][_0x3df781(0x162)](_0x1c4dec);!_0x4a76e4&&(this['initialize'](_0x1c4dec),_0x4a76e4=this['barHistory']['get'](_0x1c4dec));_0x4a76e4['push'](_0x3b443c);if(_0x4a76e4[_0x3df781(0x105)]>0x1f4)_0x4a76e4[_0x3df781(0x121)]();const _0x4990be=_0x4a76e4[_0x3df781(0x105)]-0x1;if(_0x4a76e4[_0x3df781(0x105)]<this['config']['swing'][_0x3df781(0xfa)]*0x3)return null;const _0x1e91b4=this[_0x3df781(0x135)]['get'](_0x1c4dec)[_0x3df781(0x105)];this[_0x3df781(0xd7)](_0x1c4dec,_0x4a76e4,_0x4990be);const _0xbd0d81=this[_0x3df781(0x135)]['get'](_0x1c4dec);if(_0xbd0d81['length']>_0x1e91b4){const _0x5b3bd5=_0xbd0d81[_0xbd0d81['length']-0x1];this[_0x3df781(0xee)](_0x3df781(0x147),{'type':'debug','message':'[2B]\x20NEW\x20SWING\x20'+_0x5b3bd5[_0x3df781(0x128)]['toUpperCase']()+_0x3df781(0x15c)+_0x5b3bd5['price']['toFixed'](0x2)+_0x3df781(0x14c)+_0xbd0d81['length']});}const _0x158b31=this[_0x3df781(0x10e)][_0x3df781(0x162)](_0x1c4dec)['length'];this['_updateZones'](_0x1c4dec,_0x4990be);const _0x567f32=this['liquidityZones']['get'](_0x1c4dec);if(_0x567f32['length']>_0x158b31){const _0x386fbc=_0x567f32[_0x567f32[_0x3df781(0x105)]-0x1];this['emit'](_0x3df781(0x147),{'type':'debug','message':'[2B]\x20NEW\x20ZONE\x20'+_0x386fbc[_0x3df781(0x128)]['toUpperCase']()+'\x20@\x20'+_0x386fbc['getLevel']()['toFixed'](0x2)+'\x20|\x20Total:\x20'+_0x567f32[_0x3df781(0x105)]});}const _0x440e9c=this['_detectSweep'](_0x1c4dec,_0x4a76e4,_0x4990be);_0x440e9c&&this[_0x3df781(0xee)](_0x3df781(0x147),{'type':'debug','message':_0x3df781(0x124)+_0x440e9c[_0x3df781(0x160)]+'\x20|\x20Valid:\x20'+_0x440e9c[_0x3df781(0xef)]+'\x20|\x20Pen:\x20'+_0x440e9c[_0x3df781(0xfd)][_0x3df781(0x138)](0x1)+'t\x20|\x20Q:\x20'+(_0x440e9c['qualityScore']*0x64)['toFixed'](0x0)+'%'});if(_0x440e9c&&_0x440e9c['isValid'])return this['_generateSignal'](_0x1c4dec,_0x3b443c,_0x4990be,_0x440e9c);return null;}[_0xe9f20f(0xd7)](_0x1eb7bc,_0x5282ff,_0x1f6151){const _0xc911f1=_0xe9f20f,_0x19e887=this['config']['swing']['lookbackBars'],_0x48d834=this[_0xc911f1(0x12d)][_0xc911f1(0x168)]['minStrength'];if(_0x1f6151<_0x19e887*0x2)return;const _0x594eff=this[_0xc911f1(0x135)]['get'](_0x1eb7bc),_0x5a9fd3=_0x1f6151-_0x19e887,_0x26d00b=_0x5282ff[_0x5a9fd3];let _0x97b5d9=!![],_0x30b7dd=0x0;for(let _0x28497b=_0x5a9fd3-_0x19e887;_0x28497b<=_0x5a9fd3+_0x19e887;_0x28497b++){if(_0x28497b===_0x5a9fd3||_0x28497b<0x0||_0x28497b>=_0x5282ff['length'])continue;if(_0x5282ff[_0x28497b]['high']>=_0x26d00b['high']){_0x97b5d9=![];break;}_0x30b7dd++;}if(_0x97b5d9&&_0x30b7dd>=_0x48d834){const _0x47f1b9=_0x594eff['find'](_0x80a7de=>_0x80a7de[_0xc911f1(0xd8)]===_0x5a9fd3&&_0x80a7de[_0xc911f1(0x128)]===_0xc911f1(0x15e));!_0x47f1b9&&_0x594eff['push'](new SwingPoint(_0xc911f1(0x15e),_0x26d00b['high'],_0x5a9fd3,_0x26d00b[_0xc911f1(0x141)],_0x30b7dd));}let _0x54ad94=!![],_0x1ff924=0x0;for(let _0x11915c=_0x5a9fd3-_0x19e887;_0x11915c<=_0x5a9fd3+_0x19e887;_0x11915c++){if(_0x11915c===_0x5a9fd3||_0x11915c<0x0||_0x11915c>=_0x5282ff[_0xc911f1(0x105)])continue;if(_0x5282ff[_0x11915c][_0xc911f1(0x116)]<=_0x26d00b[_0xc911f1(0x116)]){_0x54ad94=![];break;}_0x1ff924++;}if(_0x54ad94&&_0x1ff924>=_0x48d834){const _0xf012a6=_0x594eff[_0xc911f1(0x149)](_0x25a953=>_0x25a953[_0xc911f1(0xd8)]===_0x5a9fd3&&_0x25a953['type']==='low');!_0xf012a6&&_0x594eff[_0xc911f1(0x136)](new SwingPoint('low',_0x26d00b[_0xc911f1(0x116)],_0x5a9fd3,_0x26d00b['timestamp'],_0x1ff924));}const _0x803395=this[_0xc911f1(0x12d)]['zone'][_0xc911f1(0xe9)];while(_0x594eff[_0xc911f1(0x105)]>0x0&&_0x594eff[0x0][_0xc911f1(0xd8)]<_0x1f6151-_0x803395){_0x594eff['shift']();}}[_0xe9f20f(0xff)](_0x17c7f9,_0x4339cf){const _0x2198da=_0xe9f20f,_0x11b15b=this['swingPoints']['get'](_0x17c7f9),_0x23550f=this['liquidityZones']['get'](_0x17c7f9),_0x4560ca=this[_0x2198da(0x12d)]['zone'][_0x2198da(0x140)]*this[_0x2198da(0x11f)],_0x4aed86=this['config']['zone']['maxZoneAgeBars'];for(let _0x3ceedb=_0x23550f[_0x2198da(0x105)]-0x1;_0x3ceedb>=0x0;_0x3ceedb--){_0x4339cf-_0x23550f[_0x3ceedb][_0x2198da(0xd8)]>_0x4aed86&&_0x23550f['splice'](_0x3ceedb,0x1);}for(const _0x32d4a7 of _0x11b15b){let _0x48c417=null;for(const _0x2981dd of _0x23550f){if(_0x2981dd[_0x2198da(0x13e)](_0x32d4a7[_0x2198da(0x102)],this[_0x2198da(0x12d)][_0x2198da(0x11b)][_0x2198da(0x140)],this[_0x2198da(0x11f)])){_0x48c417=_0x2981dd;break;}}if(_0x48c417){_0x48c417['touches']++;if(_0x32d4a7['price']>_0x48c417[_0x2198da(0x154)])_0x48c417['priceHigh']=_0x32d4a7['price'];if(_0x32d4a7['price']<_0x48c417['priceLow'])_0x48c417['priceLow']=_0x32d4a7[_0x2198da(0x102)];_0x48c417[_0x2198da(0xdb)]=Math[_0x2198da(0xd6)](0x1,0.3+_0x48c417[_0x2198da(0x131)]*0.15);}else{const _0x405218=_0x32d4a7[_0x2198da(0x128)]==='high'?ZoneType[_0x2198da(0x11c)]:ZoneType['SUPPORT'],_0x41bcea=new LiquidityZone(_0x405218,_0x32d4a7[_0x2198da(0x102)]+_0x4560ca/0x2,_0x32d4a7['price']-_0x4560ca/0x2,_0x32d4a7['timestamp'],_0x32d4a7[_0x2198da(0xd8)]);_0x41bcea['qualityScore']=0.3+_0x32d4a7['strength']*0.1,_0x23550f['push'](_0x41bcea);}}}[_0xe9f20f(0x110)](_0x33c591,_0x3dd663,_0x42754b){const _0x5e0543=_0xe9f20f,_0x347eeb=this['liquidityZones'][_0x5e0543(0x162)](_0x33c591),_0x9bf91f=_0x3dd663[_0x42754b],_0x3aa74b=_0x9bf91f['close'],_0x4d106f=this['config']['sweep'],_0x308030=this[_0x5e0543(0x12d)][_0x5e0543(0x11b)];for(const _0x116804 of _0x347eeb){if(_0x116804['lastUsedBarIndex']>=0x0&&_0x42754b-_0x116804['lastUsedBarIndex']<_0x308030['cooldownBars'])continue;const _0x4b4f65=_0x116804['getLevel'](),_0x5410b5=Math['abs'](_0x3aa74b-_0x4b4f65)/this[_0x5e0543(0x11f)];if(_0x5410b5>_0x308030[_0x5e0543(0x13c)])continue;const _0x2bf3f0=Math[_0x5e0543(0x148)](0x0,_0x42754b-_0x4d106f[_0x5e0543(0x101)]*0x2);for(let _0x264c8f=_0x2bf3f0;_0x264c8f<_0x42754b;_0x264c8f++){const _0x31ff71=_0x3dd663[_0x264c8f];if(_0x116804['type']===ZoneType['RESISTANCE']){const _0x599f59=(_0x31ff71['high']-_0x116804['priceHigh'])/this['tickSize'];if(_0x599f59>=_0x4d106f[_0x5e0543(0x145)]&&_0x599f59<=_0x4d106f[_0x5e0543(0x165)]){if(_0x3aa74b<_0x116804[_0x5e0543(0x154)]){const _0x30f63d=_0x31ff71['high']-_0x31ff71['low'],_0xc0a1c3=Math[_0x5e0543(0x143)](_0x31ff71['close']-_0x31ff71['open']),_0x458c86=_0x30f63d>0x0?_0xc0a1c3/_0x30f63d:0x0;if(_0x458c86>=_0x4d106f[_0x5e0543(0x103)]){const _0x2f6e10=this[_0x5e0543(0x13a)](_0x3dd663,_0x264c8f,0x14);if(_0x2f6e10>=_0x4d106f['minVolumeRatio']){const _0x1056ba=new SweepEvent(SweepType['HIGH_SWEEP'],_0x116804,_0x264c8f,_0x264c8f,_0x31ff71[_0x5e0543(0x15e)]);_0x1056ba['exitBarIndex']=_0x42754b,_0x1056ba['penetrationTicks']=_0x599f59,_0x1056ba['durationBars']=_0x42754b-_0x264c8f,_0x1056ba['volumeRatio']=_0x2f6e10,_0x1056ba['qualityScore']=this['_scoreSweep'](_0x1056ba,_0x458c86),_0x1056ba['isValid']=_0x1056ba['qualityScore']>=_0x4d106f['minQualityScore'];if(_0x1056ba[_0x5e0543(0xef)])return _0x1056ba;}}}}}if(_0x116804[_0x5e0543(0x128)]===ZoneType['SUPPORT']){const _0x4da648=(_0x116804['priceLow']-_0x31ff71['low'])/this['tickSize'];if(_0x4da648>=_0x4d106f[_0x5e0543(0x145)]&&_0x4da648<=_0x4d106f[_0x5e0543(0x165)]){if(_0x3aa74b>_0x116804['priceLow']){const _0x8d387d=_0x31ff71[_0x5e0543(0x15e)]-_0x31ff71['low'],_0x351997=Math[_0x5e0543(0x143)](_0x31ff71[_0x5e0543(0xfb)]-_0x31ff71[_0x5e0543(0xf4)]),_0x69c9cf=_0x8d387d>0x0?_0x351997/_0x8d387d:0x0;if(_0x69c9cf>=_0x4d106f['minBodyRatio']){const _0x1553c0=this[_0x5e0543(0x13a)](_0x3dd663,_0x264c8f,0x14);if(_0x1553c0>=_0x4d106f['minVolumeRatio']){const _0x568bb4=new SweepEvent(SweepType[_0x5e0543(0x11d)],_0x116804,_0x264c8f,_0x264c8f,_0x31ff71[_0x5e0543(0x116)]);_0x568bb4[_0x5e0543(0xce)]=_0x42754b,_0x568bb4['penetrationTicks']=_0x4da648,_0x568bb4['durationBars']=_0x42754b-_0x264c8f,_0x568bb4[_0x5e0543(0xec)]=_0x1553c0,_0x568bb4[_0x5e0543(0xdb)]=this[_0x5e0543(0x112)](_0x568bb4,_0x69c9cf),_0x568bb4['isValid']=_0x568bb4[_0x5e0543(0xdb)]>=_0x4d106f[_0x5e0543(0x150)];if(_0x568bb4['isValid'])return _0x568bb4;}}}}}}}return null;}[_0xe9f20f(0x13a)](_0x5af0cf,_0x24f08f,_0x13e0fc){const _0x107a8f=_0xe9f20f,_0x1bd95e=Math['max'](0x0,_0x24f08f-_0x13e0fc),_0x2fa2c2=_0x5af0cf['slice'](_0x1bd95e,_0x24f08f);if(_0x2fa2c2[_0x107a8f(0x105)]===0x0)return 0x1;const _0x317a15=_0x2fa2c2['map'](_0x32d43e=>_0x32d43e[_0x107a8f(0x167)])['sort']((_0x35b99c,_0x34801e)=>_0x35b99c-_0x34801e),_0x260e99=Math[_0x107a8f(0xf1)](_0x317a15['length']/0x2),_0x4f7e52=_0x317a15[_0x260e99]||0x1;return _0x5af0cf[_0x24f08f]['volume']/_0x4f7e52;}['_scoreSweep'](_0x715217,_0x2c7e1a){const _0x168cc8=_0xe9f20f;let _0x53f151=0x0;const _0x3ecb65=0x4,_0x308a5e=Math[_0x168cc8(0x143)](_0x715217['penetrationTicks']-_0x3ecb65);return _0x53f151+=Math['max'](0x0,0.3-_0x308a5e*0.03),_0x53f151+=Math[_0x168cc8(0x148)](0x0,0.25-_0x715217['durationBars']*0.05),_0x53f151+=Math[_0x168cc8(0xd6)](0.25,_0x715217['volumeRatio']*0.1),_0x53f151+=Math['min'](0.2,_0x2c7e1a*0.4),Math[_0x168cc8(0xd6)](0x1,_0x53f151);}[_0xe9f20f(0xe7)](_0x459bf3,_0xa9cc83,_0x25eb8c,_0x54b92b){const _0x445bec=_0xe9f20f;if(Date['now']()-this[_0x445bec(0x126)]<this['config'][_0x445bec(0xd1)][_0x445bec(0x144)])return null;const _0x52797c=this[_0x445bec(0x12d)][_0x445bec(0xd1)],_0x3c5bbf=_0xa9cc83['close'],_0x2e0a89=_0x54b92b[_0x445bec(0x160)]===SweepType['HIGH_SWEEP']?_0x445bec(0x13f):_0x445bec(0x14b);let _0x130a6a,_0x2a6fb8,_0x113cb0,_0x3b35d0;_0x2e0a89==='long'?(_0x130a6a=_0x3c5bbf-_0x52797c[_0x445bec(0x15b)]*this[_0x445bec(0x11f)],_0x2a6fb8=_0x3c5bbf+_0x52797c[_0x445bec(0x119)]*this[_0x445bec(0x11f)],_0x113cb0=_0x3c5bbf+_0x52797c[_0x445bec(0xd9)]*this['tickSize'],_0x3b35d0=_0x3c5bbf+_0x52797c[_0x445bec(0x115)]*this['tickSize']):(_0x130a6a=_0x3c5bbf+_0x52797c['stopTicks']*this['tickSize'],_0x2a6fb8=_0x3c5bbf-_0x52797c['targetTicks']*this['tickSize'],_0x113cb0=_0x3c5bbf-_0x52797c['breakevenTicks']*this[_0x445bec(0x11f)],_0x3b35d0=_0x3c5bbf-_0x52797c['trailTriggerTicks']*this[_0x445bec(0x11f)]);const _0x35c96e=_0x52797c['targetTicks']/_0x52797c[_0x445bec(0x15b)],_0x21d93c=Math['min'](0x1,_0x54b92b[_0x445bec(0xdb)]*0.5+_0x54b92b['zone']['qualityScore']*0.3+(_0x54b92b[_0x445bec(0xec)]>1.5?0.2:_0x54b92b[_0x445bec(0xec)]*0.1));let _0x53685e=SignalStrength[_0x445bec(0x157)];if(_0x21d93c>=0.8)_0x53685e=SignalStrength['VERY_STRONG'];else{if(_0x21d93c>=0.65)_0x53685e=SignalStrength['STRONG'];else{if(_0x21d93c<0.5)_0x53685e=SignalStrength['WEAK'];}}const _0xd274c6=0.5+(_0x21d93c-0.5)*0.4,_0x5d3f10=_0xd274c6*Math[_0x445bec(0x143)](_0x2a6fb8-_0x3c5bbf)-(0x1-_0xd274c6)*Math[_0x445bec(0x143)](_0x3c5bbf-_0x130a6a);_0x54b92b[_0x445bec(0x11b)][_0x445bec(0x12e)]=_0x25eb8c,_0x54b92b[_0x445bec(0x11b)][_0x445bec(0xd4)]=!![],_0x54b92b[_0x445bec(0x11b)][_0x445bec(0x118)]=new Date(_0xa9cc83[_0x445bec(0x141)]),this[_0x445bec(0x126)]=Date[_0x445bec(0x10c)](),this['stats']['signals']++;const _0x3d224a={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x459bf3['split']('.')[0x0]||_0x459bf3,'contractId':_0x459bf3,'side':_0x2e0a89===_0x445bec(0x14b)?OrderSide[_0x445bec(0xd2)]:OrderSide[_0x445bec(0x123)],'direction':_0x2e0a89,'strategy':'HQX_2B_LIQUIDITY_SWEEP','strength':_0x53685e,'edge':_0x5d3f10,'confidence':_0x21d93c,'entry':_0x3c5bbf,'entryPrice':_0x3c5bbf,'stopLoss':_0x130a6a,'takeProfit':_0x2a6fb8,'riskReward':_0x35c96e,'stopTicks':_0x52797c['stopTicks'],'targetTicks':_0x52797c['targetTicks'],'breakevenTicks':_0x52797c[_0x445bec(0xd9)],'trailTriggerTicks':_0x52797c[_0x445bec(0x115)],'trailDistanceTicks':_0x52797c[_0x445bec(0x114)],'beLevel':_0x113cb0,'trailTrigger':_0x3b35d0,'sweepType':_0x54b92b[_0x445bec(0x160)],'penetrationTicks':_0x54b92b['penetrationTicks'],'sweepDurationBars':_0x54b92b['durationBars'],'sweepQuality':_0x54b92b[_0x445bec(0xdb)],'volumeRatio':_0x54b92b[_0x445bec(0xec)],'zoneType':_0x54b92b[_0x445bec(0x11b)]['type'],'zoneLevel':_0x54b92b['zone'][_0x445bec(0xdc)](),'zoneTouches':_0x54b92b[_0x445bec(0x11b)][_0x445bec(0x131)],'zoneQuality':_0x54b92b['zone'][_0x445bec(0xdb)],'expires':Date[_0x445bec(0x10c)]()+0xea60};return this[_0x445bec(0xee)](_0x445bec(0x14a),{'side':_0x2e0a89===_0x445bec(0x14b)?'buy':'sell','action':_0x445bec(0xf4),'reason':_0x445bec(0xd0)+_0x54b92b['sweepType']+'\x20|\x20Pen:'+_0x54b92b[_0x445bec(0xfd)]['toFixed'](0x1)+'t\x20|\x20Vol:'+_0x54b92b[_0x445bec(0xec)]['toFixed'](0x1)+_0x445bec(0xe6)+(_0x54b92b['qualityScore']*0x64)['toFixed'](0x0)+'%',..._0x3d224a}),this['emit']('log',{'type':_0x445bec(0xf6),'message':_0x445bec(0xf0)+_0x2e0a89[_0x445bec(0xfc)]()+'\x20@\x20'+_0x3c5bbf[_0x445bec(0x138)](0x2)+_0x445bec(0x137)+_0x54b92b['sweepType']+_0x445bec(0xd5)+_0x54b92b['penetrationTicks'][_0x445bec(0x138)](0x1)+_0x445bec(0x153)+_0x54b92b[_0x445bec(0xec)]['toFixed'](0x1)+'x\x20|\x20Conf:'+(_0x21d93c*0x64)['toFixed'](0x0)+'%'}),_0x3d224a;}['getAnalysisState'](_0x117c91,_0x353eb0){const _0x592b55=_0xe9f20f,_0x523a54=this['barHistory']['get'](_0x117c91)||[],_0x4fa58c=this['liquidityZones'][_0x592b55(0x162)](_0x117c91)||[],_0xaabaad=this['swingPoints'][_0x592b55(0x162)](_0x117c91)||[];if(_0x523a54[_0x592b55(0x105)]<0x5)return{'ready':![],'message':_0x592b55(0xd3)+_0x523a54[_0x592b55(0x105)]+_0x592b55(0x120)};const _0x4ee45c=_0x4fa58c[_0x592b55(0x100)](_0x9d3f1e=>({'zone':_0x9d3f1e,'distance':Math[_0x592b55(0x143)](_0x353eb0-_0x9d3f1e['getLevel']())}))[_0x592b55(0x155)]((_0x247322,_0x185170)=>_0x247322[_0x592b55(0x10b)]-_0x185170['distance']),_0xb3f821=_0x4ee45c[_0x592b55(0x149)](_0x4746ed=>_0x4746ed['zone']['type']===ZoneType['RESISTANCE']),_0x14355a=_0x4ee45c[_0x592b55(0x149)](_0xc6444b=>_0xc6444b['zone']['type']===ZoneType[_0x592b55(0x11e)]);return{'ready':!![],'barsProcessed':_0x523a54[_0x592b55(0x105)],'swingsDetected':_0xaabaad[_0x592b55(0x105)],'activeZones':_0x4fa58c[_0x592b55(0x105)],'nearestResistance':_0xb3f821?_0xb3f821[_0x592b55(0x11b)]['getLevel']():null,'nearestSupport':_0x14355a?_0x14355a['zone'][_0x592b55(0xdc)]():null,'stopTicks':this['config']['execution'][_0x592b55(0x15b)],'targetTicks':this[_0x592b55(0x12d)]['execution'][_0x592b55(0x119)],'strategy':'HQX-2B\x20Liquidity\x20Sweep\x20(Optimized)'};}['recordTradeResult'](_0x3fa498){const _0xfb4c45=_0xe9f20f;this['recentTrades']['push']({'netPnl':_0x3fa498,'timestamp':Date[_0xfb4c45(0x10c)]()});if(this['recentTrades'][_0xfb4c45(0x105)]>0x64)this['recentTrades'][_0xfb4c45(0x121)]();_0x3fa498>0x0?this[_0xfb4c45(0xed)]['wins']++:this['stats']['losses']++,this[_0xfb4c45(0xed)][_0xfb4c45(0x158)]++,this[_0xfb4c45(0xed)]['pnl']+=_0x3fa498,this['emit']('log',{'type':_0xfb4c45(0x15a),'message':_0xfb4c45(0x125)+(_0x3fa498>0x0?'WIN':_0xfb4c45(0x113))+'\x20$'+_0x3fa498['toFixed'](0x2)});}['getBarHistory'](_0x4a4ef4){return this['barHistory']['get'](_0x4a4ef4)||[];}['getStats'](){const _0x27458c=_0xe9f20f;return this[_0x27458c(0xed)];}['getHealthStatus'](_0x22046a){const _0x50a630=_0xe9f20f,_0x4e14a4=this['barHistory']['get'](_0x22046a)||[],_0x5f00d7=this['liquidityZones']['get'](_0x22046a)||[],_0x94637a=this[_0x50a630(0x135)]['get'](_0x22046a)||[],_0x5d9f9=this[_0x50a630(0x129)]['get'](_0x22046a),_0x442c6a=_0x4e14a4[_0x4e14a4['length']-0x1],_0x27dd93=_0x442c6a?Date[_0x50a630(0x10c)]()-_0x442c6a[_0x50a630(0x141)]:null,_0xa06375=_0x5f00d7['filter'](_0x4b71fd=>_0x4b71fd[_0x50a630(0x128)]===ZoneType['RESISTANCE'])['length'],_0x3b0605=_0x5f00d7['filter'](_0x931f3d=>_0x931f3d['type']===ZoneType['SUPPORT'])['length'];return{'healthy':_0x4e14a4[_0x50a630(0x105)]>=0x5,'barsTotal':_0x4e14a4['length'],'barsLast5Min':_0x4e14a4[_0x50a630(0xdd)](_0x5959b1=>Date[_0x50a630(0x10c)]()-_0x5959b1[_0x50a630(0x141)]<0x5*0x3c*0x3e8)[_0x50a630(0x105)],'swingsTotal':_0x94637a['length'],'zonesResistance':_0xa06375,'zonesSupport':_0x3b0605,'zonesTotal':_0x5f00d7[_0x50a630(0x105)],'currentBarTicks':_0x5d9f9?_0x5d9f9[_0x50a630(0xf7)]:0x0,'isAggregating':_0x5d9f9&&_0x5d9f9['tickCount']>0x0,'timeSinceLastBarMs':_0x27dd93,'lastSignalTime':this[_0x50a630(0x126)],'signalCooldownMs':this['config'][_0x50a630(0xd1)][_0x50a630(0x144)],'uptime':Date[_0x50a630(0x10c)]()-(this['startTime']||Date[_0x50a630(0x10c)]())};}['reset'](_0x4d21e3){const _0x81d339=_0xe9f20f;this['barHistory'][_0x81d339(0x12f)](_0x4d21e3,[]),this[_0x81d339(0x135)]['set'](_0x4d21e3,[]),this['liquidityZones']['set'](_0x4d21e3,[]),this['activeSweeps'][_0x81d339(0x12f)](_0x4d21e3,[]),this[_0x81d339(0x129)][_0x81d339(0xcf)](_0x4d21e3),this[_0x81d339(0xee)](_0x81d339(0x147),{'type':'info','message':'[HQX-2B]\x20Reset\x20state\x20for\x20'+_0x4d21e3});}[_0xe9f20f(0x122)](_0xc696c9,_0x3c9c5c){const _0x51100a=_0xe9f20f;if(!_0x3c9c5c||_0x3c9c5c[_0x51100a(0x105)]===0x0){this[_0x51100a(0xee)]('log',{'type':'debug','message':_0x51100a(0xf5)});return;}!this['barHistory'][_0x51100a(0xe4)](_0xc696c9)&&this[_0x51100a(0x14e)](_0xc696c9);const _0x151797=[..._0x3c9c5c][_0x51100a(0x155)]((_0x2eb83d,_0x248e94)=>_0x2eb83d['timestamp']-_0x248e94[_0x51100a(0x141)]);this[_0x51100a(0xee)](_0x51100a(0x147),{'type':_0x51100a(0xf6),'message':_0x51100a(0x166)+_0x151797[_0x51100a(0x105)]+_0x51100a(0x152)});let _0x2568ca=0x0;for(const _0x555de6 of _0x151797){const _0x2661e4=this[_0x51100a(0x133)](_0xc696c9,_0x555de6);if(_0x2661e4)_0x2568ca++;}const _0x365fcb=this['barHistory']['get'](_0xc696c9)||[],_0x3a7213=this['swingPoints'][_0x51100a(0x162)](_0xc696c9)||[],_0x570063=this[_0x51100a(0x10e)][_0x51100a(0x162)](_0xc696c9)||[];this['emit']('log',{'type':_0x51100a(0xf6),'message':_0x51100a(0xda)+_0x365fcb[_0x51100a(0x105)]+_0x51100a(0xde)+_0x3a7213[_0x51100a(0x105)]+_0x51100a(0x117)+_0x570063[_0x51100a(0x105)]+_0x51100a(0x107)}),_0x2568ca>0x0&&this[_0x51100a(0xee)](_0x51100a(0x147),{'type':'debug','message':'[HQX-2B]\x20'+_0x2568ca+'\x20historical\x20signals\x20detected\x20(ignored)'}),this[_0x51100a(0x126)]=0x0;}}class HQX2BStrategy extends EventEmitter{constructor(_0x1f50df={}){const _0x220419=_0xe9f20f;super(),this['config']=_0x1f50df,this[_0x220419(0x161)]=new HQX2BLiquiditySweep(_0x1f50df),this[_0x220419(0x161)]['on']('signal',_0x2a966f=>this[_0x220419(0xee)](_0x220419(0x14a),_0x2a966f)),this['strategy']['on']('log',_0x4ccb1d=>this['emit']('log',_0x4ccb1d));}[_0xe9f20f(0xe5)](_0x4c941a){const _0x2133c8=_0xe9f20f;return this[_0x2133c8(0x161)][_0x2133c8(0xe5)](_0x4c941a);}[_0xe9f20f(0x104)](_0x5df28d){const _0x21704=_0xe9f20f;return this['strategy'][_0x21704(0x104)](_0x5df28d);}['onTrade'](_0x25ad89){const _0x473f51=_0xe9f20f;return this[_0x473f51(0x161)]['onTrade'](_0x25ad89);}['processBar'](_0x5eb77b,_0x537689){return this['strategy']['processBar'](_0x5eb77b,_0x537689);}[_0xe9f20f(0x14e)](_0x4b323d,_0x407c44,_0x1a10eb){const _0x1bed4c=_0xe9f20f;return this[_0x1bed4c(0x161)]['initialize'](_0x4b323d,_0x407c44,_0x1a10eb);}[_0xe9f20f(0xdf)](_0x2ed4bd,_0x253fd2){const _0x33c5f5=_0xe9f20f;return this[_0x33c5f5(0x161)]['getAnalysisState'](_0x2ed4bd,_0x253fd2);}['recordTradeResult'](_0x358ab5){const _0x39ca76=_0xe9f20f;return this[_0x39ca76(0x161)][_0x39ca76(0x15f)](_0x358ab5);}[_0xe9f20f(0xf9)](_0x34eb0b){return this['strategy']['reset'](_0x34eb0b);}['getStats'](){const _0x5ac039=_0xe9f20f;return this[_0x5ac039(0x161)]['getStats']();}[_0xe9f20f(0x109)](_0x5ac205){const _0x264270=_0xe9f20f;return this[_0x264270(0x161)]['getBarHistory'](_0x5ac205);}[_0xe9f20f(0x122)](_0x4bec42,_0x5291ec){return this['strategy']['preloadBars'](_0x4bec42,_0x5291ec);}['getHealthStatus'](_0x112d40){const _0x503d92=_0xe9f20f;return this[_0x503d92(0x161)][_0x503d92(0x12b)](_0x112d40);}[_0xe9f20f(0x12c)](_0x4f9670){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 _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 +1 @@
|
|
|
1
|
-
const _0x3da12b=_0x58c7;(function(_0xbdf1ef,_0x474ebe){const _0x57b7f=_0x58c7,_0x4b4117=_0xbdf1ef();while(!![]){try{const _0x5396a0=parseInt(_0x57b7f(0x109))/0x1*(-parseInt(_0x57b7f(0x12f))/0x2)+parseInt(_0x57b7f(0xcd))/0x3+parseInt(_0x57b7f(0xd6))/0x4*(parseInt(_0x57b7f(0xdf))/0x5)+-parseInt(_0x57b7f(0x11f))/0x6*(-parseInt(_0x57b7f(0xd4))/0x7)+parseInt(_0x57b7f(0xee))/0x8+-parseInt(_0x57b7f(0x114))/0x9+-parseInt(_0x57b7f(0x125))/0xa;if(_0x5396a0===_0x474ebe)break;else _0x4b4117['push'](_0x4b4117['shift']());}catch(_0x2ac42c){_0x4b4117['push'](_0x4b4117['shift']());}}}(_0x5566,0xa52a0));const EventEmitter=require(_0x3da12b(0xfb)),{v4:uuidv4}=require(_0x3da12b(0xf7)),OrderSide={'BID':0x0,'ASK':0x1},SignalStrength={'WEAK':0x1,'MODERATE':0x2,'STRONG':0x3,'VERY_STRONG':0x4};class HQXUltraScalping extends EventEmitter{constructor(_0x5a9aff={}){const _0x2653c1=_0x3da12b;super(),this['tickSize']=_0x5a9aff['tickSize']||0.25,this['tickValue']=_0x5a9aff['tickValue']||0x5,this['zscoreEntryThreshold']=1.5,this['zscoreExitThreshold']=0.5,this['vpinWindow']=0x32,this['vpinToxicThreshold']=0.7,this[_0x2653c1(0x104)]=0.01,this[_0x2653c1(0x121)]=0.1,this['volatilityLookback']=0x64,this['ofiLookback']=0x14,this[_0x2653c1(0xfa)]=0x8,this[_0x2653c1(0xeb)]=0x10,this['breakevenTicks']=0x4,this[_0x2653c1(0xc8)]=0.5,this['minConfidence']=0.55,this[_0x2653c1(0xe5)]={'zscore':0.3,'ofi':0.2,'vpin':0.15,'kalman':0.15,'kyleLambda':0.1,'volatility':0.1},this[_0x2653c1(0x130)]=new Map(),this[_0x2653c1(0x126)]=new Map(),this['volumeBuffer']=new Map(),this[_0x2653c1(0xdb)]=new Map(),this['atrHistory']=new Map(),this[_0x2653c1(0xf9)]=[],this['winStreak']=0x0,this[_0x2653c1(0xc4)]=0x0,this[_0x2653c1(0xf3)]=0x0,this[_0x2653c1(0xe8)]=0x7530,this['minHoldTimeMs']=0x2710,this[_0x2653c1(0xf0)]={'signals':0x0,'trades':0x0,'wins':0x0,'losses':0x0,'pnl':0x0};}[_0x3da12b(0xc5)](_0x5c2963,_0x2a4315=0.25,_0x7dedf5=0x5){const _0xd5d034=_0x3da12b;this['tickSize']=_0x2a4315,this['tickValue']=_0x7dedf5,this[_0xd5d034(0x130)][_0xd5d034(0x108)](_0x5c2963,[]),this[_0xd5d034(0x126)]['set'](_0x5c2963,[]),this['volumeBuffer'][_0xd5d034(0x108)](_0x5c2963,[]),this['atrHistory'][_0xd5d034(0x108)](_0x5c2963,[]),this[_0xd5d034(0xdb)]['set'](_0x5c2963,{'estimate':0x0,'errorCovariance':0x1}),this[_0xd5d034(0xea)]('log',{'type':'info','message':'[HQX-UltraScalping]\x20Initialized\x20for\x20'+_0x5c2963+':\x20tick='+_0x2a4315+',\x20value='+_0x7dedf5}),this['emit'](_0xd5d034(0x128),{'type':'info','message':_0xd5d034(0x10f)});}[_0x3da12b(0xdc)](_0x3b4bbc){const _0x24ec74=_0x3da12b,{contractId:_0x40e85b,price:_0x2c5607,volume:_0xca50f2,side:_0x51e21a,timestamp:_0xfe5f31}=_0x3b4bbc,_0x3e212c={'timestamp':_0xfe5f31||Date[_0x24ec74(0x106)](),'open':_0x2c5607,'high':_0x2c5607,'low':_0x2c5607,'close':_0x2c5607,'volume':_0xca50f2||0x1};return this[_0x24ec74(0xcf)](_0x40e85b,_0x3e212c);}['onTick'](_0x101470){return this['processTick'](_0x101470);}[_0x3da12b(0xca)](_0x14c28a){const _0xb61fb2=_0x3da12b;return this[_0xb61fb2(0xdc)]({'contractId':_0x14c28a['contractId']||_0x14c28a[_0xb61fb2(0x10b)],'price':_0x14c28a['price'],'volume':_0x14c28a[_0xb61fb2(0xe2)]||_0x14c28a[_0xb61fb2(0xe9)]||0x1,'side':_0x14c28a['side'],'timestamp':_0x14c28a[_0xb61fb2(0x131)]||Date[_0xb61fb2(0x106)]()});}[_0x3da12b(0xcf)](_0x5a24f5,_0x8abd51){const _0x58f840=_0x3da12b;let _0x135c50=this[_0x58f840(0x130)][_0x58f840(0x110)](_0x5a24f5);!_0x135c50&&(this['initialize'](_0x5a24f5),_0x135c50=this[_0x58f840(0x130)][_0x58f840(0x110)](_0x5a24f5));_0x135c50['push'](_0x8abd51);if(_0x135c50[_0x58f840(0xcb)]>0x1f4)_0x135c50[_0x58f840(0x112)]();const _0xadbc5f=this['priceBuffer']['get'](_0x5a24f5);_0xadbc5f[_0x58f840(0xf1)](_0x8abd51[_0x58f840(0xfc)]);if(_0xadbc5f['length']>0xc8)_0xadbc5f[_0x58f840(0x112)]();const _0x3c5e0c=this[_0x58f840(0xd8)]['get'](_0x5a24f5),_0x37a714=_0x8abd51['high']-_0x8abd51['low'];let _0x240058=_0x8abd51['volume']*0.5,_0x30f27c=_0x8abd51[_0x58f840(0xe9)]*0.5;if(_0x37a714>0x0){const _0x1a90f0=(_0x8abd51['close']-_0x8abd51['low'])/_0x37a714;_0x240058=_0x8abd51[_0x58f840(0xe9)]*_0x1a90f0,_0x30f27c=_0x8abd51['volume']*(0x1-_0x1a90f0);}_0x3c5e0c[_0x58f840(0xf1)]({'buy':_0x240058,'sell':_0x30f27c});if(_0x3c5e0c[_0x58f840(0xcb)]>0x64)_0x3c5e0c[_0x58f840(0x112)]();if(_0x135c50['length']<0x32)return null;const _0x220d55=this[_0x58f840(0xed)](_0xadbc5f),_0x1b244a=this['_computeVPIN'](_0x3c5e0c),_0x54cdd9=this['_computeKyleLambda'](_0x135c50),_0x3257d8=this['_applyKalmanFilter'](_0x5a24f5,_0x8abd51['close']),{regime:_0x834b25,params:_0x591b23}=this['_detectVolatilityRegime'](_0x5a24f5,_0x135c50),_0xc0890a=this[_0x58f840(0xd1)](_0x135c50);return this['_generateSignal'](_0x5a24f5,_0x8abd51['close'],_0x220d55,_0x1b244a,_0x54cdd9,_0x3257d8,_0x834b25,_0x591b23,_0xc0890a,_0x135c50);}[_0x3da12b(0xed)](_0x15f4e7,_0x573fed=0x32){const _0x54153d=_0x3da12b;if(_0x15f4e7['length']<_0x573fed)return 0x0;const _0x1c20ca=_0x15f4e7[_0x54153d(0xfd)](-_0x573fed),_0x196d3e=_0x1c20ca[_0x54153d(0x11e)]((_0x2ebf0c,_0x2f4e69)=>_0x2ebf0c+_0x2f4e69,0x0)/_0x573fed,_0x5a60c0=_0x1c20ca['reduce']((_0x5df1d0,_0x4f65a1)=>_0x5df1d0+Math['pow'](_0x4f65a1-_0x196d3e,0x2),0x0)/_0x573fed,_0x175ed2=Math['sqrt'](_0x5a60c0);if(_0x175ed2<0.0001)return 0x0;const _0x2b7f0d=_0x15f4e7[_0x15f4e7['length']-0x1];return(_0x2b7f0d-_0x196d3e)/_0x175ed2;}['_computeVPIN'](_0x20eb56){const _0x5b53b5=_0x3da12b;if(_0x20eb56['length']<this[_0x5b53b5(0xd3)])return 0.5;const _0x5bcb11=_0x20eb56['slice'](-this['vpinWindow']);let _0x1baf33=0x0,_0x1fcbbf=0x0;for(const _0x22d925 of _0x5bcb11){_0x1baf33+=_0x22d925['buy'],_0x1fcbbf+=_0x22d925['sell'];}const _0x2e26cb=_0x1baf33+_0x1fcbbf;if(_0x2e26cb<0x1)return 0.5;return Math[_0x5b53b5(0x102)](_0x1baf33-_0x1fcbbf)/_0x2e26cb;}[_0x3da12b(0xef)](_0x101a50){const _0x5bcfc8=_0x3da12b;if(_0x101a50['length']<0x14)return 0x0;const _0x54370e=_0x101a50['slice'](-0x14),_0x2c4866=[],_0x329552=[];for(let _0x462446=0x1;_0x462446<_0x54370e[_0x5bcfc8(0xcb)];_0x462446++){_0x2c4866[_0x5bcfc8(0xf1)](_0x54370e[_0x462446][_0x5bcfc8(0xfc)]-_0x54370e[_0x462446-0x1][_0x5bcfc8(0xfc)]),_0x329552['push'](_0x54370e[_0x462446][_0x5bcfc8(0xe9)]);}const _0x86c99e=_0x2c4866[_0x5bcfc8(0x11e)]((_0x4026f9,_0x12c57f)=>_0x4026f9+_0x12c57f,0x0)/_0x2c4866['length'],_0x4e5cff=_0x329552['reduce']((_0x1e91c8,_0x47f7b6)=>_0x1e91c8+_0x47f7b6,0x0)/_0x329552['length'];let _0x3305ec=0x0,_0x293b7c=0x0;for(let _0x15d038=0x0;_0x15d038<_0x2c4866[_0x5bcfc8(0xcb)];_0x15d038++){_0x3305ec+=(_0x2c4866[_0x15d038]-_0x86c99e)*(_0x329552[_0x15d038]-_0x4e5cff),_0x293b7c+=Math[_0x5bcfc8(0xfe)](_0x329552[_0x15d038]-_0x4e5cff,0x2);}_0x3305ec/=_0x2c4866['length'],_0x293b7c/=_0x2c4866[_0x5bcfc8(0xcb)];if(_0x293b7c<0.0001)return 0x0;return Math[_0x5bcfc8(0x102)](_0x3305ec/_0x293b7c);}[_0x3da12b(0x123)](_0x20a79b,_0x599046){const _0x17bbb2=_0x3da12b;let _0x55c5dc=this['kalmanStates'][_0x17bbb2(0x110)](_0x20a79b);if(!_0x55c5dc)return _0x55c5dc={'estimate':_0x599046,'errorCovariance':0x1},this['kalmanStates'][_0x17bbb2(0x108)](_0x20a79b,_0x55c5dc),_0x599046;const _0x44e1c0=_0x55c5dc[_0x17bbb2(0x115)],_0x4563f6=_0x55c5dc[_0x17bbb2(0xf4)]+this[_0x17bbb2(0x104)],_0x5e912c=_0x4563f6/(_0x4563f6+this['kalmanMeasurementNoise']),_0x5ad057=_0x44e1c0+_0x5e912c*(_0x599046-_0x44e1c0),_0x5ae60d=(0x1-_0x5e912c)*_0x4563f6;return _0x55c5dc['estimate']=_0x5ad057,_0x55c5dc[_0x17bbb2(0xf4)]=_0x5ae60d,_0x5ad057;}[_0x3da12b(0x116)](_0x4a6bfc,_0x371812){const _0x418e81=_0x3da12b,_0x1641a2=this['_calculateATR'](_0x371812),_0x10bee3=_0x1641a2/this['tickSize'];let _0x50c8f2=this[_0x418e81(0x111)]['get'](_0x4a6bfc);!_0x50c8f2&&(_0x50c8f2=[],this['atrHistory'][_0x418e81(0x108)](_0x4a6bfc,_0x50c8f2));_0x50c8f2['push'](_0x1641a2);if(_0x50c8f2['length']>0x1f4)_0x50c8f2['shift']();let _0x1d0a21=0.5;_0x50c8f2['length']>=0x14&&(_0x1d0a21=_0x50c8f2[_0x418e81(0x12c)](_0x33cf51=>_0x33cf51<=_0x1641a2)[_0x418e81(0xcb)]/_0x50c8f2[_0x418e81(0xcb)]);let _0x3bc301,_0x5587cf;if(_0x1d0a21<0.25)_0x3bc301='low',_0x5587cf={'stopMultiplier':0.8,'targetMultiplier':0.9,'zscoreThreshold':1.2,'confidenceBonus':0.05};else _0x1d0a21<0.75?(_0x3bc301='normal',_0x5587cf={'stopMultiplier':0x1,'targetMultiplier':0x1,'zscoreThreshold':1.5,'confidenceBonus':0x0}):(_0x3bc301=_0x418e81(0x11d),_0x5587cf={'stopMultiplier':1.3,'targetMultiplier':1.2,'zscoreThreshold':0x2,'confidenceBonus':-0.05});return{'regime':_0x3bc301,'params':_0x5587cf};}['_calculateATR'](_0x4148ce,_0x1080a3=0xe){const _0x341874=_0x3da12b;if(_0x4148ce['length']<_0x1080a3+0x1)return 2.5;const _0x3ce9aa=[];for(let _0x3dd4f3=_0x4148ce['length']-_0x1080a3;_0x3dd4f3<_0x4148ce['length'];_0x3dd4f3++){const _0x166e67=_0x4148ce[_0x3dd4f3],_0x350e18=_0x4148ce[_0x3dd4f3-0x1]['close'],_0x15ad7f=Math[_0x341874(0x12a)](_0x166e67['high']-_0x166e67['low'],Math['abs'](_0x166e67['high']-_0x350e18),Math['abs'](_0x166e67[_0x341874(0xf8)]-_0x350e18));_0x3ce9aa['push'](_0x15ad7f);}return _0x3ce9aa[_0x341874(0x11e)]((_0xdadf67,_0x379d30)=>_0xdadf67+_0x379d30,0x0)/_0x3ce9aa['length'];}['_computeOrderFlowImbalance'](_0x485966){const _0x492ff1=_0x3da12b;if(_0x485966[_0x492ff1(0xcb)]<this['ofiLookback'])return 0x0;const _0x157890=_0x485966['slice'](-this[_0x492ff1(0x10a)]);let _0x193294=0x0,_0x12598f=0x0;for(const _0x5785ed of _0x157890){const _0x23c618=_0x5785ed['high']-_0x5785ed['low'];if(_0x23c618>0x0){const _0x5286d5=(_0x5785ed['close']-_0x5785ed[_0x492ff1(0xf8)])/_0x23c618;_0x193294+=_0x5286d5*_0x5785ed[_0x492ff1(0xe9)],_0x12598f+=(0x1-_0x5286d5)*_0x5785ed[_0x492ff1(0xe9)];}}const _0x194b47=_0x193294+_0x12598f;if(_0x194b47<0x1)return 0x0;return(_0x193294-_0x12598f)/_0x194b47;}[_0x3da12b(0x11c)](_0x362db6,_0x8d5f50,_0x5adacf,_0x5d16f9,_0x520006,_0x438c9b,_0x3c2af0,_0x397fd1,_0x232da3,_0x7674ea){const _0x1973a5=_0x3da12b,_0x5203b2=Math['abs'](_0x5adacf);if(_0x5203b2<_0x397fd1[_0x1973a5(0x122)])return null;if(_0x5d16f9>this['vpinToxicThreshold'])return null;let _0x6e0c76;if(_0x5adacf<-_0x397fd1['zscoreThreshold'])_0x6e0c76=_0x1973a5(0xd0);else{if(_0x5adacf>_0x397fd1['zscoreThreshold'])_0x6e0c76=_0x1973a5(0xce);else return null;}const _0xd25623=_0x6e0c76==='long'&&_0x232da3>0.1||_0x6e0c76==='short'&&_0x232da3<-0.1,_0x532fe0=_0x8d5f50-_0x438c9b,_0x4bdc55=_0x6e0c76==='long'&&_0x532fe0<0x0||_0x6e0c76===_0x1973a5(0xce)&&_0x532fe0>0x0,_0x49a590={'zscore':Math['min'](0x1,_0x5203b2/0x4),'vpin':0x1-_0x5d16f9,'kyleLambda':_0x520006>0.001?0.5:0.8,'kalman':_0x4bdc55?0.8:0.4,'volatility':_0x3c2af0===_0x1973a5(0xd2)?0.8:_0x3c2af0==='low'?0.7:0.6,'ofi':_0xd25623?0.9:0.5,'composite':0x0};_0x49a590[_0x1973a5(0xf2)]=_0x49a590[_0x1973a5(0xe1)]*this[_0x1973a5(0xe5)]['zscore']+_0x49a590['vpin']*this[_0x1973a5(0xe5)]['vpin']+_0x49a590['kyleLambda']*this['weights'][_0x1973a5(0x124)]+_0x49a590['kalman']*this[_0x1973a5(0xe5)]['kalman']+_0x49a590['volatility']*this['weights']['volatility']+_0x49a590[_0x1973a5(0x12d)]*this[_0x1973a5(0xe5)]['ofi'];const _0x574d0f=Math[_0x1973a5(0x129)](0x1,_0x49a590[_0x1973a5(0xf2)]+_0x397fd1['confidenceBonus']);if(_0x574d0f<this['minConfidence'])return null;if(Date['now']()-this['lastSignalTime']<this[_0x1973a5(0xe8)])return null;const _0x4e7291=Math[_0x1973a5(0x11b)](this[_0x1973a5(0xfa)]*_0x397fd1[_0x1973a5(0x100)]),_0x2116b1=Math[_0x1973a5(0x11b)](this['baseTargetTicks']*_0x397fd1['targetMultiplier']),_0xf92e7d=Math['max'](0x6,Math[_0x1973a5(0x129)](0xc,_0x4e7291)),_0x463630=Math[_0x1973a5(0x12a)](_0xf92e7d*1.5,Math['min'](0x18,_0x2116b1));let _0x2fe4e7,_0x417457,_0x105bb0,_0x6d52b2;_0x6e0c76===_0x1973a5(0xd0)?(_0x2fe4e7=_0x8d5f50-_0xf92e7d*this['tickSize'],_0x417457=_0x8d5f50+_0x463630*this[_0x1973a5(0x118)],_0x105bb0=_0x8d5f50+this['breakevenTicks']*this[_0x1973a5(0x118)],_0x6d52b2=_0x8d5f50+_0x463630*this['profitLockPct']*this[_0x1973a5(0x118)]):(_0x2fe4e7=_0x8d5f50+_0xf92e7d*this[_0x1973a5(0x118)],_0x417457=_0x8d5f50-_0x463630*this[_0x1973a5(0x118)],_0x105bb0=_0x8d5f50-this[_0x1973a5(0x10e)]*this[_0x1973a5(0x118)],_0x6d52b2=_0x8d5f50-_0x463630*this['profitLockPct']*this['tickSize']);const _0x28ef7c=_0x463630/_0xf92e7d,_0x19650d=Math['round'](_0x463630*0.5),_0x2337a4=Math[_0x1973a5(0x11b)](_0xf92e7d*0.4);let _0x4b10f9=SignalStrength['MODERATE'];if(_0x574d0f>=0.85)_0x4b10f9=SignalStrength['VERY_STRONG'];else{if(_0x574d0f>=0.75)_0x4b10f9=SignalStrength['STRONG'];else{if(_0x574d0f<0.6)_0x4b10f9=SignalStrength[_0x1973a5(0x103)];}}const _0x512316=0.5+(_0x574d0f-0.5)*0.4,_0x347e8f=_0x512316*Math['abs'](_0x417457-_0x8d5f50)-(0x1-_0x512316)*Math[_0x1973a5(0x102)](_0x8d5f50-_0x2fe4e7);this['lastSignalTime']=Date[_0x1973a5(0x106)](),this[_0x1973a5(0xf0)][_0x1973a5(0xcc)]++;const _0x1f5186={'id':uuidv4(),'timestamp':Date['now'](),'symbol':_0x362db6['split']('.')[0x0]||_0x362db6,'contractId':_0x362db6,'side':_0x6e0c76==='long'?OrderSide[_0x1973a5(0x107)]:OrderSide[_0x1973a5(0x12e)],'direction':_0x6e0c76,'strategy':_0x1973a5(0x120),'strength':_0x4b10f9,'edge':_0x347e8f,'confidence':_0x574d0f,'entry':_0x8d5f50,'entryPrice':_0x8d5f50,'stopLoss':_0x2fe4e7,'takeProfit':_0x417457,'riskReward':_0x28ef7c,'stopTicks':_0xf92e7d,'targetTicks':_0x463630,'trailTriggerTicks':_0x19650d,'trailDistanceTicks':_0x2337a4,'beBreakeven':_0x105bb0,'profitLockLevel':_0x6d52b2,'zScore':_0x5adacf,'zScoreExit':this['zscoreExitThreshold'],'vpinValue':_0x5d16f9,'kyleLambda':_0x520006,'kalmanEstimate':_0x438c9b,'volatilityRegime':_0x3c2af0,'ofiValue':_0x232da3,'models':_0x49a590,'orderFlowConfirmed':_0xd25623,'kalmanConfirmed':_0x4bdc55,'expires':Date[_0x1973a5(0x106)]()+0xea60};return this['emit'](_0x1973a5(0xec),{'side':_0x6e0c76===_0x1973a5(0xd0)?'buy':'sell','action':_0x1973a5(0xc9),'reason':'Z='+_0x5adacf['toFixed'](0x2)+',\x20VPIN='+(_0x5d16f9*0x64)['toFixed'](0x0)+'%,\x20OFI='+(_0x232da3*0x64)[_0x1973a5(0x10d)](0x0)+_0x1973a5(0xf5)+(_0x574d0f*0x64)[_0x1973a5(0x10d)](0x0)+'%',..._0x1f5186}),this['emit'](_0x1973a5(0x128),{'type':_0x1973a5(0x105),'message':'[HQX]\x20SIGNAL:\x20'+_0x6e0c76['toUpperCase']()+_0x1973a5(0xd5)+_0x8d5f50['toFixed'](0x2)+'\x20|\x20Z:'+_0x5adacf['toFixed'](0x2)+_0x1973a5(0x117)+(_0x5d16f9*0x64)[_0x1973a5(0x10d)](0x0)+_0x1973a5(0x127)+(_0x232da3*0x64)['toFixed'](0x0)+'%\x20Kyle:'+_0x520006['toFixed'](0x5)+'\x20Regime:'+_0x3c2af0+'\x20|\x20Conf:'+(_0x574d0f*0x64)['toFixed'](0x0)+'%'}),_0x1f5186;}['shouldExitByZScore'](_0x296a56){const _0x34aca4=_0x3da12b,_0x19a780=this['priceBuffer']['get'](_0x296a56);if(!_0x19a780||_0x19a780['length']<0x32)return![];const _0x28f18a=this['_computeZScore'](_0x19a780);return Math[_0x34aca4(0x102)](_0x28f18a)<this[_0x34aca4(0x113)];}[_0x3da12b(0xde)](_0x1e367e){const _0x1b844d=_0x3da12b,_0x537343=this[_0x1b844d(0x126)][_0x1b844d(0x110)](_0x1e367e),_0x40e92c=this['volumeBuffer'][_0x1b844d(0x110)](_0x1e367e),_0x124814=this[_0x1b844d(0x130)]['get'](_0x1e367e);if(!_0x537343||!_0x40e92c||!_0x124814||_0x124814['length']<0x32)return null;const _0x1700ab=this[_0x1b844d(0xed)](_0x537343),_0x4f7b7f=this['_computeVPIN'](_0x40e92c),_0xd4a247=this[_0x1b844d(0xef)](_0x124814),_0x4259a6=this[_0x1b844d(0xd1)](_0x124814);return{'zscore':Math['min'](0x1,Math[_0x1b844d(0x102)](_0x1700ab)/0x4),'vpin':0x1-_0x4f7b7f,'kyleLambda':_0xd4a247>0.001?0.5:0.8,'kalman':0.7,'volatility':0.7,'ofi':Math[_0x1b844d(0x102)](_0x4259a6)>0.1?0.8:0.5,'composite':0.7,'raw':{'zscore':_0x1700ab,'vpin':_0x4f7b7f,'kyleLambda':_0xd4a247,'ofi':_0x4259a6}};}[_0x3da12b(0xc7)](_0x384545,_0x45eca4){const _0x31752b=_0x3da12b,_0xad502b=this[_0x31752b(0x130)][_0x31752b(0x110)](_0x384545)||[];if(_0xad502b[_0x31752b(0xcb)]<0x32)return{'ready':![],'message':_0x31752b(0xdd)+_0xad502b['length']+_0x31752b(0x119)};const _0x2c5617=this['priceBuffer'][_0x31752b(0x110)](_0x384545)||[],_0x24db6c=this[_0x31752b(0xd8)][_0x31752b(0x110)](_0x384545)||[],_0x345465=this['_computeZScore'](_0x2c5617),_0x2ef726=this[_0x31752b(0xe7)](_0x24db6c),_0x3bc367=this[_0x31752b(0xd1)](_0xad502b),_0x479828=this[_0x31752b(0xef)](_0xad502b),{regime:_0x2fbf4f,params:_0x284475}=this['_detectVolatilityRegime'](_0x384545,_0xad502b);return{'ready':!![],'zScore':_0x345465,'vpin':_0x2ef726,'ofi':_0x3bc367,'kyleLambda':_0x479828,'regime':_0x2fbf4f,'stopTicks':Math[_0x31752b(0x11b)](this[_0x31752b(0xfa)]*_0x284475['stopMultiplier']),'targetTicks':Math['round'](this[_0x31752b(0xeb)]*_0x284475['targetMultiplier']),'threshold':_0x284475[_0x31752b(0x122)],'barsProcessed':_0xad502b['length'],'models':_0x31752b(0xd9)};}['recordTradeResult'](_0x1311d9){const _0x21a2e1=_0x3da12b;this[_0x21a2e1(0xf9)]['push']({'netPnl':_0x1311d9,'timestamp':Date['now']()});if(this[_0x21a2e1(0xf9)]['length']>0x64)this[_0x21a2e1(0xf9)]['shift']();_0x1311d9>0x0?(this[_0x21a2e1(0xda)]++,this[_0x21a2e1(0xc4)]=0x0,this['stats'][_0x21a2e1(0xe4)]++):(this[_0x21a2e1(0xc4)]++,this[_0x21a2e1(0xda)]=0x0,this[_0x21a2e1(0xf0)][_0x21a2e1(0x10c)]++),this['stats']['trades']++,this[_0x21a2e1(0xf0)]['pnl']+=_0x1311d9,this[_0x21a2e1(0xea)](_0x21a2e1(0x128),{'type':'debug','message':_0x21a2e1(0xd7)+(_0x1311d9>0x0?'WIN':'LOSS')+'\x20$'+_0x1311d9[_0x21a2e1(0x10d)](0x2)+_0x21a2e1(0x11a)+(_0x1311d9>0x0?this['winStreak']:-this[_0x21a2e1(0xc4)])});}[_0x3da12b(0xe3)](_0x2f82b8){return this['barHistory']['get'](_0x2f82b8)||[];}[_0x3da12b(0x101)](){const _0x25eaad=_0x3da12b;return this[_0x25eaad(0xf0)];}[_0x3da12b(0xe6)](_0xdd980e){const _0x43cd06=_0x3da12b;this[_0x43cd06(0x130)]['set'](_0xdd980e,[]),this[_0x43cd06(0x126)][_0x43cd06(0x108)](_0xdd980e,[]),this[_0x43cd06(0xd8)][_0x43cd06(0x108)](_0xdd980e,[]),this['atrHistory']['set'](_0xdd980e,[]),this[_0x43cd06(0xdb)][_0x43cd06(0x108)](_0xdd980e,{'estimate':0x0,'errorCovariance':0x1}),this[_0x43cd06(0xea)](_0x43cd06(0x128),{'type':'info','message':'[HQX-UltraScalping]\x20Reset\x20state\x20for\x20'+_0xdd980e});}}class UltraScalpingStrategy extends EventEmitter{constructor(_0x5e8184={}){const _0x45d715=_0x3da12b;super(),this['config']=_0x5e8184,this['strategy']=new HQXUltraScalping(_0x5e8184),this[_0x45d715(0xff)]['on'](_0x45d715(0xec),_0x4cebff=>this['emit']('signal',_0x4cebff)),this[_0x45d715(0xff)]['on']('log',_0x4e40c8=>this[_0x45d715(0xea)]('log',_0x4e40c8));}[_0x3da12b(0xdc)](_0x2967ce){const _0x21dba7=_0x3da12b;return this[_0x21dba7(0xff)]['processTick'](_0x2967ce);}['onTick'](_0xe6dc4c){const _0x275f48=_0x3da12b;return this[_0x275f48(0xff)]['onTick'](_0xe6dc4c);}[_0x3da12b(0xca)](_0x4929de){const _0x20cba1=_0x3da12b;return this[_0x20cba1(0xff)][_0x20cba1(0xca)](_0x4929de);}['processBar'](_0x31566d,_0x33938c){const _0x31b415=_0x3da12b;return this[_0x31b415(0xff)][_0x31b415(0xcf)](_0x31566d,_0x33938c);}['initialize'](_0x39baf2,_0x56fd90,_0x9264ab){const _0x11acc2=_0x3da12b;return this[_0x11acc2(0xff)][_0x11acc2(0xc5)](_0x39baf2,_0x56fd90,_0x9264ab);}['getAnalysisState'](_0x5e099e,_0x18d65a){const _0x2f7ff8=_0x3da12b;return this[_0x2f7ff8(0xff)][_0x2f7ff8(0xc7)](_0x5e099e,_0x18d65a);}['recordTradeResult'](_0x4aa3dd){const _0x5b4404=_0x3da12b;return this[_0x5b4404(0xff)][_0x5b4404(0xe0)](_0x4aa3dd);}[_0x3da12b(0xe6)](_0x306e62){const _0x393299=_0x3da12b;return this['strategy'][_0x393299(0xe6)](_0x306e62);}[_0x3da12b(0x101)](){const _0x31bd5e=_0x3da12b;return this[_0x31bd5e(0xff)][_0x31bd5e(0x101)]();}['getBarHistory'](_0x435b6a){return this['strategy']['getBarHistory'](_0x435b6a);}[_0x3da12b(0xde)](_0x23f498){return this['strategy']['getModelValues'](_0x23f498);}['shouldExitByZScore'](_0x875cff){const _0x43cc5c=_0x3da12b;return this[_0x43cc5c(0xff)][_0x43cc5c(0xc6)](_0x875cff);}[_0x3da12b(0xf6)](_0x55b6d0){return null;}}function _0x58c7(_0x5a0252,_0x2ab212){_0x5a0252=_0x5a0252-0xc4;const _0x556667=_0x5566();let _0x58c76c=_0x556667[_0x5a0252];return _0x58c76c;}function _0x5566(){const _0x20771a=['profitLockPct','open','onTrade','length','signals','2238696lGImgI','short','processBar','long','_computeOrderFlowImbalance','normal','vpinWindow','349601wOjQWr','\x20@\x20','18332YBVOaj','[HQX]\x20Trade\x20result:\x20','volumeBuffer','6\x20(Z-Score,\x20VPIN,\x20Kyle,\x20Kalman,\x20Vol,\x20OFI)','winStreak','kalmanStates','processTick','Collecting\x20data...\x20','getModelValues','1075VhKXQd','recordTradeResult','zscore','size','getBarHistory','wins','weights','reset','_computeVPIN','cooldownMs','volume','emit','baseTargetTicks','signal','_computeZScore','5560880tVMTVj','_computeKyleLambda','stats','push','composite','lastSignalTime','errorCovariance','%,\x20cf=','generateSignal','uuid','low','recentTrades','baseStopTicks','events','close','slice','pow','strategy','stopMultiplier','getStats','abs','WEAK','kalmanProcessNoise','info','now','BID','set','677EriKCE','ofiLookback','symbol','losses','toFixed','breakevenTicks','[HQX-UltraScalping]\x206\x20Models:\x20Z-Score(30%),\x20OFI(20%),\x20VPIN(15%),\x20Kalman(15%),\x20Kyle(10%),\x20Vol(10%)','get','atrHistory','shift','zscoreExitThreshold','3631959exDCIv','estimate','_detectVolatilityRegime','\x20VPIN:','tickSize','/50\x20bars',',\x20streak:\x20','round','_generateSignal','high','reduce','60QFUEhj','HQX_ULTRA_SCALPING_6MODELS','kalmanMeasurementNoise','zscoreThreshold','_applyKalmanFilter','kyleLambda','16009800Zxfxtb','priceBuffer','%\x20OFI:','log','min','max','exports','filter','ofi','ASK','724PCJxav','barHistory','timestamp','lossStreak','initialize','shouldExitByZScore','getAnalysisState'];_0x5566=function(){return _0x20771a;};return _0x5566();}module[_0x3da12b(0x12b)]={'HQXUltraScalping':HQXUltraScalping,'UltraScalpingStrategy':UltraScalpingStrategy,'M1':UltraScalpingStrategy,'S1':HQXUltraScalping,'OrderSide':OrderSide,'SignalStrength':SignalStrength};
|
|
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};
|
package/package.json
CHANGED
|
@@ -495,8 +495,15 @@ const executeAlgo = async ({ service, account, contract, config, strategy: strat
|
|
|
495
495
|
const h = Math.floor(durationMs / 3600000), m = Math.floor((durationMs % 3600000) / 60000), s = Math.floor((durationMs % 60000) / 1000);
|
|
496
496
|
stats.duration = h > 0 ? `${h}h ${m}m ${s}s` : m > 0 ? `${m}m ${s}s` : `${s}s`;
|
|
497
497
|
renderSessionSummary(stats, stopReason);
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
|
|
499
|
+
const readline = require('readline');
|
|
500
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
501
|
+
await new Promise(resolve => {
|
|
502
|
+
rl.question('\n Press Enter to return to menu...', () => {
|
|
503
|
+
rl.close();
|
|
504
|
+
resolve();
|
|
505
|
+
});
|
|
506
|
+
});
|
|
500
507
|
};
|
|
501
508
|
|
|
502
509
|
module.exports = { executeAlgo };
|
|
@@ -255,8 +255,14 @@ const launchCopyTrading = async (config) => {
|
|
|
255
255
|
|
|
256
256
|
renderSessionSummary(stats, stopReason);
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
const readline = require('readline');
|
|
259
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
260
|
+
await new Promise(resolve => {
|
|
261
|
+
rl.question('\n Press Enter to return to menu...', () => {
|
|
262
|
+
rl.close();
|
|
263
|
+
resolve();
|
|
264
|
+
});
|
|
265
|
+
});
|
|
260
266
|
};
|
|
261
267
|
|
|
262
268
|
/**
|