voidOnStart()
{
int TrailingStop=50;
//--- модифицирует цену Stop Loss ордера на покупку №12345if(TrailingStop>0)
{
OrderSelect(12345,SELECT_BY_TICKET);
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
bool res=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*TrailingStop,Digits),OrderTakeProfit(),0,Blue);
if(!res)
Print("Ошибка модификации ордера. Код ошибки=",GetLastError());
elsePrint("Цена Stop Loss ордера успешно модифицирована.");
}
}
}
}
I'm sure it is a result of my lack of knowledge and consequent lamer switch from 4 to 5. I will accept any suggestions how to improve my skills))))
The idea is to choose an order by ticket, select order type (Buy or Sell) and then use this type to check if the current order state is according to condition (current price minus open price) which should be greater than the price of one pip multiplied by the amount given (in my code this is take profit price divided by 10). If this condition is met you should make sure that the stop loss price is lower than the current price by the value of one pip multiplied by the specified value. If this is also true the price of the stop loss changes.
So the bullshit is the result of little knowledge and as a consequence of lamer transition from 4 to 5
This is the result of laziness to read the handbook.What you were pointed out-identifiers of the properties of orders.And the value is obtained using identifiers and functions OrderGetDouble , OrderGetInteger, etc.
lewvik: The value is obtained using identifiers and functions OrderGetDouble , OrderGetInteger, etc.
Could we have a little example, I just don't quite understand the construction, maybe it would be better: if(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY)?
StrangerNet: Could you give me a small example, I just don't quite understand the construction, maybe it would be more correct: if(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY)?
I'm not a clue - I don't write in F5. But let me ask you a question: what prevents you from logging the result of this check?
and flies through the whole function without entering it. At the same time, the variable tik is declared globally: ulong tik=0; - and a new value is assigned to it when a response is received about order setting: tik=mresult.order; - this value changes in debugging. Why doesn't it go into the condition?
StrangerNet: Can I have a small example, I just don't quite understand the construction, maybe this is more correct: if(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY)?
OrderSelect(tiket);//-- выбрать ордер по тикетуif(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY)
{
}
Function if(OrderSelect(tik)==true) writes error 4754 - Order not found, with tik value in debugging 42276230 equal to created order number 42276230, what could be the bug?
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.
Either attach the entire code or initialize your variables before the code snippet. You never know what you have there in variables, for example in
Whole code:
The whole code:
What the hell is that?
What the fuck is that?
)))))))
I am using MQL4 as the basis for my code:
I'm sure it is a result of my lack of knowledge and consequent lamer switch from 4 to 5. I will accept any suggestions how to improve my skills))))
The idea is to choose an order by ticket, select order type (Buy or Sell) and then use this type to check if the current order state is according to condition (current price minus open price) which should be greater than the price of one pip multiplied by the amount given (in my code this is take profit price divided by 10). If this condition is met you should make sure that the stop loss price is lower than the current price by the value of one pip multiplied by the specified value. If this is also true the price of the stop loss changes.
So the bullshit is the result of little knowledge and as a consequence of lamer transition from 4 to 5
The value is obtained using identifiers and functions OrderGetDouble , OrderGetInteger, etc.
Could you give me a small example, I just don't quite understand the construction, maybe it would be more correct: if(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY)?
I can't tell you - I don't write in A. But I will ask a question: what prevents you from logging the result of this check?
Job)))))))))
Corrected the bugs, everything seems to be according to the handbook:
In debugging, it reaches the condition
and flies through the whole function without entering it. At the same time, the variable tik is declared globally: ulong tik=0; - and a new value is assigned to it when a response is received about order setting: tik=mresult.order; - this value changes in debugging. Why doesn't it go into the condition?
Can I have a small example, I just don't quite understand the construction, maybe this is more correct: if(OrderGetInteger(ORDER_TYPE)==ORDER_TYPE_BUY)?