I have a loop that only exits when my Ask/Bid price meets certain criteria. The problem is that they values don't change. How can I update to current Ask/Bid in my loop?
Show us the code.
I don't have the code with me now but I can give you a general idea.
double var = Ask+15*Point;
while(Ask!=var)
{
running code here that works
}
I just need to know how to keep the Ask price updating
caldolegare
Try
bool RefreshRates( )
Refreshing data in the built-in variables and series arrays. This function is used when expert advisor calculates for a long time and needs refreshing data. Returns true if data are refreshed, otherwise false.
OR
use get MarketInf() function to retreive price on each loop.
Market information identifiers
Market information identifiers, used with MarketInfo() function.
It can be any of the following values:
Constant Value Description
MODE_LOW 1 Low day price.
MODE_HIGH 2 High day price.
MODE_TIME 5 The last incoming quotation time.
MODE_BID 9 Last incoming bid price.
MODE_ASK 10 Last incoming ask price.
MODE_POINT 11 Point size.
MODE_DIGITS 12 Digits after decimal point.
MODE_SPREAD 13 Spread value in points.
MODE_STOPLEVEL 14 Stop level in points.
MODE_LOTSIZE 15 Lot size in the base currency.
MODE_TICKVALUE 16 Tick value.
MODE_TICKSIZE 17 Tick size.
MODE_SWAPLONG 18 Swap of the long position.
MODE_SWAPSHORT 19 Swap of the short position.
MODE_STARTING 20 Market starting date (usually used for future markets).
MODE_EXPIRATION 21 Market expiration date (usually used for future markets).
MODE_TRADEALLOWED 22 Trade is allowed for the symbol.
MODE_MINLOT 22 The minimum lot size in points.
MODE_LOTSTEP 22 Step for changing lots in points.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a loop that only exits when my Ask/Bid price meets certain criteria. The problem is that they values don't change. How can I update to current Ask/Bid in my loop?