[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 251

 
skyjet:
Professionals, please help me! I have installed my Expert Advisor on 4 currencies in one terminal, but it opens orders only on 1 of them. What may be the reason for this? How can I get it to work in 4 currencies at once?

I have been dealing with this issue myself recently. In addition to doing the enumeration of currencies in the EA, you need to correctly specify Point, ask, bid, digits. Swap the historical data on each currency, if it is used. If there are calculations with predefined currency iBar, iClose, also insert currency enumeration instead of NULL. Here is an example for 25 currency pairs. Maybe I am not a great expert, but I have not received a clear answer from the experts, I have had to try it myself.


int nnnn;
string SymbolMax[25] = {"EURUSD", "GBPUSD", "USDCHF", "USDJPY", "AUDUSD", 
                        "USDCAD", "EURGBP", "EURJPY", "GBPJPY", "AUDCAD", 
                        "EURAUD", "EURCAD", "GBPCHF", "AUDCHF", "AUDJPY", 
                        "CADCHF", "CADJPY", "CHFJPY", "GBPAUD", "GBPCAD", 
                        "NZDCAD", "AUDNZD", "NZDJPY", "EURNZD", "NZDUSD"};

     if(nnnn<24) nnnn+=1; else nnnn=0;
     bid=MarketInfo(SymbolMax[nnnn],MODE_BID);
     ask=MarketInfo(SymbolMax[nnnn],MODE_ASK);
     point=MarketInfo(SymbolMax[nnnn],MODE_POINT);
     digits=MarketInfo(SymbolMax[nnnn],MODE_DIGITS);
     Startimeframe4();


 
sergeev:
yeah :)
Since you answer so quickly, answer me a dumb question - if I make error 1 in the code, will the terminal throw it back to me? Does this information not go to the server?
 
granit77:
Since you answer so quickly, answer me a dumb question - if I make error 1 in the code, will the terminal throw it back to me? Doesn't this information go to the server?

I join the question, only to add: "error 130".

 
granit77:
Since you're so fast to reply, answer me a stupid question - if I make error 1 in the code, will the terminal throw it back to me? This information does not go to the server?


I'll tell you right away:

- I'm not sergeev :)

- and I don't know :)

But

- it's easy to find out by experience :)

 
granit77:
Since you answer so quickly, answer me a dumb question - if I make mistake 1 in the code, will the terminal throw it back to me? Does this information not go to the server?

I checked, it doesn't. it's the terminal's response by modification.
 
sergeev:
Checked it, it's not. by modification, it's the terminal's response.
Thank you, so I can take it easy.
 
Roman.:


1.EURUSD or GBPUSD etc... - it means EVERYTHING ... ticket=OrderSend( EURUSD, op, ll, pp, Slippage, sl, tp, lsComm, mn, 0, clOpen);

2.sy=Symbol(); ticket=OrderSend(sy, op, ll, pp, Slippage, sl, tp, lsComm, mn, 0, clOpen); - this means via assignment...

Figure it out with this smart function - OpenPosition() function for online - and paste it into your owl code and everything will work... maybe through assignment too...

Roman, thank you for your help and professional approach :)
 
please tell me if there is a function/command that determines the commission for all open orders
 

I have a problem with looping using a modification,

i used fractal modification with breakeven, i got infinite modifications with fractal and breakeven.

the modification is based on https://book.mql4.com/ru/trading/ordermodify

//ф-я модификации ордеров безубыток

