Errors, bugs, questions - page 133

 
Interesting:
As far as I understand accrual, as in the demo or in the tester...
what's that? Re-accrual or accrual
 
Dmitriy2:

So when outputting values to the log, only once (for the first time) the parabolic function, i.e. CopyBuffer, returns 0 and not -1, as it should be in case of error (although it shouldn't be either, all data is there, all downloaded, no great multidimensional arrays, no error should occur!) And this happens ONLY in the tester and ONLY ONE time. From here on everything works fine.

In basic code I don't care what the functions return, eventually when it comes to a trade request, the values received for the request are checked by the universal function, and if everything is OK we send the request, if not - we wait for it to be OK...

Try the following code in your function of getting parabolic value.

double Параболик(ENUM_TIMEFRAMES период,double step,double maximum,int бар)
  {
   double ЗначениеParabolic[1];
   int Parabolic=iSAR(Symbol(),период,step,maximum);
   int cb=CopyBuffer(Parabolic,0,бар,1,ЗначениеParabolic);
   if(cb!=1) Print("BarsCalculated ",BarsCalculated(Parabolic),", CopyBuffer ", cb, ", ArrayValue ",ЗначениеParabolic[0]);
   return(ЗначениеParabolic[0]);
  }

You'll get something like this in the log

2010.09.15 14:53:53     Core 1  2010.09.01 00:00:07   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
2010.09.15 14:53:53     Core 1  2010.09.01 00:00:07   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
2010.09.15 14:53:53     Core 1  2010.09.01 00:00:07   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
2010.09.15 14:53:53     Core 1  2010.09.01 00:00:07   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
2010.09.15 14:53:53     Core 1  2010.09.01 00:00:07   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
2010.09.15 14:53:53     Core 1    SLпоПервойТочкеПараболика=true

It will explain why you get 0 and not -1.

I'll repeat it for the 3rd time. The data is there, but the indicator values at that moment MAY not yet be calculated. It is written about it in the help!

 
maryan.dirtyn:
What is it? Re-cryption or accrual
Overcritching suffers from FC, MT has had accrual all his life. Single on regular days and x3 on Wednesday(Triple Swap Day should be clarified)...
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте - Документация по MQL5
 
Interesting:
FC suffers from over-accumulation, MT has had accrual all his life. Single on regular days and x3 on Wednesday(Triple Swap Day should be clarified)...
I don't know what fc is... I just need to know HOW it will be at the championships
 
alexvd:

Try this code in your function to get the value of the parabolic.

You will get roughly this output in the log

This will explain why you get 0 and not -1.

I will repeat it for the 3rd time. The data exists, but the indicator values at that moment MAY not have been calculated yet. It's written in the help!

Exactly, we're getting the parabolic value, not the CopyBuffer response...

ok... change the parabolic function to the one you provided (with the prints).

I add the prints in the for loop (it has no zero protection)

if(НапрСигнала==ORDER_TYPE_BUY)
     {
      if(SLпоПервойТочкеПараболика==true)
         for(i=0;;i=i+1)
           {
            Print("бай, параболик до иф ",Параболик(PERIOD_CURRENT,0.02,0.2,i+1));
            if(iLow(PERIOD_CURRENT,i+1,1)<Параболик(PERIOD_CURRENT,0.02,0.2,i+1))// || Параболик(PERIOD_CURRENT,0.02,0.2,i+1)<=0
              {
               Print("бай, параболик после иф ",Параболик(PERIOD_CURRENT,0.02,0.2,i+1));
               break;
              }
           }
      ЗначениеSAR=NormalizeDouble(Параболик(PERIOD_CURRENT,0.02,0.2,i)/ТИК,0)*ТИК;
      if(БИД>ЗначениеSAR) //bay
         slтики=(int)NormalizeDouble((АСК-ЗначениеSAR)/ТИК,0);
     }
   if(НапрСигнала==ORDER_TYPE_SELL)
     {
      if(SLпоПервойТочкеПараболика==true)
         for(i=0;;i=i+1)
           {
            Print("селл, параболик до иф ",Параболик(PERIOD_CURRENT,0.02,0.2,i+1));
            if(iHigh(PERIOD_CURRENT,i+1,1)>Параболик(PERIOD_CURRENT,0.02,0.2,i+1))// || Параболик(PERIOD_CURRENT,0.02,0.2,i+1)<=0
              {
               Print("селл, параболик после иф ",Параболик(PERIOD_CURRENT,0.02,0.2,i+1));
               break;
              }
           }
      ЗначениеSAR=NormalizeDouble(Параболик(PERIOD_CURRENT,0.02,0.2,i)/ТИК,0)*ТИК;
      if(БИД<ЗначениеSAR) //sell
         slтики=(int)NormalizeDouble((ЗначениеSAR-БИД)/ТИК,0);
     }

Run it in the tester

JQ      0       Core 1  15:16:37        agent process started
NJ      0       Core 1  15:16:37        connecting to 127.0.0.1:3000
NJ      0       Core 1  15:16:39        connected
GP      0       Core 1  15:16:39        authorized (agent build 328)
LK      0       Tester  15:16:39        EURUSD,H1 (MetaQuotes-Demo): testing of Experts\Отладка.ex5 from 2010.01.01 00:00 to 2010.09.11 00:00 to be started
RH      0       Core 1  15:16:41        common synchronization completed
RS      0       Core 1  15:16:41        3124 bytes of account info loaded
RI      0       Core 1  15:16:41        3768 bytes of group info loaded
MN      0       Core 1  15:16:41        7170 bytes of tester parameters loaded
EL      0       Core 1  15:16:41        275 bytes of selected symbols loaded
IK      0       Core 1  15:16:41        expert file added: Experts\Отладка.ex5. 6597 bytes loaded
LE      0       Core 1  15:16:41        initial deposit 10000.00 USD, leverage 1:100
KO      0       Core 1  15:16:41        successfully initialized
RQ      0       Core 1  15:16:41        23 Kb of total initialization data received
KK      0       Core 1  15:16:41        performance: 72
HP      0       Core 1  15:16:41        EURUSD: symbol synchronized, 2904 bytes of symbol info received
RI      0       Core 1  15:16:43        EURUSD: load 27 bytes of history data to synchronize
MG      0       Core 1  15:16:43        EURUSD: history synchronized from 1993.05.13 to 2010.09.10
MP      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
CD      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
IK      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
ON      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
ER      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
KI      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
QL      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
GP      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
MG      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
CK      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
IN      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
OE      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
EI      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
KL      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
QS      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
GG      0       Core 1  15:16:45        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
KJ      0       Core 1  15:16:47        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0
EN      0       Core 1  15:16:47        2010.01.04 00:00:02   BarsCalculated -1, CopyBuffer -1, ArrayValue 0

and so on forever, until you press cancel

Expert Advisor on the chart

PJ      0       Experts 15:27:14        expert Отладка (EURUSD,M20) removed
MR      0       Trades  15:27:18        '677265' : instant buy 0.10 EURUSD at 1.29697
EH      0       Trades  15:27:19        '677265' : accepted instant buy 0.10 EURUSD at 1.29697
GL      0       Trades  15:27:21        '677265' : order #1350474 buy 0.10 EURUSD at 1.29697 done
LH      0       Trades  15:27:21        '677265' : deal #1426626 buy 0.10 EURUSD at 1.29697 done (based on order #1350474)
LI      0       Experts 15:27:56        expert Отладка (EURUSD,M20) loaded successfully
IR      0       Trades  15:28:07        '677265' : instant sell 0.10 EURUSD at 1.29690 sl: 1.30136 tp: 1.29502
IM      0       Trades  15:28:08        '677265' : accepted instant sell 0.10 EURUSD at 1.29690 sl: 1.30136 tp: 1.29502
RK      0       Trades  15:28:10        '677265' : order #1350477 sell 0.10 EURUSD at 1.29690 done
RO      0       Trades  15:28:10        '677265' : deal #1426629 sell 0.10 EURUSD at 1.29690 done (based on order #1350477)

no errors in the journal

look at the picture in the Experts tab; no error messages as well

you can count parabolic points, everything coincides well, on the twelfth one, exit the cycle...

 

I realised a long time ago that in MQL5 at "that moment" or at that... The data here or there may not be calculated... But it's not right, you have to fix it, not to write crutches in the code

by the way, it's the same with all other indicators, not only with parabolic

 
maryan.dirtyn:
i don't know what fc is. i just need to know HOW it will be at the championships.

FC - Forex Club and say its terminal Rumus2.

Do you have a test account for the championship? Try it and everything will be clear...

 
Dmitriy2:

I realised a long time ago that in MQL5 at "that moment" or at that... The data here or there may not be calculated... But it's not right, you have to fix it, not to write crutches in the code

By the way, it's the same with all other indicators, not only with parabolic.

Let's not create new discussions.

This topic has been discussed many times. It was revisited not too long ago(https://www.mql5.com/ru/forum/1951)

Тестер стратегий. Помогите разобраться с ошибкой.
Тестер стратегий. Помогите разобраться с ошибкой.
  • www.mql5.com
mq5) handle индикатора объявляется как глобальная переменная, индикатор инициализируется в OnInit() и передается в функцию.
 

Sitting... Watching...

I will never believe that MQL5 and MQL4 were written by the same team.(((

MQ4 - flying...

MQ5 is child's play. No offence intended - but...(((

 
alexvd:

Let's not have a discussion.

This topic has been discussed more than once. It was revisited not too long ago(https://www.mql5.com/ru/forum/1951)

I haven't seen this thread... same thing...

The point is that I'm not going to stupidly make checks on every line for all occasions, confusing and cluttering up the code. If that's out of the question then... crutches are added, a big enough project is finally completely redone and working...

And in general, I'm just amazed at this approach... It turns out that not the first time such a question arises (and I'm sure more than once in the future will arise in other people), and every time "for the first time" to spend a lot of your and others' work time to explain what you need to do to bypass this bug ...

The only thing to do is to add into TESTER that recommended in that thread only ONE Sleep(1000) at start of Expert Advisor.

It must not be so that the shell would imply glitches, and those glitches must be avoided in the code. And the TERMINAL is working correctly and correctly, there are NO ERRORS (in this situation). But the operation of the tester is DIFFERENT from that of the terminal.

ps EQU hello:)

Reason: