-Alexey-: Why when I press "Start" button the tester does not test from the initial deposit level, but from the level where the last test ended. There is no such a problem in 4. How to start testing from the initial deposit level?
I generate a parabolic in the wizard on the average with a stop. I run a test on open prices, click "Cancel". I run it for the second time and get the situation described above (balance and equity chart is not drawn anew but continues). Expert Advisors not from the Wizard are OK.
Вы хотите быстро проверить торговую идею, не тратя времени на программирование? Выберите в "Мастере MQL5" нужный тип торговых сигналов, подключите модули сопровождения позиций и управления капиталом - на этом вся работа закончена. Создайте свои реализации модулей или закажите их через сервис "Работа" - и комбинируйте новые модули с уже существующими.
In multicurrency testing mode, when waiting for a new bar to appear on two instruments, the tester does not behave correctly.
A little clarification. In the isNewBar function, when a new bar appears on the main symbol, we wait for a new bar to appear in the loop on the other symbol.
I am pasting the code.
//в тестере баг в режиме мультивалютного тестирования//позиция открывается если на двух инструментах появился новый бар #include <Trade\Trade.mqh>#include <Trade\OrderInfo.mqh>#include <Trade\PositionInfo.mqh>//--- input parametersinputint Per=10;//период средней inputstring Instrum1="EURUSD";//первый инструментinputstring Instrum2="GBPUSD";//второй инструмент//-------------------------------------------------------
CTrade trade;//торговые функции
COrderInfo orderinfo;//информация об ордере
CPositionInfo posinfo;//информация о позицииint hiMA ;//хэндл индикатора intOnInit()
{
hiMA=iMA(_Symbol,_Period,Per,0,MODE_SMA,PRICE_OPEN) ;
if(hiMA < INVALID_HANDLE) return(-1) ;
return(0);
}
//====================================================================voidOnDeinit(constint reason)
{
IndicatorRelease(hiMA) ;
}
//=====================================================================voidOnTick()
{
if(!isNewBar(Instrum2)) return ;
//Print(" Это новый бар ");double Ma[1] ;//показания индикатора CopyBuffer(hiMA,0,0,1,Ma) ;
MqlTick price;// будет использоваться для получения текущих/последних котировок ценыbool possel=posinfo.Select(Instrum1) ;
SymbolInfoTick(Instrum1,price) ;
if(possel && price.bid > Ma[0] && posinfo.PositionType() == POSITION_TYPE_SELL)
{//цена выше средней закрываем короткую позу
trade.PositionClose(Instrum1) ; return ;
}
if( !possel && price.bid > Ma[0])
{//цена выше средней нет поз открываем длинную позу
trade.Buy(0.1,Instrum1,0,0,0,NULL) ; return ;
}
if( possel && price.ask < Ma[0] && posinfo.PositionType() == POSITION_TYPE_BUY)
{//цена ниже средней закрываем длинную позу
trade.PositionClose(Instrum1) ; return ;
}
if(!possel && price.ask < Ma[0])
{// цена ниже средней нет поз открываем короткую позу
trade.Sell(0.1,Instrum1,0,0,0,NULL) ;
}
return ;
}
//=======================================================================bool isNewBar(string other_symbol)
{//возвращает труе если новый бар на двух инструментахstaticdatetime last_bar_time=0;
int cntsleep ;
if(last_bar_time==0)
{//--- это первый вызов, запишем время открытия и выйдем
last_bar_time=(datetime)SeriesInfoInteger(_Symbol,Period(),SERIES_LASTBAR_DATE);
return(false);
}
datetime curr_time=(datetime)SeriesInfoInteger(Symbol(),Period(),SERIES_LASTBAR_DATE);
if(curr_time!=last_bar_time)
{//время открытия не совпадает это новый бар
last_bar_time=curr_time;
cntsleep=0 ;
while(!(curr_time == (datetime)SeriesInfoInteger(other_symbol,Period(),SERIES_LASTBAR_DATE)))
{// ждем появления нового бара на втором инструменте Sleep(5000);
if(cntsleep >10) return(false) ;// недождались
cntsleep++ ;
}
return(true) ;
}
return(false) ;
}
Язык программирования MQL5 позволяет решать задачи на совершенно новом уровне. Даже те задачи, которые уже вроде имеют решения, благодаря объектно-ориентированному программированию могут подняться на качественно новый уровень. В данной статье специально взят простой пример проверки появления нового бара на графике, который был преобразован в достаточно мощный и универсальный инструмент. Какой? Читайте в статье.
In multi-currency test mode, when waiting for a new bar to appear on two instruments, the tester does not behave correctly.
What exactly do you see as a bug, please explain. You have not given any details of the testing, or the result obtained, or the expected result.
In addition, I would like to draw your attention to the Basics of Testing in MetaTrader 5. It explains the mechanism of tick generation and basic concepts.
What exactly do you see as a bug, please explain. You haven't provided any details of testing or the result you've got, and you don't know the expected result.
In addition, I would like to draw your attention to the Basics of Testing in MetaTrader 5. It explains the mechanism of tick generation and basic concepts.
It's easy.
We start the Expert Advisor for optimization and see the result.
For example, we choose the 4th pass, run the Expert Advisor, and get its normal operation with all trades - here is the report.
I have a feeling. In the multi-currency optimization mode the tester cannot bind a trade to the bar if it was not opened on the open bar.
If the isNewBar function has commented out the loop and does not wait for the appearance of a new bar on another symbol, everything works. Terminal version 5 build 642.
I have read the articles and the codes from there. Although, I know myself, I may have to reread them.
-Alexey-: I generate in the wizard an EA on medium with a stop parabolic. I run a test on open prices and click "cancel". I run it for the second time and get the situation described above (balance and equity chart is not drawn again but continues). Expert Advisors not from the Wizard are OK.
Here is a piece of code. How to make the parametersinput int grusdchf=100; input int grusdjpy=100; not to be optimised whentrpar2=false
//------------------------------------------------------------inputbool trpar1=true ;//разрешение торговли по EURUDSDinputint greurusd=100;//сетка для EURUSDinputint grgbpusd=100;//сетка для GBPUSD//------------------------------------------------------------inputbool trpar2=true;//inputint grusdchf=100;//inputint grusdjpy=100;////------------------------------------------------------------inputbool trpar3=true;//inputint graudjpy=100;//inputint grchfjpy=100;//
Here is a piece of code. How to make the parametersinput int grusdchf=100; input int grusdjpy=100; not to be optimised whentrpar2=false
inputbool trpar2=true;
inputint grusdchf=100;
inputint grusdjpy=100;
if (trpair2==false) // если false то всегда 100
{
x_grusdchf=100;
x_grusdjpy=100;
}
else// если true то значения с перебора
{
x_grusdchf=grusdchf;
x_grusdjpy=grusdjpy;
}
The checkboxes are enabled on all three inputs and then locks at false.
Why when I press "Start" button the tester does not test from the initial deposit level, but from the level where the last test ended. There is no such a problem in 4. How to start testing from the initial deposit level?
We cannot reproduce the situation you describe.
Let's give more details
We cannot reproduce the situation you describe.
Give us more details
This seems to be a bug.
In multicurrency testing mode, when waiting for a new bar to appear on two instruments, the tester does not behave correctly.
A little clarification. In the isNewBar function, when a new bar appears on the main symbol, we wait for a new bar to appear in the loop on the other symbol.
I am pasting the code.
This seems to be a bug.
In multi-currency test mode, when waiting for a new bar to appear on two instruments, the tester does not behave correctly.
What exactly do you see as a bug, please explain. You have not given any details of the testing, or the result obtained, or the expected result.
In addition, I would like to draw your attention to the Basics of Testing in MetaTrader 5. It explains the mechanism of tick generation and basic concepts.
What exactly do you see as a bug, please explain. You haven't provided any details of testing or the result you've got, and you don't know the expected result.
In addition, I would like to draw your attention to the Basics of Testing in MetaTrader 5. It explains the mechanism of tick generation and basic concepts.
It's easy.
We start the Expert Advisor for optimization and see the result.
For example, we choose the 4th pass, run the Expert Advisor, and get its normal operation with all trades - here is the report.
I have a feeling. In the multi-currency optimization mode the tester cannot bind a trade to the bar if it was not opened on the open bar.
If the isNewBar function has commented out the loop and does not wait for the appearance of a new bar on another symbol, everything works. Terminal version 5 build 642.
I have read the articles and the codes from there. Although, I know myself, I may have to reread them.
Happy Holidays.
I generate in the wizard an EA on medium with a stop parabolic. I run a test on open prices and click "cancel". I run it for the second time and get the situation described above (balance and equity chart is not drawn again but continues). Expert Advisors not from the Wizard are OK.
Create a servicedesk application, specifying
Here is a piece of code. How to make the parametersinput int grusdchf=100; input int grusdjpy=100; not to be optimised whentrpar2=false
Here is a piece of code. How to make the parametersinput int grusdchf=100; input int grusdjpy=100; not to be optimised whentrpar2=false
Do not check the checkboxes in the tester against these parameters. Or clarify the question, otherwise I see ambiguity. :)
Question:
You need to pass an array of object pointers to a function. By reference, of course (an array).
What syntax to use?
Or should I use it in some other way?
Here is a piece of code. How to make the parametersinput int grusdchf=100; input int grusdjpy=100; not to be optimised whentrpar2=false