Group Abstract Group Abstract

Message Boards Message Boards

0
|
49 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Using a variable with CandlestickChart

Posted 1 day ago

So I am currently evaluating the desktop version of Wolfram for Desktop, and I am interesting in plotting financial data. I found the documentation here: https://reference.wolfram.com/language/ref/CandlestickChart.html

And while most of the examples don't work for me (because they assign the data to a variable "data", which is apparently illegal because the name "data" is more than one letter), this one worked:

CandlestickChart[{{{2025, 06, 16}, { 3412.49`, 3422.95`, 3374.33`, 3385.9`}},{{2025, 06, 17}, { 3386.0`, 3400.38`, 3366.38`, 3378.43`}},
{{2025, 06, 18}, { 3378.48`, 3397.11`, 3347.85`, 3370.52`}},
{{2025, 06, 19}, { 3370.53`, 3379.44`, 3340.58`, 3355.43`}},
{{2025, 06, 20}, { 3355.53`, 3390.0`, 3342.18`, 3366.8`}}}]

So that was nice, but I wanted to have the data in a dedicated variable, so that I could process it further. So I tried assigning it to a variable "C":

C = {{{2025, 06, 16}, { 3412.49`, 3422.95`, 3374.33`, 3385.9`}},{{2025, 06, 17}, { 3386.0`, 3400.38`, 3366.38`, 3378.43`}},{{2025, 06, 18}, { 3378.48`, 3397.11`, 3347.85`, 3370.52`}},{{2025, 06, 19}, { 3370.53`, 3379.44`, 3340.58`, 3355.43`}},{{2025, 06, 20}, { 3355.53`, 3390.0`, 3342.18`, 3366.8`}}}
CandlestickChart[C]

But for this I only get: CandlestickChart: C is not a valid dataset or list of datasets.

So I looked into converting my data into a dataset, but could not find any information (the generic term does not help).

It would be great if anyone could shed some light on this.

POSTED BY: Philipp Ludwig
3 Replies
Posted 20 hours ago

...most of the examples don't work for me (because they assign the data to a variable "data", which is apparently illegal because the name "data" is more than one letter)...:

What are you talking about?

data is a perfectly valid symbol name.

POSTED BY: Eric Rimbey
Posted 4 hours ago

It is not, and I found that other people faced this issue, to: https://community.wolfram.com/groups/-/m/t/3199730

Thank you @Mohammed for explaining the issue. I could not thank you earlier, because this forum lets me post only once per 24 hours (probably a limitation of free accounts).

POSTED BY: Philipp Ludwig

You cannot use upper case letter C and assign it a value, because it is a protected symbol: https://reference.wolfram.com/language/ref/C.html

Call your list for example lower case c and it will work.

POSTED BY: Mohammad Bahrami
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard