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)
-   -   Signum Funktion (http://www.expert-advisor.com/forum/showthread.php?t=6762)

AVT 30.08.20 22:13

Signum Funktion
 
Hat jemand ne Idee, wie ich eine Signum Funktion am besten "nachbilde", MQL kennt sowas wie sgn(Wert) nicht.
Danke. AVT

MA-EA 31.08.20 17:32

Code:

if( Wert() < 0.0 )bool Wert_Negativ = true;
:confused:

https://de.wikipedia.org/wiki/Vorzeichenfunktion

Indikator-Trading 01.09.20 08:01

Zitat:

Zitat von MA-EA (Beitrag 44346)
Code:

if( Wert() < 0.0 )bool Wert_Negativ = true;
:confused:

https://de.wikipedia.org/wiki/Vorzeichenfunktion

:rolleyes:

Nimm lieber das hier:

Code:

int sgn(double LocalValue,int LocalDigits)
  {
  if(NormalizeDouble(LocalValue,LocalDigits) == 0)
      return 0;
  if(LocalValue>0)
      return 1;
  return -1;
  }


AVT 01.09.20 14:40

Zitat:

Zitat von Indikator-Trading (Beitrag 44347)
Nimm lieber das hier:
Code:

int sgn(double LocalValue,int LocalDigits)
  {
  if(NormalizeDouble(LocalValue,LocalDigits) == 0)
      return 0;
  if(LocalValue>0)
      return 1;
  return -1;
  }


Danke, damit sind alle Möglichkeiten abgedeckt - und ich kann den LocalValue als Komplettformel angeben. Damit ist schon mal ein Teil des neuen Indikators gelöst. :) AVT


Alle Zeitangaben in WEZ +2. Es ist jetzt 19:15 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