Recording related data of trading
I want to record some information of candles(for example 5 candles) and then send an order.After that the result of order and the corresponding trade was obtained, add that to the saved related candles that base on I did the trade. It should be mentioned that it might be several positions in same time and also I want do this for the remaining data. How can I code this? is there any example to help me?