Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1015

 

Hello, don't scold me too much please, I'm just learning the language and OOP in general.

Can you tell me why when I try to multiply the entire formula assigned to ExtATRBuffer[i]=.... When I multiply by 1 it shows the actual value on the chart, when I multiply by fractional 0.5 n.e. some values are up and down from the zero line

What should I do to avoid error?

the final bill needs actual ATP value multiplied by a constant that can be changed...

thanks to all who replied!!!

//+------------------------------------------------------------------+
//| Average True Range                                               |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int i,limit;
//--- check for bars count
   if(rates_total<=ExtPeriodATR)
      return(0); // not enough bars for calculation
//--- preliminary calculations
   if(prev_calculated==0)
     {
      ExtTRBuffer[0]=0.0;
      ExtATRBuffer[0]=0.0;
      //--- filling out the array of True Range values for each period
      for(i=1;i<rates_total && !IsStopped();i++)
         ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
      //--- first AtrPeriod values of the indicator are not calculated
      double firstValue=0.0;
      for(i=1;i<=ExtPeriodATR;i++)
        {
         ExtATRBuffer[i]=0.0;
         firstValue+=ExtTRBuffer[i];
        }
      //--- calculating the first value of the indicator
      firstValue/=ExtPeriodATR;
      ExtATRBuffer[ExtPeriodATR]=firstValue;
      limit=ExtPeriodATR+1;
     }
   else limit=prev_calculated-1;
//--- the main loop of calculations
   for(i=limit;i<rates_total && !IsStopped();i++)
     {
      ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
      ExtATRBuffer[i]=ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-ExtPeriodATR])/ExtPeriodATR;

   // ExtATRBuffer[i]=(ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-ExtPeriodATR])/ExtPeriodA)*4;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Thank you all! Help to understand : test error: 2019.12.04 14:14:40.097 TestGenerator: unmatched data error (high value 0.71570 at 2019.01.21 23:30 is not reached from the lowest timeframe, high price 0.71560 mismatches)
 
Ilzadjan Akhmedov:
Thank you all! Help to understand : test error: 2019.12.04 14:14:40.097 TestGenerator: unmatched data error (high value 0.71570 at 2019.01.21 23:30 is not reached from the lowest timeframe, high price 0.71560 mismatches)

Load the history for the instrument under test (F2)

 
Artyom Trishkin:

Load the history for the instrument under test (F2)

Thank you for your attention! Loaded but now summary is: 2019.12.04 16: 00: 20.408 TestGenerator: Inconsistent data error (volume limit 409 exceeded on 2016.03.30 23: 45)

Files:
 
Ilzadjan Akhmedov:

Thank you for your attention! Downloaded but now summary is: 2019.12.04 16: 00: 20.408 TestGenerator: Inconsistent data error (volume limit 409 exceeded on 2016.03.30 23: 45)

For each of the timeframes, download the history.

 
Artyom Trishkin:

For each of the timeframes download the history.

This $600 advisor, Did a test again does not trade. please see what can be done. Giving it to you if you solve the problem please send the settings!

Files:
 
Artyom Trishkin:

Try to open a file that doesn't exist using FileOpen()...

I've read about this. The only clue may lie in this phrase"The name of the file to be opened, may contain sub-folders. If the file is opened for writing, the specified subfolders will be created if there are none. "But even here it says some subfolders, maybe it's a reference to the fact that in this directory in these subfolders the file will be created, because it's not written normally. You can write normally, if there is no file it will be created. It's not like I'm a scientist to guess all the details. I still don't even understand how many functions work, because there is no function code or a proper description. You know, they throw you a certain bone, and you understand for yourself whether it's edible or not.

 
Hello, help me solve this problem. i connected the signals, one month everything was fine, at the end of the month my trades were not copied correctly to the signals from the provider, now the lot size is not respected. what could be the problem with lot size, and why the signals did not work correctly, where can i see what to click?
 
Seric29:

I've read about this. The only clue may lie in this phrase"The name of the file to be opened, may contain sub-folders. If the file is opened for writing, the specified subfolders will be created if there are none. "But even here it says some subfolders, maybe it's a reference to the fact that in this directory in these subfolders the file will be created, because it's not written normally. You can write normally, if there is no file it will be created. It's not like I'm a scientist to guess all the details. I don't even understand how many functions work, because there is no function code or a proper description. You know, you throw some kind of bone, and you understand if it's edible or not.

How do you meet the sun in the morning? Have you studied all astronomy?

Standard functions aren't for figuring out their inner workings. They're for using them. And the description is in the documentation.

I told you to use FileOpen() to create a new file. But no..., you have to make a ten-page chorus instead of just "take it and use it". Well, sometimes you can say "thank you" to those who help.

 

Hello.

Isn't anyone going to say anything about the Bilder post?

Maybe it makes sense to put it in a new thread, so that more people will see it? If so, please ask the moderators to post it... Or create one yourself?

Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
  • 2019.11.09
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
Reason: