Questions from Beginners MQL5 MT5 MetaTrader 5 - page 949

 
Vasiliy Sokolov:

This is a template method. The parameter type in it will be matched according to the type passed in these brackets. The type is determined statically, at compile time. You can read more about this in "function and class templates":https://www.mql5.com/ru/docs/basis/oop/templates.

Thank you!

 
Artyom Trishkin:
  1. A new tick is generated - the condition is fulfilled, for example, pattern indication will be drawn on this tick and an alert will be generated.
    1. Need a function to receive a condition with the flag of this condition set by the next two paragraphs
    2. Need a pattern drawing function
    3. Need function to send alert (not necessarily a function - there are standard functions for only alert, only e-mail and only push)
  2. After the condition above is fulfilled, we need to stop the execution of multiple repetitions of the same action of the above action until a period of time equal to...
    1. If there is a flag that three steps from step 1 above are already done, then do nothing - go to step 3, otherwise go to step 1
  3. As soon as the bar changes to the next one, restart the condition until the next time period described above
    1. We need a function for defining a new bar. As soon as a new bar has been defined, we go to step 1. Otherwise we go to step 2.

Thank you, I will try to do

 
Can you tell me if the TimeLocal and TimeCurrent functions can give time accurately to milliseconds?
 

Good afternoon!

The advisor is giving out warnings:

possible use of uninitialized variable 'hv1' test_gme.mq5 154 23
0 error(s), 14 warning(s), compile time: 1306 msec 1 15

Here's the code: What's the error?

//============================================================================================================
   int GetSignal (string sb)
  {
    int    dig=int(SymbolInfoInteger(pos.Symbol(), SYMBOL_DIGITS));
   double vpoint  = SymbolInfoDouble(sb,SYMBOL_POINT);
   double op1,op2,op3,op4,op5,op6,op7,
              cl1,
              hi1,hi2,hi3,hi4,hi5,hi6,hi7,
              lo1,lo2,lo3,lo4,lo5,lo6,lo7;
 double hv1,hv2,hv3,hv4,hv5,hv6,hv7;
 double gr1,gr2,gr3,gr4,gr5,gr6,gr7;
 //pp=NormalizeDouble(pp, dg);
 // op=NormalizeDouble(pos.PriceOpen() , dg);
  hv1=NormalizeDouble(hv1, dig);
  hv2=NormalizeDouble(hv2, dig);
  hv3=NormalizeDouble(hv3, dig);
  hv4=NormalizeDouble(hv4, dig);
  hv5=NormalizeDouble(hv5, dig);
  hv6=NormalizeDouble(hv6, dig);
  hv7=NormalizeDouble(hv7, dig);
  gr1=NormalizeDouble(gr1, dig);
  gr2=NormalizeDouble(gr2, dig);
  gr3=NormalizeDouble(gr3, dig);
  gr4=NormalizeDouble(gr4, dig);
  gr5=NormalizeDouble(gr5, dig);
  gr6=NormalizeDouble(gr6, dig);
  gr7=NormalizeDouble(gr7, dig);
  //=================================================================================================
      double ma_sred1 =NormalizeDouble(iMA(sb,PERIOD_M5,sr,0,MODE_SMA,PRICE_CLOSE),dig);      //for M5
   //==============================================================================================
           op1=NormalizeDouble(iOpen(sb,PERIOD_M5,1),dig);       //m5
           op2=NormalizeDouble(iOpen(sb,PERIOD_M5,2),dig);      //m10 sintez
           op3=NormalizeDouble(iOpen(sb,PERIOD_M5,3),dig);     //m15 si
           op4=NormalizeDouble(iOpen(sb,PERIOD_M5,4),dig);    //m20 si
           op5=NormalizeDouble(iOpen(sb,PERIOD_M5,5),dig);   //m25 si
           op6=NormalizeDouble(iOpen(sb,PERIOD_M5,6),dig);  //m30 si
           op7=NormalizeDouble(iOpen(sb,PERIOD_M5,7),dig); //m35 si
 //==================================================================================
       cl1=NormalizeDouble(iClose(sb,PERIOD_M5,1),dig);     //m5
 //=================================================================================   
  //   hay1=NormalizeDouble(iHigh(sb,PERIOD_M5,30),dig);
    
     //   niz1=NormalizeDouble(iLow(sb,PERIOD_M5,30),dig);
       
 //======================================================================================
            lo1=NormalizeDouble(iLow(sb,PERIOD_M5,1),dig);                                      //m5
            lo2=NormalizeDouble(MathMin(iLow(sb,PERIOD_M5,1),iLow(sb,PERIOD_M5,2)),dig);  //m10
            lo3=NormalizeDouble(MathMin(lo2,iLow(sb,PERIOD_M5,3)),dig);                       //m15 
            lo4=NormalizeDouble(MathMin(lo3,iLow(sb,PERIOD_M5,4)),dig);                      //m20
            lo5=NormalizeDouble(MathMin(lo4,iLow(sb,PERIOD_M5,5)),dig);                     //m25
            lo6=NormalizeDouble(MathMin(lo5,iLow(sb,PERIOD_M5,6)),dig);                    //m30
            lo7=NormalizeDouble(MathMin(lo6,iLow(sb,PERIOD_M5,7)),dig);                   //m35
      
 //=========================================================================================================
            hi1=NormalizeDouble(iHigh(sb,PERIOD_M5,1),dig);                                       //m5
            hi2=NormalizeDouble(MathMax(iHigh(sb,PERIOD_M5,1),iHigh(sb,PERIOD_M5,2)),dig);  //m10 sint
            hi3=NormalizeDouble(MathMax(hi2,iHigh(sb,PERIOD_M5,3)),dig);                        //m15 sint
            hi4=NormalizeDouble(MathMax(hi3,iHigh(sb,PERIOD_M5,4)),dig);                       //m20 sint
            hi5=NormalizeDouble(MathMax(hi4,iHigh(sb,PERIOD_M5,5)),dig);                      //m25 sint
            hi6=NormalizeDouble(MathMax(hi5,iHigh(sb,PERIOD_M5,6)),dig);                     //m30 sint
            hi7=NormalizeDouble(MathMax(hi6,iHigh(sb,PERIOD_M5,7)),dig);                    //m35 sint
 
fregat555:

Good afternoon!

The advisor is giving out warnings:

possible use of uninitialized variable 'hv1' test_gme.mq5 154 23
0 error(s), 14 warning(s), compile time: 1306 msec 1 15

Here is the code: what is the error?

Add =0 .

double hv1=0,hv2=0,hv3=0...
 
Thank you!
 

When compiling, everything is OK, no errors or warnings. But

When testing, it gives the following:

2018.12.01 17:53:00.074 Core 4 genetic pass (0, 509) tested with error "OnInit failed" at 0:00:00.000

 
I think it's working. Thank you.
 
Can you please tell me how to get a list of directories in the specified directory MQL5\Files ?
 
Aleksey Vyazmikin:
Please tell me how to get a list of directories in a specified directory MQL5\Files ?
Example fromLifeHack for Trader: One backtest is good, but four is better:
Reason: