Errors, bugs, questions - page 1739
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Do I understand correctly that modifying orders through SB will not work in an exchange?
//| Modify specified pending order |
//+------------------------------------------------------------------+
bool CTrade::OrderModify(const ulong ticket,const double price,const double sl,const double tp,
const ENUM_ORDER_TYPE_TIME type_time,const datetime expiration,const double stoplimit)
{
//--- check stopped
if(IsStopped(__FUNCTION__))
return(false);
//--- clean
ClearStructures();
//--- setting request
m_request.action =TRADE_ACTION_MODIFY;
m_request.magic =m_magic;
m_request.order =ticket;
m_request.price =price;
m_request.stoplimit =stoplimit;
m_request.sl =sl;
m_request.tp =tp;
m_request.type_time =type_time;
m_request.expiration =expiration;
//--- action and return the result
return(OrderSend(m_request,m_result));
}
It is not set.
//| Get the property value "ORDER_TYPE_FILLING" |
//+------------------------------------------------------------------+
ENUM_ORDER_TYPE_FILLING COrderInfo::TypeFilling(void) const
{
return((ENUM_ORDER_TYPE_FILLING)OrderGetInteger(ORDER_TYPE_FILLING));
}
ALWAYS returnsENUM_ORDER_TYPE_FILLING::ORDER_FILLING_RETURN in the tester.
The filling is not set.
So if you set filling in OrderModify via COrderInfo::TypeFilling(), then on RoboForexEU-MetaTrader 5 there will be a logical error [Unsupported filling mode]. However, this error doesn't occur in MetaQuotes-Demo - wrongly configured developer's server?
Do I understand correctly that modifying orders through SB will not work in an exchange?
//| Modify specified pending order |
//+------------------------------------------------------------------+
bool CTrade::OrderModify(const ulong ticket,const double price,const double sl,const double tp,
const ENUM_ORDER_TYPE_TIME type_time,const datetime expiration,const double stoplimit)
{
//--- check stopped
if(IsStopped(__FUNCTION__))
return(false);
//--- clean
ClearStructures();
//--- setting request
m_request.action =TRADE_ACTION_MODIFY;
m_request.magic =m_magic;
m_request.order =ticket;
m_request.price =price;
m_request.stoplimit =stoplimit;
m_request.sl =sl;
m_request.tp =tp;
m_request.type_time =type_time;
m_request.expiration =expiration;
//--- action and return the result
return(OrderSend(m_request,m_result));
}
It does not.
Do not panic!
{
protected:
MqlTradeRequest m_request; // request data
MqlTradeResult m_result; // result data
MqlTradeCheckResult m_check_result; // result check data
bool m_async_mode; // trade mode
ulong m_magic; // expert magic number
ulong m_deviation; // deviation default
ENUM_ORDER_TYPE_FILLING m_type_filling;
ENUM_ACCOUNT_MARGIN_MODE m_margin_mode;
//---
ENUM_LOG_LEVELS m_log_level;
public:
Don't panic!
//| Modify specified pending order |
//+------------------------------------------------------------------+
bool CTrade::OrderModify(const ulong ticket,const double price,const double sl,const double tp,
const ENUM_ORDER_TYPE_TIME type_time,const datetime expiration,const double stoplimit)
{
//--- check stopped
if(IsStopped(__FUNCTION__))
return(false);
//--- clean
ClearStructures();
//--- setting request
m_request.action =TRADE_ACTION_MODIFY;
m_request.magic =m_magic;
m_request.order =ticket;
m_request.price =price;
m_request.stoplimit =stoplimit;
m_request.sl =sl;
m_request.tp =tp;
m_request.type_time =type_time;
m_request.expiration =expiration;
//--- action and return the result
return(OrderSend(m_request,m_result));
}
//| Modify specified pending order |
//+------------------------------------------------------------------+
bool CTrade::OrderModify(const ulong ticket,const double price,const double sl,const double tp,
const ENUM_ORDER_TYPE_TIME type_time,const datetime expiration,const double stoplimit)
{
//--- check stopped
if(IsStopped(__FUNCTION__))
return(false);
//--- clean
ClearStructures();
//--- setting request
m_request.action =TRADE_ACTION_MODIFY;
m_request.magic =m_magic;
m_request.order =ticket;
m_request.price =price;
m_request.stoplimit =stoplimit;
m_request.sl =sl;
m_request.tp =tp;
m_request.type_time =type_time;
m_request.expiration =expiration;
//--- action and return the result
return(OrderSend(m_request,m_result));
}
Wait, why specify the fill type when modifying at all?
From the documentation:
Trade order to modify StopLoss and/or TakeProfit levels. Requires 4 (jamb:)) fields to be specified:
Wait, why specify the fill type when modifying at all?
From the documentation:
Don't believe everything it says. It MUST be specified. Otherwise it will not work.
I can't use SB. But you can try OrderModify on exchange to make sure of the bug.
Don't believe everything that is written. You MUST specify. Otherwise it won't work.
I totally agree, but...
I don't know how to use SB. But you can try OrderModify on the exchange to make sure of the bug.
But MQ even added an example in the doc... It's not indicated there...
Also there is an Expert Advisor I wrote, which works on the exchange and uses such a piece of code:
trade.OrderModify( order.Ticket(), order.PriceOpen(), newSl, newTp, order.TypeTime(), 0 );
But MQ even added an example to the doc... It doesn't specify...
Wrong, people. We have to correct both doc and SB.
Also, there's an EA I wrote that works on an exchange and uses such a piece of code:
trade.OrderModify( order.Ticket(), order.PriceOpen(), newSl, newTp, order.TypeTime(), 0 );
And in the tester?
Wrong, people. You have to correct both the doc and the SB.
Wrong, people. You have to correct both the doc and the SB.
And in the tester?