
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
#Orders Calculations & Account Info's Updates - Open
( Once I asked - but I still need help )
I call my calculate functions by the OnTick() or Start(), and they depends on Chart Symbol Ticks.
And I has been started to researching for how can I do my EA's calculation updates does not depends on Ticks and Symbols ( / Chart - Ticks, Symbols ).
Just I am trying to do 'All Orders Calculations & Account Info's' will updates sync ( / real time ) with 'Terminal > Trade'.
Please help me, thanks.
Thanks in advance.
OnTimer()
https://www.mql5.com/en/docs/basis/function/events#ontimer
And SymbolName(x,1);And SymbolName(x,1);
Good comment, which one it helped me, thanks a lot.
Now, I am using OnTick() and OnTimer(), both of that functions works good for me. ( I first time to use OnTimer() for EA's )
---
Also I would like to try Ticks. I just need only Ticks from which symbols ( Pairs ) on 'Terminal > Trade' and current chart symbol. Is this SymbolName() could help me?
Please, help me or give me advice, so how can I do that?
All the best.
{
Print(i," Symbol: ",SymbolName(i,1)," Ask: ",MarketInfo(SymbolName(i,1),MODE_ASK)," Bid: ",MarketInfo(SymbolName(i,1),MODE_BID));
}
{
Print(i," Symbol: ",SymbolName(i,1)," Ask: ",MarketInfo(SymbolName(i,1),MODE_ASK)," Bid: ",MarketInfo(SymbolName(i,1),MODE_BID));
}
Amazing example and really useful comment for me, thanks a lot man.
Is it possible Ticks comes from Trade Pairs / Symbols, please?
Because almost all the time my Market Watch shows all symbols - specially I look for new good Pairs for Trades and that is only reason I am researching some ways for how can I get ' Terminal > Trade ' symbols / pairs, just currently opening trades ticks.
Thanks a lot in advance.
no but you can update price in OnTimer() function set to a low value for example 250 milliseconds will be equal to 4 ticks a second so why do you need it ?
Thanks for your comment.
( subtopic - #Orders Calculations & Account Info's Updates - Open ) As I mentioned I use orders profit calculations and that is not running sync with ' Terminal > Trade ', that is only reason.
So, sometimes volatility very low, Ticks comes least amounts, and I think functions could be running 4 times in a second, so that running for nothing ( / vain ).
If I cannot find the way which one it can give me ' Terminal > Trade ' ticks for Orders Profit Calculations and Account info ( / updates ) sync. I will use your very useful methods - which one you showed me that ways in your last comments, thanks a lot. ( I already tested and that way works me )
Thanks in advance.
Well if your really into it you can use:
{
datetime time; // Time of the last prices update
double bid; // Current Bid price
double ask; // Current Ask price
double last; // Price of the last deal (Last)
ulong volume; // Volume for the current Last price
long time_msc; // Time of a price last update in milliseconds
uint flags // Tick flags
};
The Structure for Returning Current Prices (MqlTick)
This is a structure for storing the latest prices of the symbol. It is designed for fast retrieval of the most requested information about current prices.
The variable of the MqlTick type allows obtaining values of Ask, Bid, Last and Volume within a single call of the SymbolInfoTick() function.
The parameters of each tick are filled in regardless of whether there are changes compared to the previous tick. Thus, it is possible to find out a correct price for any moment in the past without the need to search for previous values at the tick history. For example, even if only a Bid price changes during a tick arrival, the structure still contains other parameters as well, including the previous Ask price, volume, etc.
You can analyze the tick flags to find out what data have been changed exactly:
Example:
{
MqlTick last_tick;
//---
if(SymbolInfoTick(Symbol(),last_tick))
{
Print(last_tick.time,": Bid = ",last_tick.bid,
" Ask = ",last_tick.ask," Volume = ",last_tick.volume);
}
else Print("SymbolInfoTick() failed, error = ",GetLastError());
//---
}
See also
https://www.mql5.com/en/docs/constants/structures/mqltick
Structures and Classes, CopyTicks(), SymbolInfoTick()
So u can use it to check if there was a new tick for a specific symbol, but this will actually be one step more then directly reading the price levels directly so once more, why would you need it.
Marco vd Heijden:
Well if your really into it you can use: ...
So u can use it to check if there was a new tick for a specific symbol, but this will actually be one step more then directly reading the price levels directly so once more, why would you need it.
Thanks for your informative comment, much appreciate.
---
If I am right this part of sentence is a question.
And I need to describe my situation.
All of that concern comes from here.
---
I hope you understand me now more clearly.
All the best.
Well if you really want to wait for each tick you will have to write a separate EA for every symbol and use the OnTick() function.
But i can tell you i also program micro controllers and they are in an endless while loop (forever) until a power failure, or interrupt occurs.
To check if a condition is true or false, uses the smallest Boolean data type and your processor already does that millions if not billions of times per second with all the processes running in the background and the graphics etc.
It's when you start doing heavy calculations involving larger data types, that this becomes an issue.