Gentlemen programmers. I have a question. I am testing one EA on aforex.ru demo account. I sometimes get an error when I open order 138 "New prices". I have not understood why. I open orders through the function below. I have to find the reason of error during the opening. What are your thoughts?
void open_positions(int signal,double lot,double price,double tp,double lev)
{
//signal=0 -> сигнал на открытие покупки//signal=1 -> сигнал на открытие продажиint i=0; //переменная для счётчика циклаstring symb=Symbol(),com;
com=DoubleToStr(lev,Digits);
color col;
double stop,take;
int count=Count_Of_Trade_Try; //количество попыток открытия ордера в случае, если его не удаётся совершить сразуint err=0;
if(signal==OP_BUYLIMIT || signal==OP_BUYSTOP || signal==OP_BUY)
{
RefreshRates();
price=NormalizeDouble(Ask,Digits); //цена открытия для покупок
col=Green;
}
if(signal==OP_SELLLIMIT || signal==OP_SELLSTOP || signal==OP_SELL)
{
RefreshRates();
price=NormalizeDouble(Bid,Digits); //цена открытия для продаж
col=Red;
}
//stop=NormalizeDouble(sl(SL,signal),Digits);
take=NormalizeDouble(tp,Digits);
while(i<=count)
{
//сама функия открытия ордера (встроенная). Для удобства восприятия параметры разнесены на разные строки:int ticket=OrderSend(symb,//символ
signal, //тип ордера
lot, //объем
price, //цена открытия
Slipage, //уровень допустимого реквота0, //величина Stop Loss0, //величина Take Profit
com,//комментарий ордера
magic_number,//магическое число0,//срок истечения (используется при отложенных ордерах)
CLR_NONE); //цвет отображаемой стрелки на графике (CLR_NONE - стрелка не рисуется)if(ticket!=-1) //если открытие произошло успешно, наносим графический объект и выходим из цикла
{
OrderModify(ticket,price,stop,take,0,col);
break;
}
err=GetLastError();
if(err!=0) Print("Ошибка открытия ("+symb+", "+signal+", "+price+", "+0+", "+take+"): "+Market_Err_To_Str(err));
i++;
Sleep(Pause_Of_Trade_Try*100); //в случае ошибки делаем паузу перед новой попыткой
} //end while(i<=count)
} //end void open_positions(int signal, double lot, int magic, double price=0.0, string symb="NONE")
Gentlemen programmers. I have a question. I am testing one EA on aforex.ru demo account. I sometimes get an error when I open order 138 "New prices". I have not understood why. I open orders through the function below. I have to find the reason of error during the opening. What are your thoughts?
Somebody who is a professional does not ask such questions. You must be in the wrong branch.
It's all bad. Even with versions. Except with scripts.
Here's an example. It's possible to define and retrieve name to version there, but it's a bit tricky.
Unless the scripts.
came up with a half-finished method.
Create a new configuration for the compiler. like "Release Main", in which I write the name of the required file.
It's not very automated, but it saves me from a duplicate output file name.
Does MQL4 have functions for working with crosshair?
I need to assign the value of price difference in pips to a variable.
Does MQL4 have functions for working with crosshair?
I need to assign the value of price difference in pips to a variable.
Does MQL4 have functions for working with crosshair?
I need to assign a value of price difference in pips to a variable.
CHARTEVENT_MOUSE_MOVEи
CHARTEVENT_CLICKGentlemen programmers. I have a question. I am testing one EA on aforex.ru demo account. I sometimes get an error when I open order 138 "New prices". I have not understood why. I open orders through the function below. I have to find the reason of error during the opening. What are your thoughts?
Gentlemen programmers. I have a question. I am testing one EA on aforex.ru demo account. I sometimes get an error when I open order 138 "New prices". I have not understood why. I open orders through the function below. I have to find the reason of error during the opening. What are your thoughts?
Professionals don't ask such questions. You must be in the wrong branch.
Well, if you're such a superprofessional, maybe you can tell me what's wrong!