# Obtaining the data from a Renko chart

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.

• What is a renkochart? Commented Nov 10, 2018 at 6:34

data = {{{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}}}

• Excelent answer. I was no able to do it. Thanks Commented Nov 17, 2018 at 7:17
• If you change the PerformanceGoal -> "Speed" by a brick size or quality It is not working? why? Commented Dec 2, 2018 at 10:59
• @roble_the reason for using PerformanceGoal -> "Speed" to prevent RenkoChart from creating Tooltips (and dynamic elements) so that post-processing the output to extract elements is easier.
– kglr
Commented Dec 3, 2018 at 7:07
• Thanks for your comments and help. But if I want the pair {middle date, midle point} of ^SP500 index. I can not do it. The first code give me the midle data but the second give a dates that not correspond. How Will be the code for the ^SP500 index that prodeuce pairs of mean of (date, data) of each renko box ? Commented Dec 8, 2018 at 20:30
• DeleteDuplicates@ Cases[RenkoChart["^SP500"], Tooltip[, t] :> ({DateList[#], ToExpression@#2} & @@@ Partition[DeleteCases[StringSplit@t[[1]], "~"], 2]), [Infinity]] produces 23 points Commented Dec 8, 2018 at 20:34