codifx 0.1.9 → 0.1.11

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.
Files changed (43) hide show
  1. package/dist/cli/commands/explain.js +1 -179
  2. package/dist/cli/commands/profile.js +1 -55
  3. package/dist/cli/commands/scan.js +1 -300
  4. package/dist/cli/commands/simulate.js +1 -109
  5. package/dist/cli/commands/validate.js +1 -26
  6. package/dist/cli/index.js +1 -94
  7. package/dist/config/loader.js +1 -124
  8. package/dist/config/schema.js +1 -49
  9. package/dist/core/engine.js +1 -169
  10. package/dist/core/filters.js +1 -70
  11. package/dist/core/oscillator-engine.js +1 -224
  12. package/dist/core/scoring.js +1 -101
  13. package/dist/core/timeframe.js +1 -52
  14. package/dist/core/trend-engine.js +1 -137
  15. package/dist/data/mock.js +1 -111
  16. package/dist/data/provider.js +1 -29
  17. package/dist/data/yahoo.js +1 -200
  18. package/dist/index.js +1 -19
  19. package/dist/indicators/oscillator/adx.js +1 -118
  20. package/dist/indicators/oscillator/atr.js +1 -31
  21. package/dist/indicators/oscillator/cci.js +1 -39
  22. package/dist/indicators/oscillator/macd.js +1 -73
  23. package/dist/indicators/oscillator/momentum.js +1 -35
  24. package/dist/indicators/oscillator/rsi.js +1 -93
  25. package/dist/indicators/oscillator/stochastic.js +1 -89
  26. package/dist/indicators/oscillator/williams.js +1 -44
  27. package/dist/indicators/trend/ema.js +1 -36
  28. package/dist/indicators/trend/hma.js +1 -48
  29. package/dist/indicators/trend/sma.js +1 -30
  30. package/dist/indicators/trend/vwma.js +1 -23
  31. package/dist/types/index.js +1 -5
  32. package/dist/utils/constants.js +1 -105
  33. package/dist/utils/explain.js +1 -83
  34. package/dist/utils/formatter.js +1 -104
  35. package/dist/utils/html-generator.js +1 -107
  36. package/dist/utils/indicators.js +1 -106
  37. package/dist/utils/levels.js +1 -82
  38. package/dist/utils/logger.js +1 -238
  39. package/dist/utils/paths.js +1 -32
  40. package/dist/utils/symbols.js +1 -44
  41. package/dist/utils/trading-type-config.js +1 -96
  42. package/dist/utils/version-checker.js +1 -76
  43. package/package.json +1 -2
