From a339040402e83b49aacadae644f5b490a741159f Mon Sep 17 00:00:00 2001 From: bangae1 Date: Mon, 25 Aug 2025 20:20:37 +0900 Subject: [PATCH] =?UTF-8?q?rsi=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 167 ++++++++++++++++++++++++++++------------------- src/utils/sig.ts | 7 +- 2 files changed, 104 insertions(+), 70 deletions(-) diff --git a/src/App.vue b/src/App.vue index c64797e..76c9b11 100644 --- a/src/App.vue +++ b/src/App.vue @@ -16,15 +16,19 @@ import {swingSignal} from "./utils/sig.js"; import { useWindowSize } from '@vueuse/core' const { width, height } = useWindowSize() -console.log(width, height) /** * Generates sample data for the lightweight chart * @param {Boolean} ohlc Whether generated dat should include open, high, low, and close values * @returns {Array} sample data */ let socket; + const lazyLock = ref(false) const positionData = ref('') +const scrollContainer1 = ref() +const scrollContainer2 = ref() +const signal1 = ref([]) +const signal2 = ref([]) const contract = ref('BTC_USDT') /* Interval : "10s", "1m", "5m", "15m", "30m", "1h", "4h", "8h", "1d", "7d"*/ @@ -37,8 +41,8 @@ const chartOptions = ref({ separatorColor: '#FF0000', }, }, - width: width, - height: height, + // width: 800, + height: height.value - 60, timeScale: { timeVisible: true, // 분/초까지 표시 secondsVisible: false // 초 숨기고 싶으면 false @@ -209,7 +213,11 @@ const candleSocket = (cont, ti) => { bb.value = calculateBollingerBands(ticks) rsi.value = calculateRSI(ticks) // console.table(entrySignals(ticks)) - console.log(swingSignal(ticks)) + const dd = entrySignals(ticks) + if(dd.length) signal2.value = [...signal2.value, entrySignals(ticks)] + + const tt = swingSignal(ticks) + if(tt[0] !== 'HOLD') signal1.value = [...signal1.value, swingSignal(ticks)] lazyLock.value = false } @@ -283,77 +291,103 @@ watch(time, newVal => { init(contract.value, newVal) }) +watch(signal1, newVal => { + if(scrollContainer1.value) { + scrollContainer1.value.scrollTop = scrollContainer1.value.scrollHeight + 1000 + } +}) + +watch(signal2, newVal => { + if(scrollContainer2.value) { + scrollContainer2.value.scrollTop = scrollContainer2.value.scrollHeight + 10000 + } +}) + + + - {{ item.title }} - - - - + > + {{ item.title }} + + + + + +
+ + +
+

+ {{i}} {{new Date()}} +

+
+
+

+ {{i}} {{new Date()}} +

+
+
+ -
- -
- -
- + diff --git a/src/utils/sig.ts b/src/utils/sig.ts index 64541fa..35378ff 100644 --- a/src/utils/sig.ts +++ b/src/utils/sig.ts @@ -128,19 +128,18 @@ const swingSignal = (data: any) => { const bbl = bbands.lower[latest - offsetBb]; const bbu = bbands.upper[latest - offsetBb]; - console.log(volatilityBreak, prev, hist, rsiVal, close, bbl) // 4) 최종 조건 if (volatilityBreak && prev < 0 && hist >= 0 && rsiVal <= 35 && close <= bbl) - return 'LONG'; + return ['LONG',volatilityBreak, prev, hist, rsiVal, close, bbl] if (volatilityBreak && prev > 0 && hist <= 0 && rsiVal >= 65 && close >= bbu) - return 'SHORT'; + return ['SHORT',volatilityBreak, prev, hist, rsiVal, close, bbl] - return 'HOLD'; + return ['HOLD',volatilityBreak, prev, hist, rsiVal, close, bbl]; }; export {swingSignal} \ No newline at end of file