Good afternoon, need help with the code, I am a newbie.
The problem there is the following - trailing works only in buy direction, and in sell direction does not work and the code gives error"Error of ordermodification. Error code=4051".
Here is the part of the code responsible for trailing:
void Trailing(int tral)
{
int Mag=OrderMagicNumber();
OrderSelect(Mag,MODE_TRADES);
//+------------------------------------------------------------------+//| tral buy |//+------------------------------------------------------------------+if (OrderType()==OP_BUY)
if(Bid-OrderOpenPrice()>Point*tral)
{
if(OrderStopLoss()<Bid-Point*tral)
{
bool ress= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*tral,Digits),0,0,Blue);
if(!ress)
Print("Ошибка модификации ордера. Код ошибки=",GetLastError());
elsePrint("Цена Stop Loss ордера успешно модифицирована.");
}
}
//+------------------------------------------------------------------+//| tral sell |//+------------------------------------------------------------------+ if (OrderType()==OP_SELL)
if(OrderOpenPrice()-Ask>Point*tral)
{
if(OrderStopLoss()>Ask+Point*tral)
{
bool res= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+Point*tral,Digits),0,0,Red);
if(!res)
Print("Ошибка модификации ордера. Код ошибки=",GetLastError());
elsePrint("Цена Stop Loss ордера успешно модифицирована.");
}
}
}
Good afternoon, need help with the code, I am a newbie, I think it would not be appropriate to insert the whole code here.
The problem is that trailing works only in buy direction and does not work in sell direction and the code gives error"Error in ordermodification. Error code=4051".
Who can help me figure this out, please send a message to
Good afternoon, need help with the code, I am a newbie.
The problem there is the following - trailing works only in buy direction, and in sell direction does not work and the code gives error"Error of ordermodification. Error code=4051".
Here is the part of the code responsible for trailing:
//+------------------------------------------------------------------+//| tral sell |//+------------------------------------------------------------------+ if (OrderType()==OP_SELL)
if(OrderOpenPrice()-Ask>Point*tral)
{
if((OrderStopLoss()==0.0) || (OrderStopLoss()>Ask+Point*tral))
{
bool res= OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+Point*tral,Digits),0,0,Red);
if(!res)
Print("Ошибка модификации ордера. Код ошибки=",GetLastError());
elsePrint("Цена Stop Loss ордера успешно модифицирована.");
}
}
}
and I don't like the whole design, here's a simple trailing magik, almost the same as yours:
A string array can only be written to a file of type TXT. In this case the strings are automatically terminated with "\r\n". Depending on the file type ANSI or UNICODE, the strings are converted to ansi-encoding, or not.
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.
Good afternoon, need help with the code, I am a newbie.
The problem there is the following - trailing works only in buy direction, and in sell direction does not work and the code gives error"Error of ordermodification. Error code=4051".
Here is the part of the code responsible for trailing:
Good afternoon, need help with the code, I am a newbie, I think it would not be appropriate to insert the whole code here.
The problem is that trailing works only in buy direction and does not work in sell direction and the code gives error"Error in ordermodification. Error code=4051".
Who can help me figure this out, please send a message to
The topic is for discussion, not couloirs.
Please forgive me ^_^
Pasted part of the code, please advise where the error is
Please forgive me ^_^
Inserted part of the code, please tell me where the error is
Good afternoon, need help with the code, I am a newbie.
The problem there is the following - trailing works only in buy direction, and in sell direction does not work and the code gives error"Error of ordermodification. Error code=4051".
Here is the part of the code responsible for trailing:
and I don't like the whole design, here's a simple trailing magik, almost the same as yours:
how to correctly write an iCustom for ZigZag, so that it would produce the values of extrema?
You don't need to write anything, you just need to come and take
I don't like the whole construction, here's a simple trailing magik, almost the same as yours:
Thank you very much for your help, adding your code trailing does not work for some reason, i must be doing something wrong((
I added it and it worked, but it keeps getting spammed with errors #1 and #4051
#1-No error, but the result is unknown.
#4051- Invalidvalue of function parameter
Hello, there is an array of data type datatime,
how do I get it into a readable file?
Code:
It only writes if there is the FILE_BIN flag, but it writes unreadable.
If the FILE_BIN flag is not present, the file remains empty.
Hello, there is an array of datatime type data,
how do I get it into a readable file?
Code:
It only writes if there is the FILE_BIN flag, but it writes unreadable.
If the FILE_BIN flag is not present, the file remains empty.
FileWriteArray
Note .
A string array can only be written to a file of type TXT. In this case the strings are automatically terminated with "\r\n". Depending on the file type ANSI or UNICODE, the strings are converted to ansi-encoding, or not.