Questions from Beginners MQL4 MT4 MetaTrader 4 - page 228

 

I have been searching for one, but do not know how to solve this problem.

I think I need an update of MT4 and I have not found anything.

 
darirunu1:

I have been searching for one, but do not know how to solve this problem.

I want to know why maybe somebody has faced with this problem.

it's more likely that no one has encountered problems like yours, that's why there are no answers.

 
Hi all, is it possible to call the indicator in a separate window in the mt4 tester when testing an EA?
 
Aleksandr Egorov:
Hi all, is it possible to call the indicator in a separate window in the mt4 tester when testing an EA?

yes

 
Iurii Tokman:

yes

how ?

 

Save the template with the indicator under the name tester.tpl

And when you start the tester in the visualisation you will get a chart with the indicator.

 
Aleksei Stepanenko:

Save the template with the indicator under the name tester.tpl

And when you start the tester you will get a chart with the indicator in the visualization.

i know it can be called from an EA ?

 

Only a prepared template can be called up.

bool  ChartApplyTemplate(
   long          chart_id,     // идентификатор графика
   const string  filename      // имя файла с шаблоном
   );

The indicator is not.


Or I don't know anything about such a possibility. Also a possible option, but unlikely.

With WinAPI, you could try searching the Navigator list, I suppose. But that's a lot of fun.
 

Please advise what is wrong in this code, before this slip was not there everything worked fine.

I have specified 2 quid as a profit, as soon as op variable exceeds 2 quid the EA should wait for 10 seconds and then close. I want the EA to wait for more than 2 quid and not to close it immediately after it sees 2 quid.

double op = CalculateProfit();
if (op >= Profit)
{
Sleep(10000);
CloseAll();

}


Now after the slip function, the EA does not close.

 
input int Second=10;
ulong LastTime=ULONG_MAX;

void OnTick()
   {
   if(op>=Profit) LastTime=GetMicrosecondCount();
   if(GetMicrosecondCount()-LastTime>Second*1000000) {CloseAll(); LastTime=ULONG_MAX;}
   }
    
Reason: