tvjsx / trading-vue-js

💹 Hackable charting lib for traders. You can draw literally ANYTHING on top of candlestick charts. [Not Maintained]
https://tvjsx.github.io/trading-vue-demo/
MIT License
2.07k stars 631 forks source link

TPO charts #168

Closed storewaladotcom closed 3 years ago

storewaladotcom commented 3 years ago

Hello,

I am trying to create TPO charts, however missing out what the best way to code this up is. Does a new overlay work with index based chart where multiple boxes are rendered within a single index? any thoughts?

image

C451 commented 3 years ago

Hi, Yes, there is no problem, just provide each index with several data points, e.g.:

[<time>, [E, E, E, ...]]
storewaladotcom commented 3 years ago

hi @C451,

I tried following the below way of specifying data but something is not right. The candles do not render. Could you clarify about the structure of the 'data' node?

{
    "chart": {
        "indexBased": true,
        "type": "Candles",
        "data": [
            [
                1584428400000,
                [
                    [
                        1584428400000,
                        5300,
                        5325,
                        5300,
                        5325,
                        518.94863323
                    ],
                    [
                        1584428400000,
                        5325,
                        5350,
                        5325,
                        5350,
                        518.94863323
                    ],
                    [
                        1584428400000,
                        5350,
                        5375,
                        5350,
                        5375,
                        518.94863323
                    ],
                    [
                        1584428400000,
                        5375,
                        5400,
                        5375,
                        5400,
                        518.94863323
                    ]
                ]
            ],
            [
                1584432000000,
                [
                    [
                        1584432000000,
                        5375,
                        5375,
                        5350,
                        5350,
                        710.36249024
                    ],
                    [
                        1584432000000,
                        5350,
                        5350,
                        5325,
                        5325,
                        710.36249024
                    ],
                    [
                        1584435600000,
                        5325,
                        5325,
                        5300,
                        5300,
                        227.64174381
                    ],
                    [
                        1584435600000,
                        5300,
                        5300,
                        5275,
                        5275,
                        227.64174381
                    ]
                ]
            ]
        ],
        "settings": {}
    }
}
C451 commented 3 years ago

Fair, your data doesn't follow the format of Candles overlay. The full data specs are in the API book.