@@ -1,107 +1 @@
1
- /**
2
- * HTML Generator - Generate HTML dashboard from scan results
3
- */
4
- import { readFile, writeFile } from "fs/promises";
5
- import { join } from "path";
6
- import { tmpdir } from "os";
7
- import { exec } from "child_process";
8
- import { promisify } from "util";
9
- const execAsync = promisify(exec);
10
- export class HTMLGenerator {
11
- /**
12
- * Generate HTML dashboard from trading signals
13
- */
14
- static async generateDashboard(signals, outputPath) {
15
- // Default output path - use OS temp directory with fixed filename
16
- const htmlPath = outputPath || join(tmpdir(), `codifx-dashboard.html`);
17
- // Load template
18
- const templatePath = join(new URL("../../templates/", import.meta.url).pathname, "dashboard.html");
19
- let template = await readFile(templatePath, "utf-8");
20
- // Calculate stats
21
- const totalSignals = signals.length;
22
- const buySignals = signals.filter((s) => s.direction === "BUY").length;
23
- const sellSignals = signals.filter((s) => s.direction === "SELL").length;
24
- const avgScore = totalSignals > 0
25
- ? Math.round(signals.reduce((sum, s) => sum + s.score, 0) /
26
- totalSignals)
27
- : 0;
28
- // Format scan time
29
- const scanTime = new Date().toLocaleString("id-ID", {
30
- dateStyle: "medium",
31
- timeStyle: "short",
32
- });
33
- // Helper function to convert symbol to TradingView format
34
- const convertSymbolToTradingView = (symbol) => {
35
- if (symbol.endsWith(".JK")) {
36
- const baseSymbol = symbol.replace(".JK", "");
37
- return `IDX:${baseSymbol}`;
38
- }
39
- // Add other market conversions if needed
40
- return symbol;
41
- };
42
- // Transform signals to template format
43
- const stockData = signals.map((signal) => ({
44
- symbol: convertSymbolToTradingView(signal.symbol),
45
- originalSymbol: signal.symbol, // Keep original for internal use if needed
46
- direction: signal.direction,
47
- rating: signal.rating,
48
- finalScore: signal.score,
49
- breakdown: {
50
- trend: signal.trendScore,
51
- oscillator: signal.oscillatorScore,
52
- volumeBonus: signal.volumeBonus,
53
- volatilityBonus: signal.volatilityBonus,
54
- confirmationBonus: signal.confirmationBonus,
55
- },
56
- trendDetails: signal.trendDetails,
57
- oscillatorDetails: signal.oscillatorDetails,
58
- filters: {
59
- liquidity: signal.details.filters.liquidity,
60
- volatility: signal.details.filters.volatilityPass,
61
- },
62
- // Trading levels
63
- entry: signal.entry,
64
- stopLoss: signal.stopLoss,
65
- takeProfit: signal.takeProfit,
66
- support: signal.support,
67
- resistance: signal.resistance,
68
- riskRewardRatio: signal.riskRewardRatio,
69
- winRate: signal.winRate,
70
- }));
71
- // Replace placeholders
72
- template = template.replace("{{SCAN_TIME}}", scanTime);
73
- template = template.replace("{{TOTAL_SIGNALS}}", totalSignals.toString());
74
- template = template.replace("{{BUY_SIGNALS}}", buySignals.toString());
75
- template = template.replace("{{SELL_SIGNALS}}", sellSignals.toString());
76
- template = template.replace("{{AVG_SCORE}}", avgScore.toString());
77
- template = template.replace("{{STOCK_DATA}}", JSON.stringify(stockData, null, 2));
78
- // Write HTML file
79
- await writeFile(htmlPath, template, "utf-8");
80
- return htmlPath;
81
- }
82
- /**
83
- * Open HTML file in default browser
84
- */
85
- static async openInBrowser(htmlPath) {
86
- const platform = process.platform;
87
- try {
88
- if (platform === "darwin") {
89
- // macOS
90
- await execAsync(`open "${htmlPath}"`);
91
- }
92
- else if (platform === "win32") {
93
- // Windows
94
- await execAsync(`start "" "${htmlPath}"`);
95
- }
96
- else {
97
- // Linux
98
- await execAsync(`xdg-open "${htmlPath}"`);
99
- }
100
- }
101
- catch (error) {
102
- console.error("Failed to open browser:", error);
103
- throw new Error(`Could not open browser automatically. Please open: ${htmlPath}`);
104
- }
105
- }
106
- }
107
- //# sourceMappingURL=html-generator.js.map
1
+ const a0_0x5485ba=a0_0xbaf5;(function(_0x596faf,_0x46b28a){const _0x56f6c9=a0_0xbaf5,_0x112a4a=_0x596faf();while(!![]){try{const _0x140e7b=-parseInt(_0x56f6c9(0x1f4))/0x1+parseInt(_0x56f6c9(0x1c9))/0x2*(-parseInt(_0x56f6c9(0x1f6))/0x3)+-parseInt(_0x56f6c9(0x1f3))/0x4*(-parseInt(_0x56f6c9(0x1c4))/0x5)+-parseInt(_0x56f6c9(0x1ac))/0x6*(-parseInt(_0x56f6c9(0x1b3))/0x7)+-parseInt(_0x56f6c9(0x1e2))/0x8*(-parseInt(_0x56f6c9(0x1de))/0x9)+-parseInt(_0x56f6c9(0x1ae))/0xa*(-parseInt(_0x56f6c9(0x1db))/0xb)+-parseInt(_0x56f6c9(0x1e9))/0xc;if(_0x140e7b===_0x46b28a)break;else _0x112a4a['push'](_0x112a4a['shift']());}catch(_0x2b21c1){_0x112a4a['push'](_0x112a4a['shift']());}}}(a0_0x5555,0x6aed1));const a0_0x45e842=(function(){const _0x88df54=a0_0xbaf5,_0x4a5296={'psiMI':_0x88df54(0x1c6),'CLsnx':_0x88df54(0x1cf),'iKFSX':function(_0xca2afc,_0x4cf921){return _0xca2afc!==_0x4cf921;},'HKQsO':_0x88df54(0x1a7),'zfDqO':_0x88df54(0x1aa)};let _0x592f02=!![];return function(_0x1ac08c,_0x186718){const _0x19f61f=_0x592f02?function(){const _0x26f304=a0_0xbaf5,_0x1cba9e={'JKYst':_0x4a5296[_0x26f304(0x1c3)],'cstsk':_0x4a5296['CLsnx']};if(_0x4a5296[_0x26f304(0x1f8)](_0x26f304(0x1a7),_0x4a5296[_0x26f304(0x1d4)]))return _0xb3bb09[_0x26f304(0x1eb)]()[_0x26f304(0x1ff)](_0x1cba9e[_0x26f304(0x1e5)])[_0x26f304(0x1eb)]()[_0x26f304(0x1c0)](_0x4d9695)[_0x26f304(0x1ff)](_0x26f304(0x1c6));else{if(_0x186718){if(_0x4a5296[_0x26f304(0x1f8)](_0x26f304(0x1aa),_0x4a5296['zfDqO'])){const _0xb78a6b=_0x6c81d1[_0x26f304(0x1b2)](_0x1cba9e['cstsk'],'');return _0x26f304(0x1b7)+_0xb78a6b;}else{const _0x4027ce=_0x186718['apply'](_0x1ac08c,arguments);return _0x186718=null,_0x4027ce;}}}}:function(){};return _0x592f02=![],_0x19f61f;};}()),a0_0x371b2d=a0_0x45e842(this,function(){const _0xe1ff8b=a0_0xbaf5,_0x4d26c2={'sSjhh':_0xe1ff8b(0x1c6)};return a0_0x371b2d[_0xe1ff8b(0x1eb)]()[_0xe1ff8b(0x1ff)](_0xe1ff8b(0x1c6))[_0xe1ff8b(0x1eb)]()[_0xe1ff8b(0x1c0)](a0_0x371b2d)['search'](_0x4d26c2['sSjhh']);});function a0_0x5555(){const _0x1ed626=['Affnug8','q291BgqGBM90ig9Wzw4GyNjVD3nLCIbHDxrVBwf0AwnHBgX5lIbqBgvHC2uGB3bLBJOG','C2vHCMnO','B3nJAwXSyxrVCKrLDgfPBhm','twvLs0W','AvzXrvu','CerqCfe','CM91BMq','uMDxCK0','BgnNAfO','CMf0Aw5N','mtu2zMjguwDq','E3Ttq0fox1rjtuv9Fq','nZK2otGXmfjNrxfxBW','lI4VlI4VDgvTCgXHDgvZlW','De1IEKm','AwqTsuq','CMvWBgfJzq','mtuYnduZDM9NqNv4','C3LTyM9S','E3TtruXmx1njr05btfn9Fq','qLvz','suryoG','u0vmta','CgXHDgzVCM0','zxjYB3i','BwfW','DM9SDw1LqM9UDxm','zgfYD2LU','y29UzMLYBwf0Aw9UqM9UDxm','C3rYAw5NAwz5','y29UC3rYDwn0B3i','ChfdC1y','CMvKDwnL','ChnPtuK','mteXnty0nuHOvfbrsW','DhjLBMrezxrHAwXZ','kcGOlISPkYKRksSK','BgvUz3rO','C3rVCeXVC3m','mK9Rs2fLva','sMfirxe','sxbnD0y','qK1euhO','EgrNlw9Wzw4GiG','DM9SyxrPBgL0EujVBNvZ','lKPl','DgfRzvbYB2zPDa','turAtLO','uuzlCNC','zMLSDgvYCW','seTrC08','DxL2ALu','DhjLBMrty29Yzq','De9gq1a','C3rHCNqGiIiGiG','Dg9mB2nHBgvtDhjPBMC','yxbWBhK','mtfPD1Pku0C','DxrMltG','B3bLBKLUqNjVD3nLCG','mJyXzLLIB0XS','zgLYzwn0Aw9U','y01nq1e','AwfJs3C','otCZnKjZAMjNra','BwvKAxvT','Cgf0Ag5HBwu','sKTzC3q','B3nJAwXSyxrVCLnJB3jL','C3vWCg9YDa','E3Ttve9ds19eqvrbFx0','mtaZnJK0odHTBxzUshu','yLblt2i','Dg9tDhjPBMC','zw5KC1DPDgG','C2nVCMu','DhDeqwK','EhHryxq','rMfPBgvKihrVig9Wzw4GyNjVD3nLCJO','zxPHthq','vKXvANK','ngXVrgvTyq','mtu0ndmXD1zgB0vk','y29KAwz4lwrHC2HIB2fYzc5ODg1S','ndK1mZK5rhPvrKjV','CMLZA1jLD2fYzfjHDgLV','AuTgu1G','EgXswKK','DM9SyxrPBgL0EvbHC3m','B3bLBIaI','rujgywO'];a0_0x5555=function(){return _0x1ed626;};return a0_0x5555();}a0_0x371b2d();import{readFile,writeFile}from'fs/promises';import{join}from'path';import{tmpdir}from'os';import{exec}from'child_process';function a0_0xbaf5(_0x25d481,_0x3993fa){_0x25d481=_0x25d481-0x1a4;const _0x3e680b=a0_0x5555();let _0x371b2d=_0x3e680b[_0x25d481];if(a0_0xbaf5['ZRfZVw']===undefined){var _0x45e842=function(_0x1434ad){const _0x43bb5b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4e0d2b='',_0x4176bc='',_0x13c340=_0x4e0d2b+_0x45e842;for(let _0x408b4e=0x0,_0x64a61f,_0x3c48bf,_0x222a1d=0x0;_0x3c48bf=_0x1434ad['charAt'](_0x222a1d++);~_0x3c48bf&&(_0x64a61f=_0x408b4e%0x4?_0x64a61f*0x40+_0x3c48bf:_0x3c48bf,_0x408b4e++%0x4)?_0x4e0d2b+=_0x13c340['charCodeAt'](_0x222a1d+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x64a61f>>(-0x2*_0x408b4e&0x6)):_0x408b4e:0x0){_0x3c48bf=_0x43bb5b['indexOf'](_0x3c48bf);}for(let _0x4655cb=0x0,_0x367d3c=_0x4e0d2b['length'];_0x4655cb<_0x367d3c;_0x4655cb++){_0x4176bc+='%'+('00'+_0x4e0d2b['charCodeAt'](_0x4655cb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4176bc);};a0_0xbaf5['xgDrOy']=_0x45e842,a0_0xbaf5['taqdzn']={},a0_0xbaf5['ZRfZVw']=!![];}const _0x5555b2=_0x3e680b[0x0],_0xbaf5cc=_0x25d481+_0x5555b2,_0x5103bd=a0_0xbaf5['taqdzn'][_0xbaf5cc];if(!_0x5103bd){const _0x318417=function(_0x2ce9c0){this['sorgTY']=_0x2ce9c0,this['JGYXgi']=[0x1,0x0,0x0],this['ayKjNX']=function(){return'newState';},this['iuBwzE']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['UvJWMi']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x318417['prototype']['hRGZZY']=function(){const _0x31d2e8=new RegExp(this['iuBwzE']+this['UvJWMi']),_0x2926f7=_0x31d2e8['test'](this['ayKjNX']['toString']())?--this['JGYXgi'][0x1]:--this['JGYXgi'][0x0];return this['vMnfOb'](_0x2926f7);},_0x318417['prototype']['vMnfOb']=function(_0x200fc4){if(!Boolean(~_0x200fc4))return _0x200fc4;return this['YQPPUF'](this['sorgTY']);},_0x318417['prototype']['YQPPUF']=function(_0x5b1669){for(let _0x2bff1b=0x0,_0xcf1f6d=this['JGYXgi']['length'];_0x2bff1b<_0xcf1f6d;_0x2bff1b++){this['JGYXgi']['push'](Math['round'](Math['random']())),_0xcf1f6d=this['JGYXgi']['length'];}return _0x5b1669(this['JGYXgi'][0x0]);},new _0x318417(a0_0xbaf5)['hRGZZY'](),_0x371b2d=a0_0xbaf5['xgDrOy'](_0x371b2d),a0_0xbaf5['taqdzn'][_0xbaf5cc]=_0x371b2d;}else _0x371b2d=_0x5103bd;return _0x371b2d;}import{promisify}from'util';const execAsync=promisify(exec);export class HTMLGenerator{static async['generateDashboard'](_0x19c4d1,_0x2d5df5){const _0x5ed0ea=a0_0xbaf5,_0x207359={'iVqEU':_0x5ed0ea(0x1cf),'cMMCQ':'DuXRW','MeeKL':function(_0x43a6c7,_0x42a2f0,_0x112e22){return _0x43a6c7(_0x42a2f0,_0x112e22);},'pqCsV':function(_0x471f59){return _0x471f59();},'ezaLt':_0x5ed0ea(0x1af),'RgWrM':'dashboard.html','uyvjU':function(_0x282977,_0x48f60c,_0x3707c4){return _0x282977(_0x48f60c,_0x3707c4);},'IpMwF':'utf-8','VLUjy':function(_0x3730ef,_0x5952e1){return _0x3730ef>_0x5952e1;},'hQMPo':function(_0x558adc,_0x5ae714){return _0x558adc/_0x5ae714;},'tMbzC':_0x5ed0ea(0x1b1),'xxQat':_0x5ed0ea(0x1e3),'BMDPz':'short','EBFaj':_0x5ed0ea(0x1ad),'MDZNZ':'{{TOTAL_SIGNALS}}','PKump':_0x5ed0ea(0x1b5),'iacKw':'{{AVG_SCORE}}'},_0x499cdd=_0x2d5df5||_0x207359[_0x5ed0ea(0x1a5)](join,_0x207359[_0x5ed0ea(0x1c1)](tmpdir),_0x5ed0ea(0x1f5)),_0x1a2726=_0x207359['MeeKL'](join,new URL(_0x207359[_0x5ed0ea(0x1f1)],import.meta.url)[_0x5ed0ea(0x1e4)],_0x207359[_0x5ed0ea(0x1a9)]);let _0x240473=await _0x207359[_0x5ed0ea(0x1d5)](readFile,_0x1a2726,_0x207359[_0x5ed0ea(0x1cb)]);const _0x498ec7=_0x19c4d1[_0x5ed0ea(0x1c7)],_0x39c00d=_0x19c4d1['filter'](_0x3c0caa=>_0x3c0caa[_0x5ed0ea(0x1df)]===_0x5ed0ea(0x1b6))['length'],_0x1943d7=_0x19c4d1['filter'](_0x34adfa=>_0x34adfa[_0x5ed0ea(0x1df)]===_0x5ed0ea(0x1b8))[_0x5ed0ea(0x1c7)],_0x2516e3=_0x207359[_0x5ed0ea(0x1f2)](_0x498ec7,0x0)?Math[_0x5ed0ea(0x1a8)](_0x207359[_0x5ed0ea(0x1fd)](_0x19c4d1[_0x5ed0ea(0x1c2)]((_0x35ab0b,_0x3db843)=>_0x35ab0b+_0x3db843[_0x5ed0ea(0x1ed)],0x0),_0x498ec7)):0x0,_0x5a13ef=new Date()[_0x5ed0ea(0x1d9)](_0x207359[_0x5ed0ea(0x1b0)],{'dateStyle':_0x207359[_0x5ed0ea(0x1ef)],'timeStyle':_0x207359[_0x5ed0ea(0x1cc)]}),_0x5a7db4=_0x13ef9e=>{const _0x2f656a=_0x5ed0ea;if(_0x13ef9e[_0x2f656a(0x1ec)](_0x207359[_0x2f656a(0x1a6)])){if(_0x207359[_0x2f656a(0x1e0)]!==_0x207359[_0x2f656a(0x1e0)]){if(_0x3da38d){const _0x5233de=_0x1ffd23[_0x2f656a(0x1da)](_0x247cb0,arguments);return _0x5bd6aa=null,_0x5233de;}}else{const _0x31607f=_0x13ef9e[_0x2f656a(0x1b2)](_0x207359['iVqEU'],'');return _0x2f656a(0x1b7)+_0x31607f;}}return _0x13ef9e;},_0x1a99ae=_0x19c4d1[_0x5ed0ea(0x1bb)](_0x594b3d=>({'symbol':_0x5a7db4(_0x594b3d['symbol']),'originalSymbol':_0x594b3d[_0x5ed0ea(0x1b4)],'direction':_0x594b3d['direction'],'rating':_0x594b3d[_0x5ed0ea(0x1ab)],'finalScore':_0x594b3d[_0x5ed0ea(0x1ed)],'breakdown':{'trend':_0x594b3d[_0x5ed0ea(0x1d6)],'oscillator':_0x594b3d[_0x5ed0ea(0x1e6)],'volumeBonus':_0x594b3d[_0x5ed0ea(0x1bc)],'volatilityBonus':_0x594b3d[_0x5ed0ea(0x1ce)],'confirmationBonus':_0x594b3d[_0x5ed0ea(0x1be)]},'trendDetails':_0x594b3d[_0x5ed0ea(0x1c5)],'oscillatorDetails':_0x594b3d[_0x5ed0ea(0x1a4)],'filters':{'liquidity':_0x594b3d['details'][_0x5ed0ea(0x1d3)]['liquidity'],'volatility':_0x594b3d['details']['filters'][_0x5ed0ea(0x1fa)]},'entry':_0x594b3d['entry'],'stopLoss':_0x594b3d[_0x5ed0ea(0x1c8)],'takeProfit':_0x594b3d[_0x5ed0ea(0x1d0)],'support':_0x594b3d[_0x5ed0ea(0x1e7)],'resistance':_0x594b3d['resistance'],'riskRewardRatio':_0x594b3d[_0x5ed0ea(0x1f7)],'winRate':_0x594b3d['winRate']}));return _0x240473=_0x240473['replace'](_0x207359[_0x5ed0ea(0x1fc)],_0x5a13ef),_0x240473=_0x240473[_0x5ed0ea(0x1b2)](_0x207359[_0x5ed0ea(0x1d1)],_0x498ec7['toString']()),_0x240473=_0x240473['replace']('{{BUY_SIGNALS}}',_0x39c00d[_0x5ed0ea(0x1eb)]()),_0x240473=_0x240473[_0x5ed0ea(0x1b2)](_0x207359['PKump'],_0x1943d7[_0x5ed0ea(0x1eb)]()),_0x240473=_0x240473['replace'](_0x207359[_0x5ed0ea(0x1e1)],_0x2516e3['toString']()),_0x240473=_0x240473[_0x5ed0ea(0x1b2)](_0x5ed0ea(0x1e8),JSON[_0x5ed0ea(0x1bf)](_0x1a99ae,null,0x2)),await writeFile(_0x499cdd,_0x240473,_0x5ed0ea(0x1dc)),_0x499cdd;}static async[a0_0x5485ba(0x1dd)](_0x4d7ff5){const _0x20c7d1=a0_0x5485ba,_0x1b1ece={'twDAi':function(_0x54b93d,_0x1e42a3){return _0x54b93d===_0x1e42a3;},'JaHEq':_0x20c7d1(0x1bd),'tOFCP':function(_0x39a260,_0x9ea501){return _0x39a260(_0x9ea501);},'QFKrw':_0x20c7d1(0x1ea),'xlRZI':_0x20c7d1(0x1f0)},_0x2aa013=process[_0x20c7d1(0x1b9)];try{if(_0x1b1ece[_0x20c7d1(0x1ee)](_0x2aa013,_0x1b1ece[_0x20c7d1(0x1ca)]))await execAsync(_0x20c7d1(0x1fb)+_0x4d7ff5+'\x22');else _0x2aa013==='win32'?await _0x1b1ece[_0x20c7d1(0x1d7)](execAsync,_0x20c7d1(0x1d8)+_0x4d7ff5+'\x22'):await _0x1b1ece[_0x20c7d1(0x1d7)](execAsync,_0x20c7d1(0x1cd)+_0x4d7ff5+'\x22');}catch(_0x3577fd){if(_0x1b1ece[_0x20c7d1(0x1d2)]!==_0x1b1ece['QFKrw']){const _0x238f53=_0x318417?function(){const _0x10b733=_0x20c7d1;if(_0x2bff1b){const _0x36b62e=_0x293546[_0x10b733(0x1da)](_0xc56630,arguments);return _0x12802d=null,_0x36b62e;}}:function(){};return _0x5b1669=![],_0x238f53;}else{console[_0x20c7d1(0x1ba)](_0x1b1ece[_0x20c7d1(0x1f9)],_0x3577fd);throw new Error(_0x20c7d1(0x1fe)+_0x4d7ff5);}}}}
@@ -1,106 +1 @@
1
- /**
2
- * Utility functions for indicator calculations
3
- */
4
- /**
5
- * Extract close prices from OHLCV data
6
- */
7
- export function getClosePrices(data) {
8
- return data.map((d) => d.close);
9
- }
10
- /**
11
- * Extract high prices from OHLCV data
12
- */
13
- export function getHighPrices(data) {
14
- return data.map((d) => d.high);
15
- }
16
- /**
17
- * Extract low prices from OHLCV data
18
- */
19
- export function getLowPrices(data) {
20
- return data.map((d) => d.low);
21
- }
22
- /**
23
- * Extract volumes from OHLCV data
24
- */
25
- export function getVolumes(data) {
26
- return data.map((d) => d.volume);
27
- }
28
- /**
29
- * Calculate average of an array
30
- */
31
- export function average(values) {
32
- if (values.length === 0)
33
- return 0;
34
- return values.reduce((sum, val) => sum + val, 0) / values.length;
35
- }
36
- /**
37
- * Calculate standard deviation
38
- */
39
- export function standardDeviation(values) {
40
- const avg = average(values);
41
- const squaredDiffs = values.map((val) => Math.pow(val - avg, 2));
42
- return Math.sqrt(average(squaredDiffs));
43
- }
44
- /**
45
- * True Range calculation for ATR
46
- */
47
- export function trueRange(data) {
48
- const tr = [];
49
- for (let i = 0; i < data.length; i++) {
50
- if (i === 0) {
51
- tr.push(data[i].high - data[i].low);
52
- }
53
- else {
54
- const highLow = data[i].high - data[i].low;
55
- const highClose = Math.abs(data[i].high - data[i - 1].close);
56
- const lowClose = Math.abs(data[i].low - data[i - 1].close);
57
- tr.push(Math.max(highLow, highClose, lowClose));
58
- }
59
- }
60
- return tr;
61
- }
62
- /**
63
- * Detect crossover (fast crosses above slow)
64
- */
65
- export function crossover(fast, slow) {
66
- if (fast.length < 2 || slow.length < 2)
67
- return false;
68
- const prevFast = fast[fast.length - 2];
69
- const prevSlow = slow[slow.length - 2];
70
- const currFast = fast[fast.length - 1];
71
- const currSlow = slow[slow.length - 1];
72
- return prevFast <= prevSlow && currFast > currSlow;
73
- }
74
- /**
75
- * Detect crossunder (fast crosses below slow)
76
- */
77
- export function crossunder(fast, slow) {
78
- if (fast.length < 2 || slow.length < 2)
79
- return false;
80
- const prevFast = fast[fast.length - 2];
81
- const prevSlow = slow[slow.length - 2];
82
- const currFast = fast[fast.length - 1];
83
- const currSlow = slow[slow.length - 1];
84
- return prevFast >= prevSlow && currFast < currSlow;
85
- }
86
- /**
87
- * Calculate slope of values (recent trend)
88
- */
89
- export function slope(values, period = 5) {
90
- if (values.length < period)
91
- return 0;
92
- const recent = values.slice(-period);
93
- const n = recent.length;
94
- let sumX = 0;
95
- let sumY = 0;
96
- let sumXY = 0;
97
- let sumX2 = 0;
98
- for (let i = 0; i < n; i++) {
99
- sumX += i;
100
- sumY += recent[i];
101
- sumXY += i * recent[i];
102
- sumX2 += i * i;
103
- }
104
- return (n * sumXY - sumX * sumY) / (n * sumX2 - sumX * sumX);
105
- }
106
- //# sourceMappingURL=indicators.js.map
1
+ (function(_0x561807,_0x495842){const _0x3d4bc5=a0_0x47ac,_0x17d169=_0x561807();while(!![]){try{const _0x497d22=parseInt(_0x3d4bc5(0xa5))/0x1+-parseInt(_0x3d4bc5(0x98))/0x2+parseInt(_0x3d4bc5(0x9d))/0x3*(parseInt(_0x3d4bc5(0xbf))/0x4)+parseInt(_0x3d4bc5(0xb2))/0x5+parseInt(_0x3d4bc5(0xa2))/0x6*(parseInt(_0x3d4bc5(0xa7))/0x7)+-parseInt(_0x3d4bc5(0x97))/0x8*(parseInt(_0x3d4bc5(0xaf))/0x9)+parseInt(_0x3d4bc5(0xc3))/0xa;if(_0x497d22===_0x495842)break;else _0x17d169['push'](_0x17d169['shift']());}catch(_0x357752){_0x17d169['push'](_0x17d169['shift']());}}}(a0_0x5dec,0x5ba6f));const a0_0x112508=(function(){const _0x481442=a0_0x47ac,_0x4820e3={'mubIm':function(_0x2c5932,_0x4d394a){return _0x2c5932!==_0x4d394a;},'TLsiL':_0x481442(0xc1),'usWPu':function(_0x2208e2,_0x29fa4b){return _0x2208e2===_0x29fa4b;},'NcSVi':function(_0x56b694,_0x118ccc){return _0x56b694-_0x118ccc;},'DAizh':function(_0x334c0d,_0x19d984){return _0x334c0d-_0x19d984;},'vavkE':_0x481442(0xa0)};let _0x59be14=!![];return function(_0x260e21,_0x4c7e76){const _0x481e66=_0x481442,_0x422bc6={'Kpkxp':function(_0x34423e,_0x523cc0){return _0x4820e3['usWPu'](_0x34423e,_0x523cc0);},'MMqai':function(_0x5e5e64,_0x5e117c){return _0x5e5e64-_0x5e117c;},'jMkph':function(_0x2d7bf7,_0x1cca69){const _0x349822=a0_0x47ac;return _0x4820e3[_0x349822(0xa3)](_0x2d7bf7,_0x1cca69);},'fmGrM':function(_0x48817b,_0x3e8f99){const _0x4ead4b=a0_0x47ac;return _0x4820e3[_0x4ead4b(0xa8)](_0x48817b,_0x3e8f99);}};if(_0x481e66(0x96)===_0x4820e3[_0x481e66(0xb9)]){if(_0x170925){const _0xed39b7=_0x30e660[_0x481e66(0xcc)](_0xab0180,arguments);return _0x5740aa=null,_0xed39b7;}}else{const _0x339cc2=_0x59be14?function(){const _0x5e5b9b=_0x481e66;if(_0x4820e3['mubIm'](_0x4820e3[_0x5e5b9b(0x93)],_0x4820e3[_0x5e5b9b(0x93)])){const _0x2c6def=[];for(let _0x32684d=0x0;_0x32684d<_0x1e3410[_0x5e5b9b(0xce)];_0x32684d++){if(_0x422bc6['Kpkxp'](_0x32684d,0x0))_0x2c6def[_0x5e5b9b(0x99)](_0x422bc6[_0x5e5b9b(0xab)](_0x39fe42[_0x32684d][_0x5e5b9b(0xba)],_0x558086[_0x32684d][_0x5e5b9b(0x94)]));else{const _0xa5d0fb=_0x45e387[_0x32684d][_0x5e5b9b(0xba)]-_0x242b66[_0x32684d][_0x5e5b9b(0x94)],_0x366314=_0x5768ce[_0x5e5b9b(0xc8)](_0x422bc6[_0x5e5b9b(0xc4)](_0x6017a4[_0x32684d][_0x5e5b9b(0xba)],_0x42bd1c[_0x32684d-0x1][_0x5e5b9b(0xcd)])),_0x5e48de=_0x259ed9['abs'](_0x422bc6['jMkph'](_0x1baa35[_0x32684d][_0x5e5b9b(0x94)],_0x5415e9[_0x422bc6[_0x5e5b9b(0xcb)](_0x32684d,0x1)]['close']));_0x2c6def[_0x5e5b9b(0x99)](_0x2dfe4b['max'](_0xa5d0fb,_0x366314,_0x5e48de));}}return _0x2c6def;}else{if(_0x4c7e76){const _0x5510ff=_0x4c7e76['apply'](_0x260e21,arguments);return _0x4c7e76=null,_0x5510ff;}}}:function(){};return _0x59be14=![],_0x339cc2;}};}()),a0_0x300646=a0_0x112508(this,function(){const _0x42fdbd=a0_0x47ac,_0x4afff3={'eAWZd':'(((.+)+)+)+$'};return a0_0x300646[_0x42fdbd(0xa1)]()[_0x42fdbd(0xb5)](_0x4afff3[_0x42fdbd(0x9a)])['toString']()['constructor'](a0_0x300646)['search'](_0x4afff3[_0x42fdbd(0x9a)]);});a0_0x300646();export function getClosePrices(_0x69cbda){const _0x126c53=a0_0x47ac;return _0x69cbda[_0x126c53(0xac)](_0x83df8c=>_0x83df8c[_0x126c53(0xcd)]);}function a0_0x47ac(_0x1db5f4,_0x3d301d){_0x1db5f4=_0x1db5f4-0x93;const _0x6424c3=a0_0x5dec();let _0x300646=_0x6424c3[_0x1db5f4];if(a0_0x47ac['IJYtNM']===undefined){var _0x112508=function(_0x15e3db){const _0x34e6b2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x6db817='',_0xffa968='',_0x4ed0d2=_0x6db817+_0x112508;for(let _0x59e5f4=0x0,_0x401afb,_0x5c6c15,_0xc158f7=0x0;_0x5c6c15=_0x15e3db['charAt'](_0xc158f7++);~_0x5c6c15&&(_0x401afb=_0x59e5f4%0x4?_0x401afb*0x40+_0x5c6c15:_0x5c6c15,_0x59e5f4++%0x4)?_0x6db817+=_0x4ed0d2['charCodeAt'](_0xc158f7+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x401afb>>(-0x2*_0x59e5f4&0x6)):_0x59e5f4:0x0){_0x5c6c15=_0x34e6b2['indexOf'](_0x5c6c15);}for(let _0x1ba239=0x0,_0x328d89=_0x6db817['length'];_0x1ba239<_0x328d89;_0x1ba239++){_0xffa968+='%'+('00'+_0x6db817['charCodeAt'](_0x1ba239)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xffa968);};a0_0x47ac['egijbx']=_0x112508,a0_0x47ac['xExplq']={},a0_0x47ac['IJYtNM']=!![];}const _0x5deccc=_0x6424c3[0x0],_0x47ac2b=_0x1db5f4+_0x5deccc,_0x331b58=a0_0x47ac['xExplq'][_0x47ac2b];if(!_0x331b58){const _0x27beca=function(_0x316e8e){this['IIfGTt']=_0x316e8e,this['OBTBen']=[0x1,0x0,0x0],this['agEyoD']=function(){return'newState';},this['caLeMD']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['dgUGcb']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x27beca['prototype']['rFuNBA']=function(){const _0x487697=new RegExp(this['caLeMD']+this['dgUGcb']),_0x3f8f7d=_0x487697['test'](this['agEyoD']['toString']())?--this['OBTBen'][0x1]:--this['OBTBen'][0x0];return this['vkLBJV'](_0x3f8f7d);},_0x27beca['prototype']['vkLBJV']=function(_0x223f7d){if(!Boolean(~_0x223f7d))return _0x223f7d;return this['VApSbh'](this['IIfGTt']);},_0x27beca['prototype']['VApSbh']=function(_0x4ca536){for(let _0x53cc24=0x0,_0x4843ae=this['OBTBen']['length'];_0x53cc24<_0x4843ae;_0x53cc24++){this['OBTBen']['push'](Math['round'](Math['random']())),_0x4843ae=this['OBTBen']['length'];}return _0x4ca536(this['OBTBen'][0x0]);},new _0x27beca(a0_0x47ac)['rFuNBA'](),_0x300646=a0_0x47ac['egijbx'](_0x300646),a0_0x47ac['xExplq'][_0x47ac2b]=_0x300646;}else _0x300646=_0x331b58;return _0x300646;}export function getHighPrices(_0x2a573d){const _0x56aec8=a0_0x47ac;return _0x2a573d[_0x56aec8(0xac)](_0x4ec8c9=>_0x4ec8c9[_0x56aec8(0xba)]);}export function getLowPrices(_0x12285e){const _0x299f4b=a0_0x47ac;return _0x12285e['map'](_0x5b6667=>_0x5b6667[_0x299f4b(0x94)]);}export function getVolumes(_0x11f6fe){const _0x5d1192=a0_0x47ac;return _0x11f6fe[_0x5d1192(0xac)](_0xd8f5c6=>_0xd8f5c6[_0x5d1192(0xb7)]);}function a0_0x5dec(){const _0x2c5d2c=['vKTdvuq','zLfYA2e','zM1hCK0','yxbWBhK','y2XVC2u','BgvUz3rO','sMPkwwu','veXZAuW','Bg93','vuf1C2O','CgXNuKy','oerUEeHnsa','mtq4nJy2nejQzMPNBW','ChvZAa','zufxwMq','C1vJue4','AuX6EvO','mtaYvfLHs3Lx','C2XPy2u','uvbhv1G','qur0vNC','Dg9tDhjPBMC','mti2vKHWBhbt','tMntvMK','CMvKDwnL','mtiYmdGYAg9gwu5T','vfnWs3q','nJK4ndzvAvHJqNi','refPEMG','t09QCLy','rfbVreG','tu1XywK','BwfW','uM5Ivu4','D1vZAvi','ndK5nJe4ohnLCvPAvW','sfvLwxC','zvPAsxu','mZeYnJi1nxLNwK1yCW','t0Pvr0K','sMTpAvq','C2vHCMnO','tLnmsgO','DM9SDw1L','uwDKqLO','DMf2A0u','AgLNAa','Bwf4','zwPju0u','BfnMuuS','tfDQr3q','nZK3nJrtAu5Ns24','Cg93','Eu5etNO','C1fJqK0','mZKWmdyWAgvntKfX','AK1RCgG','A0PUvg0','zwjdCu0','BhDLBhi','ywjZ'];a0_0x5dec=function(){return _0x2c5d2c;};return a0_0x5dec();}export function average(_0x129cb1){const _0x40158a=a0_0x47ac,_0x60c76={'UAusj':function(_0x3e85af,_0x22c437){return _0x3e85af===_0x22c437;},'lSfQK':function(_0x214a18,_0x33bd12){return _0x214a18/_0x33bd12;}};if(_0x60c76[_0x40158a(0x95)](_0x129cb1[_0x40158a(0xce)],0x0))return 0x0;return _0x60c76[_0x40158a(0xbd)](_0x129cb1[_0x40158a(0xa4)]((_0x137d29,_0x582506)=>_0x137d29+_0x582506,0x0),_0x129cb1[_0x40158a(0xce)]);}export function standardDeviation(_0x214e11){const _0x459235=a0_0x47ac,_0x3c1681={'mAdCv':function(_0x2f4500,_0x1930f7){return _0x2f4500(_0x1930f7);},'QgdBZ':function(_0x214a6e,_0x54e252){return _0x214a6e(_0x54e252);}},_0x3f52fe=_0x3c1681['mAdCv'](average,_0x214e11),_0x541ff0=_0x214e11[_0x459235(0xac)](_0x514642=>Math[_0x459235(0xc0)](_0x514642-_0x3f52fe,0x2));return Math['sqrt'](_0x3c1681[_0x459235(0xb8)](average,_0x541ff0));}export function trueRange(_0x148c00){const _0xde12a=a0_0x47ac,_0x5d7961={'eZZIu':function(_0x478cd5,_0x358cdd){return _0x478cd5-_0x358cdd;},'JkOiT':function(_0x9d1128,_0x5c1b5e){return _0x9d1128-_0x5c1b5e;},'qPzQA':function(_0x420f58,_0xc2866b){return _0x420f58===_0xc2866b;},'ebCqM':function(_0x68a79d,_0x1c9c36){return _0x68a79d/_0x1c9c36;},'OJUGI':function(_0x57d70c,_0x259a55){return _0x57d70c<_0x259a55;},'wUsiR':_0xde12a(0xa9),'sUcPN':function(_0x565563,_0x25a1da){return _0x565563===_0x25a1da;},'qdLgs':function(_0x5857df,_0x5156f2){return _0x5857df===_0x5156f2;},'NSLHj':_0xde12a(0xca),'HUeYw':function(_0x553109,_0x5aa7d4){return _0x553109-_0x5aa7d4;},'VKCUD':function(_0x534230,_0x5d39b0){return _0x534230-_0x5d39b0;},'LWjGt':function(_0x41ffb9,_0x906594){return _0x41ffb9-_0x906594;}},_0x548f17=[];for(let _0x17b42f=0x0;_0x5d7961[_0xde12a(0xb3)](_0x17b42f,_0x148c00['length']);_0x17b42f++){if(_0xde12a(0xad)!==_0x5d7961[_0xde12a(0xae)]){if(_0x5d7961[_0xde12a(0x9b)](_0x17b42f,0x0)){if(_0x5d7961['qdLgs'](_0x5d7961[_0xde12a(0xb6)],_0x5d7961['NSLHj']))_0x548f17[_0xde12a(0x99)](_0x148c00[_0x17b42f][_0xde12a(0xba)]-_0x148c00[_0x17b42f][_0xde12a(0x94)]);else{if(_0x1f3571===0x0)_0x25626d[_0xde12a(0x99)](_0x5d7961[_0xde12a(0xb1)](_0x6424d4[_0x2ac1d8][_0xde12a(0xba)],_0xa6161[_0x4e479d][_0xde12a(0x94)]));else{const _0x406e1a=_0x5d7961['eZZIu'](_0x25a3ee[_0x23ae6d][_0xde12a(0xba)],_0x531ba7[_0xdf97f0][_0xde12a(0x94)]),_0x3870ca=_0x5f2778[_0xde12a(0xc8)](_0x5d7961[_0xde12a(0xb4)](_0x2a598f[_0x340ddf][_0xde12a(0xba)],_0x5c9a04[_0x558286-0x1][_0xde12a(0xcd)])),_0x273ab3=_0x1616fd['abs'](_0x4e5b34[_0x1ae4a]['low']-_0x2ae2d3[_0x375eef-0x1][_0xde12a(0xcd)]);_0x208e20['push'](_0x3b2cad[_0xde12a(0xbb)](_0x406e1a,_0x3870ca,_0x273ab3));}}}else{const _0x5ec8b3=_0x5d7961[_0xde12a(0xb0)](_0x148c00[_0x17b42f][_0xde12a(0xba)],_0x148c00[_0x17b42f]['low']),_0x53593a=Math['abs'](_0x5d7961[_0xde12a(0xc9)](_0x148c00[_0x17b42f][_0xde12a(0xba)],_0x148c00[_0x5d7961[_0xde12a(0xbe)](_0x17b42f,0x1)][_0xde12a(0xcd)])),_0x4bdaee=Math['abs'](_0x5d7961[_0xde12a(0xc9)](_0x148c00[_0x17b42f]['low'],_0x148c00[_0x5d7961['LWjGt'](_0x17b42f,0x1)][_0xde12a(0xcd)]));_0x548f17[_0xde12a(0x99)](Math[_0xde12a(0xbb)](_0x5ec8b3,_0x53593a,_0x4bdaee));}}else{if(_0x5d7961['qPzQA'](_0x4e3a85['length'],0x0))return 0x0;return _0x5d7961[_0xde12a(0xc6)](_0x51d5e2[_0xde12a(0xa4)]((_0x9eee12,_0x2feb25)=>_0x9eee12+_0x2feb25,0x0),_0x31e02a['length']);}}return _0x548f17;}export function crossover(_0x42e2dd,_0x593dff){const _0xade50d=a0_0x47ac,_0x595a9e={'lwelr':function(_0x387578,_0x12e2db){return _0x387578<_0x12e2db;},'JjJYe':function(_0x49f319,_0x2d766a){return _0x49f319-_0x2d766a;},'DPoDH':function(_0x59b4e5,_0x7b7cee){return _0x59b4e5<=_0x7b7cee;},'QPGWX':function(_0x32697f,_0x55c9de){return _0x32697f>_0x55c9de;}};if(_0x595a9e[_0xade50d(0xc7)](_0x42e2dd[_0xade50d(0xce)],0x2)||_0x595a9e['lwelr'](_0x593dff['length'],0x2))return![];const _0x178790=_0x42e2dd[_0x42e2dd[_0xade50d(0xce)]-0x2],_0x49bd18=_0x593dff[_0x595a9e[_0xade50d(0xcf)](_0x593dff[_0xade50d(0xce)],0x2)],_0x404dd8=_0x42e2dd[_0x595a9e[_0xade50d(0xcf)](_0x42e2dd[_0xade50d(0xce)],0x1)],_0x53f318=_0x593dff[_0x595a9e[_0xade50d(0xcf)](_0x593dff[_0xade50d(0xce)],0x1)];return _0x595a9e[_0xade50d(0xaa)](_0x178790,_0x49bd18)&&_0x595a9e[_0xade50d(0x9f)](_0x404dd8,_0x53f318);}export function crossunder(_0x395f68,_0x22c205){const _0x5a2bce=a0_0x47ac,_0x4d22e7={'iLzyZ':function(_0x3a93df,_0x333c4b){return _0x3a93df<_0x333c4b;},'kJnTm':function(_0x534167,_0x43afae){return _0x534167-_0x43afae;},'VlKqZ':function(_0x1c4412,_0x36a7e5){return _0x1c4412<_0x36a7e5;}};if(_0x4d22e7[_0x5a2bce(0x9c)](_0x395f68['length'],0x2)||_0x4d22e7['iLzyZ'](_0x22c205[_0x5a2bce(0xce)],0x2))return![];const _0x3b3383=_0x395f68[_0x4d22e7[_0x5a2bce(0xc5)](_0x395f68[_0x5a2bce(0xce)],0x2)],_0x203f78=_0x22c205[_0x4d22e7['kJnTm'](_0x22c205['length'],0x2)],_0x3a5379=_0x395f68[_0x395f68[_0x5a2bce(0xce)]-0x1],_0x266751=_0x22c205[_0x4d22e7[_0x5a2bce(0xc5)](_0x22c205[_0x5a2bce(0xce)],0x1)];return _0x3b3383>=_0x203f78&&_0x4d22e7['VlKqZ'](_0x3a5379,_0x266751);}export function slope(_0x14c43b,_0xa37d9d=0x5){const _0x5afdd2=a0_0x47ac,_0x2b7ebf={'TSpKt':function(_0x12b23e,_0x56b38c){return _0x12b23e<_0x56b38c;},'sQcBM':function(_0x20e974,_0x49ace5){return _0x20e974*_0x49ace5;},'GXcqa':function(_0x4be464,_0x53e558){return _0x4be464*_0x53e558;},'jqfEt':function(_0x50cf07,_0x1d7bf1){return _0x50cf07/_0x1d7bf1;},'MoeQD':function(_0x16c197,_0x11739f){return _0x16c197-_0x11739f;},'ejISE':function(_0x4acbee,_0x4bfb02){return _0x4acbee*_0x4bfb02;}};if(_0x2b7ebf[_0x5afdd2(0xa6)](_0x14c43b[_0x5afdd2(0xce)],_0xa37d9d))return 0x0;const _0x3ebb53=_0x14c43b[_0x5afdd2(0x9e)](-_0xa37d9d),_0x48c0fa=_0x3ebb53['length'];let _0xeecbb2=0x0,_0x46fb8e=0x0,_0x17cdcb=0x0,_0x2d98d6=0x0;for(let _0x2fbb98=0x0;_0x2fbb98<_0x48c0fa;_0x2fbb98++){_0xeecbb2+=_0x2fbb98,_0x46fb8e+=_0x3ebb53[_0x2fbb98],_0x17cdcb+=_0x2b7ebf['sQcBM'](_0x2fbb98,_0x3ebb53[_0x2fbb98]),_0x2d98d6+=_0x2b7ebf['GXcqa'](_0x2fbb98,_0x2fbb98);}return _0x2b7ebf['jqfEt'](_0x2b7ebf[_0x5afdd2(0xc2)](_0x48c0fa,_0x17cdcb)-_0xeecbb2*_0x46fb8e,_0x2b7ebf['MoeQD'](_0x2b7ebf[_0x5afdd2(0xbc)](_0x48c0fa,_0x2d98d6),_0xeecbb2*_0xeecbb2));}
@@ -1,82 +1 @@
1
- /**
2
- * Level Calculator - Support/Resistance and Price Levels
3
- */
4
- export class LevelCalculator {
5
- /**
6
- * Calculate support level using swing lows
7
- */
8
- static calculateSupport(data, currentPrice) {
9
- // Look at last 20 candles for swing lows
10
- const recentData = data.slice(-20);
11
- const lows = recentData.map((d) => d.low).sort((a, b) => a - b);
12
- // Find significant low below current price
13
- for (const low of lows) {
14
- if (low < currentPrice * 0.99) {
15
- // Support at least 1% below current
16
- return low;
17
- }
18
- }
19
- // Fallback: use lowest low
20
- return lows[0];
21
- }
22
- /**
23
- * Calculate resistance level using swing highs
24
- */
25
- static calculateResistance(data, currentPrice) {
26
- // Look at last 20 candles for swing highs
27
- const recentData = data.slice(-20);
28
- const highs = recentData.map((d) => d.high).sort((a, b) => b - a);
29
- // Find significant high above current price
30
- for (const high of highs) {
31
- if (high > currentPrice * 1.01) {
32
- // Resistance at least 1% above current
33
- return high;
34
- }
35
- }
36
- // Fallback: use highest high
37
- return highs[0];
38
- }
39
- /**
40
- * Calculate Stop Loss based on ATR
41
- */
42
- static calculateStopLoss(entry, atr, direction, multiplier = 2.0) {
43
- const slDistance = atr * multiplier;
44
- if (direction === "BUY") {
45
- // SL below entry for BUY
46
- return entry - slDistance;
47
- }
48
- else {
49
- // SL above entry for SELL
50
- return entry + slDistance;
51
- }
52
- }
53
- /**
54
- * Calculate Take Profit based on Risk-Reward ratio
55
- */
56
- static calculateTakeProfit(entry, stopLoss, direction, riskRewardRatio = 2.0) {
57
- const slDistance = Math.abs(entry - stopLoss);
58
- const tpDistance = slDistance * riskRewardRatio;
59
- if (direction === "BUY") {
60
- // TP above entry for BUY
61
- return entry + tpDistance;
62
- }
63
- else {
64
- // TP below entry for SELL
65
- return entry - tpDistance;
66
- }
67
- }
68
- /**
69
- * Estimate WinRate based on signal strength
70
- */
71
- static estimateWinRate(finalScore, confirmationBonus, volumeBonus) {
72
- // Base winrate from score (40-80% range)
73
- const baseWinRate = 40 + (finalScore / 100) * 40;
74
- // Boost from confirmations
75
- const confirmationBoost = confirmationBonus > 0 ? 5 : 0;
76
- const volumeBoost = volumeBonus > 0 ? 5 : 0;
77
- // Calculate final winrate (max 95%)
78
- const finalWinRate = Math.min(95, baseWinRate + confirmationBoost + volumeBoost);
79
- return Math.round(finalWinRate);
80
- }
81
- }
82
- //# sourceMappingURL=levels.js.map
1
+ function a0_0x30dc(_0x3110f8,_0x25e5d2){_0x3110f8=_0x3110f8-0x152;const _0x4c0d21=a0_0x54ee();let _0x2d11a7=_0x4c0d21[_0x3110f8];if(a0_0x30dc['eprDHz']===undefined){var _0x2ba426=function(_0x86d083){const _0x542896='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1430dc='',_0x5c23eb='',_0x27583e=_0x1430dc+_0x2ba426;for(let _0x2b6491=0x0,_0x1b1c31,_0x260dbf,_0x328ef0=0x0;_0x260dbf=_0x86d083['charAt'](_0x328ef0++);~_0x260dbf&&(_0x1b1c31=_0x2b6491%0x4?_0x1b1c31*0x40+_0x260dbf:_0x260dbf,_0x2b6491++%0x4)?_0x1430dc+=_0x27583e['charCodeAt'](_0x328ef0+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x1b1c31>>(-0x2*_0x2b6491&0x6)):_0x2b6491:0x0){_0x260dbf=_0x542896['indexOf'](_0x260dbf);}for(let _0x4a73da=0x0,_0x5297d5=_0x1430dc['length'];_0x4a73da<_0x5297d5;_0x4a73da++){_0x5c23eb+='%'+('00'+_0x1430dc['charCodeAt'](_0x4a73da)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5c23eb);};a0_0x30dc['QmMEWY']=_0x2ba426,a0_0x30dc['ZOLsed']={},a0_0x30dc['eprDHz']=!![];}const _0x54eedb=_0x4c0d21[0x0],_0x30dc06=_0x3110f8+_0x54eedb,_0x422abb=a0_0x30dc['ZOLsed'][_0x30dc06];if(!_0x422abb){const _0x5d2d71=function(_0x5d5fe){this['WJKOTH']=_0x5d5fe,this['ZtbIOM']=[0x1,0x0,0x0],this['sXmHcU']=function(){return'newState';},this['DJNAFu']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['GKVEGy']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x5d2d71['prototype']['wTXpEJ']=function(){const _0x1e73f8=new RegExp(this['DJNAFu']+this['GKVEGy']),_0x188f0e=_0x1e73f8['test'](this['sXmHcU']['toString']())?--this['ZtbIOM'][0x1]:--this['ZtbIOM'][0x0];return this['PmQEZo'](_0x188f0e);},_0x5d2d71['prototype']['PmQEZo']=function(_0x3fd5c0){if(!Boolean(~_0x3fd5c0))return _0x3fd5c0;return this['zMzapB'](this['WJKOTH']);},_0x5d2d71['prototype']['zMzapB']=function(_0x41b1ef){for(let _0x22d64a=0x0,_0xec50dc=this['ZtbIOM']['length'];_0x22d64a<_0xec50dc;_0x22d64a++){this['ZtbIOM']['push'](Math['round'](Math['random']())),_0xec50dc=this['ZtbIOM']['length'];}return _0x41b1ef(this['ZtbIOM'][0x0]);},new _0x5d2d71(a0_0x30dc)['wTXpEJ'](),_0x2d11a7=a0_0x30dc['QmMEWY'](_0x2d11a7),a0_0x30dc['ZOLsed'][_0x30dc06]=_0x2d11a7;}else _0x2d11a7=_0x422abb;return _0x2d11a7;}const a0_0x5c8c11=a0_0x30dc;(function(_0x1c8630,_0x464354){const _0x3b158e=a0_0x30dc,_0x229bc3=_0x1c8630();while(!![]){try{const _0x4391e3=parseInt(_0x3b158e(0x185))/0x1*(parseInt(_0x3b158e(0x15a))/0x2)+parseInt(_0x3b158e(0x18a))/0x3+-parseInt(_0x3b158e(0x17e))/0x4+parseInt(_0x3b158e(0x176))/0x5*(-parseInt(_0x3b158e(0x153))/0x6)+-parseInt(_0x3b158e(0x170))/0x7+-parseInt(_0x3b158e(0x188))/0x8*(-parseInt(_0x3b158e(0x162))/0x9)+parseInt(_0x3b158e(0x155))/0xa;if(_0x4391e3===_0x464354)break;else _0x229bc3['push'](_0x229bc3['shift']());}catch(_0x1f2456){_0x229bc3['push'](_0x229bc3['shift']());}}}(a0_0x54ee,0xbcf29));const a0_0x2ba426=(function(){const _0x4fe0e4=a0_0x30dc,_0x5a2e16={'lKNMk':function(_0x11a7e2,_0x200ec4){return _0x11a7e2===_0x200ec4;},'THxoV':_0x4fe0e4(0x173),'Wqslf':_0x4fe0e4(0x15c),'FfzOq':function(_0x1c6598,_0x4bf514){return _0x1c6598+_0x4bf514;}};let _0xf5a47e=!![];return function(_0x14f766,_0x3788ff){const _0x2916c0={'nYMuw':function(_0x481131,_0x9721cc){const _0x38bd55=a0_0x30dc;return _0x5a2e16[_0x38bd55(0x15b)](_0x481131,_0x9721cc);}},_0x50fa50=_0xf5a47e?function(){const _0x3b234e=a0_0x30dc;if(_0x5a2e16[_0x3b234e(0x16f)](_0x5a2e16[_0x3b234e(0x161)],_0x5a2e16[_0x3b234e(0x177)]))return _0x2916c0[_0x3b234e(0x167)](_0x260c5f,_0x14b7c7);else{if(_0x3788ff){const _0x4460b1=_0x3788ff['apply'](_0x14f766,arguments);return _0x3788ff=null,_0x4460b1;}}}:function(){};return _0xf5a47e=![],_0x50fa50;};}()),a0_0x2d11a7=a0_0x2ba426(this,function(){const _0x23cb4a=a0_0x30dc;return a0_0x2d11a7[_0x23cb4a(0x17d)]()[_0x23cb4a(0x187)]('(((.+)+)+)+$')[_0x23cb4a(0x17d)]()[_0x23cb4a(0x183)](a0_0x2d11a7)[_0x23cb4a(0x187)](_0x23cb4a(0x180));});a0_0x2d11a7();function a0_0x54ee(){const _0x34a031=['Bg93','C2vHCMnO','mteZnJbHBgLmuNa','ENL0tve','mZaYmtmWmhrlsNPwvG','AgLNAa','mJrMCeTdrgW','tufzvNe','mtmYmdC1mtbhAKPPuuG','ENHYChG','C29YDa','CM91BMq','sxrbu3u','nJu1otGYCMPQz3vA','rMz6t3e','qMfgCfy','C2XPy2u','BKjnwvm','BM5wC3e','BwfW','veH4B1y','ntC1mu1Uy3bswq','C056vee','yxbWBhK','y2fSy3vSyxrLuMvZAxn0yw5Jzq','tLjesKm','BLLnDxC','uuf2A0m','y2fSy3vSyxrLvgfRzvbYB2zPDa','EK12wLm','zLvjEfy','ywjZ','sufSvuq','BLrYBuK','BeTotwS','ndu0ntu2ovnbquHpvW','twP2t1u','yxvMzfG','zuLqCe0','wNnOqu8','uKHeAMe','mtC0mZq2nuDXy0v4qG','v3fZBgy','rKPlr2W','zxn0Aw1HDgvxAw5syxrL','BLbMDKG','y3Lvr0y','weLlsKS','Dg9tDhjPBMC','ntyWndu0ngLYzK9mzW','vunVC04','kcGOlISPkYKRksSK','qLvz','shvbELG','y29UC3rYDwn0B3i','weDSD1u','m0jyAMLXua'];a0_0x54ee=function(){return _0x34a031;};return a0_0x54ee();}export class LevelCalculator{static['calculateSupport'](_0x1bcf73,_0x2f3f1a){const _0x32341d=a0_0x30dc,_0x556c9d={'MjvOU':_0x32341d(0x180),'zytMQ':function(_0x5c31ca,_0x863187){return _0x5c31ca===_0x863187;},'FJKGl':_0x32341d(0x166),'RHDja':_0x32341d(0x174),'ItASu':function(_0x316a3d,_0x416c6e){return _0x316a3d<_0x416c6e;},'sNzTA':function(_0x52ec6d,_0x4289b9){return _0x52ec6d*_0x4289b9;}},_0x3823d4=_0x1bcf73[_0x32341d(0x15d)](-0x14),_0x44a2f8=_0x3823d4['map'](_0x24738b=>_0x24738b[_0x32341d(0x186)])[_0x32341d(0x157)]((_0x2031d7,_0x2d1528)=>_0x2031d7-_0x2d1528);for(const _0x14888f of _0x44a2f8){if(_0x556c9d[_0x32341d(0x189)](_0x556c9d[_0x32341d(0x178)],_0x556c9d[_0x32341d(0x175)]))return _0x29f74f[_0x32341d(0x17d)]()['search'](jHzMsS[_0x32341d(0x171)])[_0x32341d(0x17d)]()[_0x32341d(0x183)](_0x4b6aef)[_0x32341d(0x187)](_0x32341d(0x180));else{if(_0x556c9d[_0x32341d(0x159)](_0x14888f,_0x556c9d[_0x32341d(0x163)](_0x2f3f1a,0.99)))return _0x14888f;}}return _0x44a2f8[0x0];}static[a0_0x5c8c11(0x165)](_0x4d6057,_0x4e2f4d){const _0x5c2ad0=a0_0x5c8c11,_0x28efed={'zMvZS':function(_0x464504,_0x2d01b0){return _0x464504===_0x2d01b0;},'zxrpx':_0x5c2ad0(0x16d),'HuAzX':function(_0x414a98,_0x45c156){return _0x414a98>_0x45c156;},'XGlwU':function(_0x4777a2,_0x15cdaa){return _0x4777a2===_0x15cdaa;},'aufdX':'pCvFl'},_0x4a5458=_0x4d6057['slice'](-0x14),_0xf419ec=_0x4a5458[_0x5c2ad0(0x160)](_0x67a3d=>_0x67a3d[_0x5c2ad0(0x152)])[_0x5c2ad0(0x157)]((_0x5116ef,_0x3557e6)=>_0x3557e6-_0x5116ef);for(const _0x5ecadf of _0xf419ec){if(_0x28efed[_0x5c2ad0(0x16a)](_0x28efed[_0x5c2ad0(0x156)],_0x28efed[_0x5c2ad0(0x156)])){if(_0x28efed[_0x5c2ad0(0x182)](_0x5ecadf,_0x4e2f4d*1.01)){if(_0x28efed[_0x5c2ad0(0x184)](_0x5c2ad0(0x17a),_0x28efed[_0x5c2ad0(0x172)])){const _0x1f71dd=_0xe9eccb['apply'](_0x230b58,arguments);return _0x254134=null,_0x1f71dd;}else return _0x5ecadf;}}else{const _0x4a4124=_0x5d2d71?function(){const _0x5b834e=_0x5c2ad0;if(_0x22d64a){const _0x44e9f8=_0x34e2c8[_0x5b834e(0x164)](_0x10b6a1,arguments);return _0xc38197=null,_0x44e9f8;}}:function(){};return _0x41b1ef=![],_0x4a4124;}}return _0xf419ec[0x0];}static['calculateStopLoss'](_0x5e07f6,_0x5bd528,_0xc4a485,_0x4f8d06=0x2){const _0x219dcc=a0_0x5c8c11,_0x5219c1={'UCosN':function(_0x52ca7c,_0x5eb92a){return _0x52ca7c+_0x5eb92a;},'nTrmI':function(_0x6179b5,_0x2e62da){return _0x6179b5===_0x2e62da;},'nBMYS':'nnVsq','cyUGF':function(_0x161249,_0x10c448){return _0x161249+_0x10c448;}},_0x5a54d4=_0x5bd528*_0x4f8d06;return _0x5219c1[_0x219dcc(0x16e)](_0xc4a485,'BUY')?_0x5219c1[_0x219dcc(0x15e)]===_0x219dcc(0x15f)?_0x5e07f6-_0x5a54d4:_0x5219c1[_0x219dcc(0x17f)](_0x2739ec,_0xc9d613):_0x5219c1[_0x219dcc(0x17b)](_0x5e07f6,_0x5a54d4);}static[a0_0x5c8c11(0x169)](_0x2e0be5,_0x3a0a45,_0x288f07,_0x278ef6=0x2){const _0x11dfbe=a0_0x5c8c11,_0x57c00c={'MAYVq':function(_0xaf6d34,_0x241b98){return _0xaf6d34-_0x241b98;},'xUBTj':function(_0x58eb52,_0x3d06ff){return _0x58eb52===_0x3d06ff;},'HhiUa':function(_0xa7d1b8,_0x4c82c9){return _0xa7d1b8+_0x4c82c9;}},_0x48f69e=Math[_0x11dfbe(0x16c)](_0x57c00c[_0x11dfbe(0x154)](_0x2e0be5,_0x3a0a45)),_0x3472ef=_0x48f69e*_0x278ef6;return _0x57c00c['xUBTj'](_0x288f07,_0x11dfbe(0x181))?_0x57c00c['HhiUa'](_0x2e0be5,_0x3472ef):_0x2e0be5-_0x3472ef;}static[a0_0x5c8c11(0x179)](_0x3aaf2a,_0x1c0b7a,_0x537c67){const _0x3a7ee3=a0_0x5c8c11,_0x4a9892={'fUIxV':function(_0x45e937,_0x30dca8){return _0x45e937>_0x30dca8;},'XIKJK':function(_0x3ae023,_0x480fbc){return _0x3ae023>_0x480fbc;},'oeMnE':function(_0xd06e86,_0xba7aa6){return _0xd06e86+_0xba7aa6;},'QAvkC':function(_0x3a1ec6,_0x2f268c){return _0x3a1ec6+_0x2f268c;}},_0x8bc640=0x28+_0x3aaf2a/0x64*0x28,_0x2e6743=_0x4a9892[_0x3a7ee3(0x16b)](_0x1c0b7a,0x0)?0x5:0x0,_0x4ca256=_0x4a9892[_0x3a7ee3(0x17c)](_0x537c67,0x0)?0x5:0x0,_0x7795a=Math['min'](0x5f,_0x4a9892['oeMnE'](_0x4a9892[_0x3a7ee3(0x168)](_0x8bc640,_0x2e6743),_0x4ca256));return Math[_0x3a7ee3(0x158)](_0x7795a);}}