I found this function somewhere, however, the RoundNumberLow is the only result that works when putting this into EAs. However, the RoundNumberHigh seems to never be traded in my EA.
Can anyone help please?
void NextRoundNumbers()
{
//Finds the nearest big numbers to the market price.
//Saves these in RoundNumberHigh[index] and RoundNumberLow[index]
RefreshRates();
//Jpy pairs
if (Digits == 2 || Digits == 3)
{
int price = Ask;//Truncates the quote
RoundNumberLow = price;
RoundNumberHigh = price + 1;
}//if (Digits == 2 || Digits == 3)
//non-Jpy pairs
if (Digits == 4 || Digits == 5)
{
string sprice = DoubleToStr(Ask, Digits);
if (Ask >= 10) sprice = StringSubstr(sprice, 0, 5);
if (Ask < 10) sprice = StringSubstr(sprice, 0, 4);
RoundNumberLow = StrToDouble(sprice);
RoundNumberHigh = RoundNumberLow + 0.01;
}//if (Digits == 4 || Digits == 5)
}
Can anyone help please?
void NextRoundNumbers()
{
//Finds the nearest big numbers to the market price.
//Saves these in RoundNumberHigh[index] and RoundNumberLow[index]
RefreshRates();
//Jpy pairs
if (Digits == 2 || Digits == 3)
{
int price = Ask;//Truncates the quote
RoundNumberLow = price;
RoundNumberHigh = price + 1;
}//if (Digits == 2 || Digits == 3)
//non-Jpy pairs
if (Digits == 4 || Digits == 5)
{
string sprice = DoubleToStr(Ask, Digits);
if (Ask >= 10) sprice = StringSubstr(sprice, 0, 5);
if (Ask < 10) sprice = StringSubstr(sprice, 0, 4);
RoundNumberLow = StrToDouble(sprice);
RoundNumberHigh = RoundNumberLow + 0.01;
}//if (Digits == 4 || Digits == 5)
}