// Через MT5-Стандартную Библиотеку - only MT5 // Выставляет SellLimit и затем устаналивает ему SL/TP void MT5Order( constdouble Price ) { CTrade Trade;
if ((ENUM_SYMBOL_TRADE_EXECUTION)::SymbolInfoInteger(_Symbol, SYMBOL_TRADE_EXEMODE) == SYMBOL_TRADE_EXECUTION_EXCHANGE) Trade.SetTypeFilling(ORDER_FILLING_RETURN);
// Через MT5-Стандартную Библиотеку - only MT5 // Выставляет SellLimit и затем устаналивает ему SL/TP void MT5Order( constdouble Price ) { CTrade Trade;
if ((ENUM_SYMBOL_TRADE_EXECUTION)::SymbolInfoInteger(_Symbol, SYMBOL_TRADE_EXEMODE) == SYMBOL_TRADE_EXECUTION_EXCHANGE) Trade.SetTypeFilling(ORDER_FILLING_RETURN);
MT5Order(Price); // Через MT5-Стандартную Библиотеку - only MT5 MT4Order(Price); // Через MT4-ОЯС - кроссплатформенный вариант (MT4/5)
FirstRun = false; } }
The result (bottom to top)
2016.10.2016:49:14.9872016.10.1810:00:00 order modified [#3 sell limit 1.00 RTS-12.16 at 100] 2016.10.2016:49:14.9872016.10.1810:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 97600) 2016.10.2016:49:14.9872016.10.1810:00:00 CTrade::OrderSend: modify #2 at 100.00000 (sl: 110.00000 tp: 90.00000) [invalid fill] 2016.10.2016:49:14.9872016.10.1810:00:00 failed modify order #2 sell limit 1.00 at 100.00000 sl: 0.00000 tp: 0.00000 -> 100.00000, sl: 110.00000 tp: 90.00000 [Unsupported filling mode] 2016.10.2016:49:14.9872016.10.1810:00:00 CTrade::OrderSend: sell limit 1.00 RTS-12.16 at 100 [done] 2016.10.2016:49:14.9862016.10.1810:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 97600) 2016.10.2016:49:14.985 RTS-12.16 : real ticks begin from 2016.10.1800:00:00
Error in SB is highlighted in bold. At the same time you can compare the code of MT4Order and MT5Order functions.
I ran your code on my own (without MT4):
2016.10.2019:05:31.1502016.09.1610:00:00 order performed buy 1.00 at 96500 [#3 buy 1.00 RTS-12.16 at 110] 2016.10.2019:05:31.1502016.09.1610:00:00 deal performed [#3 buy 1.00 RTS-12.16 at 96500] 2016.10.2019:05:31.1502016.09.1610:00:00 deal #3 buy 1.00 RTS-12.16 at 96500 done (based on order #3) 2016.10.2019:05:31.1502016.09.1610:00:00 stop loss triggered #2 sell 1.00 RTS-12.16100 sl: 110 tp: 90 [#3 buy 1.00 RTS-12.16 at 110] 2016.10.2019:05:31.1482016.09.1610:00:00 order performed sell 1.00 at 100 [#2 sell limit 1.00 RTS-12.16 at 100] 2016.10.2019:05:31.1482016.09.1610:00:00 deal performed [#2 sell 1.00 RTS-12.16 at 100] 2016.10.2019:05:31.1482016.09.1610:00:00 deal #2 sell 1.00 RTS-12.16 at 100 done (based on order #2) 2016.10.2019:05:31.1482016.09.1610:00:00 order [#2 sell limit 1.00 RTS-12.16 at 100] triggered 2016.10.2019:05:31.1212016.09.1610:00:00 CTrade::OrderSend: modify #2 at 100.00000 (sl: 110.00000 tp: 90.00000) [done] 2016.10.2019:05:31.1212016.09.1610:00:00 order modified [#2 sell limit 1.00 RTS-12.16 at 100] 2016.10.2019:05:31.1212016.09.1610:00:00 CTrade::OrderSend: sell limit 1.00 RTS-12.16 at 100 [done] 2016.10.2019:05:31.1212016.09.1610:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 96650) 2016.10.2019:05:31.118 RTS-12.16 : real ticks begin from 2016.09.1600:00:00 2016.10.2019:05:30.941 RTS-12.16,M1: testing of Experts\test_filling_mode.ex5 from 2016.09.1600:00 to 2016.09.2000:00 started 2016.10.2019:05:30.941 RTS-12.16,M1 (Open-Broker): generating based on real ticks 2016.10.2019:05:30.940 RTS-12.16,M1: history begins from 2015.01.1510:08 2016.10.2019:05:30.937 RTS-12.16,M1: history cache allocated for645942 bars and contains 15277 bars from 2015.01.1510:08 to 2016.09.1523:49
As far as we know, this feature is a year old. Since it doesn't bother anyone, except a select few of course, it's more likely to have a higher priority.
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.
2016.10.20 15:40:41 Core 1 connection closed
2016.10.20 15:40:16 History nothing to analyze
2016.10.20 15:40:16 Core 1 common synchronization completed
2016.10.20 15:40:16 Tester RTS-12.16,M1 (BCS-MetaTrader5): visual testing of Experts\fxsaber\Test9.ex5 from 2016.10.19 00:00 to 2016.10.20 00:00
2016.10.20 15:40:16 Core 1 authorized (agent build 1455)
2016.10.20 15:40:16 Core 1 connected
2016.10.20 15:40:16 Core 1 connecting to 127.0.0.1:3000
Well, if suddenly there is no story, why is there a single run for 28 (25 + 3) seconds? It's also talking about the Cloud!
This happened while the visualisation window was open, which I had safely forgotten about. It doesn't make any sense.
I have not raced in the tester.
#include <Trade\Trade.mqh>;
#include <Trade\OrderInfo.mqh>
// Через MT5-Стандартную Библиотеку - only MT5
// Выставляет SellLimit и затем устаналивает ему SL/TP
void MT5Order( const double Price )
{
CTrade Trade;
if ((ENUM_SYMBOL_TRADE_EXECUTION)::SymbolInfoInteger(_Symbol, SYMBOL_TRADE_EXEMODE) == SYMBOL_TRADE_EXECUTION_EXCHANGE)
Trade.SetTypeFilling(ORDER_FILLING_RETURN);
Trade.OrderOpen(_Symbol, ORDER_TYPE_SELL_LIMIT, 1, 0, Price, 0, 0, ORDER_TIME_GTC, 0, __FUNCTION__);
const ulong Ticket = Trade.ResultOrder();
if (Ticket > 0)
{
COrderInfo Order;
if (Order.Select(Ticket))
Trade.OrderModify(Order.Ticket(), Order.PriceOpen(), Order.PriceOpen() + SLTP, Order.PriceOpen() - SLTP, Order.TypeTime(), Order.TimeExpiration());
}
}
#include <MT4Orders.mqh> // https://www.mql5.com/ru/code/16006
// Через MT4-ОЯС - кроссплатформенный вариант (MT4/5)
// Выставляет SellLimit и затем устаналивает ему SL/TP
void MT4Order( const double Price )
{
const int Ticket = OrderSend(_Symbol, OP_SELLLIMIT, 1, Price, 0, 0, 0, __FUNCTION__);
if ((Ticket > 0) && OrderSelect(Ticket, SELECT_BY_TICKET))
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + SLTP, OrderOpenPrice() - SLTP, OrderExpiration(), clrNONE);
}
void OnTick()
{
static bool FirstRun = true;
if (FirstRun)
{
const double Price = SymbolInfoDouble(_Symbol, SYMBOL_BID) + 100 * _Point;
MT5Order(Price); // Через MT5-Стандартную Библиотеку - only MT5
MT4Order(Price); // Через MT4-ОЯС - кроссплатформенный вариант (MT4/5)
FirstRun = false;
}
}
The result (bottom-up)
2016.10.20 16:49:14.987 2016.10.18 10:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 97600)
2016.10.20 16:49:14.987 2016.10.18 10:00:00 CTrade::OrderSend: modify #2 at 100.00000 (sl: 110.00000 tp: 90.00000) [invalid fill]
2016.10.20 16:49:14.987 2016.10.18 10:00:00 failed modify order #2 sell limit 1.00 at 100.00000 sl: 0.00000 tp: 0.00000 -> 100.00000, sl: 110.00000 tp: 90.00000 [Unsupported filling mode]
2016.10.20 16:49:14.987 2016.10.18 10:00:00 CTrade::OrderSend: sell limit 1.00 RTS-12.16 at 100 [done]
2016.10.20 16:49:14.986 2016.10.18 10:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 97600)
2016.10.20 16:49:14.985 RTS-12.16 : real ticks begin from 2016.10.18 00:00:00
Studied the Standard Library and wrote a test EA
#include <Trade\Trade.mqh>;
#include <Trade\OrderInfo.mqh>
// Через MT5-Стандартную Библиотеку - only MT5
// Выставляет SellLimit и затем устаналивает ему SL/TP
void MT5Order( const double Price )
{
CTrade Trade;
if ((ENUM_SYMBOL_TRADE_EXECUTION)::SymbolInfoInteger(_Symbol, SYMBOL_TRADE_EXEMODE) == SYMBOL_TRADE_EXECUTION_EXCHANGE)
Trade.SetTypeFilling(ORDER_FILLING_RETURN);
Trade.OrderOpen(_Symbol, ORDER_TYPE_SELL_LIMIT, 1, 0, Price, 0, 0, ORDER_TIME_GTC, 0, __FUNCTION__);
const ulong Ticket = Trade.ResultOrder();
if (Ticket > 0)
{
COrderInfo Order;
if (Order.Select(Ticket))
Trade.OrderModify(Order.Ticket(), Order.PriceOpen(), Order.PriceOpen() + SLTP, Order.PriceOpen() - SLTP, Order.TypeTime(), Order.TimeExpiration());
}
}
#include <MT4Orders.mqh> // https://www.mql5.com/ru/code/16006
// Через MT4-ОЯС - кроссплатформенный вариант (MT4/5)
// Выставляет SellLimit и затем устаналивает ему SL/TP
void MT4Order( const double Price )
{
const int Ticket = OrderSend(_Symbol, OP_SELLLIMIT, 1, Price, 0, 0, 0, __FUNCTION__);
if ((Ticket > 0) && OrderSelect(Ticket, SELECT_BY_TICKET))
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + SLTP, OrderOpenPrice() - SLTP, OrderExpiration(), clrNONE);
}
void OnTick()
{
static bool FirstRun = true;
if (FirstRun)
{
const double Price = SymbolInfoDouble(_Symbol, SYMBOL_BID) + 100 * _Point;
MT5Order(Price); // Через MT5-Стандартную Библиотеку - only MT5
MT4Order(Price); // Через MT4-ОЯС - кроссплатформенный вариант (MT4/5)
FirstRun = false;
}
}
The result (bottom to top)
2016.10.20 16:49:14.987 2016.10.18 10:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 97600)
2016.10.20 16:49:14.987 2016.10.18 10:00:00 CTrade::OrderSend: modify #2 at 100.00000 (sl: 110.00000 tp: 90.00000) [invalid fill]
2016.10.20 16:49:14.987 2016.10.18 10:00:00 failed modify order #2 sell limit 1.00 at 100.00000 sl: 0.00000 tp: 0.00000 -> 100.00000, sl: 110.00000 tp: 90.00000 [Unsupported filling mode]
2016.10.20 16:49:14.987 2016.10.18 10:00:00 CTrade::OrderSend: sell limit 1.00 RTS-12.16 at 100 [done]
2016.10.20 16:49:14.986 2016.10.18 10:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 97600)
2016.10.20 16:49:14.985 RTS-12.16 : real ticks begin from 2016.10.18 00:00:00
I ran your code on my own (without MT4):
2016.10.20 19:05:31.150 2016.09.16 10:00:00 deal performed [#3 buy 1.00 RTS-12.16 at 96500]
2016.10.20 19:05:31.150 2016.09.16 10:00:00 deal #3 buy 1.00 RTS-12.16 at 96500 done (based on order #3)
2016.10.20 19:05:31.150 2016.09.16 10:00:00 stop loss triggered #2 sell 1.00 RTS-12.16 100 sl: 110 tp: 90 [#3 buy 1.00 RTS-12.16 at 110]
2016.10.20 19:05:31.148 2016.09.16 10:00:00 order performed sell 1.00 at 100 [#2 sell limit 1.00 RTS-12.16 at 100]
2016.10.20 19:05:31.148 2016.09.16 10:00:00 deal performed [#2 sell 1.00 RTS-12.16 at 100]
2016.10.20 19:05:31.148 2016.09.16 10:00:00 deal #2 sell 1.00 RTS-12.16 at 100 done (based on order #2)
2016.10.20 19:05:31.148 2016.09.16 10:00:00 order [#2 sell limit 1.00 RTS-12.16 at 100] triggered
2016.10.20 19:05:31.121 2016.09.16 10:00:00 CTrade::OrderSend: modify #2 at 100.00000 (sl: 110.00000 tp: 90.00000) [done]
2016.10.20 19:05:31.121 2016.09.16 10:00:00 order modified [#2 sell limit 1.00 RTS-12.16 at 100]
2016.10.20 19:05:31.121 2016.09.16 10:00:00 CTrade::OrderSend: sell limit 1.00 RTS-12.16 at 100 [done]
2016.10.20 19:05:31.121 2016.09.16 10:00:00 sell limit 1.00 RTS-12.16 at 100 (0 / 0 / 96650)
2016.10.20 19:05:31.118 RTS-12.16 : real ticks begin from 2016.09.16 00:00:00
2016.10.20 19:05:30.941 RTS-12.16,M1: testing of Experts\test_filling_mode.ex5 from 2016.09.16 00:00 to 2016.09.20 00:00 started
2016.10.20 19:05:30.941 RTS-12.16,M1 (Open-Broker): generating based on real ticks
2016.10.20 19:05:30.940 RTS-12.16,M1: history begins from 2015.01.15 10:08
2016.10.20 19:05:30.937 RTS-12.16,M1: history cache allocated for 645942 bars and contains 15277 bars from 2015.01.15 10:08 to 2016.09.15 23:49
#define SLTP (10 * _Point)
#include <Trade\Trade.mqh>;
#include <Trade\OrderInfo.mqh>
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
static bool FirstRun=true;
if(FirstRun)
{
const double Price=SymbolInfoDouble(_Symbol,SYMBOL_BID)+100*_Point;
MT5Order(Price); // Через MT5-Стандартную Библиотеку - only MT5
//MT4Order(Price); // Через MT4-ОЯС - кроссплатформенный вариант (MT4/5)
FirstRun=false;
}
}
//+------------------------------------------------------------------+
// Через MT5-Стандартную Библиотеку - only MT5
// Выставляет SellLimit и затем устаналивает ему SL/TP
void MT5Order(const double Price)
{
CTrade Trade;
if((ENUM_SYMBOL_TRADE_EXECUTION)::SymbolInfoInteger(_Symbol,SYMBOL_TRADE_EXEMODE)==SYMBOL_TRADE_EXECUTION_EXCHANGE)
Trade.SetTypeFilling(ORDER_FILLING_RETURN);
Trade.OrderOpen(_Symbol,ORDER_TYPE_SELL_LIMIT,1,0,Price,0,0,ORDER_TIME_GTC,0,__FUNCTION__);
const ulong Ticket=Trade.ResultOrder();
if(Ticket>0)
{
COrderInfo Order;
if(Order.Select(Ticket))
Trade.OrderModify(Order.Ticket(),Order.PriceOpen(),Order.PriceOpen()+SLTP,Order.PriceOpen()-SLTP,Order.TypeTime(),Order.TimeExpiration());
}
}
//+------------------------------------------------------------------+
I ran your code on mine (without MT4):
This may be the case.
Forum on trading, automated trading systems and trading strategy testing
Bugs, bugs, questions
fxsaber, 2016.10.18 22:00
Web engine bug
Didn't notice.
Since it doesn't bother anyone, except a select few of course, it's more likely to have a higher priority.
As far as I can tell - this feature is a year old.
{
public:
virtual string classname() const
{
return(typename(this));
}
};
class B : public A
{
public:
virtual string classname() const
{
return(typename(this));
}
};
void OnStart()
{
B b;
Print(b.classname());
}
You have to write the same thing in each inherited class
{
return(typename(this));
}
Will it be possible not to pull such tails in MQL?