Questions from Beginners MQL5 MT5 MetaTrader 5 - page 342

 
When testing in mt5 in visualisation mode the graphical objects are not displayed?
 
VOLDEMAR:
Guys, I can't understand why when testing in mt5 in visualisation mode graphical objects are not displayed?
1062 x64 at least arrows and trends are displayed...
 
VOLDEMAR:
I cannot understand why testing in MT5 in visualization mode graphic objects are not displayed?

You mean where the order opened and where it closed? They will be drawn on the chart that will open when the tester closes or stops. But the most unpleasant thing is that these charts open as needed and as not needed... The number of times you start the tester and at least one order is opened, this means the number of charts to be opened. I don't need them if I just want to catch errors in code...

I tried to use MQL5 to get my hands on it, but it didn't work, because I was too tired... If I don't understand what's going on in MQL5, I will try to unlock it with a special tool...

 
AlexeyVik:

You mean where the order opened and where it closed? They will be drawn on the chart that will open when the tester closes or stops. But the most unpleasant thing is that these charts open as needed and as not needed... The number of times you start the tester and at least one order is opened, this means the number of charts to be opened. What the hell do you need them for, if I just catch errors in the code...

The more I learn MT5 and MQL5 the more I am confused...

I mean, I draw a button to delete arrows and stuff like that, or a button to show lines...

If I'm not sure if these buttons will be drawn or not in visualization... What about OnChartEvent - should it work in tester or not in Quaternary?

 
VOLDEMAR:

No, what I mean is that I drew a button for example to delete arrows and stuff, or a button to display lines...

Should these buttons be rendered or not rendered in the visualization and a related question OnChartEvent in the tester works or as in quadruple does not work?

Buttons are drawn, but you can not click on them in the tester before, as far as I remember. OnChartEvent - it worked.
 

Good afternoon, gentlemen of the forum :)

Please, maybe who knows, tell me, I need a script or advisor that will close all trades when they reach -20% of the deposit or vice versa +20%, probably there, but how to properly specify in a search engine do not know..... Please advise :) i appreciate it! :)

 
Hello, could you please explain why I cannot select execution type when creating an order in MT5: execute on demand, market and exchange? They are mentioned in manuals everywhere. I am working on my demo account liteforex-mt5.com. Can this be the only option for a demo account? I have never tried it before.
 
asussena:

Good afternoon, gentlemen of the forum :)

Please, maybe who knows, tell me, I need a script or advisor that will close all trades when they reach -20% of the deposit or vice versa +20%, I bet there is, but how to ask in a search engine do not know..... Please advise :) i appreciate it! :)

https://www.mql5.com/ru/code/8602
Скрипты для закрытия ордеров
Скрипты для закрытия ордеров
  • votes: 7
  • 2009.01.20
  • James Malwitz
  • www.mql5.com
Скрипты для закыртия ордеров при различных условиях.
 

Hi all !

I need to get the MA indicator values in my EA directly. Simple MA is calculated correctly but EMA is not. What have I done wrong ?

   ///Собственный расчет индикатора MA
double MA(const int ns,const ENUM_TIMEFRAMES period,const int bars,const ENUM_MA_METHOD method,const int pos)
  {
   double result=0.0;

   ArraySetAsSeries(Close,true);

   if(CopyClose(Symbols[ns],period,pos,bars+1,Close)<bars)
     {
      Print("Не удалось скопировать значения (",Symbols[ns],"в массив цен Close! ");
            //"Ошибка ("+IntegerToString(GetLastError())+"): "+ErrorDescription(GetLastError())+"");
     }

 switch (method){
   
      case MODE_SMA:
      {
      for(int i=0;i<bars;i++) result+=Close[period-i-1];
      result/=bars;
      break;
      }
      
      case MODE_EMA:
      {
      double SmoothFactor=2.0/(1.0+bars);
    
      for(int i=0; i<bars; i++) result+=Close[bars-i];
      result/=bars;
      result=Close[0]*SmoothFactor+result*(1.0-SmoothFactor);
      break;
      }    

   } 
    
    return(result);
}
 
Alvin1976:

Hi all !

I need to get the MA indicator values in my EA directly. Simple MA is calculated correctly but EMA is not. What am I doing wrong?

Change in the calculation code

case MODE_EMA:
      {
      double SmoothFactor=2.0/(1.0+bars);
    

to

case MODE_EMA:
      {
      double SmoothFactor=2.0/(1.0+13);
    

That is 13 or 12 or any other number - this must be the "Period" parameter. Averaging period

Reason: