Why is MathArctanh and all "h" functions not found in my MT4 MetaEditor?

To add comments, please log in or register
Wilson Wong
316
Wilson Wong  
arctanh not found
Samuel Akinbowale
2771
Samuel Akinbowale  
it means you work around with the one available for you to define your own
kypa
981
kypa  
These are MT5 only, MT4 doesn't support them.
fxsaber
10277
fxsaber  

Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий

Особенности языка mql4, тонкости и приёмы работы

fxsaber, 2017.03.27 09:04

// После этого в MQL4 будут компилироваться все библиотеки из MQL5\Include\Math
#property strict

#ifdef __MQL4__
  #include <Math\Alglib\bitconvert.mqh>  
  
  #define TEMP_MACROS(A) double A( double ) { return(0); }
    TEMP_MACROS(MathLog1p)
    TEMP_MACROS(MathExpm1)
    TEMP_MACROS(MathArcsinh)
    TEMP_MACROS(MathArccosh)
    TEMP_MACROS(MathArctanh)
  #undef TEMP_MACROS
#endif
Wilson Wong
316
Wilson Wong  
fxsaber:

Thanks for your help, fxsaber.


 for (int i=begin;i>=0;i--)

   {  
      bandsUpper=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_UPPER,i);
      bandsLower=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_LOWER,i);
      bandsMain=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_MAIN,i);
      oldBandsUpper=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_UPPER,i-1);
      oldBandsLower=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_LOWER,i-1);
      oldBandsMain=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_MAIN,i-1);

      lwma=iMA(NULL,PERIOD_CURRENT,BBandPeriod,0,MODE_LWMA,PRICE_CLOSE,i);

      bbandwidth=(bandsUpper-bandsLower)/bandsMain*100;
      oldBandsWidth=(oldBandsUpper-oldBandsLower)/oldBandsMain*100;

      tangent=(bbandwidth-oldBandsWidth)/(Time[i]-Time[i-1]);

      bbwidthslopeBuffer[i]=MathArctanh(tangent);
  }

my bbwidthslopeBuffer[i] did not show up any plot, any idea?

Ernst Van Der Merwe
5752
Ernst Van Der Merwe  
Wilson Wong:

Thanks for your help, fxsaber.


my bbwidthslopeBuffer[i] did not show up any plot, any idea?

//---
   for(int i=begin;i>=0;i--)
     {
      bandsUpper=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_UPPER,i);
      bandsLower=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_LOWER,i);
      bandsMain=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_MAIN,i);
      oldBandsUpper=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_UPPER,i+1);
      oldBandsLower=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_LOWER,i+1);
      oldBandsMain=iBands(NULL,PERIOD_CURRENT,BBandPeriod,2,0,PRICE_CLOSE,MODE_MAIN,i+1);
      bbandsWidth=(bandsUpper-bandsLower)/bandsMain*100;
      oldBandsWidth=(oldBandsUpper-oldBandsLower)/oldBandsMain*100;

      tangent=(bbandsWidth-oldBandsWidth)/PeriodSeconds()*100;
      
      bbwidthslopeBuffer[i]=MathAtanh(tangent);
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double MathAtanh(double x)
  {
   return(0.5*MathLog((1+x)/(1-x)));
  }
//+------------------------------------------------------------------+
Wilson Wong
316
Wilson Wong  
Ernst Van Der Merwe:
Thanks.
To add comments, please log in or register