for(int cnt=0;cnt<OrdersTotal();cnt++){ OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); iTicket=OrderTicket(); Comment("\nOrderTicket = ", iTicket); // проверяем переданные значения if ((iTicket==0) || ((iTmFrme!=1) && (iTmFrme!=5) && (iTmFrme!=15) && (iTmFrme!=30) && (iTmFrme!=60) && (iTmFrme!=240) && (iTmFrme!=1440) && (iTmFrme!=10080) && (iTmFrme!=43200)) || (iMAPeriod<2) || (MAMethod<0) || (MAMethod>3) || (iApplPrice<0) || (iApplPrice>6) || (iShift<0) || (iIndent<0)) {Comment("\nТрейлинг функцией TrailingByMA() невозможен из-за некорректности значений переданных ей аргументов."); return(0);} // определим значение МА с переданными функции параметрами double dMA = iMA(Symbol(),iTmFrme,iMAPeriod,iMAShift,MAMethod,iApplPrice,iShift);// значение скользящего среднего с переданными параметрами // если длинная позиция, и её стоплосс хуже значения среднего с отступом в iIndent пунктов, модифицируем его if (OrderType()==OP_BUY){ if ((OrderStopLoss()<dMA-iIndent*Point) && (dMA-iIndent*Point<Bid-MarketInfo(Symbol(),MODE_STOPLEVEL)*Point)){ if (!OrderModify(iTicket,OrderOpenPrice(),dMA-iIndent*Point,OrderTakeProfit(),OrderExpiration())) Comment("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());}} // если позиция - короткая, и её стоплосс хуже (выше верхней границы канала или не определён, ==0), модифицируем его if (OrderType()==OP_SELL){ if (((OrderStopLoss()==0) || (OrderStopLoss()>dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point)) && (dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point>Ask+MarketInfo(Symbol(),MODE_STOPLEVEL)*Point)) {if (!OrderModify(iTicket,OrderOpenPrice(),dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point,OrderTakeProfit(),OrderExpiration())) Print("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());}}}
Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.
I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?
Just every time you count, for example, 1.3 lots of GBPUSD, and then 2.8 lots of EURJPI gets a little tired.
Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.
I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?
Just every time you count for example 1.3 lot of GBPUSD, and then 2.8 lot of EURJPI, it gets a bit tiresome.
At GBPUSD, he smiled. At the EBUJPI, I went down with a patsy. I'm sorry, I don't mean anything bad by it.
And another question: there are three variables. Of any type. Is it possible to implement the following condition: if two variables out of three correspond to the condition so-and-so, then do so-and-so?
Swetten писал (а)>> One more question: there are three variables. Of any type. Is it possible to implement the following condition: if two variables out of three correspond to the condition so-and-so, then do so-and-so?
boola,b,c; //Переменные. True - удовлетворяют условию, False - не удовлетворяют.intcount; // Счетчик количества переменных, удовлетворяющих условию.if(a==true)count++;
if(b==true)count++;
if(c==true)count++;
if(count>=2){//Делаем то-то}
I advise to rename the topic to "Questions from Swetten" -)
It's all wonderfully written, except it's all nonsense on the inside. The textbook is a bit of a bummer, really! And how do you write and read data like a table? And arrays like this? And in general? Kim's library has a look in it.
Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.
I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?
Just every time you count for example 1.3 lot of GBPUSD, and then 2.8 lots of EURJPI, it gets a bit tiresome.
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.
Down with the glitchy wind :)
To measure an angle, you need a point + datum and a point at which to measure the angle.
For starters:
int cnt, total;
total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
iTicket=OrderTicket();
}
For starters:
Here's a snippet of code with an order overrun. The trailing stop code is taken from here: 'Library of Functions and Expert Advisors for Trailing Stop / Yuri Dzyuban'.
Returns 0, for crying out loud!!!for(int cnt=0;cnt<OrdersTotal();cnt++){
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
iTicket=OrderTicket();
Comment("\nOrderTicket = ", iTicket);
// проверяем переданные значения
if ((iTicket==0) || ((iTmFrme!=1) && (iTmFrme!=5) && (iTmFrme!=15) && (iTmFrme!=30) && (iTmFrme!=60) && (iTmFrme!=240) && (iTmFrme!=1440) && (iTmFrme!=10080) && (iTmFrme!=43200)) || (iMAPeriod<2) || (MAMethod<0) || (MAMethod>3) || (iApplPrice<0) || (iApplPrice>6) || (iShift<0) || (iIndent<0))
{Comment("\nТрейлинг функцией TrailingByMA() невозможен из-за некорректности значений переданных ей аргументов."); return(0);}
// определим значение МА с переданными функции параметрами
double dMA = iMA(Symbol(),iTmFrme,iMAPeriod,iMAShift,MAMethod,iApplPrice,iShift);// значение скользящего среднего с переданными параметрами
// если длинная позиция, и её стоплосс хуже значения среднего с отступом в iIndent пунктов, модифицируем его
if (OrderType()==OP_BUY){
if ((OrderStopLoss()<dMA-iIndent*Point) && (dMA-iIndent*Point<Bid-MarketInfo(Symbol(),MODE_STOPLEVEL)*Point)){
if (!OrderModify(iTicket,OrderOpenPrice(),dMA-iIndent*Point,OrderTakeProfit(),OrderExpiration()))
Comment("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());}}
// если позиция - короткая, и её стоплосс хуже (выше верхней границы канала или не определён, ==0), модифицируем его
if (OrderType()==OP_SELL){
if (((OrderStopLoss()==0) || (OrderStopLoss()>dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point)) && (dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point>Ask+MarketInfo(Symbol(),MODE_STOPLEVEL)*Point))
{if (!OrderModify(iTicket,OrderOpenPrice(),dMA+(MarketInfo(Symbol(),MODE_SPREAD)+iIndent)*Point,OrderTakeProfit(),OrderExpiration()))
Print("Не удалось модифицировать стоплосс ордера №",OrderTicket(),". Ошибка: ",GetLastError());}}}
Swetten , write if you need anything else.
Write if you need anything else.
Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.
I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?
Just every time you count, for example, 1.3 lots of GBPUSD, and then 2.8 lots of EURJPI gets a little tired.
Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.
I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?
Just every time you count for example 1.3 lot of GBPUSD, and then 2.8 lot of EURJPI, it gets a bit tiresome.
At GBPUSD, he smiled. At the EBUJPI, I went down with a patsy. I'm sorry, I don't mean anything bad by it.
One more question: there are three variables. Of any type. Is it possible to implement the following condition: if two variables out of three correspond to the condition so-and-so, then do so-and-so?
I advise to rename the topic to "Questions from Swetten" -)
on the subject =)
I've been using one of them seriously =) it's been going for two days now.
to practice, 200 quid.
for mts, a little more serious, 700 quid.
for long term mts from 7,000 quid
IMHO =)
Here's another good question: there's data like:
P1[a, b, step]
P2[c, d, step]
P3[e, f, step]
P4[g, h, step]
P5[i, j, step].
How can I write them in one go to a file and then read them from there?
I did it like this:
It's all wonderfully written, except it's all nonsense on the inside. The textbook is a bit of a bummer, really! And how do you write and read data like a table? And arrays like this? And in general? Kim's library has a look in it.Thank you very much! Only my fault - I had a higher cycle with return(0), so it was hiding and hurting me little by little.
I have a question: do you have a program, where I enter lot size, specify pair, and it shows me how much money (in rubles, for example) I need to buy this lot, point value, etc.?
Just every time you count for example 1.3 lot of GBPUSD, and then 2.8 lots of EURJPI, it gets a bit tiresome.