I will suggest to collect some ticks first, then write them to the file.
When you put a new trade, you know that there is a delay in the network. The trade is put on the broker's actual prices, not yours at the time you sent the order. And you can always calculate this difference - get the price before you send the order, then after it is created, get it's open price and calculate the difference.
Thank you WHRoeder and JDeel for your responses.
May be I did not explained well what I want.
My intention is saving all the values that compose one candle, not the values where I put an order. In fact, I am not trading now. Only I am analizing the candlestick charts for developing a good strategy.
I don't want to save the bid and ask values but only the values of each "tick" along the candle.
Thank you again and regards from Argentina.
Thank you again WHRoeder for wanting help me.
I know that a "tick" is when the prices make a change.
There is two prices: bid and ask. When a trade took place, there is only one price: the price in which was made that trade. That price is what I want to save in a file...