Please use the SRC button when posting code. I have done it for you this time.
Your code will not work because Ask is the same as currentask, so the loop is pointless. You cannot get previous Ask values in MT4.
-
Play videoPlease edit your post.
For large amounts of code, attach it - You must use RefreshRates, to use any Predefined Variables after server calls and Sleep.
- The first iteration of the loop, Ask and currentask will always be the same. That is useless. Sleep and RefreshRates first, then check.
if (Ask / currentask > 1)
Why the divide? Why not just compare?if(Ask > currentask)
Also see The == operand. - MQL4 forum

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
Would this for loop work?
currentask = (MarketInfo(symbol, MODE_ASK))
for(int f=market_refresh; f<=3600; f++)
{
if (Ask / currentask > 1)
{
Market = "bear";
break;
}
else
{
RefreshRates();
Sleep(1000);
}
}
I want to compare the current ask with the previous ask to set the behavior of my trade.