Yes, you will get the most recent updated quotes at the moment you run the function call.
However, please note that for most symbols you would need to the read the Bid and Ask quotes and not the Last quote (which is only supported for certain symbols).
No, if you save it to a variable then reuse that variable's value at a later time, then obviously it is no longer the latest value. It will become stale as it holds the value at the time it was read. It is not updated automatically.
To get the latest value you would need to call the functions again.
Yes, you will get the most recent updated quotes at the moment you run the function call.
However, please note that for most symbols you would need to the read the Bid and Ask quotes and not the Last quote (which is only supported for certain symbols).
No, if you save it to a variable then reuse that variable's value at a later time, then obviously it is no longer the latest value. It will become stale as it it holds the value at the time it was read. It is not updated automatically.
To get the latest value you would need to call the functions again.
Well, naturally I'm thinking about updating the global variable each time OnTick is called ^.^
However, please note that for most symbols you would need to the read the Bid and Ask quotes and not the Last quote (which is only supported for certain symbols).
As the OP is from Brazil, most often they are trading centralised market, with charts based on "last" prices.
Hmm that's something interesting I wasn't aware of! So if I decide to use my EA in Forex or even some other stock exchange rather then Brazil's B3, I'll have to update that part of the code? I wonder what else will have I have to update :3
Yes, you will get the most recent updated quotes at the moment you run the function call.
OK than. I was hoping I could save some processing by not getting the last asset's price inside each function that needed it, but it seems I won't be able to do that :T Well thanks guys for your replies!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I've a question which I guess I know the answer to it, but just in case...
Suppose I have an EA with the OnTick function. When that function is called, it means a new tick was created with a certain price value. Then the code inside of the function starts to run. Now suppose it takes some time for that code to be executed, time in which the market has already formed a new tick with a different price value. If, at this moment, I ask inside the OnTick the current asset's price (with CopyRates or CopyClose or SymbolInfoDouble(_Symbol,SYMBOL_LAST,result)), will it give me this new, updated price value or will it give me the price the asset had when OnTick was called?
Or putting it in a different perspective: if, right at the start of my OnTick function, I save the current price in a global variable and use it throught the code, both within OnTick as well as OnTimer and OnChartEvent, will the use of my global variable always imply the use of the latest price available to my EA or I may end up with "not the last price available"?