Перевод на MQL

 

Помогите перевести на MQL функцию

function Rises( Bar, Len, Calib: integer ): float;
var
  x: float;
begin
  x := ROC( Bar, #Close, Len );
  Result := 0;
  if x > 0 then
  begin
    Result := Sqrt( x / Calib );
    if Result > 1 then
      Result := 1;
    x := RisesSharply( Bar, Len, Calib );
    if x > 0 then
    begin
      Result := Result - x;
      if Result < 0 then
        Result := 0;
    end;
  end;
end;

Мои пока изыскания

double Rises( int Bar, int Len, int Calib ){ 
  double x;
begin
  x=iCustom(Symbol(),0,"roc",12,0,1);
  Result = 0;
  if x > 0 then
  begin
    Result = Sqrt( x / Calib );
    if Result > 1 then
      Result = 1;
    x = RisesSharply( Bar, Len, Calib );
    
    if x > 0 then
    begin
      Result = Result - x;
      if Result < 0 then
        Result = 0;
    end;
  end;
end;
 
А вы сначала в хэлпе формулу ROC посмотрите....
 
Korey:
А вы сначала в хэлпе формулу ROC посмотрите....

Не понял мысли может я что то не так понимаю в этом коде

 
double Rises( int Bar, int Len, int Calib )
{ 
  double x, Result;

  x=iCustom(Symbol(),0,"roc",12,0,1);
  Result = 0;
  if (x > 0) 
  {
    Result = MathSqrt( x / Calib );
    if (Result > 1 ) Result = 1;
    x = RisesSharply( Bar, Len, Calib );
    
    if (x > 0)
      {
      Result = Result - x;
      if (Result < 0)
          Result = 0;
      }
  }
}
 
Korey:
double Rises( int Bar, int Len, int Calib )
{ 
  double x, Result;

  x=iCustom(Symbol(),0,"roc",12,0,1);
  Result = 0;
  if (x > 0) 
  {
    Result = MathSqrt( x / Calib );
    if (Result > 1 ) Result = 1;
    x = RisesSharply( Bar, Len, Calib );
    
    if (x > 0)
      {
      Result = Result - x;
      if (Result < 0)
          Result = 0;
      }
  }
}

Благодарю.

 
return(Result);
Причина обращения: