-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
Retrieve chart pattern studies example missing #220
Comments
Here is a dump of ws messages with single study create_study raw
json{
"m": "create_study",
"p": [
"cs_J9dHOapfH83N",
"st11",
"st1",
"sds_1",
"HeadAndShouldersCP@tv-chart_patterns-26",
{
"Source": "ohlc4",
"Patterns": "All",
"Price Targets": "All",
"Trend Height": 50,
"Minimum required difference": 20,
"Maximum slope of the neck line": 15,
"Shoulders height maximum difference": 30,
"Shoulders width maximum difference": 60,
"In Progress": true,
"Color Graph": "rgba(156, 39, 176, 1)",
"Line Style": "Solid",
"Width Graph": 2,
"Color Extend Line": "rgba(156, 39, 176, 1)",
"Neck Line Style": "Dotted",
"Width Neck Line": 2,
"Background": true,
"Background color": "rgba(156, 39, 176, 0.15)",
"Labels": true,
"Label Background color": "rgba(156, 39, 176, 1)",
"Label Text color": "rgba(255, 255, 255, 1)"
}
]
} study_loading raw
json{
"m": "study_loading",
"p": ["cs_J9dHOapfH83N", "st11", "s5_st1"],
"t": 1698306758,
"t_ms": 1698306758285
} du, study_completed raw
json[
{
"m": "du",
"p": [
"cs_J9dHOapfH83N",
{
"st11": {
"node": "ams1-32-studies-charts-pro-2-runner-2",
"st": [{ "i": 299, "v": [1698240600.0, 0.0, 0.0] }],
"ns": {
"d": "{\"graphicsCmds\":{\"create\":{\"dwglabels\":[{\"data\":[{\"id\":8,\"x\":2,\"y\":221.42,\"yl\":\"ab\",\"t\":\"Left Shoulder\",\"st\":\"lcn\",\"ci\":4.289734556E9,\"tci\":4.294967295E9,\"sz\":\"normal\",\"ta\":\"center\",\"tt\":\"\"},{\"id\":9,\"x\":4,\"y\":228.965,\"yl\":\"ab\",\"t\":\"Head\",\"st\":\"lcn\",\"ci\":4.289734556E9,\"tci\":4.294967295E9,\"sz\":\"normal\",\"ta\":\"center\",\"tt\":\"\"},{\"id\":10,\"x\":6,\"y\":225.78,\"yl\":\"ab\",\"t\":\"Right Shoulder\",\"st\":\"lcn\",\"ci\":4.289734556E9,\"tci\":4.294967295E9,\"sz\":\"normal\",\"ta\":\"center\",\"tt\":\"\"},{\"id\":22,\"x\":8,\"y\":201.26,\"yl\":\"pr\",\"t\":\"Target\",\"st\":\"luprg\",\"ci\":4.289734556E9,\"tci\":4.294967295E9,\"sz\":\"normal\",\"ta\":\"center\",\"tt\":\"Head And Shoulders\\nPrice: 201.26\\nStatus: Awaiting\"}],\"styleId\":\"labels\"}],\"dwglinefills\":[{\"data\":[{\"id\":13,\"line1\":11,\"line2\":12,\"ci\":6.49078684E8},{\"id\":16,\"line1\":14,\"line2\":15,\"ci\":6.49078684E8},{\"id\":19,\"line1\":17,\"line2\":18,\"ci\":6.49078684E8}],\"styleId\":\"lineFills\"}],\"dwglines\":[{\"data\":[{\"id\":1,\"x1\":0,\"y1\":200.2,\"x2\":2,\"y2\":221.42,\"ex\":\"n\",\"st\":\"sol\",\"ci\":4.289734556E9,\"w\":2},{\"id\":2,\"x1\":2,\"y1\":221.42,\"x2\":3,\"y2\":214.14,\"ex\":\"n\",\"st\":\"sol\",\"ci\":4.289734556E9,\"w\":2},{\"id\":3,\"x1\":3,\"y1\":214.14,\"x2\":4,\"y2\":228.965,\"ex\":\"n\",\"st\":\"sol\",\"ci\":4.289734556E9,\"w\":2},{\"id\":4,\"x1\":4,\"y1\":228.965,\"x2\":5,\"y2\":215.03,\"ex\":\"n\",\"st\":\"sol\",\"ci\":4.289734556E9,\"w\":2},{\"id\":5,\"x1\":5,\"y1\":215.03,\"x2\":6,\"y2\":225.78,\"ex\":\"n\",\"st\":\"sol\",\"ci\":4.289734556E9,\"w\":2},{\"id\":6,\"x1\":6,\"y1\":225.78,\"x2\":7,\"y2\":215.57,\"ex\":\"n\",\"st\":\"sol\",\"ci\":4.289734556E9,\"w\":2},{\"id\":7,\"x1\":7,\"y1\":215.56872231260166,\"x2\":1,\"y2\":213.7695757124901,\"ex\":\"n\",\"st\":\"dot\",\"ci\":4.289734556E9,\"w\":2},{\"id\":11,\"x1\":1,\"y1\":213.7695757124901,\"x2\":2,\"y2\":221.42,\"ex\":\"n\",\"st\":\"sol\",\"ci\":0.0,\"w\":2},{\"id\":12,\"x1\":3,\"y1\":214.14,\"x2\":2,\"y2\":221.42,\"ex\":\"n\",\"st\":\"sol\",\"ci\":0.0,\"w\":2},{\"id\":14,\"x1\":3,\"y1\":214.14,\"x2\":4,\"y2\":228.965,\"ex\":\"n\",\"st\":\"sol\",\"ci\":0.0,\"w\":2},{\"id\":15,\"x1\":5,\"y1\":215.03,\"x2\":4,\"y2\":228.965,\"ex\":\"n\",\"st\":\"sol\",\"ci\":0.0,\"w\":2},{\"id\":17,\"x1\":5,\"y1\":215.03,\"x2\":6,\"y2\":225.78,\"ex\":\"n\",\"st\":\"sol\",\"ci\":0.0,\"w\":2},{\"id\":18,\"x1\":7,\"y1\":215.56872231260166,\"x2\":6,\"y2\":225.78,\"ex\":\"n\",\"st\":\"sol\",\"ci\":0.0,\"w\":2},{\"id\":20,\"x1\":7,\"y1\":215.57,\"x2\":7,\"y2\":201.26,\"ex\":\"n\",\"st\":\"dot\",\"ci\":4.289734556E9,\"w\":2},{\"id\":21,\"x1\":7,\"y1\":201.26,\"x2\":8,\"y2\":201.26,\"ex\":\"n\",\"st\":\"dot\",\"ci\":4.289734556E9,\"w\":2}],\"styleId\":\"lines\"}]},\"erase\":[{\"action\":\"all\"}]}}",
"indexes": [179, 199, 209, 214, 236, 252, 262, 275, 300]
},
"t": "s5_st1"
}
}
]
},
{
"m": "study_completed",
"p": ["cs_J9dHOapfH83N", "st11", "s5_st1"],
"t": 1698306758,
"t_ms": 1698306758379
}
] |
Further check agains volume indicator, from what I understand from sources we should use built in indicator rahter than pine indicator. There are some predefined default for well know indicators here While in debug did tried to add indicator and check what I have in object
almost same as in defaults, so I do believe thats a starting point inputs are {
"length": 20,
"col_prev_close": false
} and here is what we have in defaults for build in indicators const defaultValues = {
'Volume@tv-basicstudies-144': {
length: 20,
col_prev_close: false,
}, constructor of indicator takes name so in case of volume it will be in case of head and shoulders name: {
"Source": "ohlc4",
"Patterns": "All",
"Price Targets": "All",
"Trend Height": 50,
"Minimum required difference": 20,
"Maximum slope of the neck line": 15,
"Shoulders height maximum difference": 30,
"Shoulders width maximum difference": 60,
"In Progress": true,
"Color Graph": "rgba(156, 39, 176, 1)",
"Line Style": "Solid",
"Width Graph": 2,
"Color Extend Line": "rgba(156, 39, 176, 1)",
"Neck Line Style": "Dotted",
"Width Neck Line": 2,
"Background": true,
"Background color": "rgba(156, 39, 176, 0.15)",
"Labels": true,
"Label Background color": "rgba(156, 39, 176, 1)",
"Label Text color": "rgba(255, 255, 255, 1)"
} so now the question is how to instantiate it and pass to the chart |
heh, so i have ended up facing #202 so far the attempt is: import TradingView from '@mathieuc/tradingview';
var indicator = new TradingView.BuiltInIndicator('HeadAndShouldersCP@tv-chart_patterns-26');
var client = new TradingView.Client({
token: '*********' // "sessionId" cookie,
});
var chart = new client.Session.Chart();
chart.setMarket('AMEX:VTI', { timeframe: 'D', range: 252 });
// indicator.setOption('first_bar_time', Date.now() - 10 ** 8); // aka example of how to set options
var study = new chart.Study(indicator)
console.log(`Retrieving ${indicator.description}`)
study.onUpdate(() => {
console.log(`Retrieved ${indicator.description}`)
console.log(study.periods)
console.log(study.graphic)
}) going to check:
technically issue may be closed, because it seems that I was mistaken and technically example of how to use buildin indicators is present |
By chart patterns I mean this ones:
Restriction:
TradingView.searchIndicator
somehow does not find themBearishFlagCP@tv-chart_patterns-26
but attempt to retrieve it fails with error that indicator is undefinedBearishFlagCP@tv-chart_patterns
How I tried to retrieve it:
Wondering if I am missing something, willing to create one more example while have paid subscription, because I bed I am not a first one and not last one who is struggling with this
The text was updated successfully, but these errors were encountered: