Hello, I can't understand why the stops aren't showing?
inputint StopLoss=499; // Stop Lossinputint TakeProfit=999; // Take Profitinputint EA_Magic=12345; // Magic Number советникаinputdouble Lot=0.1; // Количество лотов для торговлиintOnInit()
{
//--- Для работы с брокерами, использующими 5-ти значные котировки,//--- умножаем на 10 значения SL и TP
STP = StopLoss;
TKP = TakeProfit;
if(_Digits==5 || _Digits==3)
{
STP = STP*10;
TKP = TKP*10;
}
return(0);
}
voidOnTick()
{
//---MqlTick latest_price; // Будет использоваться для текущих котировокSymbolInfoTick(Symbol(),latest_price); // Получаем текущие ценыMqlTradeRequest mrequest; // Будет использоваться для отсылки торговых запросовMqlTradeResult mresult; // Будет использоваться для получения результатов выполнения торговых запросов
mrequest.action = TRADE_ACTION_DEAL; // немедленное исполнение
mrequest.price = NormalizeDouble(latest_price.ask,_Digits); // последняя цена ask
mrequest.sl = NormalizeDouble(latest_price.ask - STP*_Point,_Digits); // Stop Loss
mrequest.tp = NormalizeDouble(latest_price.ask + TKP*_Point,_Digits); // Take Profit
mrequest.symbol = _Symbol; // символ
mrequest.volume = Lot; // количество лотов для торговли
mrequest.magic = EA_Magic; // Magic Number
mrequest.type = ORDER_TYPE_BUY; // ордер на покупку
mrequest.type_filling = ORDER_FILLING_FOK; // тип исполнения ордера - все или ничего
mrequest.deviation=100; // проскальзывание от текущей цены//--- отсылаем ордерOrderSend(mrequest,mresult);
Top2n: Hello, I can't understand why no stops are being placed?
Firstly, initialisation is required:
MqlTradeRequest mrequest={0}; // Будет использоваться для отсылки торговых запросовMqlTradeResult mresult={0}; // Будет использоваться для получения результатов выполнения торговых запросов
Secondly, the ability to place sl and tp depends on the market order execution mode set by the broker. Look up how many of these modes there are in the Handbook and check which mode is set by the broker.
Secondly, the ability to place sl and tp depends on the market order execution mode set by the broker. Look up how many such modes there are in the Handbook and check which mode is set by the broker.
I have zeroed out via ZeroMemory(mrequest);
I don't really understand about the order execution modes, alpari broker, i think everything is standard. Damn nonsense, doesn't want to and that's it. I have already tried to use sl and tp, it shows the current price + sl. I guess it is Ok!
I don't really understand the order execution modes, alpari broker, i think everything is standard. Damn, it's not working, I just don't want to do it. I have already tried to use sl and tp, it shows the current price + sl. I guess it is Ok!
Top2n I don't really understand the order execution modes, I am an alpari broker, I think it is all standard. I do not know what to do with this kind of forex broker, I still do not know what to do with this kind of forex. I do not know what to do if I try to go back to the comment sl and tp?
I don't follow Alpari, but I think all the issues with not setting the levels you mentioned were related to Alpari. Try placing your order on the MQ demo account and you will be fine.
The developers have not yet provided a possibility to reflect in the log messages about the inability to set sl and tp levels in Market Execution and Exchange Execution modes. And there is no reason to do it. The programmer should determine the mode set by the broker.
Yedelkin: The developers have not yet provided the possibility of reflecting in the log messages about the inability to set sl and tp levels in Market Execution and Exchange Execution modes. And there is no need for that. The programmer should determine the mode set by the broker.
Anyway, not to guess, you should analyze all the errors and return codes. It is easier and faster to analyze what to do next. ))
tol64: You still need to analyse all the errors and return codes to avoid guesswork. It's easier and quicker to figure out what to do next. ))
...Especially when you know that "errors and return codes" are simply not provided in this particular case :) No doubt, the question itself is correct, but in this particular case, it won't help :/
And without "if"? ...
Hello, I can't understand why the stops aren't showing?
Firstly, initialisation is required:
Secondly, the ability to place sl and tp depends on the market order execution mode set by the broker. Look up how many of these modes there are in the Handbook and check which mode is set by the broker.
Firstly, initialisation is required:
Secondly, the ability to place sl and tp depends on the market order execution mode set by the broker. Look up how many such modes there are in the Handbook and check which mode is set by the broker.
I have zeroed out via ZeroMemory(mrequest);
I don't really understand about the order execution modes, alpari broker, i think everything is standard. Damn nonsense, doesn't want to and that's it. I have already tried to use sl and tp, it shows the current price + sl. I guess it is Ok!
I zeroed out via ZeroMemory(mrequest);
I don't really understand the order execution modes, alpari broker, i think everything is standard. Damn, it's not working, I just don't want to do it. I have already tried to use sl and tp, it shows the current price + sl. I guess it is Ok!
I don't follow Alpari, but I think all the issues with not setting the levels you mentioned were related to Alpari. Try placing your order on the MQ demo account and you will be fine.
About order execution modes. You are using the https://www.mql5.com/ru/docs/trading/ordersend function. Please read carefully this section of the Guide: https://www.mql5.com/ru/docs/constants/structures/mqltraderequest and answer the question for yourself: "how many execution modes are available for market orders". If you can't answer this question, please ask.
The developers have not yet provided the possibility of reflecting in the log messages about the inability to set sl and tp levels in Market Execution and Exchange Execution modes. And there is no need for that. The programmer should determine the mode set by the broker.