Questions from Beginners MQL5 MT5 MetaTrader 5 - page 336

 
Maxi-M:
Please. The screenshot contains the log as well as the settings.
And in the tester log in visualisation mode, what does it say?
 
Tapochun:
And in the tester's log in visualization mode, what does it say?

Nothing new is being written... The chart is scrolling, no trades are being made. The log is silent.

As if there is no signal to trade, however, I put Alert() in the code after this section:

CTrade trade;

trade.SetExpertMagicNumber(MAGICMA);

trade.PositionOpen(_Symbol,signal,TradeSizeOptimized(), SymbolInfoDouble(_Symbol,signal==ORDER_TYPE_SELL ? SYMBOL_BID:SYMBOL_ASK), 0,0);

and Alert() shows a message, consequently, the moment, according to the logic, after which a deal should be executed, has passed.

 
Maxi-M:

Nothing new is being written... The chart is scrolling, no trades are being made. The log is silent.

As if there is no signal to trade, however, I put Alert() in the code after this section:

CTrade trade;

trade.SetExpertMagicNumber(MAGICMA);

trade.PositionOpen(_Symbol,signal,TradeSizeOptimized(), SymbolInfoDouble(_Symbol,signal==ORDER_TYPE_SELL ? SYMBOL_BID:SYMBOL_ASK), 0,0);

and Alert() shows a message, consequently, the moment, after which a trade would be executed, logically passed.

Interesting... I can suggest to try to open a demo account on the MetaQuotes-Demo server and try running the test again. Or write to Service Desk.
 
Tapochun:
Interesting... I can suggest you try to open a demo account on MetaQuotes-Demo server and try running the test again. Or write to Service Desk.

I have a Demo account with BCS... And the service desk to whom?

There is, however, another possibility - I installed MT on my home laptop, and here (where I'm testing, at work) I just have the folder copied.

Maybe that's the reason... Something is not working properly. I'll have to try again at home, just to be sure.

 
Maxi-M:

I have a Demo account with BCS... And the service desk to whom?

There is, however, another possibility - I installed MT on my home laptop, and here (where I'm testing, at work) I just have the folder copied.

Maybe that's the reason... Something is not working properly. I'll have to try again at home, just to be sure.

Could well be...

Look for Service Desk in your profile, make a request there. But first of all try to run it from home.

Have a look here too. Good luck!

P.s. Please write out when it works in what was the reason. Can help others.

 
Good day, advise how to make the lines were shown on all charts pair, when you open a new chart were immediately visible.... advise in the properties of which operator or function?
 
Students:
Good day, advise how to make that lines would be shown on all charts pair, when you open a new chart were immediately visible....podkat in the properties of which operator or function?

Draw a line once and save the template. On a new chart, simply apply the saved template. Or save the template as default.tpl and this default template will be applied to all newly opened charts.

Working with charts: Templates and profiles - Client terminal

Документация по MQL5: Операции с графиками / ChartOpen
Документация по MQL5: Операции с графиками / ChartOpen
  • www.mql5.com
Операции с графиками / ChartOpen - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Maxi-M:

Good day to all.
Please advise on testing EAs.

I am just beginning to learn how to write EAs.

I downloaded this EA: https://www.mql5.com/ru/code/1812, opened it in the editor, ran it for debugging, started testing and nothing happens. No trades open and therefore no results.

I have also tried other EAs, including the easiest one taken from here, which should just open and close trades. Same thing - nothing happens.

I have tried putting a breakpoint. It works only in OnInit. The rest of the code does not work, which is very strange.

I have understood that OnTick works by adding an Alert. However, no trades are opened and they are not opened even if the required conditions are met.

I have added an Alert(GetLastError(). The error 4753 is displayed.

The question is if I am doing something wrong. Are any of the conditions required for testing not satisfied?

Thank you in advance for your reply.

Also add after trying to open a position:

Print( "retcode = ",result.retcode );

Where result - data of trade request result structure. What code is returned?

 
Tapochun:

Еще добавьте после попытки открыть позицию: 

где result - данные структуры результатов торгового запроса. Какой возвращается код?

Can you please elaborate on how to create this structure? After all, it has to be created and filled in before it can be accessed, as I understand it.

I'm not very familiar with it yet - I'm just getting to grips with it.

Regarding my research:

Already tried everything I could. I also ran a normally installed terminal. Result is the same.

Maybe I should try it on some 100% working, simple robot, with known parameters of all variables?

Then I can be sure that the EA will not run as it should and I will raise the case in the service desk.

Please advise me on some mega simple Expert Advisor, download it yourself and tell me with what parameters and with what pair it should be run?

Then we can check the results.

 
Maxi-M:
It's not the robot... It works without any errors. The structure of trade result is MqlTradeResult, it's the second parameter in OrderSend() function. The code was written using OOP, I'm not familiar with it... You have to find a method that sends a trade request using OrderSend() and after it call Print( result.retcode ), where result is an object of MqlTradeResult structure.
Reason: