Saving values of a candle tick by tick

 
Hello.  I hope someone can help me.
I want to save in a file all the values of one candle.
I know that in all moment, there is a bid value and an ask value. Finally, the values along the candle are those where was done each trade.
I know how to save each value, tick by tick of bid and ask, but...how can I save each value where really each trade took place along the candle?
Thanks whom respond me.
 
Betowm:I know how to save each value, tick by tick of bid and ask, but...how can I save each value where really each trade took place along the candle?
If you know how to save each tick, then you also know how to save when you open each order.
 

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. 

 
WHRoeder:
Betowm:I know how to save each value, tick by tick of bid and ask, but...how can I save each value where really each trade took place along the candle?
If you know how to save each tick, then you also know how to save when you open each order.

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.

 

 
Betowm: I don't want to save the bid and ask values but only the values of each "tick" along the candle.
What do you think a tick is?
 
WHRoeder:
Betowm: I don't want to save the bid and ask values but only the values of each "tick" along the candle.
What do you think a tick is?

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... 

:-) 

 
If you want to get Ask and Bid from a trade that was created in the past and belongs to the history, sorry, there is no way. You can get that information at the time of creation. MetaTrader does not keep the data of each tick, the minimum time resolution of the history data is 1 Minute (M1).
 
JDeel:
If you want to get Ask and Bid from a trade that was created in the past and belongs to the history, sorry, there is no way. You can get that information at the time of creation. MetaTrader does not keep the data of each tick, the minimum time resolution of the history data is 1 Minute (M1).
Ok. JDeel
Let's suppose I make a robot that in real time, saves in a file, the bid value, the ask value and the final value that compose the candle, and where bid and ask have been agreed for performing a trade.
How can I save that last value in a file?
Now , y know how save the "bid" value or the "ask" value but not the values that conform the candle.
 
The final value that compose the candle remains in the history of candles, it is also known as the Close price of the candle. For MQL4/MQL5 there are functions to write files, to get information about candles, prices, indicators... many things.
 
JDeel:
The final value that compose the candle remains in the history of candles, it is also known as the Close price of the candle. For MQL4/MQL5 there are functions to write files, to get information about candles, prices, indicators... many things.
Well. I have to study how to using the "historical" values as soon as they are writing in the history file, because I need working in real time, not in a backtest mode.
 
And you can always find that moment when a new candle is creates (old one is closed), but for that and for everything else you need to learn how to do it in MQL. The things you want to do are relatively simple. Yes, you can do them and no, probably no one here will do it for you :)