write historical indicator values to a csv?

 
I am plotting objects at various times on a chart and would like to know how to get various indicator values for the points in time where the objects are plotted. Similar to the data window feature in MT4.

Example - if I create an arrow object on a chart as follows:

ObjectCreate("buy_arrow", OBJ_ARROW, 0, D'2008.06.30 3:30', 1.5785)

Can someone provide some sample code snippets for how to get rsi value for the exact point where that object lives on the chart?

Thanks,
Ken
Reason: