How can I obtain the data of the trace of a RenkoChart
? Any code available?
Something like obtaining the range of dates or the middle point of the box.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communitydata = {{{2010, 1, 4}, 130.54}, {{2010, 1, 5}, 128.96}, {{2010, 1, 6}, 128.13},
{{2010, 1, 7}, 127.68} , {{2010, 1, 8}, 128.96}, {{2010, 1, 11}, 127.61},
{{2010, 1, 12}, 128.63}, {{2010, 1, 13}, 128.35}, {{2010, 1, 14}, 130.4},
{{2010, 1, 15}, 129.88}, {{2010, 1, 19}, 132.21}, {{2010, 1, 20}, 128.37}} ;
rc = RenkoChart[data, PerformanceGoal -> "Speed"];
pts = Cases[rc, Rectangle[a_, b_, ___] :> Mean[{a, b}], ∞];
Show[rc, Epilog -> {PointSize[Large], Point @ pts}]
Alternatively, you can extract the tooltips which contain the information on dates and values:
DeleteDuplicates @ Cases[ RenkoChart[data], Tooltip[_, t_] :>
({DateList[#], ToExpression @ #2} & @@@
Partition[DeleteCases[StringSplit @ t[[1]], "~"], 2]), ∞]
{{{{2010, 1, 4, 0, 0, 0.}, 130.54}, {{2010, 1, 5, 0, 0, 0.}, 128.96}},
{{{2010, 1, 6, 0, 0, 0.}, 128.13}}, {{{2010, 1, 7, 0, 0, 0.}, 127.68}},
{{{2010, 1, 8, 0, 0, 0.}, 128.96}, {{2010, 1, 14, 0, 0, 0.}, 130.4}},
{{{2010, 1, 15, 0, 0, 0.}, 129.88}, {{2010, 1, 19, 0, 0, 0.}, 132.21}},
{{{2010, 1, 20, 0, 0, 0.}, 128.37}}}
PerformanceGoal -> "Speed"
to prevent RenkoChart
from creating Tooltip
s (and dynamic elements) so that post-processing the output to extract elements is easier.
$\endgroup$