int mod_b()
{
//--------------------------------------------------------------- 2 --
for(int i=1; i<=OrdersTotal(); i++) // Цикл перебора ордер
{
if (OrderSelect(i-1,SELECT_BY_POS)==true) // Если есть следующий
{ // Анализ ордеров:
int Tip=OrderType(); // Тип ордера
if(OrderSymbol()!=Symb||Tip>1)continue;// Не наш ордер
double SL=OrderStopLoss(); // SL выбранного орд.
double TP =OrderTakeProfit(); // TP выбранного орд.
double Price =OrderOpenPrice(); // Цена выбранн. орд.
int Ticket=OrderTicket(); // Номер выбранн. орд.
//------------------------------------------------------ 3 --
while(true) // Цикл модификации
{
double TS=Tral_Stop; // Исходное значение
int Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL);//Миним. дист&&((SL<TS && Tip==0)||(SL>TS && Tip==1))
if (TS < Min_Dist) // Если меньше допуст.
TS=Min_Dist; // Новое значение TS
//--------------------------------------------------- 4 --
bool Modify=false; // Не назначен к модифи
switch(Tip) // По типу ордера
{
case 0 : // Ордер Buy
if (NormalizeDouble(SL,Digits)< // Если ниже желаем.
NormalizeDouble(Bid-TS*Point,Digits))
{
SL=Price+18*Point; // то модифицируем его
string Text="Buy "; // Текст для Buy
Modify=true; // Назначен к модифи.
}
break; // Выход из switch
case 1 : // Ордер Sell
if (NormalizeDouble(SL,Digits)> // Если выше желаем.
NormalizeDouble(Ask+TS*Point,Digits)
|| NormalizeDouble(SL,Digits)==0)//или равно нулю
{
SL=Price-18*Point; // то модифицируем его
Text="Sell "; // Текст для Sell
Modify=true; // Назначен к модифи.
}
} // Конец switch
if (Modify==false) // Если его не модифи
break; // Выход из while
//--------------------------------------------------- 5 --

Alert ("Модификация ",Text,Ticket,". Ждём ответ..");
bool Ans=OrderModify(Ticket,Price,SL,TP,0);//Модифи его!
//--------------------------------------------------- 6 --
if (Ans==true) // Получилось :)
{
Alert ("Ордер ",Text,Ticket," модифицирован:)");
break; // Из цикла модифи.
}

int mod_f()
{
//--------------------------------------------------------------- 2 --
for(int i=1; i<=OrdersTotal(); i++) // Цикл перебора ордер
{
if (OrderSelect(i-1,SELECT_BY_POS)==true) // Если есть следующий
{ // Анализ ордеров:
int Tip=OrderType(); // Тип ордера
if(OrderSymbol()!=Symb||Tip>1)continue;// Не наш ордер
double SL=OrderStopLoss(); // SL выбранного орд.

//------------------------------------------------------обсчет фрактала

int f = 3; //номер бара с которого идет проверка наличия фрагтала
int DnN = 0, UpN = 0; //порядковый номер присвоен к направлению(upper, lower)
double UpFr = 0, DnFr = 0; //числовое значение фрагтала выраженное в еденице валюты присвоен к направлению(upper, lower)
while (f < Bars && (UpFr == 0 || DnFr == 0))
{
if (iFractals(Symbol(), 0, MODE_UPPER, f) != 0)
if (UpFr == 0)
{
UpFr = iFractals(Symbol(), 0, MODE_UPPER, f);//фрактальная отложка вверх(buy)
UpN = f;
}
if (iFractals(Symbol(), 0, MODE_LOWER, f) != 0)
if (DnFr == 0)
{
DnFr = iFractals(Symbol(), 0, MODE_LOWER, f);//фрактальная отложка вниз(sell)
DnN = f;
}
f++;
}
//------------------------------------------------------ 3 --
while(true) // Цикл модификации
{
double UD;
double TS=UD; // Исходное значение
int Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL);//Миним. дист
if(Tip==0)
UD=DnFr;
if(Tip==1)
UD=UpFr;
if (TS < Min_Dist) // Если меньше допуст.
TS=Min_Dist; // Новое значение TS
//--------------------------------------------------- 4 --
bool Modify=false; // Не назначен к модифи
switch(Tip) // По типу ордера
{
case 0 : // Ордер Buy
if (NormalizeDouble(SL,Digits)< // Если ниже желаем.
NormalizeDouble(UD,Digits))
{
SL=UD; // то модифицируем его
string Text="Buy "; // Текст для Buy
Modify=true; // Назначен к модифи.
}
break; // Выход из switch
case 1 : // Ордер Sell
if (NormalizeDouble(SL,Digits)> // Если выше желаем.
NormalizeDouble(UD,Digits)
|| NormalizeDouble(SL,Digits)==0)//или равно нулю
{
SL=UD; // то модифицируем его
Text="Sell "; // Текст для Sell
Modify=true; // Назначен к модифи.
}
} // Конец switch
if (Modify==false) // Если его не модифи
break; // Выход из while
//--------------------------------------------------- 5 --
double TP =OrderTakeProfit(); // TP выбранного орд.
double Price =OrderOpenPrice(); // Цена выбранн. орд.
int Ticket=OrderTicket(); // Номер выбранн. орд.

Alert ("Модификация ",Text,Ticket,". Ждём ответ..");
bool Ans=OrderModify(Ticket,Price,SL,TP,0);//Модифи его!
//--------------------------------------------------- 6 --
if (Ans==true) // Получилось :)
{
Alert ("Ордер ",Text,Ticket," модифицирован:)");
break; // Из цикла модифи.
}

 
LazarevDenis:
please tell me if there is a function/command that determines the commission for all open orders
Why not calculate the amount yourself using the OrderCommission() function ?

Reason: