sindelio / binance-bot

A Binance trader bot written in Node.js.
MIT License
57 stars 28 forks source link

Need help about SRSI #4

Open shamanaia opened 9 months ago

shamanaia commented 9 months ago

Hi @sindelio, coding is my hobby and async arrow functions is new for me, I could't find any ansewer on MDN, even SOF :), so please can you excplain me line 95-111 in bot_public.js

I use it without yarn.

// Initializes the Ehlers filter (super smoother)
const initializeSmoother = async (SRSI) => {
    console.log('INITIALIZING SUPER SMOOTHER');
    filter[0] = c1 * (SRSI[1].stochRSI + SRSI[0].stochRSI);
    filter[1] = c1 * (SRSI[2].stochRSI + SRSI[1].stochRSI) + c2 * filter[0];
    filter[2] = c1 * (SRSI[3].stochRSI + SRSI[2].stochRSI) + c2 * filter[1] + c3 * filter[0];
    console.log('smoothedStochRSI: ', filter[2], '\n');
}

// Calculates next value for the Ehlers filter
const calculateSmoother = async (SRSI) => {
    console.log('CALCULATING SUPER SMOOTHER');
    let newValue = c1 * (SRSI[3].stochRSI + SRSI[2].stochRSI) + c2 * filter[2] + c3 * filter[1];
    filter.push(newValue);
    filter.shift();
    console.log('smoothedStochRSI: ', filter, '\n');
}

(SRSI) and SRSI[*].stochRSI

they are variables, function names or refference to some external node modules like line 90?

StochasticRSI.calculate(inputStochRSI)`

or something else. I can't realise there origin and nature.

As can see in console it's array:

srsi

Thanks in advance.

sindelio commented 9 months ago

Hey,

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

On Sun, Nov 26, 2023 at 11:48 PM shamanaia @.***> wrote:

Hi @sindelio https://github.com/sindelio, coding is my hobby and async arrow functions is new for me, I could't find any ansewer on MDN, even SOF :), so please can you excplain me line 95-111 in bot_public.js https://github.com/sindelio/binance-bot/blob/master/bot_public.js

// Initializes the Ehlers filter (super smoother) const initializeSmoother = async (SRSI) => { console.log('INITIALIZING SUPER SMOOTHER'); filter[0] = c1 (SRSI[1].stochRSI + SRSI[0].stochRSI); filter[1] = c1 (SRSI[2].stochRSI + SRSI[1].stochRSI) + c2 filter[0]; filter[2] = c1 (SRSI[3].stochRSI + SRSI[2].stochRSI) + c2 filter[1] + c3 filter[0]; console.log('smoothedStochRSI: ', filter[2], '\n'); }

// Calculates next value for the Ehlers filter const calculateSmoother = async (SRSI) => { console.log('CALCULATING SUPER SMOOTHER'); let newValue = c1 (SRSI[3].stochRSI + SRSI[2].stochRSI) + c2 filter[2] + c3 * filter[1]; filter.push(newValue); filter.shift(); console.log('smoothedStochRSI: ', filter, '\n'); }

(SRSI) and SRSI[*].stochRSI

they are variables, function names or refference to some external node modules like line 90?

StochasticRSI.calculate(inputStochRSI)`

or something else. I can't realise there origin and nature.

Thanks in advance.

— Reply to this email directly, view it on GitHub https://github.com/sindelio/binance-bot/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/AERJ747EB34DAFOBPRMBU4LYGP5QNAVCNFSM6AAAAAA73K4CQ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYTCMZYGMYDINQ . You are receiving this because you were mentioned.Message ID: @.***>

shamanaia commented 9 months ago

Thanks for reply. so, as I understand here ".stochRSI" is reference to "/node_modules/technicalindicators" and "SRSI" is parameter of async, but if SRSI is NOT declared yet, how it can own array ellement? SRSI[1]? I will be grateful for your answer.

Thanks.

sindelio commented 9 months ago

I recommend you use chatGPT to ask these questions, it will probably answer better than me xD Also, you need to study JavaScript fundamentally. There is a book called "You don't know JS", If you wanna really get good with it.

Best of luck!

On Mon, Nov 27, 2023 at 4:30 PM shamanaia @.***> wrote:

Thanks for reply. so, as I understand here ".stochRSI" is reference to "/node_modules/technicalindicators" and "SRSI" is parameter of async, but if SRSI is NOT declared yet, how it can own array ellement? SRSI[1]? I will be grateful for your answer.

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/sindelio/binance-bot/issues/4#issuecomment-1828476450, or unsubscribe https://github.com/notifications/unsubscribe-auth/AERJ74762PVUVY6PBJGPZOLYGTS3RAVCNFSM6AAAAAA73K4CQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYGQ3TMNBVGA . You are receiving this because you were mentioned.Message ID: @.***>

shamanaia commented 9 months ago

Thanks and good luck!