Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Supertrend

node v16.18.0
version: 1.0.0
endpointsharetweet
const {Supertrend} = require("stock-technical-indicators/study/Supertrend"); const {Indicator} = require("stock-technical-indicators/lib"); // [ // '2018-09-05T00:00:00+0530', // Date In Iso Format // 741.2, // Open // 748.95, // High // 733.95, // Low // 740.9, // Close // 771705 // Volume // ] const SampleData = [ ['2018-09-05T00:00:00+0530', 741.2, 748.95, 733.95, 740.9, 771705], ['2018-09-06T00:00:00+0530', 743, 758.9, 738, 743.9, 589823], ['2018-09-07T00:00:00+0530', 743, 764.85, 739, 760.6, 669449], ['2018-09-10T00:00:00+0530', 759.65, 763, 745.1, 747, 366378], ['2018-09-11T00:00:00+0530', 745.3, 749.05, 735, 738.1, 565374], ['2018-09-12T00:00:00+0530', 734, 751.25, 724.75, 748.25, 304520], ['2018-09-14T00:00:00+0530', 751, 756.4, 742.35, 746.7, 376884], ['2018-09-17T00:00:00+0530', 746.5, 762.5, 740, 751, 454647], ['2018-09-18T00:00:00+0530', 751.4, 752.65, 733.5, 741.15, 402422], ['2018-09-19T00:00:00+0530', 742.55, 746.95, 734.75, 738.75, 259730], ['2018-09-21T00:00:00+0530', 738, 743.95, 675.1, 736.75, 1526712], ['2018-09-24T00:00:00+0530', 734, 734.05, 703, 707.95, 328221], ['2018-09-25T00:00:00+0530', 707.75, 717.65, 688.25, 710.8, 380391], ['2018-09-26T00:00:00+0530', 712.1, 712.95, 695.2, 699, 296103], ['2018-09-27T00:00:00+0530', 697.1, 698.75, 679.3, 681.85, 560271], ['2018-09-28T00:00:00+0530', 682.1, 697.8, 675.75, 692.4, 731534], ['2018-10-01T00:00:00+0530', 696.55, 696.55, 670.5, 690.5, 368383], ['2018-10-03T00:00:00+0530', 692, 696, 666.05, 669.25, 507086], ['2018-10-04T00:00:00+0530', 660, 671.95, 650.5, 660.25, 363673], ['2018-10-05T00:00:00+0530', 659, 664.95, 646.05, 655.55, 389183], ['2018-10-08T00:00:00+0530', 655, 662.5, 630.45, 640.25, 718771], ['2018-10-09T00:00:00+0530', 638, 643.45, 622, 635.75, 371254], ['2018-10-10T00:00:00+0530', 631.5, 657, 628.95, 649.5, 584279], ['2018-10-11T00:00:00+0530', 639.85, 650.15, 623.1, 634.35, 705221], ['2018-10-12T00:00:00+0530', 640, 659.8, 637.3, 655.95, 416494], ['2018-10-15T00:00:00+0530', 661, 661, 641, 649.8, 528471], ['2018-10-16T00:00:00+0530', 657, 687, 654, 676.55, 826737], ['2018-10-17T00:00:00+0530', 678.2, 686.6, 663.75, 670.1, 408332], ['2018-10-19T00:00:00+0530', 667.7, 676.35, 652.5, 671.95, 302069], ['2018-10-22T00:00:00+0530', 674, 685, 662.3, 669.35, 457266], ['2018-10-23T00:00:00+0530', 661, 676.95, 660, 671.5, 380857], ['2018-10-24T00:00:00+0530', 673, 679.5, 661.4, 668.35, 442383], ['2018-10-25T00:00:00+0530', 661.5, 681.5, 653.6, 666.5, 671366], ['2018-10-26T00:00:00+0530', 664, 675, 652.5, 671, 436332], ['2018-10-29T00:00:00+0530', 674, 688.65, 667.65, 685.2, 558422], ['2018-10-30T00:00:00+0530', 686, 687.95, 674.05, 681.15, 321099], ['2018-10-31T00:00:00+0530', 681.55, 690, 670.4, 685.75, 287891], ['2018-11-01T00:00:00+0530', 686.8, 693.95, 679.85, 688, 418515], ['2018-11-02T00:00:00+0530', 694.75, 712.3, 690.55, 696.15, 643431], ['2018-11-05T00:00:00+0530', 692.95, 693, 668, 680.15, 1102545], ['2018-11-06T00:00:00+0530', 681.25, 703.95, 681.25, 693.8, 545326], ['2018-11-07T00:00:00+0530', 697.9, 704.85, 697.8, 702.35, 81891], ['2018-11-09T00:00:00+0530', 704.5, 712.55, 697, 699.4, 340208], ['2018-11-12T00:00:00+0530', 700, 707, 690.25, 698.8, 287598], ['2018-11-13T00:00:00+0530', 688.55, 702.65, 680.4, 687.05, 539666], ['2018-11-14T00:00:00+0530', 692, 708.8, 689, 699.5, 591858], ['2018-11-15T00:00:00+0530', 699.5, 703.45, 684.15, 687.5, 383090], ['2018-11-16T00:00:00+0530', 691.95, 698.25, 686, 695.85, 245985], ['2018-11-19T00:00:00+0530', 698.8, 705, 693, 700, 556542], ['2018-11-20T00:00:00+0530', 702, 708, 686.85, 691.5, 657786], ['2018-11-21T00:00:00+0530', 688.15, 693.75, 679.2, 684.95, 438506], ['2018-11-22T00:00:00+0530', 687, 706.8, 687, 699.4, 632573], ['2018-11-26T00:00:00+0530', 700, 707, 689.95, 699.2, 426092], ['2018-11-27T00:00:00+0530', 698, 722.8, 696.05, 709.05, 1519838] ]; const st = new Indicator(new Supertrend()); const res = st.calculate(SampleData,{ period: 7, multiplier: 3 }) console.log(res); //endpoint exports.endpoint = function(request, response){ response.end(res); }
Loading…

no comments

    sign in to comment