The EventSetTimer in OnInit in the Tester does not count down from the beginning of the day of the first tick, but from the start date of the test interval - the balance transaction.
fxsaber: EventSetTimer in OnInit in Tester counts down not from beginning of day of first tick, but from initial date of testing interval - balance transaction.
EventSetTimer always starts timer countdown from the moment of EventSetTimer call. Both in the tester and in the terminal
How nice it would be to see Kim's functions for the five. Can you give me a hint, please? There was a function like this in Kim's
//+------------------------------------------------------------------+//| Проверяет был ли открыт последний ордер на этой же свече |//| Checks whether the opened last the order on the same candle |//+------------------------------------------------------------------+bool IfOrdOpClSelfBar(int magik = 0, int bar = 0, int typ = -1,string sy = "",int per = 0){
if(sy == ""){sy = Symbol();}
if(per==0){per=Period();}
for(int i = OrdersTotal(); i>=0; i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()!=sy){continue;}
if(OrderType()==typ||typ==-1){
if(OrderMagicNumber()==magik||magik==0){
if(OrderOpenTime()>=iTime(sy,per,bar)){return(true);}
}
}
}
}
for(i = OrdersHistoryTotal(); i>=0; i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)){
if(OrderSymbol()!=sy){continue;}
if(OrderType()==typ||typ==-1){
if(OrderMagicNumber()==magik||magik==0){
if(OrderOpenTime()>=iTime(sy,per,bar)){return(true);}
}
}
}
}
return(false);
}
I am trying to rewrite it on mql5. But it does not want to work. How to force it? :)
//+------------------------------------------------------------------+//| Проверяет был ли открыт последний ордер на этой же свече |//| Checks whether the opened last the order on the same candle |//+------------------------------------------------------------------+bool IfOrdOpClSelfBar(ENUM_ORDER_TYPE type)
{
for(int i = OrdersTotal(); i>=0; i--){
if(OrderSelect(OrderGetTicket(i)) >0)
{
if(OrderGetString(ORDER_SYMBOL)!=_Symbol){continue;}
if(OrderGetInteger(ORDER_TYPE)==type)
{
if(OrderGetInteger(ORDER_MAGIC) == magicN)
{
if(OrderGetInteger(ORDER_TIME_SETUP) >= iTime(NULL,Period(),0)){return(true);}
}
}
}
}
for(int i = HistoryOrdersTotal(); i>=0; i--){
if(HistoryOrderSelect(OrderGetTicket(i)) >0)
{
if(OrderGetString(ORDER_SYMBOL)!=_Symbol){continue;}
if(OrderGetInteger(ORDER_TYPE)==type)
{
if(OrderGetInteger(ORDER_MAGIC) == magicN)
{
if(OrderGetInteger(ORDER_TIME_SETUP) >= iTime(NULL,Period(),0)){return(true);}
}
}
}
}
return(false);
}
Thanks for the crutch, very good :) But I'm learning a fiver for understanding, getting into it, so it's important to handle it by hand, fundamentally sorting out the knuckles.
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.
Thank you!
And this is an older code, but in pictures:TrailingStop
EventSetTimer in OnInit in Tester counts down not from beginning of day of first tick, but from initial date of testing interval - balance transaction.
Forum on trading, automated trading systems and trading strategies testing
Features of mql4 language, tips and tricks
fxsaber, 2019.02.12 13:12
Features of ArrayResize for multidimensional arraysHow nice it would be to see Kim's functions for the five. Can you give me a hint, please? There was a function like this in Kim's
I am trying to rewrite it on mql5. But it does not want to work. How to force it? :)
How nice it would be to see Kim's functions for the five. Can you give me a hint, please? There was a function like this in Kim's
I am trying to rewrite it on mql5. But it does not want to work. How to force it? :)
Forum on trading, automated trading systems and strategy tester
Libraries: MT4Orders
fxsaber, 2019.01.13 17:23
Kim's features under MT4 are quite popular, so downloaded all the sources from his site and wrote a simple "converter" for them under MT5.Thanks for the crutch, very good :) But I'm learning a fiver for understanding, getting into it, so it's important to handle it by hand, fundamentally sorting out the knuckles.
While parsing millions of ticks, I decided to periodically look at memory consumption.
I noticed that after making changes the execution speed has dropped many times.
Reason: some variants of TerminalInfoInteger use take very long time to execute
Be careful.A very expensive function.
Also TERMINAL_MEMORY_AVAILABLE
TERMINAL_MEMORY_PHYSICAL and TERMINAL_MEMORY_TOTAL are cached after the first request. Subsequent queries will return the cached values