Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Mql4 --> Schätzen / Prognose (wie in Excel)? (http://www.expert-advisor.com/forum/showthread.php?t=7005)

MarkusWilhelm89 29.05.21 20:49

Mql4 --> Schätzen / Prognose (wie in Excel)?
 
Hi.
Weiß jemand ob es im MQL4 ähnlich wie in Excel die Funktion "Prognose" oder "Schätzen" gibt?

traderdoc 29.05.21 21:46

Nicht, dass ich wüsste, aber welche Prognose soll angestrebt werden und was kann man schon unter "Schätzen" verstehen?

traderdoc

miortech 29.05.21 22:23

Vielleicht ist ein "predictive" Ansatz gemeint? Denn Schätzung gibt es nicht!
Hier werden 2 EMA berechnet und verglichen, welche dann ein Kauf ider Verkauf Signal abgeben
Code:

double LongPeriod=24.0;  // note that for an EMA you can have floating point numbers.
double ShortPeriod=12.0;
double ExtraTimeForward=1.0; // how much to further extrapolate location.
double LongPeriodx=20.0;  // note that for an EMA you can have floating point numbers.
double ShortPeriodx=10.0;
double ExtraTimeForwardx=1.0; // how much to further extrapolate location.

if(Predictive_Buy || Predictive_Sell){
  int counted_bars=1000; 
 
  int limit;
  double ma1,ma3;
  double p1,p3;
  double t1,t3,t;
  double val=0;

  int limitx;
  double max1,max3;
  double px1,px3;
  double tx1,tx3,tx;
  double valx=0;

//---- last counted bar will be recounted
  if(counted_bars>0) counted_bars--;
  limit=Bars-counted_bars;
//---- main loop
  p1 = 2.0/(LongPeriod+1.0);
  p3 = 2.0/(ShortPeriod+1.0);
  t1 = (LongPeriod-1.0)/2.0;
  t3 = (ShortPeriod-1.0)/2.0;
  t = ShortPeriod + ExtraTimeForward;
 
  ma1 = Close[limit-1];
  ma3 = ma1;
  for(int i=limit-1; i>= 0; i--)
    val = Close[i];
    double slope1, predict;
       
    ma1 = p1*val + (1.0-p1)*ma1;
    ma3 = p3*val + (1.0-p3)*ma3;     
    slope1 = (ma3-ma1)/(t1-t3);
    predict = ma3 + slope1*t;
   
//---- last counted bar will be recounted
  if(counted_bars>0) counted_bars--;
  limitx=Bars-counted_bars;
//---- main loop x
  px1 = 2.0/(LongPeriodx+1.0);
  px3 = 2.0/(ShortPeriodx+1.0); 
  tx1 = (LongPeriodx-1.0)/2.0;
  tx3 = (ShortPeriodx-1.0)/2.0;
  tx = ShortPeriodx + ExtraTimeForwardx;
 
  max1 = Close[limitx-1];
  max3 = max1;
  for(int o=limitx-1; o>= 0; o--)
    valx = Close[o];
    double slope1x, predictx;
       
    max1 = px1*valx + (1.0-px1)*max1;
    max3 = px3*valx + (1.0-px3)*max3;   
    slope1x = (max3-max1)/(tx1-tx3);
    predictx = max3 + slope1x*tx;

if ((predict > predictx)        )

...execution

Ohne Gewähr

Gruß


Alle Zeitangaben in WEZ +2. Es ist jetzt 02:10 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum