if ((Opb==0) && (MA_1_t > MA_2_t + Rastvor*Point)) // Если разница между
{ // ..МА 1 и 2 большая
Opn_B=true; // Критерий откр. Buy
Cls_S=true; // Критерий закр. Sell
Opb++;// Открытие только одного ордера
Ops=0;
if (VKO1>=Ask) {VP=VP*Koff;} // При прибыли предыдущего умножать на коэф.
if (VKO1<Ask) {VP=VP*Koff1;}// При убытке предыдущего умножать на коэф1.
}
if ((Ops==0) && (MA_1_t < MA_2_t - Rastvor*Point)) // Если разница между
{ // ..МА 1 и 2 большая
Opn_S=true; // Критерий откр. Sell
Cls_B=true; // Критерий закр. Buy
Ops++;// Открытие только одного ордера
Opb=0;
if (VKO0<=Bid) {VP=VP*Koff;} // При прибыли предыдущего умножать на коэф
if (VKO0>Bid) {VP=VP*Koff1;}// При убытке предыдущего умножать на коэф1
}
if ((Opn_S==true)||(Opn_B==true)) // Если есть сигнал на открытие ордера
{// Вычисляем объем умножая на VP
if (AccountBalance()<50000) Vol=Opn_Lots*VP;
if (AccountBalance()>50000) Vol=2*Opn_Lots*VP;
}
Can't figure out where the error is, please advise. It says "not enough money to buy Lts=1.#INF"
That's the problem... The number of lots grows to infinity, i.e. the increase in volume is looped in, and by code it turns out to be a one-off increase...
After that to make it clear see below. and hence the same with Sell
if (Total==0 && Opn_B==true) // Открытых орд. нет
{ // критерий откр. BuyRefreshRates(); // Обновление данных
Min_Lot=MarketInfo(Symb,MODE_MINLOT); // Миним. колич. лотов
Free =AccountFreeMargin(); // Свободн средства
One_Lot=MarketInfo(Symb,MODE_MARGINREQUIRED);// Стоимость 1 лота
Step =MarketInfo(Symb,MODE_LOTSTEP); // Шаг изменен размера
Lts=MathFloor(Vol); // Для открытия Alert ("Lts ", Lts);
if(Lts < Min_Lot) Lts=Min_Lot; // Не меньше минимальнif (Lts*One_Lot < Free) Alert(" Не хватает денег на ", Lts," лотов"); // Лот дороже свободн.
SL=Ask-StopLoss_Open*Point; // Вычисление SL откр.
TP=Ask+TakeProfit_Open*Point; // Вычисление TP откр.Alert("Попытка открыть Buy. Ожидание ответа..");
Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,SL,TP); //Открытие Buyif (Ticket > 0) // Получилось :)
{
Alert ("Открыт ордер Buy ",Ticket);
VKO0=Ask; Opn_B =false; KO++;
Alert ("Цена открытия =", VKO0);
}
if (Fun_Error(GetLastError())==1) // Обработка ошибокcontinue; // Повторная попытка
}
That's the problem... The number of lots grows to infinity, i.e. the increase in volume is looped in, and by code it turns out to be a one-off increase...
After that to make it clear see below. and hence the same with Sell
Try
if (Fun_Error(GetLastError())==0) // Нет ошибкиbreak;
If there is an error, it will just try to open a position again on a new tick. By the way, it was explained to me here on this forum (p. 90-91) that it is advisable not to use && (and) operator in if.
Does anyone know how to convert the number of pips into currency?
i.e. if the profit is in units of currency, then 50 pips should be converted into units of currency... i.e. leverage should be taken into account...? 0_о
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
this question
There is a CCI indicator
On one timeframe it shows some data on another one
How can I display the data of this indicator on one screen from multiple timeframes?
I.e. here is my chart,
under it is one CCI minute
under it another CCI but by 5 minutes and still below it but by 1 hour
is it possible?
And check the deposit for sufficiency ? https://docs.mql4.com/ru/constants/marketinfo
And check the lot on the output ?
That's the problem... The number of lots grows to infinity, i.e. the increase in volume is looped in, and by code it turns out to be a one-off increase...
After that to make it clear see below. and hence the same with Sell
it's a so-called "one-off" ?
cap, it's obvious, there's a cycle.
Hello!
I cannot find an answer to the following question:
If a pending order is executed, its type is still the same as the pending order's type, or is it changed to OP_BUY or OP_SELL?
That's the problem... The number of lots grows to infinity, i.e. the increase in volume is looped in, and by code it turns out to be a one-off increase...
After that to make it clear see below. and hence the same with Sell
If a pending order is executed, is it still the same as the pending order, or is it changed to OP_BUY or OP_SELL?
Does anyone know how to convert the number of pips into currency?
i.e. if the profit is in units of currency, then 50 pips should be converted into units of currency... i.e. leverage should be taken into account...? 0_о