Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tradingview #5

Open
awb99 opened this issue Aug 31, 2023 · 9 comments
Open

Tradingview #5

awb99 opened this issue Aug 31, 2023 · 9 comments

Comments

@awb99
Copy link
Collaborator

awb99 commented Aug 31, 2023

No description provided.

@awb99
Copy link
Collaborator Author

awb99 commented Aug 31, 2023

TimeScaleMarkShape
Type
"circle" | "earningUp" | "earningDown" | "earning"

@awb99
Copy link
Collaborator Author

awb99 commented Aug 31, 2023

time for daily, weekly, and monthly bars is expected to be a trading day (not session start day) at 00:00 UTC.

@awb99
Copy link
Collaborator Author

awb99 commented Aug 31, 2023

@awb99
Copy link
Collaborator Author

awb99 commented Aug 31, 2023

@awb99
Copy link
Collaborator Author

awb99 commented Sep 1, 2023

Enabling the extending time scale feature
To enable the feature for a custom study:

Enable the 'studies_extend_time_scale' featureset.
Add canExtendTimeScale: true to the study's metainfo.

@awb99
Copy link
Collaborator Author

awb99 commented Sep 1, 2023

custom_indicators_getter: function(PineJS) {
return Promise.resolve([
{
name: 'Complex Filled Areas',
metainfo: {
_metainfoVersion: 51,
id: 'ComplexFilledAreas@tv-basicstudies-1',
description: 'Complex Filled Areas',
shortDescription: 'Complex Filled Areas',
is_price_study: false,
isCustomIndicator: true,
plots: [
{
id: 'plot_0',
type: 'line',
},
{
id: 'plot_1',
type: 'line',
},
{
id: 'plot_2',
type: 'colorer',
target: 'filledAreaId1',
palette: 'paletteId1',
},
],

            filledAreas: [
                {
                    id: 'filledAreaId1',
                    objAId: 'plot_0',
                    objBId: 'plot_1',
                    title: 'Filled area between first and second plot',
                    type: 'plot_plot',
                    palette: 'paletteId1',
                },
            ],

            palettes: {
                paletteId1: {
                    valToIndex: {
                        0: 0,
                        1: 1,
                    },
                    colors: {
                        0: {
                            name: 'First color',
                        },
                        1: {
                            name: 'Second color',
                        },
                    },
                },
            },
            defaults: {
                filledAreasStyle: {
                    filledAreaId1: {
                        color: 'yellow',
                        visible: true,
                        transparency: 40,
                    },
                },

                palettes: {
                    paletteId1: {
                        colors: {
                            0: {
                                color: 'red',
                                width: 1,
                                style: 0,
                            },
                            1: {
                                color: 'blue',
                                width: 3,
                                style: 1,
                            },
                        },
                    },
                },

                styles:
                {
                    plot_0: {
                        linestyle: 0,
                        visible: true,
                        linewidth: 1,
                        plottype: 2,
                        trackPrice: true,
                        color: 'blue'
                    },
                    plot_1: {
                        linestyle: 1,
                        visible: true,
                        linewidth: 2,
                        plottype: 2,
                        trackPrice: true,
                        color: 'red'
                    },
                },
                precision: 4,
                inputs: {}
            },
            styles:
            {
                plot_0:
                {
                    title: 'First plot',
                    histogramBase: 0,
                },
                plot_1:
                {
                    title: 'Second plot',
                    histogramBase: 0,
                },
            },
            inputs: [],
            format: {
                type: 'price',
                precision: 4,
            },
        },
        constructor: function() {
            this.main = function(context, inputCallback) {
                this._context = context;
                this._input = inputCallback;

                var value = Math.random() * 200 - 100;
                var colorIndex = value > 0 ? 0 : 1;

                return [0, value, colorIndex];
            }
        }
    }
]);

},

@awb99
Copy link
Collaborator Author

awb99 commented Sep 1, 2023

https://github.com/cnuernber/tmdjs/blob/cd91d157297a164eb02916b6c96c46190da54f3d/src/tech/v3/datatype/argops.cljs#L226

I think the real answer to this would be a BRIN index (https://en.wikipedia.org/wiki/Block_Range_Index), which I don't believe is in there, but would be rad to add.

Assuming you're sorted by timestamp... This implementation of binary search does exist:

Perhaps that's good enough for what you're up to? For sure it could be used to trounce going linear over the rows for each lookup.

@awb99
Copy link
Collaborator Author

awb99 commented Sep 1, 2023

Use the subscribe method to handle events raised when users interact with marks. You can also refresh and clear marks using the chart methods.

If you want to display two characters (like 'ED', 'AB', 'CD', etc.), you should enable the two_character_bar_marks_labels featureset.

One bar can have several marks. When a user clicks on the mark, the tooltip appears. The tooltip can only contain plain text. HTML code is not supported.

You can specify a timescale mark shape using the shape property. Images can be displayed within timescale marks by providing an image url in the imageUrl property.
TimeScaleMarkShape
Type
"circle" | "earningUp" | "earningDown" | "earning"

Subscribe to library events.

Signature
subscribe(event: EventName, callback: SubscribeEventsMap[EventName]) => void
unsubscribe
Unsubscribe from library events.

Signature
unsubscribe(event: EventName, callback: SubscribeEventsMap[EventName]) => void

@awb99
Copy link
Collaborator Author

awb99 commented Sep 1, 2023

@awb99 awb99 changed the title Todo Tradingview Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant