Einzelnen Beitrag anzeigen
  #8 (permalink)  
Alt 26.06.22
smilemore smilemore ist offline
Neues Mitglied
 
Registriert seit: Sep 2021
Beiträge: 7
smilemore befindet sich auf einem aufstrebenden Ast
Standard

Funktion außerhalb OnCalculate() deklariert, Funktion brauch Datentyp, Funktionsparameter brauchen Datentyp, Semikolon vergessen

PHP-Code:
//#property strict

//#include<MovingAverages.mqh>// ?
//=============================================================================
#property version     "PRdMA_OPZ_v2.mq4"
#property description "( PR / MA ) * ?"
#property link        "daniel-rudloff@web.de"
//=============================================================================

#property indicator_chart_window// Chart-Fenster

#property indicator_buffers 1

#property indicator_color1 clrYellow// Farbe der Linie
#property indicator_width1 1

//=============================================================================

//=============================================================================================================
// G L O B A L E   E I N S T E L L U N G E N
//=============================================================================================================

input ENUM_APPLIED_PRICE Price PRICE_CLOSE;

extern int               MA_Period     6;// Zum Testen 6
extern int               MA_ChartShift 0;
input ENUM_MA_METHOD     MA_Method     MODE_SMA;
input ENUM_APPLIED_PRICE MA_Price      PRICE_CLOSE;

//=============================================================================================================
// G L O B A L E   B U F F E R
//=============================================================================================================
//=============================================================================
string IndisName "PRdMA_OPZ_v1";  // Indikatorname
//-------------------------------------------------------------------------------------------------------------

double   
Pr_Hi
,Pr_Op,Pr_Cl,Pr_Lo,Pr_ME,Pr_TY,Pr_WE,
PR,MA,

OPZ_PR,

PR_mt,PR_t,


OPZ_DIV,
OPZ_DIV_Value,
OPZ_DIV_t,
OPZ_DIV_mt,
OPZ_DIV_div,
OPZ_DIV_DivEd,
OPZ_DIV_V_mt,
OPZ_DIV_ToDiv,
OPZ_DIV_DivEd_t,


BUF_PRdMA_OPZ[]// Buffer 0

;

//-------------------------------------------------------------------------------------------------------------

int imt;

//=============================================================================================================
// I N I T
//=============================================================================================================
void OnInit(){
   
// === Anzeige des Indikatornamens und der Werte
    
IndicatorShortName(IndisName);
    
IndicatorBuffers(1);// Gesamtanzahl aller Buffer
//-------------------------------------------------------------------------------------------------------------

SetIndexBuffer(0,BUF_PRdMA_OPZ);
SetIndexLabel(0,
              
"PRdMA_OPZ"
             
);// Beschreibung im Datenfenster
SetIndexDrawBegin(0,0);

}
// OnInit

//=============================================================================================================
// D E I N I T
//=============================================================================================================
void OnDeinit(const int reason){}// nothing to do here
//=============================================================================================================
// O N C A L C U L A T E
//=============================================================================================================
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[]){
//-------------------------------------------------------------------------------------------------------------

for( i=rates_total-MA_Period-i++ ){// ?

//=============================================================================================================
// D E K L A R A T I O N   P R I C E
//=============================================================================================================

Pr_Hi=iHigh (NULL,NULL,i);
Pr_Op=iOpen (NULL,NULL,i);
Pr_Cl=iClose(NULL,NULL,i);
Pr_Lo=iLow  (NULL,NULL,i);

Pr_ME = ( Pr_Hi Pr_Lo ) / 2.0;

Pr_TY = ( Pr_Hi Pr_Cl Pr_Lo ) / 3.0;

Pr_WE = ( Pr_Hi Pr_Cl Pr_Cl Pr_Lo ) / 4.0;

// Zuweisung Price
if(Price==PRICE_HIGH    )PR=Pr_Hi;
if(
Price==PRICE_CLOSE   )PR=Pr_Cl;
if(
Price==PRICE_OPEN    )PR=Pr_Op;
if(
Price==PRICE_LOW     )PR=Pr_Lo;
if(
Price==PRICE_MEDIAN  )PR=Pr_ME;
if(
Price==PRICE_TYPICAL )PR=Pr_TY;
if(
Price==PRICE_WEIGHTED)PR=Pr_WE;

//=============================================================================================================
// D E K L A R A T I O N   M A
//=============================================================================================================

MA=iMA(Symbol(),Period(),MA_Period,MA_ChartShift,MA_Method,MA_Price,i);

//=============================================================================================================
// ?
//=============================================================================================================


if(PR<=-1.0||PR>=1.0)OPZ_PR=1.0/PR;


if( 
PR > -1.0 && PR <  1.0 ){

  
OPZ_DIV_Value PR;
  
  
OPZ_DIV_ToDiv 1.0;}

//-------------------------------------------------------------------------------------------------------------






BUF_PRdMA_OPZ[i] =  OPZ_DIV ;



//=============================================================================================================
// E N D E   F U N K T I O N E N
//=============================================================================================================
}// for (i=ratestotal)...
//=============================================================================================================
// E N D E   I N D I
//=============================================================================================================
return(rates_total);    

}
// OnCalculate´



double OPZ_DIV(
  
  
double OPZ_DIV_Value
  
,
  
double OPZ_DIV_t
  
,
  
double OPZ_DIV_mt
  
,
  
double OPZ_DIV_ToDiv
  
,
  
double OPZ_DIV_DivEd   
               
)
{
   
int imt;

  
OPZ_DIV_mt=-1;
  
  
OPZ_DIV_V_mt=OPZ_DIV_Value;
  
  while( 
OPZ_DIV_V_mt > -1.0 && OPZ_DIV_V_mt 1.0 ){
  
    
OPZ_DIV_t OPZ_DIV_mt 10.0;
    
    
OPZ_DIV_mt OPZ_DIV_t;
    
    
mt++;}
  
  
  
OPZ_DIV_DivEd OPZ_DIV_ToDiv OPZ_DIV_mt;


  for( 
mt mt 0mt-- ){
  
    
OPZ_DIV_DivEd_t OPZ_DIV_DivEd 10.0;
    
    
OPZ_DIV_DivEd OPZ_DIV_DivEd_t;
    
  }
  
  
OPZ_DIV OPZ_DIV_DivEd;

  return 
OPZ_DIV;


Sollte gehen

Liebe Grüße smilemore